:root {
  --tier-gpu: #e2480f;
  --tier-ram: #8a8883;
  --tier-ssd: #b9b7b1;
  --cell: #e6e5e2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tier-gpu: #ff6a2b;
    --tier-ram: #d6d4ce;
    --tier-ssd: #6f6e6a;
    --cell: #1c1c1e;
  }
}

nav a[aria-current="page"] { color: var(--text); }
.synthetic { margin-top: 16px; background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-weight: 600; }

.watch-hero { padding: 40px 0 8px; }
.watch-hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.8rem); max-width: 20ch; }
.watch-hero h1 em { font-style: normal; color: var(--accent); }
.watch-hero .lede { margin-bottom: 8px; }

.picker { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 4px; }
.picker button {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 500;
  padding: 8px 14px; border-radius: 999px; font-size: .88rem;
}
.picker button[aria-selected="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.picker button small { opacity: .7; font-family: var(--mono); margin-left: 6px; }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stage .card { margin: 16px 0 0; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 14px; min-height: 520px; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.controls { display: flex; gap: 8px; }
.controls select { width: auto; padding: 8px 10px; }
.controls button { padding: 8px 16px; }
.status { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.live .pulse { background: var(--tier-gpu); animation: pulse 1s ease-in-out infinite; }
.status.reading .pulse { background: var(--tier-ram); animation: pulse .6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.bubble { border-radius: 14px; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.bubble.user { background: var(--accent-soft); align-self: flex-end; max-width: 92%; font-size: .92rem; }
.bubble.user .attached { display: block; margin-top: 6px; font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.bubble.bot { background: var(--surface-2); min-height: 120px; font-size: .92rem; max-height: 560px; overflow-y: auto; }
.bubble.bot:empty::before { content: "…"; color: var(--muted); }
.bubble.bot .caret { display: inline-block; width: 7px; height: 1.1em; background: var(--accent); vertical-align: -3px; margin-left: 1px; animation: pulse .8s steps(2) infinite; }
.thinking { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: .85rem; color: var(--muted); }
.thinking summary { cursor: pointer; font-weight: 600; }
.thinking div { white-space: pre-wrap; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.progress-label { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-bottom: 6px; font-family: var(--mono); }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-track i { display: block; height: 100%; width: 0; background: var(--tier-ram); transition: width .2s linear; }

/* inside */
.inside { display: flex; flex-direction: column; gap: 16px; }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tier { border-radius: 12px; padding: 12px; background: var(--surface-2); border-top: 3px solid; display: flex; flex-direction: column; min-width: 0; }
.tier.gpu { border-color: var(--tier-gpu); }
.tier.ram { border-color: var(--tier-ram); }
.tier.ssd { border-color: var(--tier-ssd); }
.tier-name { font-weight: 600; font-size: .88rem; }
.tier-sub { font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.tier b { font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tier-unit { font-size: .72rem; color: var(--muted); }

.grid-wrap { display: flex; flex-direction: column; gap: 8px; }
.grid-head { display: flex; justify-content: space-between; font-size: .78rem; font-family: var(--mono); gap: 8px; flex-wrap: wrap; }
#grid { width: 100%; height: auto; aspect-ratio: 512 / 96; image-rendering: pixelated; border-radius: 6px; background: var(--cell); }
.grid-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.sw.gpu { background: var(--tier-gpu); } .sw.ram { background: var(--tier-ram); } .sw.ssd { background: var(--tier-ssd); }

.gauges { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 10px; }
.gauge { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; position: relative; overflow: hidden; min-width: 0; }
.g-label { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.gauge b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.g-unit { font-size: .75rem; color: var(--muted); margin-left: 3px; }
.spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 26px; opacity: .55; }
#spark-line { stroke: var(--tier-gpu); }

.helper { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.helper p { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.helper-nums { display: flex; gap: 14px; font-size: .85rem; white-space: nowrap; align-items: baseline; }
.helper-nums b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.footnote { font-size: .76rem; color: var(--muted); margin: 0; }

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .chat { min-height: 0; }
  .bubble.bot { max-height: 360px; }
}
@media (max-width: 520px) {
  .tiers { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .tier { padding: 10px 8px; }
  .tier-sub { display: none; }
  .tier b { font-size: 1.05rem; }
  .gauges { grid-template-columns: 1fr 1fr; }
  .helper { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse, .bubble.bot .caret { animation: none !important; }
}

.run { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.run iframe { width: 100%; height: 460px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }

[hidden] { display: none !important; }
