/* Founder Reset 2.0 — design prototype layer (loaded after app.css).
   Two modes: Road (daylight paper, the default) and Room (.is-room: dark, for the live session steps).
   Each theme brings an edition kit (--theme, --theme-glow, --edition-font) from themes.js; see the brand block at the end. */

:root {
  --paper: #f7f6f2;
  --paper-2: #edebe5;
  --card: #ffffff;
  --ink: #121417;
  --ink-2: #2b2f37;
  --muted: #5b606b;
  --line: #e3e0d8;
  --accent: #ff5a36;
  --accent-ink: #c23a17;
  --accent-soft: #ffe6dd;
  --gold: #f2b33d;
  --theme: #6e56cf;
  --on-ink: #f7f6f2;
  --field-bg: #ffffff;
  --field-line: #d9d6ce;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(18, 20, 23, .04), 0 12px 32px -18px rgba(18, 20, 23, .18);
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --script: 'Instrument Serif', Georgia, serif;
}

/* ---------- Type ---------- */
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: .98; }
h2 { font-size: clamp(1.6rem, 2.6vw, 2rem); line-height: 1.05; }
h3 { font-family: var(--sans); font-weight: 600; }
.big-label { font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 2.8vw, 2.1rem); line-height: 1.08; letter-spacing: -0.005em; display: block; margin-bottom: .35rem; text-wrap: balance; }
.eyebrow, .chip, .ideas-title, .brief-meta span { font-family: var(--mono); font-weight: 500; letter-spacing: .08em; }
.eyebrow { font-size: .7rem; }
.chip { font-size: .68rem; font-weight: 500; padding: .35rem .65rem; border-radius: 6px; }
.hl { color: var(--accent-ink); font-style: italic; }
.lede { font-size: 1.08rem; }
.tool-clock, .timer-strip strong, .big-timer strong, .wall-count, [data-timer-value] { font-family: var(--mono); font-weight: 400; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sig, .sig-preview span { font-family: var(--serif); font-style: italic; color: var(--ink); }

/* ---------- Surfaces: fewer boxes, quieter shadows ---------- */
.card { border-radius: var(--radius); box-shadow: var(--shadow); border-color: var(--line); }
.brief, .tool, .recap, .brainstorm, .teach-steps li { background: transparent; }
.brief { border-width: 1px; }
input[type=text], input[type=email], input:not([type]), input[type=password], input[type=number], textarea, select {
  background: var(--field-bg); border: 1px solid var(--field-line); border-radius: 12px;
}
input:focus, textarea:focus { border-color: var(--theme); box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme) 22%, transparent); }

/* ---------- Buttons ---------- */
.btn { font-family: var(--sans); font-weight: 600; border-width: 1px; letter-spacing: -0.005em; }
.btn:hover { transform: none; box-shadow: none; }
.btn-primary { color: #1a0904; }
.btn-primary:hover { background: #ff6b4a; }
.btn-ghost { border-color: var(--field-line); }
.btn-dark { color: var(--on-ink); }

/* ---------- Top bar + domino rail ---------- */
.brand { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; letter-spacing: -0.01em; }
.topbar { border-bottom-color: var(--line); }
.rail { gap: 5px; }
.rail .tile { width: 10px; height: 24px; border-width: 1px; border-color: var(--field-line); border-radius: 2.5px; }
.rail .is-done .tile { background: var(--ink); border-color: var(--ink); transform: rotate(24deg); }
.rail .is-current .tile { background: var(--accent); border-color: var(--accent); height: 28px; }
.save-status { font-family: var(--mono); font-size: .72rem; }
.timer-strip { font-family: var(--mono); font-size: .8rem; letter-spacing: .02em; background: var(--ink); color: var(--on-ink); }

/* ---------- Step layout: the question is the hero ---------- */
.step-hero h1 { font-size: clamp(2.6rem, 5vw, 4rem); }
.art { border-radius: 14px; }

/* ---------- Week tiles take the month's colour in steps of strength ---------- */
.week-tile, .wk { border-top-width: 3px; border-top-color: var(--theme); }
.week-tile:nth-child(2), .wk:nth-child(2) { border-top-color: color-mix(in srgb, var(--theme) 75%, var(--paper)); }
.week-tile:nth-child(3), .wk:nth-child(3) { border-top-color: color-mix(in srgb, var(--theme) 50%, var(--paper)); }
.week-tile:nth-child(4), .wk:nth-child(4) { border-top-color: color-mix(in srgb, var(--theme) 30%, var(--paper)); }
.week-tile { background: var(--card); }

/* ---------- Plan document (Road mode) ---------- */
.plan-doc { border-radius: 18px; }
.plan-doc h1 { font-size: clamp(2.4rem, 4.6vw, 3.4rem); }
.plan-doc .eyebrow, .plan-doc-head .eyebrow { color: var(--theme); }
.seal { background: var(--theme); color: #fff; }
.pd-first p { background: color-mix(in srgb, var(--theme) 10%, var(--card)); color: var(--ink); font-family: var(--serif); font-weight: 400; font-size: 1.35rem; line-height: 1.2; }
.priority { font-family: var(--serif); font-weight: 400; }
.field-hero textarea { font-family: var(--serif); font-weight: 400; font-size: 1.45rem; line-height: 1.15; background: color-mix(in srgb, var(--theme) 5%, #fff); border-color: color-mix(in srgb, var(--theme) 35%, #fff); }

/* ================================================================
   ROOM MODE — the live session. Lights down, phone face up.
   ================================================================ */
.is-room {
  --paper: #0d0f14;
  --paper-2: #1f2430;
  --card: #161a22;
  --ink: #f3efe6;
  --ink-2: #d9d5cc;
  --muted: #9aa0ad;
  --line: #2a303d;
  --accent-ink: #ff7a59;
  --accent-soft: rgba(255, 90, 54, .14);
  --teal: #5fc6c4;
  --teal-soft: rgba(95, 198, 196, .14);
  --info-bg: rgba(110, 160, 255, .12);
  --warn-bg: rgba(242, 179, 61, .14);
  --on-ink: #0d0f14;
  --field-bg: #11141b;
  --field-line: #323a49;
  --shadow: none;
  --sky-1: #26304a; --sky-2: #3a2b3a; --sun-bg: #2a2117; --room-bg: #1c2033;
  color-scheme: dark;
  background: var(--paper);
  color: var(--ink);
}
.is-room .topbar { background: color-mix(in srgb, var(--paper) 86%, transparent); }
.is-room .card { background: var(--card); border-color: var(--line); }
.is-room input, .is-room textarea, .is-room select { color: var(--ink); }
.is-room ::placeholder { color: #8a909d; }
.is-room .hl { color: var(--accent); }

/* Components that used ink as a fill now invert: bone fill, ink text */
.is-room .btn { background: transparent; color: var(--ink); border-color: var(--field-line); }
.is-room .btn-primary { background: var(--accent); border-color: var(--accent); color: #1a0904; }
.is-room .btn-dark, .is-room .pill-dark, .is-room .seg.is-on, .is-room .chip-commit { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.is-room .btn.is-waiting { background: var(--paper-2); color: var(--muted); border-color: var(--line); }
.is-room .bubble-me, .is-room .coach-panel .revise-log .bubble-me { background: var(--ink); color: var(--on-ink); }
.is-room .bubble-coach, .is-room .revise-log .bubble-coach, .is-room .coach-panel .revise-log .bubble-coach { background: var(--paper-2); color: var(--ink); }
.is-room .bubble-note { color: #f2d48a; }
.is-room .send-btn { background: var(--accent); color: #1a0904; }
.is-room .composer, .is-room .coach-panel textarea, .is-room .coach-panel { background: var(--field-bg); border-color: var(--field-line); }
.is-room .chip-btn, .is-room .idea, .is-room .share-opt { background: var(--card); color: var(--ink); border-color: var(--field-line); }
.is-room .chip-btn:hover, .is-room .idea:hover { border-color: var(--theme); }
.is-room .rule { background: var(--paper-2); color: var(--ink); }
.is-room .rule p { color: var(--muted); }
.is-room .commit-card, .is-room .work-badge, .is-room .big-timer { background: var(--paper-2); color: var(--ink); }
.is-room .commit-card .muted { color: var(--muted); }
.is-room .prompt-card { background: color-mix(in srgb, var(--theme) 22%, var(--card)); color: var(--ink); }
.is-room .prompt-card .eyebrow { color: color-mix(in srgb, var(--theme) 45%, #fff); }
.is-room .brief-meta span { background: var(--theme); color: #fff; }
.is-room .chip { background: var(--paper-2); color: var(--muted); }
.is-room .rail .tip { background: var(--ink); color: var(--on-ink); }
.is-room .rail .tile { background: transparent; border-color: #3a4252; }
.is-room .rail .is-done .tile { background: var(--ink); border-color: var(--ink); }
.is-room .rail .is-current .tile { background: var(--accent); border-color: var(--accent); }
.is-room .timer-strip { background: var(--card); color: var(--ink); border-bottom: 1px solid var(--line); }
.is-room .timer-strip.is-zero { background: var(--accent); color: #1a0904; }
.is-room .alert-info { color: #cfe0ff; } .is-room .alert-warn { color: #f2d48a; }
.is-room .teach-hint { color: #f2d48a; }
.is-room .ladder-row span { background: var(--theme); }
.is-room .story-pair .new { color: var(--ink); }
.is-room .accept-box.is-accepted { background: rgba(60, 207, 122, .12); }
.is-room .check-summary { background: rgba(255, 146, 43, .1); color: #ffd0a8; }
.is-room .badge-sim { color: #5b3f00; }
.is-room .field-accent textarea { background: var(--field-bg); border-color: var(--teal); }
.is-room .tool.is-running .tool-clock { color: var(--accent); }
.is-room .mic-btn:hover { background: var(--paper-2); color: var(--ink); }
.is-room .signed-burst, .is-room .postcard { color: var(--ink-2); }
.is-room .postcard { background: var(--card); border-color: var(--line); }
.is-room .sig-preview span, .is-room .sig { color: var(--ink); }

/* Landing in room mode */
.is-landing.is-room .landing-visual { background: var(--card); border: 1px solid var(--line); }
.is-landing.is-room .domino-run span { background: var(--ink); }
.is-landing.is-room .domino-run span:first-child { background: var(--accent); }
.is-landing.is-room .meta-list span { font-family: var(--mono); font-weight: 500; }
.is-landing h1 { font-size: clamp(3rem, 7.4vw, 6rem); line-height: .92; }
.is-landing h1 .hl { display: block; margin-top: .1em; }

/* Leave it behind: a dark well, and the words burn off as embers */
.is-room .leave-box textarea { background: var(--field-bg); border-color: var(--field-line); font-size: 1.1rem; line-height: 1.55; }
.is-room .leave-gone { background: var(--field-bg); border-color: var(--field-line); color: var(--muted); font-family: var(--serif); font-size: 1.6rem; }
.is-room .leave-gone span { color: var(--accent); font-weight: 400; font-style: italic; font-size: 2.4rem; }
.leave-embers { position: absolute; inset: 0; padding: calc(.75rem + 1px) calc(.9rem + 1px); font-size: 1.1rem; line-height: 1.55; pointer-events: none; z-index: 2; white-space: pre-wrap; }
.leave-embers span { display: inline-block; margin-right: .3em; animation: ember 1.3s cubic-bezier(.4,0,.6,1) var(--d, 0s) forwards; }
@keyframes ember {
  0% { color: var(--ink); }
  35% { color: #ffb199; text-shadow: 0 0 10px rgba(255, 90, 54, .7); }
  70% { color: var(--accent); opacity: .7; filter: blur(1px); }
  100% { color: var(--accent); opacity: 0; filter: blur(5px); transform: translate(var(--x, 0), -34px); }
}
.leave-box.is-fading textarea { animation-duration: .5s; }
@media (prefers-reduced-motion: reduce) { .leave-embers { display: none; } }

/* ================================================================
   STAGE — the domino wall in the month's colour
   ================================================================ */
.is-wall { background: #0d0f14; }
.is-wall .wall-head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(3rem, 7vw, 6.4rem); line-height: .92; }
.is-wall .wall-count { color: var(--accent); font-family: var(--serif); font-style: italic; }
.is-wall .eyebrow { color: color-mix(in srgb, var(--theme) 55%, #fff); }
.wall-card { background: #161a22; border: 1px solid #2a303d; border-top: 3px solid var(--theme); border-radius: 12px; animation: tipin .7s cubic-bezier(.3,1.4,.5,1) both; transform-origin: bottom left; }
.wall-card:nth-child(4n+2), .wall-card:nth-child(4n+3), .wall-card:nth-child(4n+4) { border-top-color: var(--theme); }
.wall-card p { font-family: var(--serif); font-weight: 400; font-size: clamp(1.25rem, 1.9vw, 1.7rem); line-height: 1.12; }
.wall-card span { font-family: var(--mono); font-weight: 500; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: #9aa0ad; }
@keyframes tipin { from { opacity: 0; transform: rotate(-9deg) translateY(-24px); } 60% { opacity: 1; transform: rotate(2deg); } to { transform: none; } }
.wall-dominoes i { background: var(--theme) !important; }
@media (prefers-reduced-motion: reduce) { .wall-card { animation: none; } }

/* Pills (speaker timer etc.) */
.is-room .pill { background: transparent; color: var(--ink); border-color: var(--field-line); }
.is-room .pill-dark { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* Instrument Serif has one weight: never let the browser fake-bold it */
.brand, .leave-gone, .postcard-stamp, .prompt-text, .focus-q blockquote, .wk-num, .commit-quote, .share-box legend,
.seal span, .priority, .wk-domino, .pd-commit blockquote, .stat b, .prompt-mini, .rule b, .commit-lead, .rs-now,
.card h2, .side-card h2, .block-title { font-weight: 400; }
.pd-commit blockquote, .commit-quote, .commit-lead { font-size: 1.5rem; line-height: 1.2; }
.wk-num { font-size: 1.35rem; }

/* Save status stays compact on phones */
.save-status { font-family: var(--sans); font-size: .8rem; }
@media (max-width: 520px) {
  .save-status { min-width: 0; }
  .save-status:not([data-state="error"]) .txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Teach: the focusing question in the month's colour */
.focus-q { background: color-mix(in srgb, var(--theme) 10%, var(--card)); border-left: 3px solid var(--theme); border-radius: 4px 14px 14px 4px; }
.focus-q blockquote { color: var(--ink); font-size: clamp(1.5rem, 2.6vw, 1.9rem); line-height: 1.12; }
.focus-q figcaption { color: color-mix(in srgb, var(--theme) 70%, var(--ink)); font-family: var(--mono); font-weight: 500; }
.is-room .focus-q { background: color-mix(in srgb, var(--theme) 18%, var(--card)); }
.is-room .focus-q figcaption { color: color-mix(in srgb, var(--theme) 45%, #fff); }
.rule-num { font-family: var(--mono); font-weight: 500; }

/* Room fixes from the axe audit */
.is-room .build-banner { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.is-room .build-banner p, .is-room .build-banner b { color: var(--ink); }
.is-room .ladder-row span { opacity: 1 !important; color: #fff; background: color-mix(in srgb, var(--theme) calc(100% - var(--i, 0) * 12%), #0d0f14); }

/* "Check this" tags: white on #d9480f was 4.3:1 at a small size. Darker ember clears AA (5.37:1). */
.check-tag { background: #c23a17; border-color: #9e2e11; }
.check-summary { border-left-color: #c23a17; }
.field.is-suggested { border-left-color: #c23a17; }

/* "The host moved on" strip: white on #22a35a was 3.25:1 (on main too), and Room mode turned its button text pale. */
.moved-strip { background: #157a42; color: #fff; }
.moved-strip .btn, .is-room .moved-strip .btn { background: #fff; color: #0d5c31; border-color: #fff; }

/* Plan: protected time picker and who checks in (round 3) */
.protect { display: grid; gap: .5rem; margin-bottom: .7rem; }
.protect-row { display: grid; grid-template-columns: 5.5rem 1fr; gap: .6rem; align-items: center; }
.protect-row > span { font: 500 .7rem var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.protect-row > div { display: flex; flex-wrap: wrap; gap: .35rem; }
.pchip { font: 500 .85rem var(--sans); padding: .38rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; min-height: 36px; }
.pchip:hover { border-color: var(--theme); }
.pchip[aria-pressed="true"] { background: var(--theme); border-color: var(--theme); color: #fff; }
.checkin-block input { width: 100%; }
.row-btns { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
@media (max-width: 560px) { .protect-row { grid-template-columns: 1fr; gap: .3rem; } }

/* Admin tabs (round 3) */
.admin-tabs { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0 0 1rem; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.admin-tabs button { font: 600 .92rem var(--sans); border: 0; background: transparent; color: var(--muted); padding: .5rem .9rem; border-radius: 8px; cursor: pointer; }
.admin-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.admin-tabs .btn { margin-left: auto; }
.admin-layout[data-view="between"], .admin-layout[data-view="setup"] { grid-template-columns: minmax(0, 1fr); }
.admin-layout[data-view="between"] .admin-side, .admin-layout[data-view="setup"] .admin-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }

/* ---------- Brand: core + edition kit (round 5) ----------
   Core never changes: paper, ink, Geist, Geist Mono. Each theme's edition sets --theme (deep, holds white text),
   --theme-glow (gradient), --theme-tint, --theme-on and --edition-font from themes.js. The mica finish shows
   flecks of light near the pointer and as the page scrolls, then settles (public/app.js). */
:root { --paper: #f7f3ec; --ink: #15171f; --line: #e2dacb; --muted: #5d6170; --gold: #f2b33d; }
body[data-finish] { --accent: var(--theme); --accent-ink: color-mix(in srgb, var(--theme) 80%, #15171f); --accent-soft: var(--theme-tint); }
.is-room[data-finish] { --accent-ink: var(--theme-glow); --accent-soft: color-mix(in srgb, var(--theme) 18%, transparent); }
body[data-finish] h1 { font-family: var(--edition-font, var(--serif)); font-style: var(--edition-style, normal); }
body[data-finish] h1 .hl { font-style: italic; }
.edition-tag { display: inline-flex; align-items: center; gap: .5rem; font: 500 .78rem var(--mono); letter-spacing: .06em; text-transform: uppercase; margin: 0 0 1rem; color: var(--ink); }
.edition-tag .glyph { display: inline-flex; width: 22px; height: 22px; color: var(--theme); }
.is-room .edition-tag { color: #fff; } .is-room .edition-tag .glyph { color: var(--theme-glow); }
.edition-tag .glyph svg { width: 100%; height: 100%; }
body[data-finish] .btn-primary, body[data-finish] .send-btn, body[data-finish] .seal, body[data-finish] .pchip[aria-pressed="true"] {
  position: relative; isolation: isolate; overflow: hidden; color: var(--theme-on); border-color: transparent;
  background: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(75% 160% at calc(105% - var(--gx, 20%) * .4) 130%, var(--theme-glow) 0%, transparent 70%), var(--theme);
  background-size: 160px, auto, auto; background-blend-mode: soft-light, normal, normal;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 8px 18px -10px var(--theme);
}
body[data-finish] .btn-primary:hover { filter: brightness(1.04); }
body[data-finish] .is-room .timer-strip.is-zero, .is-room[data-finish] .timer-strip.is-zero, .is-room[data-finish] .rail .is-current .tile { color: var(--theme-on); }
body[data-finish="mica"] .btn-primary::after, body[data-finish="mica"] .seal::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background-image: var(--mica, none); background-size: 180px; background-position: var(--sx, 0) var(--sy, 0); opacity: .75;
  -webkit-mask-image: radial-gradient(120px circle at var(--px, -300px) var(--py, -300px), #000, rgba(0, 0, 0, .1) 75%);
  mask-image: radial-gradient(120px circle at var(--px, -300px) var(--py, -300px), #000, rgba(0, 0, 0, .1) 75%);
}
@media (prefers-reduced-motion: reduce) { body[data-finish="mica"] .btn-primary::after, body[data-finish="mica"] .seal::after { display: none; } }
