/* Teach the count. Tokens follow the app's Count screen (count_face_v3.dart): canvas, text, peach primary, green now. */
@font-face { font-family: P; font-weight: 400; font-display: swap; src: url(/fonts/poppins-regular.woff2) format("woff2"); }
@font-face { font-family: P; font-weight: 500; font-display: swap; src: url(/fonts/poppins-medium.woff2) format("woff2"); }
@font-face { font-family: P; font-weight: 600; font-display: swap; src: url(/fonts/poppins-semibold.woff2) format("woff2"); }

:root {
  --canvas: #FAF8F6; --text: #1A1715; --text-2: #6B6560; --text-2w: #514B46;
  --primary: #FFAB91; --on-primary: #2A1912; --accent: #A3462A; --success: #2E7D45; --on-success: #FFFFFF;
  --warning: #8A5A00; --surface: #FFFFFF; --surface-2: #F1ECE8; --line: rgb(26 23 21 / 0.1); --tile: #ECE6E1;
  --tile-one: #FFE6DC; --focus: #A3462A; --shadow: 0 1px 2px rgb(42 25 18 / 0.06), 0 8px 24px rgb(42 25 18 / 0.06);
  --danger: #A32A2A;
  --r: 16px; --r-s: 12px; --pad: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0B0B0B; --text: #F3F1EF; --text-2: #A19D99; --text-2w: #C9C4BF;
    --primary: #FFDBCF; --on-primary: #2A1912; --accent: #FFDBCF; --success: #9ADBA8; --on-success: #0B2212;
    --warning: #FFC56B; --surface: #171515; --surface-2: #211E1D; --line: rgb(243 241 239 / 0.1); --tile: #2A2624;
    --tile-one: #4A3129; --focus: #FFDBCF; --shadow: none; --danger: #FF9C8F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #0B0B0B; --text: #F3F1EF; --text-2: #A19D99; --text-2w: #C9C4BF;
  --primary: #FFDBCF; --on-primary: #2A1912; --accent: #FFDBCF; --success: #9ADBA8; --on-success: #0B2212;
  --warning: #FFC56B; --surface: #171515; --surface-2: #211E1D; --line: rgb(243 241 239 / 0.1); --tile: #2A2624;
  --tile-one: #4A3129; --focus: #FFDBCF; --shadow: none; --danger: #FF9C8F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--canvas); color: var(--text); }
body {
  font: 400 16px/1.5 P, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100svh; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--accent); }

/* ---------- boot ---------- */
.boot { min-height: 100svh; display: flex; align-items: center; justify-content: center; gap: 6px; }
.boot i { width: 18px; height: 26px; border-radius: 6px; background: var(--tile); animation: breathe 1.6s ease-in-out infinite; }
.boot i:nth-child(1), .boot i:nth-child(5) { height: 34px; }
.boot i:nth-child(4) { margin-right: 10px; }
.boot i:nth-child(n+2) { animation-delay: .08s } .boot i:nth-child(n+3) { animation-delay: .16s }
.boot i:nth-child(n+4) { animation-delay: .24s } .boot i:nth-child(n+5) { animation-delay: .32s }
.boot i:nth-child(n+6) { animation-delay: .4s } .boot i:nth-child(n+7) { animation-delay: .48s } .boot i:nth-child(n+8) { animation-delay: .56s }
@keyframes breathe { 50% { opacity: .4 } }

/* ---------- page frame ---------- */
.page {
  min-height: 100svh; max-width: 520px; margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.page.wide { max-width: 1040px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text-2w); font-weight: 500; font-size: 15px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 52px; padding: 12px 20px; border-radius: 14px; border: 0;
  font-weight: 500; font-size: 16px; letter-spacing: -0.005em; text-align: center;
  background: var(--surface-2); color: var(--text);
  transition: transform .12s var(--ease), background-color .2s, opacity .2s;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.quiet { background: transparent; color: var(--text-2w); min-height: 44px; }
.btn.line { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { color: var(--danger); }
.btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.btn[aria-disabled="true"]:active { transform: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn small { font-size: 13px; font-weight: 400; opacity: .8; }
.link { background: none; border: 0; padding: 10px 4px; min-height: 44px; color: var(--text-2w); font-weight: 500; font-size: 15px;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.stack { display: grid; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- sign-in ---------- */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 40px; line-height: 1.05; letter-spacing: -0.035em; color: var(--text); }
.hero h1 span { color: var(--accent); }
.lede { margin-top: 14px; color: var(--text-2w); font-size: 17px; line-height: 1.5; }
.steps { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 14px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; color: var(--text); font-size: 15.5px; }
.steps li::before {
  counter-increment: s; content: counter(s); width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text-2w); font-weight: 600; font-size: 14px;
}
.time { margin-top: 18px; color: var(--text-2); font-size: 14.5px; }
.minibars { display: flex; gap: 5px; align-items: flex-end; margin-top: 30px; }
.minibars i { width: 22px; height: 22px; border-radius: 6px; background: var(--tile); }
.minibars i.tall { height: 32px; }
.minibars i.now { background: var(--success); }
.minibars i:nth-child(4) { margin-right: 8px; }
.signin-actions { margin-top: 28px; display: grid; gap: 10px; }
.consent { margin-top: 14px; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.note { margin-top: 22px; padding: 16px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 14.5px; color: var(--text-2w); }
.note b { color: var(--text); font-weight: 600; display: block; margin-bottom: 2px; }
.note details { margin-top: 6px; }
.note summary { cursor: pointer; color: var(--text); font-weight: 500; min-height: 36px; display: flex; align-items: center; list-style: none; }
.note summary::-webkit-details-marker { display: none; }
.note summary::after { content: ""; width: 8px; height: 8px; margin-left: 10px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.note details[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.noacct { margin-top: 14px; font-size: 14.5px; color: var(--text-2); }
.err { margin-top: 12px; color: var(--danger); font-size: 14.5px; }
.ok { margin-top: 12px; color: var(--text-2w); font-size: 14.5px; }

/* forms */
.field { display: grid; gap: 6px; margin-top: 14px; }
.field label { font-size: 14px; color: var(--text-2w); font-weight: 500; }
.field input {
  min-height: 52px; padding: 12px 16px; border-radius: 14px; border: 0; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line); font-size: 16px;
}
.field input:focus { outline: 2px solid var(--focus); outline-offset: 0; }
.help { font-size: 13px; color: var(--text-2); }

/* ---------- top bar ---------- */
.top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; min-height: 52px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
.top .mid { text-align: center; min-width: 0; }
.top .step { font-size: 13px; color: var(--text-2); font-weight: 500; }
.top .song { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .song span { color: var(--text-2); font-weight: 400; }

/* ---------- home ---------- */
.home h1 { font-size: 32px; letter-spacing: -0.03em; margin-top: 28px; }
.home .lede { font-size: 16px; }
.card { margin-top: 18px; padding: 18px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.card .label { color: var(--text-2); font-size: 13.5px; }
.card .big { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; }
.meter { height: 6px; margin-top: 12px; border-radius: 3px; background: var(--tile); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--success); border-radius: 3px; }
.mine { margin-top: 16px; color: var(--text-2w); font-size: 15px; }
.menu { margin-top: 18px; display: grid; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.menu button { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 18px; border: 0; background: transparent; text-align: left; font-weight: 500; }
.menu button + button { border-top: 1px solid var(--line); }
.menu button::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--text-2); border-top: 1.5px solid var(--text-2); transform: rotate(45deg); }

/* ---------- the task ---------- */
.task { flex: 1; display: flex; flex-direction: column; }
.face { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.numeral {
  font-weight: 600; font-size: min(42vw, 176px); line-height: 1; letter-spacing: -0.04em;
  height: min(44vw, 184px); display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums; color: var(--text); transition: font-size .3s var(--ease), height .3s var(--ease);
}
.numeral.idle { color: var(--tile); }
.numeral.pop { animation: pop .22s var(--ease); }
@keyframes pop { from { transform: scale(.94); opacity: .6 } to { transform: none; opacity: 1 } }
.fixing .face { display: none; }
.fixing .timeline { margin-top: 6px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 40px; margin-top: 6px; }
.bars i { width: 30px; height: 28px; border-radius: 8px; background: var(--tile); transition: background-color .08s; }
.bars i.tall { height: 40px; }
.bars i:nth-child(4) { margin-right: 10px; }
.bars i.now { background: var(--success); }

.timeline { margin-top: 18px; display: grid; gap: 6px; }
.track { position: relative; height: 28px; cursor: pointer; touch-action: none; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: var(--tile); }
.track .heard { position: absolute; top: 12px; height: 4px; background: var(--text-2); opacity: .45; border-radius: 2px; }
.track .ones { position: absolute; top: 9px; width: 2px; height: 10px; border-radius: 1px; background: var(--accent); opacity: .7; }
.track .head { position: absolute; top: 6px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--canvas); }
.times { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.transport { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 6px; }
.round { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--text); }
.round svg { width: 22px; height: 22px; }
.round.play { width: 72px; height: 72px; background: var(--text); color: var(--canvas); }
.round.play svg { width: 28px; height: 28px; }
.round:active { transform: scale(.96); }

.ask { margin-top: 20px; text-align: center; }
.ask h2 { font-size: 21px; letter-spacing: -0.02em; }
.ask p { margin-top: 4px; color: var(--text-2); font-size: 14.5px; }
.answers { margin-top: 16px; display: grid; gap: 10px; }
.answers .hint { text-align: center; font-size: 13px; color: var(--text-2); margin: -2px 0 2px; }
.answers .hint:empty { display: none; }
.nosound { text-align: center; margin-top: 6px; }
.nosound p { font-size: 13.5px; color: var(--text-2); max-width: 30em; margin: 2px auto 0; }
.keys { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--text-2); }
@media (hover: none) { .keys { display: none; } }

/* grid of beats (fix mode) */
.grid { margin-top: 14px; display: grid; gap: 6px; max-height: 40svh; overflow-y: auto; padding: 4px 2px; scroll-padding: 40px; }
.whole .grid { max-height: none; flex: 1; }
.grow { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.cell {
  min-height: 46px; border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text-2w);
  font-weight: 500; font-size: 17px; font-variant-numeric: tabular-nums; position: relative; padding: 0;
}
.cell.one { background: var(--tile-one); color: var(--text); font-weight: 600; }
.cell.now { box-shadow: inset 0 0 0 2px var(--success); color: var(--text); }
.cell.anchor::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.cell.cursor { outline: 2px solid var(--focus); outline-offset: 1px; }
.cell.unheard { opacity: .55; }

/* sheets and toasts */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 0.4); display: flex; align-items: flex-end; justify-content: center; z-index: 10; animation: fade .2s; }
.sheet {
  width: 100%; max-width: 520px; background: var(--canvas); border-radius: 22px 22px 0 0; padding: 22px 20px max(20px, env(safe-area-inset-bottom));
  box-shadow: 0 -1px 0 var(--line); animation: rise .28s var(--ease); max-height: 92svh; overflow-y: auto;
}
@media (min-width: 640px) { .scrim { align-items: center; } .sheet { border-radius: 22px; } }
.sheet h2 { font-size: 21px; }
.sheet p { margin-top: 6px; color: var(--text-2w); }
.sheet .stack { margin-top: 18px; }
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { transform: translateY(24px); opacity: 0 } }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--canvas); padding: 10px 18px; border-radius: 12px; font-size: 14.5px; font-weight: 500; z-index: 20; animation: fade .2s; }
.banner { margin: 8px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2w); font-size: 14px; }

/* state screens */
.state { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 10px; padding: 24px 4px; }
.state h1 { font-size: 30px; letter-spacing: -0.03em; }
.state p { color: var(--text-2w); font-size: 16px; max-width: 26em; margin: 0 auto; }
.state .stack { margin-top: 18px; }
.state .mark { margin: 0 auto 6px; }

/* intro */
.intro h1 { font-size: 30px; margin-top: 18px; letter-spacing: -0.03em; }
.intro dl { margin: 18px 0 0; display: grid; gap: 18px; }
.intro dt { font-weight: 600; font-size: 16.5px; }
.intro dd { margin: 3px 0 0; color: var(--text-2w); font-size: 15.5px; }
.intro .halfdemo { display: flex; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.intro .halfdemo i { font-style: normal; width: 28px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 13px; font-weight: 500; background: var(--surface-2); color: var(--text-2w); }
.intro .halfdemo i.one { background: var(--tile-one); color: var(--text); font-weight: 600; }
.intro .halfdemo b { width: 100%; height: 0; }

/* whole songs list */
.songs { margin-top: 14px; display: grid; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.songs button { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; text-align: left; padding: 12px 18px; min-height: 60px; border: 0; background: transparent; }
.songs button + button { border-top: 1px solid var(--line); }
.songs .t { font-weight: 500; }
.songs .a { color: var(--text-2); font-size: 14px; grid-column: 1; }
.songs .m { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--text-2); font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* owner view */
.owner h1 { font-size: 28px; margin-top: 18px; }
.otable { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; font-variant-numeric: tabular-nums; }
.otable th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 12.5px; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.otable td:first-child { min-width: 170px; }
.otable td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.otable td.n, .otable th.n { text-align: right; }
.otable tr.click { cursor: pointer; }
.otable tr.click:hover td { background: var(--surface); }
.pill-agreed { color: var(--success); } .pill-disputed { color: var(--warning); } .pill-unclear, .pill-open { color: var(--text-2); }
.oscroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.osub { color: var(--text-2); font-size: 13.5px; }
.ans-list { display: grid; gap: 6px; margin-top: 10px; }
.ans-list button { text-align: left; padding: 10px 14px; border-radius: 12px; border: 0; background: var(--surface-2); min-height: 44px; font-size: 14px; }
.ans-list button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }

@media (min-width: 900px) {
  .page:not(.wide) { padding-top: 40px; }
  .hero h1 { font-size: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* a locked primary reads as waiting, not as a broken colour */
.btn.primary[aria-disabled="true"] { background: var(--surface-2); color: var(--text-2); opacity: 1; }
.state .card { text-align: left; }
.state .card p { max-width: none; margin: 0; }
.state .card .big { color: var(--text); font-size: 22px; }
