:root {
  /* Layout: one phone-width column centred on a night-pasture field.
     Ear tags carry the identity: yellow = you / player 1 / bulls, orange = opponent, bone = cows. */
  --bg: #0d1c17;
  --surface: #15291f;
  --surface-2: #1d362a;
  --line: #2b463a;
  --ink: #eef0e3;
  --muted: #93a99f;
  --tag: #f3c332;
  --tag-ink: #17130a;
  --tag2: #ff9a5a;
  --cow: #d9ceb2;
  --good: #7fd69b;
  --alert: #ff8466;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(900px 480px at 50% -12%, rgba(243, 195, 50, .09), transparent 62%),
    radial-gradient(700px 520px at 100% 112%, rgba(255, 154, 90, .07), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }
[hidden] { display: none !important; }

#app {
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
}
#app.locked { height: 100%; min-height: 0; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- App bar ---------- */
.appbar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; height: 58px; }
.appbar > :first-child { justify-self: start; }
.bar-title { margin: 0; max-width: 62vw; font: 800 22px/1 var(--display); text-transform: uppercase; letter-spacing: .05em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-right { justify-self: end; display: flex; gap: 2px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: none; color: var(--muted); }
.icon-btn:hover { color: var(--ink); background: var(--surface); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.ph { visibility: hidden; }

/* ---------- Ear tags ---------- */
.tag {
  --w: 40px;
  position: relative; flex: none;
  width: var(--w); height: calc(var(--w) * 1.24);
  padding-top: calc(var(--w) * .34);
  display: grid; place-items: center;
  background: var(--tag); color: var(--tag-ink);
  border-radius: 42% 42% 16% 16% / 30% 30% 14% 14%;
  font: 900 calc(var(--w) * .7)/1 var(--display);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
  transition: opacity .15s;
}
.tag::before {
  content: ""; position: absolute; left: 50%; top: calc(var(--w) * .08);
  width: calc(var(--w) * .16); height: calc(var(--w) * .16); margin-left: calc(var(--w) * -.08);
  border-radius: 50%; background: var(--hole, var(--bg)); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .45);
}
.tag.c1 { background: var(--tag2); }
.tag.xs { --w: 20px; box-shadow: none; }
.tag.sm { --w: var(--tw, 24px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); }
.tag.md { --w: 40px; }
.tag.lg { --w: 58px; }
.tag.xl { --w: 64px; }
.tag.n-out { opacity: .28; }
.tag.n-in { outline: 2px solid var(--cow); outline-offset: 1px; }
.tag.q { background: transparent; color: var(--tag); box-shadow: inset 0 0 0 2px var(--tag); }
.tag.q::before { background: var(--tag); opacity: .5; }
.tag.think { animation: pulse 1s ease-in-out infinite; }
.tag.think:nth-child(2) { animation-delay: .15s; } .tag.think:nth-child(3) { animation-delay: .3s; } .tag.think:nth-child(4) { animation-delay: .45s; } .tag.think:nth-child(5) { animation-delay: .6s; }
.tag.flip { animation: flip .32s ease; }
.tags-row { display: flex; gap: 6px; }
.tilt .tag:nth-child(odd) { rotate: -2.5deg; }
.tilt .tag:nth-child(even) { rotate: 2deg; }

.slot {
  --w: 58px; flex: none; width: var(--w); height: calc(var(--w) * 1.24);
  border: 2px dashed var(--line); border-radius: 42% 42% 16% 16% / 30% 30% 14% 14%;
}
.slot.next { border-color: var(--tag); animation: blink 1.1s steps(2, start) infinite; }
.entry { display: flex; justify-content: center; gap: 10px; }
.entry .tag.lg, .entry .slot { --w: var(--ew, 58px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; text-align: center;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--tag); border-color: var(--tag); color: var(--tag-ink); font: 800 20px/1 var(--display); text-transform: uppercase; letter-spacing: .05em; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); border-color: var(--tag); }
.btn.lg { min-height: 56px; font-size: 22px; }
.btn.block { width: 100%; }
.btn.ghost { background: none; }
.btn.wa { background: #1e8a52; border-color: #1e8a52; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.link-btn { border: 0; background: none; color: var(--tag); font-weight: 600; font-size: 14px; padding: 8px; }

/* ---------- Home ---------- */
.home { gap: 14px; padding-bottom: 28px; }
.home-top { display: flex; justify-content: space-between; align-items: center; height: 52px; }
.home-top .brand-mini { font: 800 14px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.logo { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 2px 0 6px; }
.logo .tags-row { gap: 10px; margin-bottom: 10px; }
.wordmark { margin: 0; display: flex; align-items: baseline; gap: .08em; font: 900 clamp(64px, 19vw, 92px)/.8 var(--display); text-transform: uppercase; }
.wordmark .b { color: var(--tag); }
.wordmark .c { color: var(--cow); }
.wordmark .amp { color: var(--muted); font-weight: 600; font-size: .52em; }
.tagline { margin: 8px 0 0; max-width: 30ch; color: var(--muted); text-wrap: balance; }

.hero-mode {
  position: relative; display: grid; grid-template-columns: 52px 1fr 22px; align-items: center; gap: 14px;
  padding: 18px; border: 0; border-radius: 20px; background: var(--tag); color: var(--tag-ink); text-align: left;
  box-shadow: 0 14px 34px -16px rgba(243, 195, 50, .6), inset 0 -4px 0 rgba(0, 0, 0, .15);
}
.hero-mode:active { transform: translateY(1px); }
.hero-mode .hm-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: rgba(0, 0, 0, .12); }
.hero-mode .hm-icon svg { width: 28px; height: 28px; }
.hero-mode b { display: block; font: 900 27px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.hero-mode small { display: block; margin-top: 4px; font-size: 14px; opacity: .78; }
.hero-mode > svg { width: 22px; height: 22px; }

.mode-list { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.mode-row { width: 100%; display: grid; grid-template-columns: 44px 1fr 20px; align-items: center; gap: 12px; padding: 14px 16px; border: 0; background: none; text-align: left; }
.mode-row + .mode-row { border-top: 1px solid var(--line); }
.mode-row:hover { background: var(--surface-2); }
.mode-row .mr-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); color: var(--cow); }
.mode-row .mr-icon svg { width: 24px; height: 24px; }
.mode-row b { display: block; font: 800 22px/1.05 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.mode-row small { color: var(--muted); font-size: 14px; }
.mode-row > svg { width: 20px; height: 20px; color: var(--muted); }

.daily-strip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px dashed rgba(243, 195, 50, .6); border-radius: 18px; background: rgba(243, 195, 50, .05); text-align: left; }
.daily-strip:hover { background: rgba(243, 195, 50, .09); }
.daily-strip .ds-num { font: 900 36px/1 var(--display); color: var(--tag); font-variant-numeric: tabular-nums; }
.daily-strip b { display: block; font: 800 22px/1.05 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.daily-strip small { color: var(--muted); font-size: 14px; }
.daily-strip .ds-streak { display: flex; align-items: center; gap: 3px; font: 800 24px var(--display); color: var(--tag2); }
.daily-strip .ds-streak svg { width: 20px; height: 20px; }

.banner { display: grid; grid-template-columns: 40px 1fr 20px; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); text-align: left; }
.banner .b-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--tag); color: var(--tag-ink); }
.banner .b-icon svg { width: 18px; height: 18px; margin-left: 2px; }
.banner.resume .b-icon { background: var(--tag2); }
.banner b { display: block; font-weight: 700; }
.banner small { color: var(--muted); font-size: 13px; }
.banner > svg { width: 20px; height: 20px; color: var(--muted); }

.home-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.home-links button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: none; font-size: 14px; font-weight: 600; }
.home-links button:hover { border-color: var(--muted); }
.home-links svg { width: 16px; height: 16px; color: var(--tag); }
.home-links .install { border-color: var(--tag); color: var(--tag); }

/* ---------- Forms / setup ---------- */
.pad { display: grid; gap: 18px; padding: 6px 0 28px; align-content: start; }
.lead { margin: 0; color: var(--muted); }
.lead b { color: var(--ink); }
.field { display: grid; gap: 8px; }
.field-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 800 19px var(--display); text-transform: uppercase; letter-spacing: .04em; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.input { width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 17px; }
.input:focus { outline: none; border-color: var(--tag); }
.input::placeholder { color: var(--muted); opacity: .7; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#joincode { font: 800 24px var(--display); letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid rgba(255, 154, 90, .5); border-radius: 12px; background: rgba(255, 154, 90, .08); font-size: 14px; }
.notice svg { width: 18px; height: 18px; flex: none; color: var(--tag2); margin-top: 2px; }
.msg { margin: 0; min-height: 1.35em; text-align: center; font-size: 13px; color: var(--muted); }
.msg.err { color: var(--alert); }

/* ---------- Keypad ---------- */
.keypad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.key {
  position: relative; min-height: 52px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--ink); font: 800 28px var(--display); touch-action: manipulation;
}
.key:hover:not(:disabled) { border-color: var(--muted); }
.key:active:not(:disabled) { transform: translateY(1px); background: var(--line); }
.key:disabled { opacity: .26; cursor: not-allowed; }
.key.n-out { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 3px; }
.key.n-in::after { content: ""; position: absolute; inset: 4px; border: 2px solid var(--cow); border-radius: 9px; opacity: .75; pointer-events: none; }
.keypad.marking .key.d { border-style: dashed; border-color: var(--cow); }
.key-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 7px; }
.key.fn { display: flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px var(--body); }
.key.fn svg { width: 18px; height: 18px; }
.key.fn.on { background: var(--cow); border-color: var(--cow); color: var(--tag-ink); }
.key.go { background: var(--tag); border-color: var(--tag); color: var(--tag-ink); font: 800 22px var(--display); text-transform: uppercase; letter-spacing: .06em; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }

/* ---------- Secret / cover ---------- */
.secret { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 14px; }
.secret-head { display: grid; justify-items: center; gap: 8px; text-align: center; padding-top: 6px; }
.secret-head h2 { margin: 0; font: 900 38px/.95 var(--display); text-transform: uppercase; text-wrap: balance; }
.secret-head p { margin: 0; color: var(--muted); max-width: 34ch; }
.secret .entry { margin-top: auto; padding: 10px 0 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--tag); color: var(--tag-ink); font: 800 15px/1.2 var(--display); text-transform: uppercase; letter-spacing: .06em; }
.chip.c1 { background: var(--tag2); }

.cover { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px 0; }
.cover-in { display: grid; justify-items: center; gap: 16px; max-width: 330px; }
.cover h2 { margin: 0; font: 900 44px/.95 var(--display); text-transform: uppercase; text-wrap: balance; }
.cover p { margin: 0; color: var(--muted); }
.cover .phone { width: 86px; height: 86px; display: grid; place-items: center; border-radius: 24px; background: var(--surface-2); color: var(--cow); }
.cover .phone svg { width: 46px; height: 46px; animation: handoff 1.8s ease-in-out infinite; }

/* ---------- Game ---------- */
.game { gap: 8px; }
.players { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.pchip { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.pchip.right { flex-direction: row-reverse; text-align: right; }
.pchip .tag { --w: 22px; box-shadow: none; --hole: var(--surface); }
.pchip .pc-text { min-width: 0; }
.pchip .pname { display: block; font: 800 18px/1.05 var(--display); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .psub { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.pchip.right .psub { justify-content: flex-end; }
.pchip.turn { border-color: var(--tag); box-shadow: 0 0 0 1px var(--tag), 0 8px 22px -12px rgba(243, 195, 50, .7); }
.pchip.turn.c1 { border-color: var(--tag2); box-shadow: 0 0 0 1px var(--tag2), 0 8px 22px -12px rgba(255, 154, 90, .7); }
.sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.sdot.off { background: var(--muted); opacity: .6; }
.vs { font: 800 15px var(--display); text-transform: uppercase; color: var(--muted); }

.mysecret { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; color: var(--muted); }
.mysecret .tags-row { gap: 4px; }
.mysecret .tag { --hole: var(--bg); }
.dots { letter-spacing: .3em; color: var(--ink); font-weight: 700; }

.boards { flex: 1; min-height: 120px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; overflow-y: auto; padding-bottom: 4px; --tw: 24px; }
.boards[data-n="3"] { --tw: 28px; }
.boards[data-n="5"] { --tw: 20px; }
.board { --hole: var(--surface); min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); align-self: start; }
.board-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 7px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.board-head .bh-name { flex: 1; min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-head .bh-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--tag); flex: none; }
.board.c1 .bh-dot { background: var(--tag2); }
.rows { list-style: none; margin: 0; padding: 0; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 2px; border-bottom: 1px dashed var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow.win { background: linear-gradient(90deg, rgba(243, 195, 50, .2), transparent); border-radius: 8px; }
.mtags { display: flex; gap: 3px; }
.sc { display: grid; gap: 2px; justify-items: end; font: 800 15px/1 var(--display); font-variant-numeric: tabular-nums; }
.sc > span { display: flex; align-items: center; gap: 2px; }
.sc svg { width: 13px; height: 13px; }
.sc .sb { color: var(--tag); }
.sc .scw { color: var(--cow); }
.sc .pending { color: var(--muted); animation: pulse 1s infinite; }
.mrow.fresh .sc, .drow.fresh .pips { animation: pop .45s cubic-bezier(.2, .9, .3, 1.4); }
.empty { padding: 18px 4px; text-align: center; font-size: 13px; color: var(--muted); }

.dock { flex: none; display: grid; gap: 8px; padding: 6px 0 12px; }
.turn { margin: 0; text-align: center; font: 800 22px/1.05 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.turn small { display: block; margin-top: 3px; font: 500 13px/1.3 var(--body); text-transform: none; letter-spacing: 0; color: var(--muted); }
.turn.t0 { color: var(--tag); }
.turn.t1 { color: var(--tag2); }
.turn.wait { color: var(--muted); }
.turn.alert { color: var(--alert); }
.dock .entry { --ew: 50px; }
.waiting { display: grid; justify-items: center; align-content: center; gap: 14px; min-height: 168px; color: var(--muted); text-align: center; font-size: 14px; }
.waiting .tags-row .tag { --hole: var(--bg); }
.show-result { justify-self: center; }

/* ---------- Result sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgba(4, 10, 8, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .2s ease; }
.sheet { width: 100%; max-width: 480px; max-height: 92%; overflow-y: auto; display: grid; gap: 14px; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0; background: var(--surface); text-align: center; animation: rise .38s cubic-bezier(.2, .9, .3, 1); --hole: var(--surface-2); }
.res-kicker { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.res-title { margin: 0; font: 900 clamp(44px, 13vw, 60px)/.88 var(--display); text-transform: uppercase; text-wrap: balance; }
.res-title.win { color: var(--tag); }
.res-title.lose { color: var(--tag2); }
.res-title.draw { color: var(--cow); }
.res-sub { margin: 0; color: var(--muted); }
.reveal { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reveal > div { display: grid; justify-items: center; gap: 8px; padding: 12px 6px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.reveal .field-label { font-size: 11px; }
.reveal .tags-row { gap: 4px; }
.badge { justify-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge svg { width: 14px; height: 14px; }
.badge.ok { background: rgba(127, 214, 155, .14); color: var(--good); }
.badge.bad { background: rgba(255, 132, 102, .14); color: var(--alert); }
.badge.wait { background: var(--surface-2); color: var(--muted); }
.sheet-actions { display: grid; gap: 8px; }
.sheet-actions .two { gap: 8px; }
.ad-slot { min-height: 0; }
.ad-slot:empty { display: none; }

/* ---------- Online lobby / join ---------- */
.code-card { display: grid; justify-items: center; gap: 12px; padding: 22px 14px; border: 1.5px dashed rgba(243, 195, 50, .6); border-radius: 20px; background: rgba(243, 195, 50, .05); text-align: center; }
.room-code { display: flex; gap: 6px; }
.room-code span { width: 42px; height: 54px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font: 900 34px var(--display); color: var(--tag); }
.wait-dots { display: flex; gap: 6px; }
.wait-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--tag); animation: pulse 1.2s infinite; }
.wait-dots i:nth-child(2) { animation-delay: .2s; } .wait-dots i:nth-child(3) { animation-delay: .4s; }
.share-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.share-grid .btn { flex-direction: column; gap: 4px; min-height: 64px; font-size: 13px; }
.share-grid .btn svg { width: 20px; height: 20px; }
.link-text { margin: 0; font-size: 13px; color: var(--muted); word-break: break-all; text-align: center; }
.small { font-size: 13px; }
.muted { color: var(--muted); }

.join { text-align: center; }
.join .tags-row { justify-content: center; }
.join h2 { margin: 0; font: 900 46px/.92 var(--display); text-transform: uppercase; text-wrap: balance; }
.join h2 .from { color: var(--tag); }
.mini-rules { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--surface); text-align: left; font-size: 15px; }
.mini-rules div { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: center; }
.mini-rules svg { width: 22px; height: 22px; }
.mini-rules .ib { color: var(--tag); } .mini-rules .ic { color: var(--cow); }

/* ---------- How to play ---------- */
.how { display: grid; gap: 18px; padding: 4px 0 28px; }
.video-frame { width: min(100%, calc(min(58vh, 560px) * 9 / 16)); aspect-ratio: 9 / 16; margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: #0a1511; }
.video-frame video { width: 100%; height: 100%; display: block; object-fit: cover; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; }
.step-n { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-2); font: 800 19px var(--display); }
.step-n svg { width: 22px; height: 22px; }
.step-n.ib { color: var(--tag); } .step-n.ic { color: var(--cow); }
.steps b { font-weight: 700; }
.example { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--surface); --hole: var(--surface); }
.example .ex-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.example .ex-row .tags-row { gap: 5px; }
.example p { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- Daily ---------- */
.daily { gap: 10px; }
.daily .lead { font-size: 14px; }
.drows { flex: 1; min-height: 120px; overflow-y: auto; list-style: none; margin: 0; padding: 0; --hole: var(--bg); }
.drow { display: grid; grid-template-columns: 26px auto 1fr; align-items: center; gap: 12px; padding: 8px 2px; border-bottom: 1px dashed var(--line); }
.drow.win { background: linear-gradient(90deg, rgba(243, 195, 50, .16), transparent); border-radius: 10px; }
.drow .idx { font: 800 18px var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.pips { justify-self: end; display: flex; gap: 3px; }
.pip { width: 20px; height: 20px; display: grid; place-items: center; }
.pip svg { width: 20px; height: 20px; }
.pip.bull { color: var(--tag); }
.pip.cow { color: var(--cow); }
.pip.none::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.done-card { display: grid; gap: 12px; padding: 16px; border-radius: 18px; background: var(--surface); text-align: center; }
.done-card h3 { margin: 0; font: 900 40px/.9 var(--display); text-transform: uppercase; color: var(--tag); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats div { display: grid; gap: 2px; }
.mini-stats b { font: 900 28px/1 var(--display); font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* ---------- Stats ---------- */
.stat-block { display: grid; gap: 10px; }
.stat-block h2 { margin: 0; font: 800 22px var(--display); text-transform: uppercase; letter-spacing: .05em; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { display: grid; gap: 2px; padding: 12px 6px; border-radius: 14px; background: var(--surface); text-align: center; }
.stat b { font: 900 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.stat-table th, .stat-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; }
.stat-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }

/* ---------- Overlays ---------- */
#toast { position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 60; padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; z-index: 50; width: 100%; height: 100%; pointer-events: none; }

/* ---------- Motion ---------- */
@keyframes blink { 50% { border-color: var(--line); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
@keyframes handoff { 0%, 100% { transform: translateX(-10px) rotate(-8deg); } 50% { transform: translateX(10px) rotate(8deg); } }
@keyframes stamp { from { transform: scale(1.8); opacity: 0; } 70% { transform: scale(.94); opacity: 1; } to { transform: scale(1); } }
.stamp { animation: stamp .42s cubic-bezier(.2, .9, .3, 1.2) both; }

@media (max-width: 370px) {
  .boards[data-n="4"] { --tw: 21px; }
  .boards[data-n="5"] { --tw: 17px; }
  .key { min-height: 48px; }
  .dock .entry { --ew: 44px; }
  .room-code span { width: 36px; }
}
@media (min-height: 820px) {
  .key { min-height: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.tag.sm::before, .tag.xs::before { top: calc(var(--w) * .07); width: calc(var(--w) * .12); height: calc(var(--w) * .12); margin-left: calc(var(--w) * -.06); }
.tag.sm, .tag.xs { padding-top: calc(var(--w) * .3); }

/* ---------- How-to card (before the first guess) ---------- */
.rules-card { grid-column: 1 / -1; align-self: start; display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); --hole: var(--surface); font-size: 14px; line-height: 1.35; text-align: left; }
.rc-title { margin: 0; font: 800 18px var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--tag); }
.rc-step { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.rc-n { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); font: 800 15px var(--display); }
.rc-key { display: grid; gap: 4px; margin-top: 6px; }
.rc-key span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.rc-key b { color: var(--ink); }
.rc-key svg { width: 18px; height: 18px; flex: none; }
.rc-key .ib svg, .legend .ib svg { color: var(--tag); }
.rc-key .ic svg, .legend .ic svg { color: var(--cow); }
.rc-ex { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); --hole: var(--surface-2); }
.rc-lab { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.ex-row { display: flex; gap: 6px; }
.ex-col { width: 34px; display: grid; justify-items: center; gap: 4px; }
.tag.ex { --w: 30px; box-shadow: none; }
.tag.ex.m-bull { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--tag); }
.tag.ex.m-cow { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--cow); }
.tag.ex.m-miss { opacity: .4; }
.ex-mark { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.ex-mark.bull { color: var(--tag); } .ex-mark.cow { color: var(--cow); } .ex-mark.miss { color: var(--muted); }
.rc-sum { margin: 0; color: var(--muted); }
.rc-sum .yb { color: var(--tag); } .rc-sum .yc { color: var(--cow); }
.legend { flex: none; display: flex; justify-content: center; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend svg { width: 14px; height: 14px; }
.drows > li.rc-li { list-style: none; padding: 4px 0; }
.sheet .rules-card { border: 0; padding: 0; background: none; --hole: var(--surface); }
.sheet .rules-card .rc-ex { --hole: var(--surface-2); }
.legend { flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 11px; }
.how-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border: 1px solid var(--tag); border-radius: 999px; background: rgba(243, 195, 50, .1); color: var(--tag); font-size: 12px; font-weight: 700; }
.how-pill svg { width: 14px; height: 14px; }
.how-pill:hover { background: rgba(243, 195, 50, .18); }

/* ---------- Animal icons (full-body, 4:3) ---------- */
svg.ani { width: auto !important; aspect-ratio: 4 / 3; }
.sc svg.ani { height: 16px; }
.sc > span { gap: 3px; }
.pip { width: auto; min-width: 26px; height: 22px; }
.pip svg.ani { height: 20px; }
.rc-key svg.ani, .mini-rules svg.ani { height: 18px; }
.legend svg.ani { height: 14px; }
.step-n svg.ani { height: 18px; }

/* ---------- Digit tracker ---------- */
.tracker { display: grid; gap: 5px; }
.tr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 11px; color: var(--muted); }
.tr-head > span:first-child { font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.tr-hint b.x { color: var(--alert); } .tr-hint b.v { color: var(--good); }
.tr-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.tr-d { position: relative; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: 800 21px var(--display); padding: 0; }
.tr-d:hover { border-color: var(--muted); }
.tr-d.t-x { color: var(--muted); background: rgba(255, 132, 102, .1); border-color: rgba(255, 132, 102, .55); }
.tr-d.t-x::before { content: ""; position: absolute; left: 22%; right: 22%; top: 50%; height: 2.5px; background: var(--alert); transform: rotate(-35deg); border-radius: 2px; }
.tr-d.t-v { color: var(--good); background: rgba(127, 214, 155, .12); border-color: var(--good); }
.tr-d::after { position: absolute; top: 1px; right: 3px; font: 700 10px var(--body); }
.tr-d.t-x::after { content: "\2715"; color: var(--alert); }
.tr-d.t-v::after { content: "\2713"; color: var(--good); }

/* keypad + boards mirror the tracker */
.key.n-out { color: var(--muted); text-decoration: none; background: rgba(255, 132, 102, .08); }
.key.n-out::before { content: ""; position: absolute; left: 30%; right: 30%; top: 50%; height: 3px; background: var(--alert); transform: rotate(-35deg); border-radius: 2px; opacity: .9; }
.key.n-in::after { content: "\2713"; position: absolute; inset: auto 6px auto auto; top: 3px; border: 0; font: 700 12px var(--body); color: var(--good); opacity: 1; }
.key.n-in { border-color: var(--good); }
.tag.n-in { outline: 2px solid var(--good); outline-offset: 1px; }
.key-actions.two { grid-template-columns: 1fr 1.6fr; }

/* tighter dock so the tracker fits */
.dock { gap: 7px; }
.dock .entry { --ew: 44px; }
.key { min-height: 48px; }
.waiting { min-height: 110px; }

/* app bar fits three icons */
.appbar { grid-template-columns: auto 1fr auto; }
.icon-btn { width: 40px; }
.bar-title { max-width: none; font-size: 20px; }
@media (max-width: 370px) { .tr-d { height: 34px; font-size: 18px; } .tr-hint { display: none; } }
.mode-row.soon b, .mode-row.soon .mr-icon { opacity: .6; }
.soon-tag { padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.mode-row.soon { grid-template-columns: 44px 1fr auto; }
