:root {
  --bg: #0a0d10;
  --panel: #11161b;
  --panel-2: #151c22;
  --line: #22303a;
  --text: #e3eaef;
  --muted: #8b9aa6;
  --accent: #7ee7c7;
  --accent-2: #f0c674;
  --danger: #ff7b72;
  --radius: 14px;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0 auto;
  max-width: 1120px;
  padding: 28px 20px 56px;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 15% -10%, rgba(126, 231, 199, 0.10), transparent 60%),
    radial-gradient(700px 380px at 95% 0%, rgba(240, 198, 116, 0.07), transparent 55%),
    var(--bg);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

.banner {
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid rgba(240, 198, 116, 0.45);
  border-radius: 10px;
  background: rgba(240, 198, 116, 0.08);
  color: var(--accent-2);
  font-size: 14px;
}

.hero { margin-bottom: 26px; }

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: baseline; gap: 12px; }

.brand-mark { color: var(--accent); font-size: 26px; line-height: 1; }

h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(24px, 4.5vw, 40px);
  letter-spacing: 0.08em;
  font-weight: 600;
}

.tagline { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.topic {
  margin: 18px 0 6px;
  max-width: 860px;
  font-size: clamp(17px, 2.6vw, 21px);
  font-style: italic;
  color: #f2f7fa;
}

.hero-meta { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 12px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: none;
  white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-thinking { color: var(--accent); border-color: rgba(126, 231, 199, 0.45); }
.status-thinking::before { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.status-sleeping { color: #9fb4c4; }
.status-sleeping::before { background: #5f7686; }
.status-degraded { color: var(--accent-2); border-color: rgba(240, 198, 116, 0.4); }
.status-degraded::before { background: var(--accent-2); }
.status-offline, .status-storage_limit_reached { color: var(--danger); border-color: rgba(255, 123, 114, 0.45); }
.status-offline::before, .status-storage_limit_reached::before { background: var(--danger); }
.status-initializing::before { background: #5f7686; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

main { display: grid; gap: 18px; }

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.018), transparent 40%), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}

.panel h2 {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.panel-head h2 { margin-bottom: 12px; }

.current { border-color: #2a3b47; background: linear-gradient(180deg, rgba(126,231,199,0.05), transparent 55%), var(--panel); }

.current-text {
  white-space: pre-wrap;
  margin: 0 0 12px;
  font-size: clamp(20px, 3.4vw, 30px);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: #f5fbfe;
  overflow-wrap: anywhere;
}

.current-text.fresh { animation: arrive 700ms ease-out; }
@keyframes arrive { from { opacity: 0.35; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.turn { font-family: var(--mono); color: var(--accent); font-size: 12px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sep { color: var(--line); padding: 0 6px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.lead { margin: 0 0 14px; color: #f0f6f9; }

.bars { display: grid; gap: 9px; margin-bottom: 16px; }

.bar { display: grid; grid-template-columns: 128px 1fr 34px; align-items: center; gap: 10px; }
.bar-label { color: var(--muted); font-size: 12.5px; }
.bar-track { height: 6px; border-radius: 999px; background: #1c262e; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3f8f7c, var(--accent)); }
.bar-value { text-align: right; font-family: var(--mono); font-size: 12px; color: #b9c9d4; }

.kv { display: grid; gap: 3px; margin: 10px 0; }
.kv-label { color: var(--muted); font-size: 11.5px; font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.kv-value { color: #dfe9ef; font-size: 14px; overflow-wrap: anywhere; }

.disclaimer { margin: 14px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); color: #71828e; font-size: 11.5px; }

.highlights { display: grid; gap: 12px; }

.highlight {
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent-2);
  border-radius: 10px;
}
.highlight-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.highlight-cat { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); }
.highlight-score { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.highlight blockquote { margin: 0; white-space: pre-wrap; color: #e8f0f4; font-size: 14.5px; overflow-wrap: anywhere; }
.highlight-foot { margin: 8px 0 0; color: #71828e; font-size: 11.5px; }
.highlight-archived { color: #9a7b52; }

.memory-text { margin: 4px 0 8px; white-space: pre-wrap; color: #dfe9ef; font-size: 14.5px; overflow-wrap: anywhere; }

.events { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.events li { display: flex; gap: 10px; color: var(--muted); font-size: 12px; }
.events .event-dot { color: var(--accent); }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 0 0 14px; }
.stats-grid div { display: grid; gap: 1px; }
.stats-grid dt { color: var(--muted); font-size: 11.5px; }
.stats-grid dd { margin: 0; font-family: var(--mono); font-size: 16px; color: #eef6fa; }

.storage-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.storage-track { height: 7px; background: #1c262e; border-radius: 999px; overflow: hidden; }
.storage-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #3f8f7c, var(--accent)); transition: width 500ms ease; }

.feed-panel { padding-bottom: 16px; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }

.thought {
  position: relative;
  padding: 14px 0 14px 24px;
  border-left: 1px solid var(--line);
  margin-left: 5px;
}
.thought::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 21px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3d5563;
  border: 1px solid var(--bg);
}
.thought.new::before { background: var(--accent); }
.thought-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 5px; }
.thought-turn { font-family: var(--mono); color: var(--accent); font-size: 12px; }
.thought-role { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.thought-role.role-critique { color: #9fc7e8; }
.thought-role.role-synthesis { color: var(--accent-2); }
.thought-time { color: #667985; font-size: 11.5px; margin-left: auto; font-family: var(--mono); }
.thought-text { margin: 0; white-space: pre-wrap; color: #dbe6ec; font-size: 15px; overflow-wrap: anywhere; }
.thought:target { background: rgba(126,231,199,0.04); }

.more {
  margin: 14px 0 0;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}
.more:hover { border-color: #3a5262; }
.more:disabled { opacity: 0.5; cursor: default; }

footer { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: #71828e; font-size: 12.5px; }
footer p { margin: 6px 0; }

@media (max-width: 760px) {
  body { padding: 18px 14px 44px; }
  .grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .bar { grid-template-columns: 104px 1fr 30px; }
  .thought-time { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .current-text.fresh { opacity: 1; }
}
