/* Overseer — the watch wall.
   One idea carries the page: every pane fills with its status colour as the build progresses. */
:root {
  --night: #141a2e;      /* page */
  --ink: #1c2440;        /* pane */
  --ink-2: #252f52;      /* raised surfaces inside a pane */
  --rule: #2e3961;
  --bone: #e8e4d8;       /* text */
  --dim: #98a0bd;
  --teal: #5fd4c4;       /* building */
  --meadow: #7be07a;     /* ready */
  --coral: #ff5f5f;      /* broken: failed or stopped */
  --orange: #ff9a3c;     /* Claude is asking you something */
  --fill-a: .16;         /* opacity of the progress fill */
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --night: #e9edf6; --ink: #ffffff; --ink-2: #eef1f8; --rule: #d3d9e8;
    --bone: #1a2340; --dim: #5b6584;
    --teal: #0f9c8b; --meadow: #2e9d3a; --coral: #d23838; --orange: #d9700f;
    --fill-a: .13;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--bone);
  font: 400 15px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  display: flex; flex-direction: column;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
svg { display: block; }

/* ---------------------------------------------------------------- header */
.top {
  display: flex; align-items: center; gap: 16px;
  padding: calc(env(safe-area-inset-top) + 14px) max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 10px; }
.eye { width: 30px; height: 30px; }
.eye path { fill: none; stroke: var(--bone); stroke-width: 3; stroke-linejoin: round; }
.eye circle { fill: var(--teal); }
.eye .glint { fill: var(--night); }
.eye.big { width: 72px; height: 72px; margin: 0 auto 18px; }
h1 { margin: 0; font-size: 22px; font-weight: 750; letter-spacing: -.02em; font-variation-settings: "opsz" 96; }
.summary { margin: 0 0 0 auto; color: var(--dim); font-size: 14px; text-align: right; }
.summary b { color: var(--bone); font-weight: 600; }
.icon-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--rule); background: transparent;
}
.icon-btn:hover { background: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .spk { fill: currentColor; stroke: none; }
#bellBtn .on-dot { display: none; fill: var(--teal); stroke: var(--night); stroke-width: 1.5; }
#bellBtn.on .on-dot { display: block; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); cursor: pointer; }
.toggle:first-child { border-top: 0; }
.toggle span { flex: 1; }
.toggle small { display: block; color: var(--dim); font-size: 13px; }
.toggle input { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--ink-2); border: 1px solid var(--rule); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--dim); transition: transform .2s, background .2s; }
.toggle input:checked { background: color-mix(in srgb, var(--teal) 35%, var(--ink-2)); border-color: var(--teal); }
.toggle input:checked::after { transform: translateX(18px); background: var(--teal); }
.note { background: var(--ink-2); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.note.warn { border-left: 3px solid var(--orange); }
#soundBtn .mute { display: none; }
#soundBtn.off { color: var(--dim); }
#soundBtn.off .wave { display: none; }
#soundBtn.off .mute { display: block; }

/* ---------------------------------------------------------------- wall */
.wall {
  flex: 1;
  display: grid; gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max(250px, calc((100dvh - 118px) / 3));   /* three rows fill the screen; more rows scroll */
  align-content: start;
  padding: 4px max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.pane {
  --tone: var(--teal);
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 16px 18px 14px;
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0; min-height: 0;
  text-align: left;
}
.pane.done { --tone: var(--meadow); }
.pane.failed, .pane.stopped { --tone: var(--coral); }
.pane.asking { --tone: var(--orange); }
/* states that need you get the strong treatment: solid border + deeper fill */
.pane.asking, .pane.stopped { border-color: var(--tone); }
.pane.asking .fill, .pane.stopped .fill { --fill-a: .24; box-shadow: none; }
.pane.asking .fill, .pane.stopped .fill { width: 100%; animation: none; transform: none; }
.pane.asking .p-state::before { animation: blink 1s ease-in-out infinite; }

/* the fill: the pane itself is the progress bar */
.fill {
  position: absolute; inset: 0 auto 0 0; z-index: -1;
  width: var(--pct, 0%);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--tone) calc(var(--fill-a) * 40%), transparent),
    color-mix(in srgb, var(--tone) calc(var(--fill-a) * 130%), transparent));
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--tone) 55%, transparent);
  transition: width 1.2s cubic-bezier(.2,.8,.2,1);
}
.pane.done .fill, .pane.failed .fill { box-shadow: none; }
.pane.stopped .fill { width: 100%; }
.pane.fresh { border-color: var(--tone); }
.pane.fresh .fill { --fill-a: .28; }
.pane.indet .fill {
  width: 30%; box-shadow: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--tone) 22%, transparent), transparent);
  animation: sweep 2.6s ease-in-out infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.pane.flash { animation: ring 1.2s ease-out 2; }
@keyframes ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tone) 70%, transparent); } to { box-shadow: 0 0 0 16px transparent; } }

.p-top { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.p-name { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.015em; line-height: 1.15; font-variation-settings: "opsz" 48; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-state { margin-left: auto; flex: none; font-size: 13px; font-weight: 600; color: var(--tone); display: inline-flex; align-items: center; gap: 6px; }
.p-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pane.running .p-state::before { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .2; } }
.p-sub { display: flex; gap: 12px; color: var(--dim); font-size: 13px; margin-top: -6px; min-width: 0; }
.p-sub span { white-space: nowrap; }
.p-sub .dev { overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 5px; }
.p-sub .dev svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.p-title { margin: 0; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.p-mid { margin-top: auto; display: flex; align-items: flex-end; gap: 14px; }
.pct { font-size: 52px; line-height: .9; font-weight: 300; letter-spacing: -.04em; font-variation-settings: "opsz" 96; }
.pct small { font-size: 22px; font-weight: 400; margin-left: 1px; color: var(--dim); }
.pane.done .pct, .pane.failed .pct { font-weight: 400; }
.p-step { flex: 1; min-width: 0; padding-bottom: 3px; }
.p-step .now { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-step .meta { font-size: 12px; color: var(--dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.p-foot { display: flex; align-items: center; gap: 6px; min-height: 34px; }
.thumbs { display: flex; gap: 6px; min-width: 0; }
.thumb {
  width: 34px; height: 34px; flex: none; border-radius: 8px; border: 1px solid var(--rule);
  background: var(--ink-2) center/cover no-repeat; image-rendering: pixelated; padding: 0;
  display: grid; place-items: center;
}
.thumb svg { width: 16px; height: 16px; fill: none; stroke: var(--dim); stroke-width: 1.8; }
.more { font-size: 12px; color: var(--dim); padding: 0 4px; }
.p-foot .hist { margin-left: auto; font-size: 13px; color: var(--dim); background: none; border: 0; padding: 6px 2px; white-space: nowrap; }
.p-foot .hist:hover { color: var(--bone); }
.ack {
  margin-left: auto; border: 0; border-radius: 9px; padding: 8px 14px;
  background: var(--tone); color: #0e1424; font-weight: 650; font-size: 14px; white-space: nowrap;
}
.pane .open-area { position: absolute; inset: 0; z-index: 0; background: none; border: 0; border-radius: inherit; }
.pane > *:not(.fill):not(.open-area) { position: relative; z-index: 1; }
.pane:has(.open-area:hover) { border-color: color-mix(in srgb, var(--tone) 50%, var(--rule)); }
.pane.fresh:has(.open-area:hover) { border-color: var(--tone); }
.p-top, .p-sub, .p-title, .p-mid { pointer-events: none; }

/* empty slot: a big plus */
.slot-empty {
  border: 1.5px dashed var(--rule); border-radius: 14px; background: transparent;
  display: grid; place-items: center; align-content: center; gap: 12px; color: var(--dim);
  min-height: 0;
}
.slot-empty:hover { border-color: var(--teal); color: var(--teal); background: color-mix(in srgb, var(--teal) 5%, transparent); }
.slot-empty svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; }
.slot-empty span { font-size: 15px; }
.slot-strip { display: none; }
.wall-tools { display: flex; justify-content: center; gap: 8px; padding: 0 20px calc(18px + env(safe-area-inset-bottom)); }
.wall-tools .btn { display: inline-flex; align-items: center; gap: 8px; color: var(--dim); font-weight: 500; font-size: 14px; padding: 8px 14px; }
.wall-tools .btn:hover { color: var(--bone); }
.wall-tools svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* question in a pane */
.p-ask { margin-top: auto; min-width: 0; }
.ask-q { margin: 0 0 3px; font-size: 16px; font-weight: 600; line-height: 1.32; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.p-ask .meta { font-size: 12px; color: var(--dim); }
.ask-foot { flex-wrap: wrap; gap: 6px; }
.qa {
  border: 1px solid color-mix(in srgb, var(--tone) 55%, transparent); background: color-mix(in srgb, var(--tone) 12%, transparent);
  color: var(--bone); border-radius: 9px; padding: 7px 12px; font-size: 14px; font-weight: 600;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qa:hover { background: color-mix(in srgb, var(--tone) 24%, transparent); }
.qa.yes { background: var(--tone); color: #1a1206; border-color: transparent; }
.qa.ghost { background: transparent; border-color: var(--rule); color: var(--dim); font-weight: 500; }
.qa:disabled { opacity: .5; }

/* ---------------------------------------------------------------- tablet + phone */
@media (max-width: 1100px) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 260px; }
}
@media (max-width: 640px) {
  .top { gap: 10px; flex-wrap: wrap; }
  .summary { order: 3; flex-basis: 100%; text-align: left; margin: 0; }
  #bellBtn { margin-left: auto; }
  h1 { font-size: 19px; }
  .summary { font-size: 13px; }
  .wall { grid-template-columns: 1fr; grid-auto-rows: auto; gap: 10px; padding-left: 16px; padding-right: 16px; align-content: start; }
  .wall .pane { height: 228px; }
  .wall .slot-empty { display: none; }
  .wall-tools { display: none; }
  .wall .slot-strip {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    border: 1.5px dashed var(--rule); border-radius: 14px; background: transparent; color: var(--dim);
    height: 64px; font-size: 15px;
  }
  .wall .slot-strip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
  .pct { font-size: 44px; }
}

/* ---------------------------------------------------------------- login */
.login { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: var(--night); }
.login form { width: min(380px, 100%); text-align: center; }
.login h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.02em; font-variation-settings: "opsz" 72; }
.login p { color: var(--dim); font-size: 14px; margin: 0 0 18px; }
.login input {
  width: 100%; padding: 13px 14px; margin-bottom: 10px; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--ink); color: var(--bone); font: 16px var(--font); letter-spacing: .05em;
}
.err { color: var(--coral) !important; margin-top: 12px !important; }
.btn { border-radius: 10px; padding: 11px 16px; border: 1px solid var(--rule); background: var(--ink-2); font-weight: 600; }
.btn.primary { width: 100%; border: 0; background: var(--teal); color: #0e1424; padding: 13px; }
.btn.quiet { background: transparent; }
.btn.danger { color: var(--coral); background: transparent; }

/* ---------------------------------------------------------------- sheet */
dialog {
  border: 1px solid var(--rule); border-radius: 16px; padding: 0;
  background: var(--ink); color: var(--bone);
  width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  box-shadow: 0 40px 120px rgba(4, 7, 20, .55);
}
dialog::backdrop { background: rgba(10, 14, 28, .62); }
dialog[open] { animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 640px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92dvh; border-bottom: 0; }
}
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 14px 12px 20px; border-bottom: 1px solid var(--rule); }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h3 { margin: 0; font-size: 20px; letter-spacing: -.015em; overflow-wrap: anywhere; }
.sheet-head p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.sheet-body { padding: 16px 20px calc(22px + env(safe-area-inset-bottom)); overflow: auto; max-height: calc(100dvh - 120px); }
.sec { margin-top: 22px; }
.sec:first-child { margin-top: 0; }
.sec h4 { margin: 0 0 8px; font-size: 14px; font-weight: 650; color: var(--dim); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.progress-line { height: 6px; border-radius: 6px; background: var(--ink-2); overflow: hidden; margin: 10px 0 6px; }
.progress-line i { display: block; height: 100%; background: var(--tone, var(--teal)); border-radius: inherit; }

.log { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.log li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 5px 0; border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); overflow-wrap: anywhere; }
.log li:first-child { border-top: 0; }
.log time { color: var(--dim); }
.log .ev-step { font-weight: 600; }
.log .ev-tool { color: var(--dim); }
.log .ev-task { color: var(--teal); }
.log .ev-error { color: var(--coral); }
.log .ev-ask { color: var(--orange); font-weight: 600; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.gallery .thumb { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; }
.gallery .thumb svg { width: 24px; height: 24px; }
.gallery .thumb span { font-size: 11px; color: var(--dim); padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.gallery .thumb.file { display: flex; flex-direction: column; gap: 4px; justify-content: center; align-items: center; }

.viewer { display: grid; place-items: center; background: var(--night); border-radius: 12px; padding: 12px; min-height: 120px; }
.viewer img { max-width: 100%; max-height: 62dvh; image-rendering: pixelated; }
.viewer.smooth img { image-rendering: auto; }
.viewer audio, .viewer video { width: 100%; max-height: 62dvh; }
.viewer pre { width: 100%; margin: 0; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60dvh; overflow: auto; }
.viewer-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--dim); font-size: 13px; }
.viewer-bar .row { margin-left: auto; }
.viewer-bar a { text-decoration: none; }

.builds { list-style: none; margin: 0; padding: 0; }
.builds button { width: 100%; display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: baseline; text-align: left; background: none; border: 0; border-top: 1px solid var(--rule); padding: 9px 2px; }
.builds li:first-child button { border-top: 0; }
.builds button:hover { color: var(--teal); }
.builds .n { font-weight: 650; }
.builds .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.builds .w { color: var(--dim); font-size: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--meadow); }
.dot.failed { background: var(--coral); } .dot.running { background: var(--teal); }

.md { font-size: 14px; overflow-wrap: anywhere; }
.md h2, .md h3, .md h4 { font-size: 15px; margin: 12px 0 4px; }
.md p { margin: 6px 0; }
.md ul { margin: 6px 0; padding-left: 20px; }
.md code { font-size: 13px; background: var(--ink-2); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--ink-2); padding: 10px; border-radius: 10px; overflow-x: auto; }
.md a { color: var(--teal); }

/* connect flow */
/* answer sheet */
.q-big { margin: 0 0 10px; font-size: 18px; font-weight: 600; line-height: 1.35; padding: 0; }
.q-pre { background: var(--night); border-radius: 10px; padding: 12px; margin: 0; font: 13px/1.5 ui-monospace, "Cascadia Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 40dvh; overflow: auto; }
.q-said { background: var(--ink-2); border-radius: 12px; padding: 4px 14px; border-left: 3px solid var(--orange); }
.q-set { border: 0; padding: 0; margin-inline: 0; }
.q-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin-bottom: 6px; border-radius: 10px; background: var(--ink-2); border: 1px solid transparent; cursor: pointer; }
.q-opt:has(input:checked) { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, var(--ink-2)); }
.q-opt input[type=radio], .q-opt input[type=checkbox] { margin-top: 4px; accent-color: var(--orange); flex: none; }
.q-opt > span { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.q-opt small { color: var(--dim); font-size: 13px; }
.q-label { display: block; font-size: 14px; color: var(--dim); margin-bottom: 6px; }
.q-input { width: 100%; border-radius: 10px; border: 1px solid var(--rule); background: var(--night); color: var(--bone); font: 15px/1.4 var(--font); padding: 10px 12px; resize: vertical; }
.q-other { margin-top: 6px; }
.btn.primary-inline { background: var(--orange); color: #1a1206; border: 0; padding: 11px 20px; }
.ask-banner { background: color-mix(in srgb, var(--orange) 12%, var(--ink-2)); border: 1px solid var(--orange); border-radius: 12px; padding: 14px 16px; }
.t-ask { color: var(--orange) !important; }
.t-bad { color: var(--coral) !important; }

.waiting-list { list-style: none; margin: 0; padding: 0; }
.waiting-list button {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--ink-2); border: 1px solid transparent; border-radius: 10px; padding: 11px 14px; margin-bottom: 6px;
}
.waiting-list button:hover { border-color: var(--teal); }
.waiting-list .nm { font-weight: 650; }
.waiting-list .ds { color: var(--dim); font-size: 13px; margin-left: auto; text-align: right; }
.code {
  font-size: 46px; font-weight: 700; letter-spacing: .14em; text-align: center; padding: 14px 0 6px;
  font-variation-settings: "opsz" 96; color: var(--teal);
}
.cmd {
  display: flex; align-items: center; gap: 8px; background: var(--night); border-radius: 10px; padding: 10px 10px 10px 14px; margin: 6px 0;
}
.cmd code { flex: 1; font: 13px ui-monospace, "Cascadia Mono", Menlo, monospace; overflow-wrap: anywhere; }
.cmd button { flex: none; border: 1px solid var(--rule); background: transparent; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.hint { color: var(--dim); font-size: 13px; margin: 6px 0 0; }
.wait { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 14px; margin-top: 14px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--rule); border-top-color: var(--teal); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
