/* Catdoku companion. Layout: one centred column, max 620px: wordmark, tabs, the board as large as the screen allows,
   then status, hint and result cards, then the book panel. Colours come from the book cover: cream paper, teal CAT,
   pink DOKU, yellow subtitle, black cat. Rooms read by colour AND by shape: a wider gutter separates rooms. */
:root {
  --paper: #fbf6ea; --sheet: #ffffff; --ink: #1c1a15; --ink2: #5b564b; --muted: #8a8475; --line: rgba(28, 26, 21, .12);
  --teal: #12a497; --pink: #ff2e7e; --yellow: #ffd23f; --bad: #e5313b; --chip: #f1ebdc; --shadow: 0 1px 0 rgba(28,26,21,.06), 0 10px 30px rgba(28,26,21,.08);
  --footer: #1c1a15; --footer-ink: #f3eee2;
  --wall: #24211b; --gridline: rgba(36, 33, 27, .2); --xmark: rgba(36, 33, 27, .72);
  --ease: cubic-bezier(.22, 1, .36, 1); --spring: cubic-bezier(.2, 1.6, .35, 1);
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
/* Light by default (Max 2026-10-15: "light mode"); dark only when the player turns it on in Settings (.cd-dark on <html>).
   The host page's theme and the device setting are ignored on purpose. */
:root.cd-dark { --paper: #15130e; --sheet: #211e17; --ink: #f3eee2; --ink2: #bdb6a6; --muted: #8f8879; --line: rgba(243,238,226,.14);
  --teal: #2fc6b8; --chip: #2b271e; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35); --footer: #0d0c09; --wall: #0d0c09; --gridline: rgba(0, 0, 0, .28); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 700; }
.skip-link:focus { top: 8px; }

/* ---------- site header (Tiny Gambit imprint) ---------- */
.cd-site { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 980px; margin: 0 auto; padding-inline: 16px; padding-block: 14px 0; }
.cd-imprint { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.cd-imprint img { width: 30px; height: 30px; }
.cd-imprint span { display: grid; line-height: 1.1; }
.cd-imprint strong { font-family: "Black Ops One", var(--font); font-weight: 400; font-size: 1rem; letter-spacing: .3px; white-space: nowrap; }
.cd-imprint small { font-size: .74rem; color: var(--ink2); }
.cd-site-nav { display: flex; align-items: center; gap: 6px; }
.cd-site nav a { font-size: .9rem; font-weight: 700; text-decoration: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); white-space: nowrap; }
.cd-site nav a:hover { border-color: var(--ink); }
:root.cd-dark .cd-imprint img { filter: invert(1); }

/* ---------- hero ---------- */
main { max-width: 640px; margin: 0 auto; padding-inline: 16px; padding-block: 8px 56px; display: grid; gap: 18px; }
.cd-hero { display: grid; justify-items: center; gap: 10px; padding-top: 6px; text-align: center; }
.cd-wordmark { margin: 0; width: min(360px, 78vw); }
.cd-wordmark img { width: 100%; height: auto; }
.cd-tag { margin: 0; color: var(--ink2); font-weight: 600; max-width: 34ch; text-wrap: balance; }
.cd-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.cd-seg { display: inline-flex; background: var(--chip); border-radius: 999px; padding: 4px; gap: 2px; }
.cd-seg a { font-weight: 800; font-size: .95rem; text-decoration: none; padding: 8px 15px; border-radius: 999px; color: var(--ink2); transition: background .16s, color .16s; white-space: nowrap; }
.cd-seg a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.cd-icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.cd-icon-btn:hover { border-color: var(--ink); }
.cd-ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- views ---------- */
.cd-app { min-height: 520px; }
.cd-view { display: grid; gap: 16px; transition: opacity .28s var(--ease), transform .28s var(--ease); }
.cd-view.enter { opacity: 0; transform: translateY(8px); }
.cd-error { text-align: center; color: var(--bad); font-weight: 700; padding: 40px 0; }
.cd-loading { display: grid; place-items: center; min-height: 420px; }
.cd-loading span { width: min(560px, 100%); aspect-ratio: 1; border-radius: 18px; background: linear-gradient(110deg, var(--chip) 30%, var(--sheet) 50%, var(--chip) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- game screen: the hero steps aside, a slim bar sits over the board ---------- */
body.cd-game .cd-hero { display: none; }
body.cd-game main { padding-top: 4px; gap: 10px; }
/* bar, board, hint, buttons and result share one width; the board gives up width before height (short phones, landscape) */
.cd-play { display: grid; gap: 12px; justify-items: center; --bw: min(100%, 560px); }
@supports (height: 100svh) { .cd-play { --bw: min(100%, 560px, max(280px, calc(100svh - 262px))); } }
.cd-play > * { width: var(--bw); }
.cd-gamebar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 52px; }
.cd-gamebar .cd-back { font-size: .92rem; }
.cd-gt { display: grid; text-align: center; line-height: 1.15; min-width: 0; }
.cd-title { font-weight: 900; font-size: 1.12rem; }
.cd-gt small { font-size: .78rem; font-weight: 700; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-meta { display: grid; justify-items: end; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; min-width: 64px; }
.cd-meta > * { transform-origin: 100% 50%; }
.cd-timer { font-size: 1.3rem; transition: color .3s; }
.cd-timer.done { color: var(--teal); animation: bump .45s var(--spring); }
.cd-timer.hurry { color: var(--bad); animation: hurry 1s ease-in-out infinite; }
@keyframes hurry { 50% { transform: scale(1.12); } }
.cd-count.bump { animation: bump .35s var(--spring); }
@keyframes bump { 40% { transform: scale(1.22); } }
.cd-count { font-size: .76rem; color: var(--ink2); }
.cd-under { display: flex; justify-content: center; }
.cd-btn-quiet { border-color: transparent; background: transparent; color: var(--ink2); }

/* ---------- board: identical square cells, rooms by colour and by a thick wall (drawn as an SVG over the cells) ---------- */
.cd-board-host { display: grid; justify-items: center; }
.cd-board { position: relative; width: var(--bw, min(100%, 560px)); aspect-ratio: 1; max-width: 100%; display: grid;
  grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  border: 3px solid var(--wall); border-radius: 12px; overflow: hidden; background: var(--wall); box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cd-row { display: contents; }
.cd-cell { position: relative; cursor: pointer; outline: none; }
.cd-tile { position: absolute; inset: 0; background: var(--tile); transition: filter .2s, opacity .2s; }
.cd-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.cd-lines path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: square; }
.cd-lines .thin { stroke: var(--gridline); stroke-width: 1; }
.cd-lines .thick { stroke: var(--wall); stroke-width: 3; }
.cd-board:not([data-pointer]) .cd-cell:focus-visible .cd-tile { box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 5px #fff; z-index: 1; }
@media (hover: hover) { .cd-cell:hover .cd-tile { filter: brightness(1.05); } }
.cd-mark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 1; }
.cd-cell[data-v="1"] .cd-mark::before, .cd-cell[data-v="1"] .cd-mark::after {
  content: ""; position: absolute; width: 9%; height: 40%; border-radius: 99px; background: var(--xmark); transform: rotate(45deg); animation: xin .26s cubic-bezier(.2, 1.7, .4, 1) var(--xd, 0ms) both; }
.cd-cell[data-v="1"] .cd-mark::after { transform: rotate(-45deg); }
.cd-cell.auto .cd-mark::before, .cd-cell.auto .cd-mark::after { opacity: .45; }
@keyframes xin { from { opacity: 0; scale: .2; } 60% { opacity: 1; scale: 1.25; } }
.cd-mark img { width: 80%; height: 80%; object-fit: contain; filter: drop-shadow(0 1.5px 1.5px rgba(0,0,0,.2)); }
.cd-cell.pop .cd-mark img { animation: catpop .46s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes catpop { from { transform: scale(.15) rotate(-18deg); } 55% { transform: scale(1.18) rotate(4deg); } }
/* a white ring ripples out of the square when a cat lands */
.cd-cell.pop::after { content: ""; position: absolute; inset: 12%; border-radius: 50%; border: 3px solid rgba(255,255,255,.95); z-index: 3; pointer-events: none; animation: ringout .55s ease-out forwards; }
@keyframes ringout { from { transform: scale(.35); opacity: 1; } to { transform: scale(1.75); opacity: 0; } }
/* a tap flashes the square */
.cd-cell.press .cd-tile { filter: brightness(.88); transition: filter 0s; }
/* Room patterns (Settings): a second cue beside colour, for players who cannot tell two rooms apart */
.cd-patterns .cd-cell:not(.bad):not(.void) .cd-tile { --p: rgba(20, 18, 40, .16); }
.cd-patterns .cd-cell[data-k="1"]:not(.bad):not(.void) .cd-tile { background-image: repeating-linear-gradient(45deg, var(--p) 0 3px, transparent 3px 9px); }
.cd-patterns .cd-cell[data-k="2"]:not(.bad):not(.void) .cd-tile { background-image: radial-gradient(var(--p) 26%, transparent 29%); background-size: 9px 9px; }
.cd-patterns .cd-cell[data-k="3"]:not(.bad):not(.void) .cd-tile { background-image: repeating-linear-gradient(0deg, var(--p) 0 3px, transparent 3px 9px); }
.cd-patterns .cd-cell[data-k="4"]:not(.bad):not(.void) .cd-tile { background-image: repeating-linear-gradient(-45deg, var(--p) 0 3px, transparent 3px 9px); }
.cd-patterns .cd-cell[data-k="5"]:not(.bad):not(.void) .cd-tile { background-image: repeating-linear-gradient(90deg, var(--p) 0 3px, transparent 3px 9px); }
.cd-patterns .cd-cell[data-k="6"]:not(.bad):not(.void) .cd-tile { background-image: conic-gradient(var(--p) 25%, transparent 0 50%, var(--p) 0 75%, transparent 0); background-size: 12px 12px; }
.cd-patterns .cd-cell[data-k="7"]:not(.bad):not(.void) .cd-tile { background-image: radial-gradient(circle at 50% 50%, transparent 30%, var(--p) 32% 44%, transparent 46%); background-size: 14px 14px; }
.cd-patterns .cd-cell[data-k="8"]:not(.bad):not(.void) .cd-tile { background-image: repeating-linear-gradient(45deg, var(--p) 0 2px, transparent 2px 8px), repeating-linear-gradient(-45deg, var(--p) 0 2px, transparent 2px 8px); }
.cd-patterns .cd-cell[data-k="9"]:not(.bad):not(.void) .cd-tile { background-image: linear-gradient(var(--p) 2px, transparent 2px), linear-gradient(90deg, var(--p) 2px, transparent 2px); background-size: 9px 9px; }
/* a broken rule: red stripes on the cells involved (cats that clash, or a row, column or room crossed out completely) */
.cd-cell.bad .cd-tile, .cd-cell.void .cd-tile { background-image: repeating-linear-gradient(45deg, rgba(229,49,59,.5) 0 4px, transparent 4px 9px); }
.cd-cell.bad .cd-mark img { animation: shake .32s; }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
/* hints (LinkedIn-style): the cells to act on get dark stripes, the cells that explain why stay bright, the rest wash out to white */
.cd-tile::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; transition: opacity .2s; pointer-events: none; }
.cd-cell.dim .cd-tile::after { opacity: .62; }
.cd-cell.hl-target .cd-tile { background-image: repeating-linear-gradient(45deg, rgba(36,33,27,.34) 0 3px, transparent 3px 8px) !important; animation: hintpulse 1.2s ease-in-out infinite; }
@keyframes hintpulse { 50% { filter: brightness(1.12); } }
.cd-board.won .cd-cell { cursor: default; }
.cd-board.timeup .cd-tile { filter: saturate(.3); } .cd-board.timeup .cd-tile::after { opacity: .5; }
.cd-cell.wave .cd-tile { animation: glow .6s var(--d, 0ms) var(--ease) both; }
@keyframes glow { 45% { filter: brightness(1.18) saturate(1.25); } }
/* the win: every cat hops, in a wave across the board, and the board gives a little bounce */
.cd-board.cheer .cd-mark img { animation: hop .6s var(--d, 0ms) cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes hop { 40% { transform: translateY(-30%) scale(1.15) rotate(-6deg); } 70% { transform: translateY(4%) scale(.96); } }
.cd-board.cheer { animation: boardpop .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes boardpop { 30% { transform: scale(1.025); } }
/* speed round: each solve floats a +1 */
.cd-board-host { position: relative; }
.cd-plus { position: absolute; left: 50%; top: 40%; z-index: 5; font-weight: 900; font-size: 3rem; color: var(--teal); text-shadow: 0 2px 0 var(--sheet), 0 6px 16px rgba(0,0,0,.18); pointer-events: none; animation: plus .9s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes plus { from { opacity: 0; transform: translate(-50%, 20%) scale(.5); } 30% { opacity: 1; transform: translate(-50%, -10%) scale(1.15); } to { opacity: 0; transform: translate(-50%, -90%) scale(1); } }

/* ---------- the three rules, live ---------- */
.cd-rulechips { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.cd-rule { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 800; color: var(--ink2); background: var(--chip); padding: 5px 10px 5px 8px; border-radius: 999px; transition: background .2s, color .2s; }
.cd-rule i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .5; }
.cd-rule.ok { background: color-mix(in srgb, var(--teal) 16%, var(--sheet)); color: var(--teal); }
.cd-rule.ok i { background: var(--teal); opacity: 1; }
.cd-rule.pop { animation: chippop .5s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes chippop { 40% { transform: scale(1.18); } }
.cd-rule.bad { background: color-mix(in srgb, var(--bad) 14%, var(--sheet)); color: var(--bad); animation: shake .32s; }
.cd-rule.bad i { background: var(--bad); opacity: 1; }

/* ---------- actions ---------- */
.cd-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.cd-actions .cd-btn { justify-content: center; min-height: 50px; padding: 0 10px; }
.cd-btn { font: inherit; font-weight: 800; font-size: .95rem; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 16px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--sheet); color: var(--ink); cursor: pointer; text-decoration: none; transition: transform .12s, border-color .15s, background .15s; }
.cd-btn:hover { border-color: var(--ink); }
.cd-btn:active { transform: scale(.94); transition: transform .06s; }
.cd-btn:disabled { opacity: .45; cursor: not-allowed; }
.cd-btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cd-btn-hint { border-color: color-mix(in srgb, var(--yellow) 70%, var(--line)); }
.cd-btn-big { font-size: 1.1rem; min-height: 54px; padding: 0 34px; border-radius: 18px; }

/* ---------- hint ---------- */
.cd-hint { background: var(--sheet); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; border-left: 6px solid var(--yellow); animation: rise .24s var(--ease); }
.cd-hint-head { display: flex; align-items: center; gap: 8px; }
.cd-hint-head strong { font-size: 1.05rem; }
.cd-hint p { margin: 6px 0 10px; color: var(--ink2); }
.cd-hint-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cd-chip { display: inline-block; font-size: .76rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--ink2); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---------- result ---------- */
.cd-result-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; background: var(--sheet); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; animation: cardin .55s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes cardin { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.cd-result-cat { animation: wobble 1.2s .3s ease-in-out; transform-origin: 50% 90%; }
@keyframes wobble { 20% { transform: rotate(-10deg); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
.cd-result-cat { width: 64px; height: 64px; object-fit: contain; }
.cd-result-title { font-size: 1.3rem; font-weight: 900; }
.cd-result-line { margin: 2px 0 0; color: var(--ink2); font-weight: 700; font-variant-numeric: tabular-nums; }
.cd-result-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cd-next { font-size: .88rem; font-weight: 700; color: var(--ink2); }

/* ---------- streak and archive ---------- */
.cd-streak { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--sheet); border-radius: 16px; box-shadow: var(--shadow); text-align: center; }
.cd-streak div { padding: 12px 6px; display: grid; }
.cd-streak div + div { border-left: 1px solid var(--line); }
.cd-streak b { font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cd-streak span { font-size: .78rem; color: var(--ink2); font-weight: 700; }
/* ---------- daily hub: three a day ---------- */
.cd-section-head h2 { font-size: 1.15rem; margin: 0 0 6px; }
.cd-today { background: var(--sheet); border-radius: 24px; box-shadow: var(--shadow); padding: 18px 16px 16px; display: grid; gap: 14px; }
.cd-today-head { text-align: center; }
.cd-today-head h2 { margin: 0; font-size: 1.6rem; font-weight: 900; letter-spacing: -.01em; }
.cd-today-head p { margin: 0; color: var(--ink2); font-weight: 700; }
.cd-today-head .cd-eyebrow { margin-bottom: 2px; }
.cd-sizes { display: grid; gap: 10px; }
.cd-size { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; border-radius: 18px; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); transition: transform .14s var(--ease), border-color .15s; min-height: 78px; }
.cd-size:hover { border-color: var(--ink); }
.cd-size:active { transform: scale(.985); }
.cd-size.done { border-color: color-mix(in srgb, var(--teal) 60%, var(--line)); }
.cd-size-t { display: grid; line-height: 1.2; }
.cd-size-t strong { font-size: 1.12rem; font-weight: 900; }
.cd-size-t small { color: var(--ink2); font-weight: 700; font-size: .84rem; }
.cd-size-s { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; font-variant-numeric: tabular-nums; padding: 8px 12px; border-radius: 999px; background: var(--chip); color: var(--ink); font-size: .92rem; }
.cd-size-s.go { background: var(--ink); color: var(--paper); padding-left: 14px; }
.cd-size-s.done { background: color-mix(in srgb, var(--teal) 16%, var(--sheet)); color: var(--teal); }
.cd-size-s .cd-ic { width: 17px; height: 17px; }
.cd-size-s.go .cd-ic { fill: currentColor; stroke: none; }
.cd-thumb { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: 58px; aspect-ratio: 1; border: 2px solid var(--wall); border-radius: 8px; overflow: hidden; background: var(--wall); }
.cd-thumb i { background: var(--tile); display: grid; place-items: center; box-shadow: inset 0 0 0 .5px var(--gridline); }
.cd-thumb i.c::after { content: ""; width: 62%; aspect-ratio: 1; border-radius: 50%; background: #1c1a15; }
.cd-today-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 800; color: var(--ink2); font-size: .9rem; }
.cd-progress { display: inline-flex; align-items: center; gap: 5px; }
.cd-progress i { width: 10px; height: 10px; border-radius: 50%; background: var(--chip); box-shadow: inset 0 0 0 1.5px var(--line); }
.cd-progress i.on { background: var(--teal); box-shadow: none; }
.cd-progress b { margin-left: 4px; }
.cd-countdown b { font-variant-numeric: tabular-nums; color: var(--ink); }
.cd-share { justify-self: stretch; justify-content: center; min-height: 50px; }
.cd-link-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--sheet); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.cd-link-card span { display: grid; line-height: 1.25; } .cd-link-card small { color: var(--ink2); font-weight: 700; }
.cd-link-card > .cd-ic:first-child { color: var(--pink); width: 24px; height: 24px; }

/* ---------- past days ---------- */
.cd-month h3 { margin: 6px 0 8px; font-size: 1rem; }
.cd-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cd-wk { text-align: center; font-size: .72rem; font-weight: 800; color: var(--muted); }
.cd-calday { display: grid; justify-items: center; gap: 4px; padding: 8px 0 7px; border-radius: 12px; background: var(--sheet); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.cd-calday b { font-size: .95rem; line-height: 1; }
.cd-calday.today { border-color: var(--ink); }
.cd-calday.full { background: color-mix(in srgb, var(--teal) 14%, var(--sheet)); border-color: color-mix(in srgb, var(--teal) 55%, var(--line)); }
.cd-calmarks { display: flex; gap: 3px; }
.cd-calmarks i { width: 6px; height: 6px; border-radius: 50%; background: var(--chip); box-shadow: inset 0 0 0 1px var(--line); }
.cd-calmarks i.on { background: var(--teal); box-shadow: none; }

/* ---------- practice and bonus ---------- */
.cd-practice { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cd-psize, .cd-bonus { display: grid; justify-items: center; gap: 6px; padding: 14px 10px; border-radius: 18px; background: var(--sheet); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); text-align: center; transition: transform .14s var(--ease); }
.cd-psize:hover, .cd-bonus:hover { transform: translateY(-2px); }
.cd-psize .cd-thumb { width: 84px; }
.cd-psize strong { font-size: 1.2rem; font-weight: 900; }
.cd-psize small { color: var(--ink2); font-weight: 700; }
.cd-bonus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.cd-bonus { padding: 10px 8px; }
.cd-bonus .cd-thumb { width: 72px; }
.cd-bonus.done { box-shadow: var(--shadow), inset 0 0 0 2px var(--teal); }
.cd-section-head .cd-btn { margin-top: 4px; }

/* ---------- ranks ---------- */
.cd-section-head { text-align: center; }
.cd-section-head p { margin: 0 0 10px; color: var(--ink2); }
.cd-ranks { display: grid; gap: 10px; }
.cd-rank { text-decoration: none; text-align: left; font: inherit; color: var(--ink); background: var(--sheet); border: 0; border-left: 7px solid var(--accent); border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px 16px; display: grid; gap: 3px; cursor: pointer; transition: transform .14s var(--ease); }
.cd-rank:hover { transform: translateY(-2px); }
.cd-rank strong { font-size: 1.2rem; font-weight: 900; }
.cd-rank span, .cd-rank small { color: var(--ink2); font-weight: 700; font-size: .86rem; }
.cd-rank-step { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem !important; }
.cd-rank-bar { display: block; height: 6px; border-radius: 99px; background: var(--chip); overflow: hidden; margin-top: 4px; }
.cd-rank-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.cd-back { justify-self: start; display: inline-flex; align-items: center; gap: 2px; font: inherit; font-weight: 800; color: var(--ink2); background: none; border: 0; cursor: pointer; padding: 10px 6px 10px 0; text-decoration: none; min-height: 44px; }
.cd-dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.cd-dot { display: inline-grid; place-items: center; text-decoration: none; width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--sheet); font: inherit; font-weight: 800; color: var(--ink2); cursor: pointer; }
.cd-dot.done { background: color-mix(in srgb, var(--teal) 18%, var(--sheet)); border-color: var(--teal); color: var(--ink); }
.cd-dot.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- beat the clock ---------- */
.cd-clock-intro { display: grid; justify-items: center; text-align: center; gap: 6px; background: var(--sheet); border-radius: 22px; box-shadow: var(--shadow); padding: 26px 18px; }
.cd-clock-intro h2 { margin: 6px 0 0; font-size: 1.5rem; font-weight: 900; }
.cd-clock-intro p { margin: 0; color: var(--ink2); max-width: 36ch; }
.cd-clock-face { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 1.6rem; font-variant-numeric: tabular-nums;
  background: conic-gradient(var(--pink) 0 75%, var(--yellow) 75%); color: var(--ink); position: relative; }
.cd-clock-face::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--sheet); }
.cd-clock-face { isolation: isolate; } .cd-clock-face::before { z-index: -1; }
.cd-best { font-weight: 800; color: var(--ink) !important; }
.cd-clock-run .cd-timer { color: var(--pink); font-size: 1.6rem; }

/* ---------- book panel ---------- */
.cd-book { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; background: var(--sheet); border-radius: 20px; box-shadow: var(--shadow); padding: 16px; margin-top: 8px; }
.cd-book img { width: 120px; height: auto; border-radius: 4px; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.cd-book h2 { margin: 0 0 4px; font-size: 1.1rem; line-height: 1.25; text-wrap: balance; }
.cd-book p { margin: 0 0 10px; color: var(--ink2); font-size: .92rem; }
.cd-eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .7rem !important; font-weight: 800; color: var(--pink) !important; margin-bottom: 2px !important; }
.cd-chip-soon { background: var(--yellow); color: #1c1a15; padding: 6px 12px; font-size: .84rem; }
@media (max-width: 420px) { .cd-book { grid-template-columns: 88px 1fr; } .cd-book img { width: 88px; } }

/* ---------- dialogs ---------- */
.cd-dialog { border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); background: var(--sheet); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.cd-dialog::backdrop { background: rgba(20, 18, 13, .55); backdrop-filter: blur(2px); }
.cd-dialog[open] { animation: rise .26s var(--ease); }
.cd-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 4px 20px; position: sticky; top: 0; background: var(--sheet); }
.cd-dialog-head h2 { margin: 0; font-size: 1.3rem; font-weight: 900; }
.cd-help, .cd-settings { padding: 4px 20px 20px; }
.cd-rules { margin: 6px 0 12px; padding-left: 22px; display: grid; gap: 4px; }
.cd-help-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cd-help figure { margin: 0; }
.cd-help figcaption { font-size: .82rem; color: var(--ink2); margin-top: 6px; }
.cd-help h3 { margin: 16px 0 6px; font-size: 1rem; }
.cd-controls { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .92rem; }
.cd-help-foot { font-size: .86rem; color: var(--ink2); margin: 12px 0 0; }
.cd-mini { display: grid; grid-template-columns: repeat(var(--n), 1fr); border: 2.5px solid var(--wall); border-radius: 10px; overflow: hidden; background: var(--wall); }
.cd-mini span { aspect-ratio: 1; background: var(--tile); display: grid; place-items: center; position: relative; box-shadow: inset 0 0 0 .5px var(--gridline); }
.cd-mini span img { width: 82%; }
.cd-mini span[data-v="1"]::before, .cd-mini span[data-v="1"]::after { content: ""; position: absolute; width: 10%; height: 42%; background: var(--xmark); border-radius: 9px; transform: rotate(45deg); }
.cd-mini span[data-v="1"]::after { transform: rotate(-45deg); }
.cd-switch { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.cd-switch input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--chip); position: relative; cursor: pointer; transition: background .18s; margin-top: 2px; }
.cd-switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--spring); }
.cd-switch input:checked { background: var(--teal); }
.cd-switch input:checked::after { transform: translateX(18px); }
.cd-switch span { display: grid; } .cd-switch small { color: var(--ink2); }

/* ---------- tap style ---------- */
.cd-settings h3 { margin: 14px 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cd-tap-lead { margin: 4px 0 10px; color: var(--ink2); }
.cd-taps { display: grid; gap: 8px; }
.cd-tapopt { display: grid; text-align: left; gap: 2px; font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px; padding: 11px 14px; cursor: pointer; }
.cd-tapopt small { color: var(--ink2); }
.cd-tapopt[aria-checked="true"] { border-color: var(--teal); box-shadow: inset 0 0 0 1.5px var(--teal); background: color-mix(in srgb, var(--teal) 8%, var(--sheet)); }

/* ---------- toast, confetti ---------- */
.cd-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 999px; font-weight: 800; pointer-events: none; transition: opacity .2s, transform .25s var(--ease); z-index: 60; }
.cd-toast.on { opacity: 1; transform: translate(-50%, 0); }
.cd-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 55; }
.cd-copy { position: fixed; left: -9999px; }

/* ---------- bonus route ---------- */
body.is-bonus .cd-tabs .cd-seg { display: none; }

/* ---------- footer ---------- */
.cd-footer { background: var(--footer); color: var(--footer-ink); }
.cd-footer-inner { max-width: 980px; margin: 0 auto; padding-inline: 16px; padding-block: 28px; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.cd-footer strong { font-family: "Black Ops One", var(--font); font-weight: 400; }
.cd-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.cd-footer a { color: inherit; text-decoration: none; font-size: .88rem; opacity: .85; }
.cd-footer a:hover { opacity: 1; }
.cd-footer p { width: 100%; margin: 0; font-size: .78rem; opacity: .6; }

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

@media (max-width: 420px) { .cd-imprint small { display: none; } .cd-site nav a { padding: 8px 12px; } .cd-seg a { padding: 8px 9px; font-size: .88rem; }
  /* Android's Roboto (and CI's DejaVu) run wider than SF Rounded: the tab bar pushed a 360px page 10-12px sideways.
     The cap is on the viewport, since the bar's parent grows with it */
  .cd-seg { max-width: calc(100vw - 32px); overflow-x: auto; scrollbar-width: none; }
  .cd-gamebar .cd-back span { display: none; } .cd-today { padding: 16px 12px 14px; } .cd-size { gap: 12px; } }
@media (max-width: 350px) { .cd-imprint span { display: none; } }   /* smallest phones: the pawn alone, so All books stays on one line */
/* tap targets stay fast: no double-tap zoom delay on controls */
.cd-btn, .cd-size, .cd-dot, .cd-calday, .cd-tapopt, .cd-back, .cd-seg a { touch-action: manipulation; }
