:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1d1f23;
  --muted: #62666e;
  --line: #e2ded5;
  --accent: #e8731a;
  --accent-ink: #ffffff;
  --ok: #1f7a3f;
  --warn: #9a5b00;
  --bad: #b3261e;
  --chip: #efebe2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --surface: #1f2125;
    --ink: #ecebe7;
    --muted: #a3a6ad;
    --line: #32353b;
    --accent: #f08a3a;
    --accent-ink: #16171a;
    --ok: #5cc98a;
    --warn: #e2ad4f;
    --bad: #ff8a80;
    --chip: #2a2c31;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh;
  display: flex; flex-direction: column;
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
a { color: inherit; }
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1080px; width: 100%; margin: 0 auto; padding: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; text-decoration: none; }
.mark { display: inline-block; width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  box-shadow: inset 0 0 0 6px var(--bg), inset 0 0 0 9px var(--accent); }
.nav { display: flex; align-items: center; gap: 14px; }
.link { text-decoration: none; color: var(--muted); font-weight: 500; }
.link:hover { color: var(--ink); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 10px; border: 2px solid var(--ink);
  background: var(--ink); color: var(--bg); text-decoration: none; cursor: pointer;
}
.button:hover { opacity: .9; }
.button:disabled { opacity: .5; cursor: progress; }
.button.small { padding: 6px 12px; font-size: 14px; }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button.wide { width: 100%; }
.button.google { background: var(--surface); color: var(--ink); border-color: var(--line); }
.g { width: 18px; height: 18px; }

.hero { padding: 48px 0 24px; }
h1 { font-size: clamp(32px, 7vw, 54px); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 14px; }
.narrow h1, .admin-head h1, #admin-denied h1 { font-size: clamp(26px, 5vw, 34px); }
.lead { color: var(--muted); font-size: 19px; max-width: 560px; margin: 0; }
.lead.small { font-size: 16px; }
.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 40px 0 12px; }

.products { display: grid; gap: 16px; }
.product {
  display: flex; align-items: center; gap: 24px; padding: 24px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
}
.product h3 { margin: 0 0 4px; font-size: 24px; }
.product p { margin: 0 0 12px; color: var(--muted); }
.dog { width: 160px; flex: none; }
.dog .body { fill: var(--accent); }
.dog .eye { fill: var(--surface); }
.dog .limb { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--chip); font-size: 13px; font-weight: 600; }

.cta { margin-top: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cta p { margin: 0 8px 0 0; color: var(--muted); flex-basis: 100%; }

.narrow { max-width: 420px; margin: 40px auto 0; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input {
  font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); width: 100%;
}
input:focus { outline: none; border-color: var(--accent); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { min-height: 1.5em; margin: 14px 0 0; font-size: 15px; }
.msg.error { color: var(--bad); }
.msg.ok { color: var(--ok); }
.switch { color: var(--muted); font-size: 15px; }
.switch a { font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 20px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts.inline { grid-template-columns: max-content 1fr max-content 1fr; }

.admin-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 32px; }
.admin-head h1 { margin: 0; }
.state { padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; background: var(--chip); }
.state.running { color: var(--ok); }
.state.paused, .state.idle { color: var(--muted); }
.state.waiting { color: var(--warn); }
.state.stopped { color: var(--bad); }
#st-summary { margin-top: 10px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.card.span { grid-column: 1 / -1; }
.card h2 { font-size: 16px; margin: 0 0 10px; }
.count { color: var(--muted); font-weight: 400; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list li { overflow-wrap: anywhere; }
.list .empty, .table .empty { color: var(--muted); }
.events time { display: block; color: var(--muted); font-size: 13px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.table th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 6px 8px 6px 0; }
.table td { border-bottom: 1px solid var(--line); padding: 6px 8px 6px 0; vertical-align: top; overflow-wrap: anywhere; }
.table td.sub { color: var(--muted); font-size: 13px; }
.tag { font-weight: 600; }
.tag.done, .tag.passed, .tag.pass, .tag.ok, .tag.merged { color: var(--ok); }
.tag.failing, .tag.failed, .tag.fail, .tag.blocked { color: var(--bad); }
.tag.waiting, .tag.open, .tag.ready { color: var(--warn); }

/* the 3D view (lesson L174) */
.viewer { display: grid; gap: 10px; }
.v-note { margin: 0; color: var(--muted); }
.v-note.error, .v-msg.error { color: var(--bad); }
.v-build { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.v-build b { color: var(--ink); }
.v-layers { display: flex; flex-wrap: wrap; gap: 8px; }
.v-layer {
  font: inherit; font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.v-layer.on { background: var(--chip); color: var(--ink); border-color: var(--ink); }
.v-stage {
  position: relative; height: min(62vh, 560px); min-height: 320px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, var(--surface), var(--bg)); border: 1px solid var(--line);
  touch-action: none;
}
.v-stage canvas { display: block; width: 100%; height: 100%; outline: none; }
.v-msg {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center;
  color: var(--muted); font-weight: 600;
}
.v-tools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.v-tool {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.v-tool.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.v-pick {
  position: absolute; left: 10px; bottom: 10px; right: 60px; padding: 6px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--muted);
  overflow-wrap: anywhere; width: fit-content; max-width: calc(100% - 70px);
}
.v-pick b { color: var(--ink); }
.v-hint { margin: 0; color: var(--muted); font-size: 13px; }
.viewer.max { position: fixed; inset: 0; z-index: 50; background: var(--bg); padding: 12px; grid-template-rows: auto auto 1fr auto; }
.viewer.max .v-stage { height: auto; min-height: 0; }
body.viewer-max { overflow: hidden; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px; }

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .facts.inline { grid-template-columns: max-content 1fr; }
  .product { flex-direction: column; align-items: flex-start; }
  .dog { width: 130px; }
  .hero { padding-top: 24px; }
  .nav { gap: 10px; }
  .v-stage { height: 58vh; min-height: 300px; }
}
