:root {
  --bg: #070708;
  --ink: #f4f4f5;
  --muted: #a7a7b0;
  --line: #2a2a30;
  --screen: #0c0c0e;
  --ready: #3dd68c;
  --build: #f5c451;
  --bad: #ff6b6b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100%;
  color: var(--ink);
  font: 15px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(880px 380px at 18% -8%, rgba(255, 80, 80, 0.16), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(255, 255, 255, 0.05), transparent 55%),
    var(--bg);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid #f4f4f5;
  outline-offset: 2px;
}
.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: #fff;
  color: #111;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 9;
}
.skip:focus { top: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 28px 28px;
}
.top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 24px;
  align-items: center;
  margin-bottom: 14px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.mark { width: 36px; height: 36px; flex: none; }
.kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.lede {
  grid-column: 1;
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
}
.summary {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  border: 1px solid #3a2426;
  background: #1a1012;
  color: #ffb4b4;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}
.summary[data-hot="0"] {
  border-color: var(--line);
  background: #141416;
  color: var(--muted);
}
.pane-switch { display: none; }
main {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.stage { display: flex; justify-content: center; min-width: 0; }
.phone {
  width: min(400px, 100%);
  height: min(664px, calc(100dvh - 128px));
  background: #000;
  border-radius: 44px;
  padding: 12px 10px 18px;
  box-shadow: 0 0 0 1px #2a2a2e, 0 30px 70px rgba(0, 0, 0, 0.45);
  position: relative;
  display: flex;
  flex-direction: column;
}
.island {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 96px;
  height: 22px;
  transform: translateX(-50%);
  background: #000;
  border-radius: 999px;
  z-index: 3;
}
.homebar {
  position: absolute;
  bottom: 7px;
  left: 50%;
  width: 108px;
  height: 4px;
  transform: translateX(-50%);
  background: #2a2a2e;
  border-radius: 999px;
}
.screen {
  background: var(--screen);
  border-radius: 32px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: 28px;
}
.screen-body {
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 4px 0 8px;
  scrollbar-color: #333 transparent;
  display: flex;
  flex-direction: column;
}
.boot { color: var(--muted); padding: 24px 16px; }
.screen-head, .block-pad { padding: 0 14px; }
.seg {
  display: flex;
  gap: 6px;
  padding: 0 14px;
}
.seg button, .chip, .btn, .tabs button, .pin, .back, .linkish {
  border: 1px solid #34343a;
  background: #18181b;
  border-radius: 999px;
  min-height: 36px;
  padding: 6px 12px;
}
.seg button { flex: 1; min-height: 40px; color: var(--muted); }
.seg button[aria-pressed="true"],
.chip[aria-pressed="true"] {
  background: #f4f4f5;
  color: #141416;
  border-color: #f4f4f5;
  font-weight: 600;
}
.tools {
  display: flex;
  gap: 8px;
  padding: 10px 14px 0;
}
.tools input, .log-tools input {
  flex: 1;
  min-width: 0;
  background: #161618;
  border: 1px solid #2c2c32;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
}
.chips, .log-tools {
  display: flex;
  gap: 6px;
  padding: 10px 14px 0;
  overflow-x: auto;
}
.chip { color: var(--muted); white-space: nowrap; background: transparent; }
.sort { white-space: nowrap; }
.plist { padding: 6px 8px 12px; }
.prow { display: flex; align-items: stretch; border-radius: 14px; }
.prow[data-status="error"] { background: #1a1012; }
.prow-main {
  flex: 1;
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 8px 10px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 14px;
  padding: 10px;
  min-height: 64px;
  color: inherit;
}
.prow-main:hover { background: #161618; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  margin-top: 6px;
  background: #8d8d98;
}
.dot[data-status="ready"] { background: var(--ready); }
.dot[data-status="error"] { background: var(--bad); }
.dot[data-status="building"] { background: var(--build); animation: pulse 1.4s ease-in-out infinite; }
.dot[data-status="queued"] { background: #c4c4cc; }
.copy { min-width: 0; }
.name, .meta { display: block; }
.name { font-weight: 600; letter-spacing: -0.01em; }
.meta {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill {
  align-self: center;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1c1c20;
  color: #c8c8d0;
}
.pill[data-status="ready"] { color: #8dffb8; background: #10261a; }
.pill[data-status="error"] { color: #ffb0b0; background: #2a1416; }
.pill[data-status="building"] { color: #ffe3a3; background: #2a220f; }
.pill[data-status="queued"] { color: #e4e4ea; background: #222228; }
.pin {
  width: 44px;
  border: 0;
  background: transparent;
  color: #6e6e78;
  border-radius: 12px;
  font-size: 18px;
}
.pin[aria-pressed="true"] { color: var(--build); }
.hint, .foot {
  color: var(--muted);
  font-size: 12px;
  padding: 4px 14px 12px;
}
.foot { margin-top: auto; }
.empty { padding: 28px 16px; text-align: center; }
.empty-title { margin: 0 0 4px; font-weight: 650; }
.empty p { margin: 0; color: var(--muted); }
.proj-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 0 14px 8px;
}
.proj-top > div { min-width: 0; flex: 1; }
.proj-top .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back {
  border: 0;
  background: transparent;
  padding: 8px 8px 0 0;
  min-height: 44px;
  border-radius: 10px;
}
.proj-top h2 { margin: 6px 0 0; font-size: 20px; letter-spacing: -0.02em; }
.url {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actions { display: flex; gap: 8px; padding: 0 14px 8px; flex-wrap: wrap; }
.btn { border-radius: 12px; min-height: 44px; }
.btn.primary { background: #f4f4f5; color: #141416; border-color: #f4f4f5; font-weight: 700; }
.btn.danger { background: #3a1416; border-color: #6d2a2e; color: #ffd0d0; }
.btn.grow { flex: 1; }
.banner {
  margin: 4px 14px 8px;
  padding: 12px;
  border-radius: 14px;
  background: #2a1416;
  color: #ffd7d7;
}
.banner strong { display: block; color: #fff; margin-bottom: 4px; }
.banner p { margin: 0 0 10px; }
.banner.build { background: #2a220f; color: #ffe7b0; }
.banner.queue { background: #1c1c20; color: #dedee4; }
.tabs {
  display: flex;
  gap: 0;
  padding: 0 8px;
  border-bottom: 1px solid #222228;
  position: sticky;
  top: 0;
  background: var(--screen);
  z-index: 1;
}
.tabs button {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  min-height: 44px;
  border-bottom: 2px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: #f4f4f5; }
.tl { list-style: none; margin: 0; padding: 10px 14px 16px; }
.tl li {
  position: relative;
  padding: 0 0 14px 16px;
  border-left: 1px solid #2a2a30;
}
.tl li:last-child { border-left-color: transparent; }
.tmark {
  position: absolute;
  left: -4px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: #8d8d98;
}
.trow { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tmsg { margin: 2px 0; }
.sub { color: var(--muted); font-size: 12px; }
.commit { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.logline {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 5px 14px;
}
.lvl[data-level="error"] { color: #ff8d8d; }
.lvl[data-level="warn"] { color: #f5c451; }
.lvl[data-level="info"] { color: #8d8d98; }
.msg { word-break: break-word; }
.env-h {
  margin: 12px 14px 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.envrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #222228;
}
.envrow code { font-size: 12px; color: #d6d6dc; word-break: break-all; }
.envrow .key { font-weight: 650; }
.meter { margin: 0 14px 12px; }
.meter .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.track {
  height: 8px;
  background: #1c1c20;
  border-radius: 99px;
  overflow: hidden;
}
.track span {
  display: block;
  height: 100%;
  width: calc(var(--p) * 1%);
  background: var(--ready);
  border-radius: inherit;
}
.track.warm span { background: var(--build); }
.track.hot span { background: var(--bad); }
.note { color: #ffb0b0; font-size: 12px; margin: 4px 0 0; }
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border: 0;
  border-radius: 0;
  z-index: 2;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  background: #141416;
  border-top: 1px solid #2c2c31;
  padding: 16px 16px 18px;
  border-radius: 18px 18px 0 0;
}
.sheet h3 { margin: 0 0 6px; font-size: 16px; }
.sheet p { margin: 0 0 14px; color: var(--muted); }
.sheet .actions { padding: 0; }
.toast {
  margin: 0 14px 8px;
  padding: 8px 10px;
  background: #10261a;
  color: #b6ffd4;
  border-radius: 10px;
  font-size: 13px;
}
.toast.bad { background: #2a1416; color: #ffd0d0; }
.rail {
  background: rgba(18, 18, 20, 0.9);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 16px 18px;
  max-height: min(664px, calc(100dvh - 128px));
  overflow: auto;
  min-width: 0;
}
.rail h2 {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 18px 0 8px;
}
.rail h2:first-child { margin-top: 0; }
.mile {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid #222228;
}
.mile input { width: 18px; height: 18px; margin-top: 2px; accent-color: #f4f4f5; }
.mile strong { display: block; }
.mile span { color: var(--muted); font-size: 13px; }
.eps, .qs { list-style: none; padding: 0; margin: 0; }
.eps li, .qs li { padding: 4px 0; }
.eps li {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: #d4d4d8;
}
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric {
  background: #141418;
  border-radius: 12px;
  padding: 8px;
}
.metric b { display: block; font-size: 14px; letter-spacing: -0.02em; }
.metric span { color: var(--muted); font-size: 12px; }
.incident {
  width: 100%;
  text-align: left;
  background: #1a1012;
  border: 1px solid #3a2426;
  color: #ffd0d0;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
  margin-bottom: 6px;
}
.quiet {
  margin-top: 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 40px;
  padding: 8px 12px;
}
.fine { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

@media (max-width: 860px) {
  .wrap { padding: 14px 0 20px; }
  .top { display: block; padding: 0 16px; }
  h1 { font-size: 24px; }
  .lede { font-size: 14px; }
  .summary { display: inline-block; margin-top: 10px; }
  .pane-switch { display: flex; gap: 6px; padding: 12px 16px; }
  .pane-switch button {
    flex: 1;
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
  }
  .pane-switch button[aria-selected="true"] {
    background: #f4f4f5;
    color: #141416;
    border-color: #f4f4f5;
    font-weight: 700;
  }
  main { grid-template-columns: 1fr; gap: 0; }
  body[data-pane="board"] .rail { display: none; }
  body[data-pane="spec"] .stage { display: none; }
  .phone {
    width: 100%;
    height: auto;
    min-height: calc(100dvh - 210px);
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  .island, .homebar { display: none; }
  .screen { border-radius: 0; min-height: calc(100dvh - 210px); padding-top: 0; }
  .screen-body { padding-top: 6px; }
  .rail { margin: 0 12px; max-height: none; }
  .metrics { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
}

@keyframes pulse {
  50% { opacity: 0.35; }
}
