:root {
  --bg: #fbf7f1; --fg: #221a2e; --muted: #6f6479; --card: #fff; --line: #e6dccd;
  --accent: #8033bb; --orange: #ff8c1f; --maze-bg: #fffdf9; --wall: #3b5bdb; --wall-fill: #dfe3fb; --door: #ff8de0;
}
/* Dark palette (#68): from the OS unless the player forced Light, or forced Dark from the profile. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #14101c; --fg: #f3ecfa; --muted: #a99db8; --card: #211a2c; --line: #382e47;
    --accent: #b27ff0; --maze-bg: #08060d; --wall: #4f7cff; --wall-fill: #1b2250; }
}
:root[data-theme="dark"] { --bg: #14101c; --fg: #f3ecfa; --muted: #a99db8; --card: #211a2c; --line: #382e47;
  --accent: #b27ff0; --maze-bg: #08060d; --wall: #4f7cff; --wall-fill: #1b2250; color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
body.playing { overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; }
#app { max-width: 560px; margin: 0 auto; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }

/* Title */
.title { text-align: center; padding: 28px 0 24px; position: relative; }
/* #157: the "star the Bitol repos" banner. An overlay strip at the top of the home page: absolutely placed, so the
   page never moves when it fades in (as #123 did for the championship card). */
.star-banner { position: absolute; top: 8px; left: 0; right: 0; z-index: 5; display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border: 2px solid var(--accent); border-radius: 14px; background: var(--card); color: var(--fg);
  box-shadow: 0 6px 24px rgb(0 0 0 / .25); text-align: left; opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; }
.star-banner[hidden] { display: none; }
.star-banner.on { opacity: 1; transform: none; }
.star-text { flex: 1 1 auto; min-width: 0; }
.star-text p { margin: 2px 0 0; font-size: .92rem; }
.star-desc { color: var(--muted); }
.star-acts { flex: 0 0 auto; display: flex; gap: 6px; align-items: center; }
.star-go { display: inline-block; padding: 8px 12px; border-radius: 10px; background: var(--accent); color: var(--bg); font-weight: 700;
  text-decoration: none; white-space: nowrap; font-size: .92rem; }
.star-go:focus-visible, .star-close:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.star-close { min-width: 40px; min-height: 40px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
/* #262: the leaderboard's invite strip: the same look, but in the page flow (under the championship banner). */
.star-banner.board-inv { position: relative; top: auto; margin: 0 0 14px; }
@media (max-width: 430px) { .star-banner { flex-wrap: wrap; } .star-acts { width: 100%; justify-content: space-between; } }
.title h1 { font-size: 2.4rem; margin: 8px 0 0; letter-spacing: -.02em; }
.title .tag { color: var(--muted); margin: 4px 0 20px; }
.logo { width: 220px; max-width: 70%; height: auto; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 14px 0; text-align: left; }
.card p { margin: 6px 0 0; }
.legend .row { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.legend svg { flex: 0 0 34px; }
.legend small { display: block; color: var(--muted); }
/* #107: What you learned: a Learn more link per lesson, and Bitol and the repos at the end of the card. */
a.learnmore { color: var(--accent); font-weight: 600; white-space: nowrap; }
.learnlinks { color: var(--muted); font-size: .85rem; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.learnlinks a { color: var(--accent); }
#overlay .card a { color: var(--accent); font-weight: 600; } /* a link in a card's text, e.g. fact 27's AMA page (#120) */
.best { color: var(--muted); }

button { font: inherit; font-weight: 700; min-height: 52px; padding: 10px 22px; border-radius: 16px; border: 2px solid var(--accent);
  background: var(--accent); color: #fff; width: 100%; cursor: pointer; }
button.ghost { background: transparent; color: var(--accent); }
button:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
/* A link styled as a button (#102: the caught card's More, which opens a new tab). */
a.button { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; font-weight: 700; min-height: 52px;
  padding: 10px 22px; border-radius: 16px; border: 2px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; }
a.button.ghost { background: transparent; color: var(--accent); }
a.button:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.big { font-size: 1.3rem; }

/* Game */
#game { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100dvh; padding: 8px 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.hud { display: flex; justify-content: space-between; width: 100%; font-variant-numeric: tabular-nums; }
.hud div { display: flex; flex-direction: column; } .hud div:nth-child(2) { align-items: center; } .hud div:last-child { align-items: flex-end; }
.hud small { color: var(--muted); font-size: .7rem; letter-spacing: .08em; } .hud b { font-size: 1.2rem; }
#stage { position: relative; margin-top: 6px; }
/* #240: the guide's way out, under its coach card at the bottom right of the board (over the side panel). */
#skipguide { position: absolute; right: 4px; bottom: 2px; z-index: 2; font-size: .85rem; background: color-mix(in srgb, var(--maze-bg) 80%, transparent); }
#skipguide[hidden] { display: none; }
canvas { display: block; border-radius: 12px; }
/* The row under the stage (#77): a fixed height of two toast lines, so a message never moves the page. */
:root { --sub-h: 40px; }
.sub { display: flex; justify-content: space-between; align-items: center; gap: 6px; width: 100%; height: var(--sub-h); margin-top: 6px; }
.sub > #lives, .sub > #fx, .sub > #pause { flex: 0 0 auto; }
#lives { color: var(--accent); display: flex; gap: 4px; align-items: center; touch-action: manipulation; min-height: 28px; min-width: 28px; } /* double tap = skip cheat (#76), no zoom */
#lives svg { width: 16px; height: 14px; } /* smaller, so a two-line toast of 20 characters fits beside 5 lives (#77) */
#toast { color: var(--orange); font-weight: 700; font-size: .8rem; line-height: 1.2; text-align: right; transition: opacity .3s;
  flex: 1 1 0; min-width: 0; white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; max-height: calc(2 * 1.2em); } /* headline\ndetail, at most two lines (#77) */
#pause { width: auto; min-height: 34px; padding: 2px 12px; font-size: .85rem; }
#overlay { position: absolute; inset: 0; display: flex; align-items: safe center; justify-content: center; padding: 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--maze-bg) 55%, transparent); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
/* #50: the browser never takes a gesture on the stage or on READY (it fired pointercancel and lost the first swipe or
   drag). Cards keep pan-y, so a long lesson card can scroll inside the overlay. */
#stage, #overlay[data-kind="ready"] { touch-action: none; }
#overlay[hidden] { display: none; }
/* #301: a game's touch pad under the stage (Data Plumber), on touch screens only. Buttons of 56 px (at least 44). */
.pad { display: none; gap: 8px; width: 100%; margin-top: 8px; touch-action: none; }
@media (pointer: coarse) { .pad { display: flex; } }
.pad .padbtn { flex: 0 0 56px; width: 56px; min-width: 44px; min-height: 56px; padding: 0; border-radius: 14px; font-size: 1.2rem;
  background: transparent; color: var(--accent); touch-action: none; -webkit-touch-callout: none; }
.pad .padbtn.gap { margin-left: auto; }
.pad .padbtn.wide { flex: 0 0 92px; width: 92px; background: var(--accent); color: #fff; font-size: 1rem; }
.pad .padbtn.on { filter: brightness(1.25); }
#overlay .card { margin: 0; max-width: 340px; text-align: center; box-shadow: 0 8px 30px rgb(0 0 0 / .3); }
#overlay h2 { margin: 0 0 4px; font-size: 1.3rem; }
#overlay .ready { font-weight: 800; font-size: 1.3rem; color: var(--orange); text-shadow: 0 1px 0 #000; text-align: center; }
#overlay .ready small { display: block; font-size: .85rem; color: var(--fg); font-weight: 600; }

/* Results */
.results h2 { margin: 18px 0 4px; }
.score-big { font-size: 2.6rem; font-weight: 800; color: var(--accent); }
.ok { color: #2e9e5b; font-weight: 700; } .bad { color: #d6453d; font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ok { color: #5fcf91; } :root:not([data-theme="light"]) .bad { color: #ff7b6b; } }
:root[data-theme="dark"] .ok { color: #5fcf91; } :root[data-theme="dark"] .bad { color: #ff7b6b; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
.practice { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.practice small { display: block; color: var(--muted); }
/* #293: the game shelf. The home page widens for it; every other screen keeps the 560 px column. */
#app:has(> section.shelf) { max-width: 1040px; }
.title.shelf { text-align: left; padding-top: 12px; }
.shelf-head { display: flex; align-items: center; gap: 8px; padding: 6px 0 2px; }
.shelf-head b { font-size: 1.05rem; }
.shelf-logo { width: 22px; height: 22px; }
.shelf-board { margin-left: auto; color: var(--accent); font-weight: 700; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.shelf-board:hover, .shelf-board:focus-visible { text-decoration: underline; }
.card.welcome { display: flex; align-items: center; gap: 12px; border-color: var(--accent); }
.card.welcome > div { flex: 1; }
.card.welcome p { color: var(--muted); }
.card.welcome #random { min-height: 44px; }
.shelf-login { margin: 4px 0 0; }
.shelf-h { font-size: 1rem; margin: 18px 0 8px; display: flex; align-items: baseline; gap: 8px; }
.shelf-h small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ticon { position: relative; display: flex; align-items: center; justify-content: center; height: 76px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); }
.ticon .gicon { width: 52px; height: 52px; }
.qhelp { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: transparent; color: var(--accent); border: 0; font-size: .95rem; display: flex; align-items: center; justify-content: center; }
.qhelp::before { content: ''; position: absolute; inset: 10px; border: 2px solid var(--accent); border-radius: 50%; }
.tname { margin-top: 4px; }
.ttag { color: var(--muted); font-size: .8rem; flex: 1; }
.tile .bests { color: var(--muted); font-size: .8rem; }
.tile .bests b, .help .bests b { color: var(--fg); }
.tplay { margin-top: auto; min-height: 44px; } /* #328: always at the bottom of its tile, so a row's Play buttons line up */
.tile .bests { margin-bottom: 2px; }
dialog.help { margin: auto; max-width: 420px; width: calc(100% - 32px); color: var(--fg); padding: 16px; }
dialog.help::backdrop { background: rgb(0 0 0 / .45); }
.help-head { display: flex; align-items: center; gap: 10px; }
.help-head .gicon { width: 32px; height: 32px; }
.help-head b { flex: 1; font-size: 1.1rem; }
.help-x { width: 44px; min-height: 44px; padding: 0; background: transparent; border: 0; color: var(--fg); font-size: 1.4rem; }
.help .muted { color: var(--muted); }
@media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ttag { display: none; }
  .card.welcome { flex-direction: column; align-items: stretch; } }
/* #219: Best scores. The game name plays it, the score opens its board; underline on hover and focus only. */
#bests .best-play { display: block; min-height: 0; padding: 0; text-align: left; color: var(--accent); text-decoration: none; }
#bests .best-play b, #bests .best-board { color: var(--accent); }
#bests .best-board { font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; text-align: right; }
#bests .best-play:hover:not(:disabled) b, #bests .best-play:focus-visible b, #bests .best-board:hover, #bests .best-board:focus-visible { text-decoration: underline; }
#bests .best-board:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; border-radius: 4px; }
#bests .best-play:disabled { cursor: not-allowed; opacity: .55; }
@media (pointer: coarse) { #bests .best-play, #bests .best-board { min-height: 40px; } } /* tap targets on a phone */
@media (min-width: 600px) { #bests .best-board { white-space: nowrap; } } /* All's value on one line where there is room */
.lvls { display: flex; gap: 6px; flex: 0 0 auto; }
button.small { min-height: 40px; padding: 4px 12px; font-size: .85rem; width: auto; }
.muted { color: var(--muted); }
/* Score bar middle (#46): the game name in the big slot. It takes the space between SCORE and BEST, never wraps,
   and shrinks with the screen so "PIPELINE STRIKE" fits at 360px without moving them. */
#lvbox { cursor: default; flex: 1 1 0; min-width: 0; padding: 0 6px; }
.hud > div:first-child, .hud > div:last-child { flex: 0 0 auto; }
#lvname { font-size: clamp(.78rem, 3.9vw, 1.2rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; letter-spacing: .02em; line-height: 1.45rem; }
.alert { border-color: #d6453d; color: var(--fg); }

/* jgp.ai family chrome (ops: ux/apps-on-jgp.ai.md). Shown on menus, hidden while playing so the board keeps the screen. */
.jgp-band { background: #531b93; color: #fff; padding: 12px 0; min-height: 68px; display: flex; align-items: center; }
.jgp-band .rail { width: 100%; max-width: 78rem; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 12px; min-height: 44px; }
.jgp-band .mark img { display: block; width: 32px; height: 32px; }
.jgp-band .label { display: none; color: #fff; opacity: .85; text-decoration: none; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; border-left: 1px solid rgba(255,255,255,.35); padding-left: 12px; }
.jgp-band .label:hover { opacity: 1; }
@media (min-width: 640px) { .jgp-band { padding: 16px 0; min-height: 76px; } .jgp-band .label { display: inline; } }
/* #330: on a phone (where the label is hidden), a house to go home and a card album for the Cards page */
.jgp-band .band-ico { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: #fff; border-radius: 12px; opacity: .9; }
.jgp-band .band-ico:hover { opacity: 1; background: rgba(255,255,255,.12); }
@media (min-width: 640px) { .jgp-band .band-ico { display: none; } }
.jgp-colophon { background: #212121; color: #666; font-size: 12px; text-align: center; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.jgp-colophon p { margin: 2px 0; }
.jgp-colophon a { color: inherit; }
#footnote { color: #9a9a9a; } #footnote a { color: #b27ff0; } /* the login / score status line (#85) */
body.playing .jgp-band, body.playing .jgp-colophon { display: none; }

/* Pause menu and quit confirmation: two tap targets side by side (>= 44px). */
.ovbtns { display: flex; gap: 10px; margin-top: 12px; }
.ovbtns button { flex: 1; min-height: 48px; }
/* #102: Continue first and widest, More beside it, or under it when the card is narrow. */
.ovbtns.more { flex-wrap: wrap; }
.ovbtns.more button { flex: 2 1 160px; }
.ovbtns.more a.button { flex: 1 1 96px; min-height: 48px; }
#overlay .card small.source { display: block; color: var(--muted); font-size: .8rem; margin-top: -4px; }
button.danger { background: #d6453d; border-color: #d6453d; color: #fff; }
#overlay .ready small.keyhint { color: var(--muted); font-size: .75rem; margin-top: 4px; }
@media (hover: none) { #overlay .ready small.keyhint { display: none; } } /* touch: use the ❚❚ button */

/* Player code (#5): home line and the 5-slot picker. Monospace, tap targets >= 44px. */
.code, .picker .ch { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace; }
button.link { width: auto; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--accent); text-decoration: underline; font-weight: 600; }
.picker { outline: none; margin: 16px auto 0; max-width: 360px; }
.picker:focus-visible .ch.cur { outline: 3px solid var(--fg); outline-offset: 2px; }
.picker .slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.picker .slot { display: flex; flex-direction: column; gap: 6px; }
.picker button.arrow { min-height: 44px; padding: 0; font-size: 1rem; }
.picker .ch { display: flex; align-items: center; justify-content: center; height: 64px; font-size: 2rem; font-weight: 800;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.picker .ch.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.picker .ch.space { color: var(--muted); font-weight: 400; }
.picker .picker-row { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 8px; margin: 12px 0; }
.pk-msg { min-height: 1.5em; margin: 8px 0 0; text-align: center; }
.pk-msg.bad { color: #d6453d; font-weight: 700; } .pk-msg.ok { color: #2e9e5b; font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pk-msg.bad { color: #ff7b6b; } :root:not([data-theme="light"]) .pk-msg.ok { color: #5fcf91; } }
:root[data-theme="dark"] .pk-msg.bad { color: #ff7b6b; } :root[data-theme="dark"] .pk-msg.ok { color: #5fcf91; }

/* Theme picker on the profile (#68): a segmented control. */
.seg { display: flex; gap: 0; margin-top: 10px; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1 1 0; width: auto; min-height: 44px; margin: 0; border: 0; border-radius: 0; background: transparent; color: var(--fg); font-weight: 600; box-shadow: none; }
.seg button + button { border-left: 2px solid var(--line); }
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; }

/* Profile and score saving (#6) */
a.back { display: inline-block; min-height: 44px; line-height: 44px; margin-top: 10px; color: var(--accent); font-weight: 600; text-decoration: none; }
a.back:hover, a.back:focus-visible { text-decoration: underline; } /* #69: no underline at rest, still recognizable as a link */
.invite { border-color: var(--accent); }
#savenote { margin: 10px 0 0; }

/* Leaderboard (#7): arcade rows, tabs that wrap on a phone */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0 4px; }
.tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 2px solid var(--accent); border-radius: 999px;
  color: var(--accent); text-decoration: none; font-weight: 700; font-size: .9rem; }
.tab.on { background: var(--accent); color: #fff; }
ol.lb { list-style: none; margin: 0; padding: 0; font-variant-numeric: tabular-nums; }
.lbrow { display: grid; grid-template-columns: 3ch 1fr auto; gap: 12px; align-items: center; min-height: 40px; padding: 4px 8px; border-radius: 10px; }
.lbrow:nth-child(odd) { background: color-mix(in srgb, var(--line) 35%, transparent); }
.lbrow .rk { color: var(--muted); text-align: right; font-weight: 700; }
.lbrow .code { font-size: 1.15rem; font-weight: 800; letter-spacing: .14em; white-space: pre; }
.lbrow .sc { font-weight: 800; }
.lbrow.mine { background: var(--accent); color: #fff; } .lbrow.mine .rk { color: #fff; }
/* All board (#24): the subtitle, and a per-game breakdown shown on tap (title tooltip on desktop) */
.board-sub { margin: 4px 0 0; text-align: center; }
.lbrow.has-bd { cursor: pointer; }
.lbrow .bd { display: none; grid-column: 1 / -1; font-size: .85rem; opacity: .85; padding: 0 0 4px; }
.lbrow.open .bd { display: block; }
/* Christmas Championship (#26): the banner, the standings heading and the prize line under the top 3 */
.champ { border-color: #2f9e44; text-align: left; }
.review { border-color: var(--orange); }
.paused { border-color: var(--orange); } /* #147: the account is paused (a temporary lock) */
button:disabled { opacity: .5; cursor: not-allowed; } /* #146: the player's own runs under review */
.champ-head { margin: 10px 0 0; }
.lbrow .prize { grid-column: 1 / -1; font-size: .85rem; font-weight: 700; padding: 0 0 4px; }
ol.lb.pinned { margin-top: 8px; border-top: 2px dashed var(--line); padding-top: 8px; }
.empty { text-align: center; }
#myrank { margin: 4px 0 0; }

/* Account area in the band (#16): white on #531b93 in both themes, focus ring visible on purple, >= 44px targets.
   Below 640px the name hides so the code and Sign out fit on one line at 360px. */
.jgp-band .who { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; color: #fff; font-size: .9rem; }
.jgp-band .band-code { color: #fff; font-weight: 800; letter-spacing: .12em; white-space: pre; text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; border-bottom: 2px solid rgba(255,255,255,.5); }
.jgp-band .band-code.placeholder { width: 6.5ch; border-bottom-color: transparent; }
.jgp-band .band-name { opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; display: none; }
.jgp-band button.band-btn { width: auto; min-height: 44px; padding: 0 14px; font-size: .85rem; border-radius: 12px;
  background: transparent; border: 2px solid #fff; color: #fff; white-space: nowrap; }
.jgp-band button.band-btn:hover { background: rgba(255,255,255,.12); }
.jgp-band a:focus-visible, .jgp-band button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (min-width: 640px) { .jgp-band .band-name { display: inline; } }
@media (max-width: 400px) { .jgp-band .rail { padding: 0 12px; gap: 8px; } .jgp-band .who { gap: 8px; } }
button.link.inline { min-height: 0; padding: 0; font-size: inherit; vertical-align: baseline; }

/* Game icons (#70): 20px before the name, aligned with the text; smaller in tabs, sized to the name in the score bar. */
.gicon { width: 1.25em; height: 1.25em; vertical-align: -0.25em; margin-right: .35em; flex: 0 0 auto; }
.tab .gicon { width: 1.1em; height: 1.1em; margin-right: .25em; }
#lvname .gicon { width: 1.05em; height: 1.05em; vertical-align: -0.15em; }
.tab.on .gicon { --accent: #fff; } /* on the selected (purple) tab, the purple parts turn white */

/* Active bonuses next to the lives (#64): the bonus icon over a bar that shrinks as it runs out. */
#fx { display: flex; gap: 6px; align-items: center; margin-left: 8px; }
#fx .fx { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 22px; }
#fx canvas { width: 22px; height: 22px; }
#fx i { display: block; height: 3px; width: 100%; border-radius: 2px; background: var(--orange); transition: width .1s linear; }

/* Christmas Championship card on the home page (#72): the three prize covers, 1st to 3rd. */
/* #99: covers in row 1 sit on one bottom line, captions in row 2 start right under them and only grow downward. */
.champ-card .covers { display: grid; grid-template-columns: repeat(3, minmax(0, 110px)); grid-template-rows: auto auto; column-gap: 10px; justify-content: center; margin: 10px 0 4px; }
.champ-card figure { display: contents; }
.champ-card .covers a.cover { grid-row: 1; align-self: end; display: block; border-radius: 4px; } /* #121: the cover links to its book */
.champ-card .covers a.cover:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.champ-card img { display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 8px rgb(0 0 0 / .25); }
.champ-card figcaption { grid-row: 2; align-self: start; margin-top: 4px; font-size: .8rem; line-height: 1.2; text-align: center; }
.champ-card figcaption small { display: block; color: var(--muted); font-size: .7rem; }
.champ-card .champ-me { min-height: 1.5em; } /* #123: one line tall, empty or not, so the rank arriving never moves the page */
/* #131: Use the book's tools. The key and the setup block wrap or scroll inside the card, never the page. */
.card.api button.small { width: auto; min-height: 44px; padding: 6px 16px; font-size: .95rem; }
.card.api > button.small { margin-top: 10px; }
.api-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.api-key { margin-top: 10px; }
.api-value { display: block; max-width: 100%; box-sizing: border-box; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--bg); font: 600 .95rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.api-setup { max-width: 100%; box-sizing: border-box; margin: 6px 0 0; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--fg); font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; white-space: pre; }
.api-confirm { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.api-links { font-size: .85rem; margin-top: 12px; overflow-wrap: anywhere; }
.api-links a { color: var(--accent); }
.api-note { margin-top: 8px; }
/* #141: invitations. A notice outside play, and the friends table, which scrolls
   sideways inside its card only (the code column stays put), never the page. */
#notice { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: calc(100vw - 32px); padding: 10px 16px;
  border-radius: 12px; background: var(--card); color: var(--fg); border: 2px solid var(--accent); box-shadow: 0 6px 24px rgb(0 0 0 / .25);
  white-space: pre-line; text-align: center; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
#notice.on { opacity: 1; transform: translate(-50%, 0); }
/* #208: invite points as an arcade counter. Theme tokens only, so it follows light and dark. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.inv-counter { position: relative; display: flex; flex-direction: column; align-items: center; margin: 12px 0 0; padding: 12px 10px 10px;
  border: 2px solid var(--accent); border-radius: 14px; background: var(--bg); }
.inv-digits { font-size: clamp(2.2rem, 11vw, 3.2rem); font-weight: 800; line-height: 1; letter-spacing: .06em; color: var(--accent);
  font-variant-numeric: tabular-nums; }
.inv-caption { margin-top: 4px; font-size: .75rem; font-weight: 800; letter-spacing: .3em; color: var(--muted); }
.inv-pops { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.inv-pop { position: absolute; right: 12px; top: 30px; font-weight: 800; font-size: 1.05rem; color: var(--orange);
  animation: inv-pop 1.4s ease-out both; white-space: nowrap; }
@keyframes inv-pop { from { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; } to { opacity: 0; transform: translateY(-22px); } }
.inv-next { margin: 10px 0 0; text-align: center; font-weight: 700; }
.inv-stats { margin: 4px 0 0; text-align: center; font-size: .85rem; }
table.friends th .inv-left { display: block; font-family: inherit; color: var(--muted); font-weight: 600; font-size: .75rem; letter-spacing: 0; }
table.friends tr.inv-new th, table.friends tr.inv-new td { animation: inv-new 2.4s ease-out forwards; }
@keyframes inv-new { from { background: color-mix(in srgb, var(--orange) 35%, transparent); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  .inv-pop { display: none; }
  table.friends tr.inv-new th, table.friends tr.inv-new td { animation: none; background: color-mix(in srgb, var(--orange) 22%, var(--card)); }
}
.friends-card { min-width: 0; }
.friends-scroll { max-width: 100%; overflow-x: auto; margin-top: 8px; -webkit-overflow-scrolling: touch; }
table.friends { border-collapse: collapse; font-size: .85rem; white-space: nowrap; }
table.friends th, table.friends td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); }
table.friends thead th { font-weight: 700; color: var(--muted); vertical-align: bottom; }
table.friends thead th svg { display: block; margin: 0 auto 2px; width: 18px; height: 18px; }
table.friends th:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; }
table.friends td.q { text-align: center; color: var(--accent); font-weight: 800; }
@media (prefers-reduced-motion: reduce) { #notice { transition: none; } }
/* #143: "Invite by email" on the Invite card: the field takes the row, Send keeps its size; 16px text so iOS doesn't zoom. */
.invite-mail { margin-top: 12px; }
.invite-mail label { display: block; font-weight: 700; margin-bottom: 6px; }
.invite-mail-row { display: flex; gap: 8px; align-items: stretch; }
.invite-mail input { flex: 1 1 auto; min-width: 0; box-sizing: border-box; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--fg); font: 16px/1.3 inherit; font-family: inherit; }
.invite-mail input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.invite-mail input[aria-invalid="true"] { border-color: #d6453d; }
.invite-mail-row button { flex: none; }
.invite-mail-note { font-size: .85rem; margin: 6px 0 0; }
.invite-mail-error { margin: 6px 0 0; }
/* #215: the invite nudge. The results card fades in under the buttons; the home strip reuses the star banner's look. */
.card.nudge { border-color: var(--accent); opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
.card.nudge.on { opacity: 1; transform: none; }
.nudge-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nudge-close { flex: none; width: auto; min-width: 40px; min-height: 40px; margin: -8px -8px -8px 0; padding: 0 8px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.nudge-close:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .card.nudge, .star-banner { transition: none; transform: none; } }
/* #129: the game's own account forms. One card, full-width fields (16px text, so iOS doesn't zoom), at 390px too. */
.auth-card { max-width: 420px; width: 100%; box-sizing: border-box; margin: 0 auto; text-align: left; }
.auth-form h2 { margin: 0 0 10px; }
.auth-form label { display: block; font-weight: 700; margin: 12px 0 4px; }
.auth-form input { display: block; width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--fg); font-size: 16px; font-family: inherit; }
.auth-form input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.auth-form button[type="submit"] { width: 100%; margin-top: 14px; }
/* #205: the show/hide eye, inside the field's right edge; 44px hit area, the text never runs under it. */
.auth-form .pw-wrap { position: relative; }
.auth-form .pw-wrap input { padding-right: 52px; }
.auth-form .pw-eye { position: absolute; top: 50%; right: 2px; transform: translateY(-50%); width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; box-shadow: none; }
.auth-form .pw-eye:hover, .auth-form .pw-eye[aria-pressed="true"] { color: var(--fg); }
.auth-form .pw-eye:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.auth-rule { font-size: .85rem; margin: 4px 0 0; }
.auth-alert, .auth-info { margin: 10px 0 0; min-height: 0; }
.auth-alert:empty, .auth-info:empty { display: none; }
.auth-alert a { color: inherit; text-decoration: underline; }
.auth-links { margin: 14px 0 0; text-align: center; }
.auth-links a { color: var(--accent); }
.auth-note { font-size: .85rem; margin: 10px 0 0; text-align: center; }

/* #162: under the sign-up email: "already has an account" with its Log in link, or the addition question. */
.auth-check:empty { display: none; }
.auth-check { margin: 6px 0 10px; }
.auth-check p { margin: 0 0 6px; }
.auth-check label { display: block; font-weight: 700; margin-bottom: 6px; }
.auth-check-row { display: flex; gap: 8px; align-items: stretch; }
.auth-check-row input { flex: 0 1 8em; min-width: 0; font-size: 16px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--fg); }
.auth-check-row button { min-height: 44px; }
.auth-exists a { color: var(--accent); font-weight: 700; }

/* #176: Report an issue. A slim tab on the right edge of every screen (hidden during play on touch: the pause menu
   has the button instead), and a panel sliding in from the right: full width at 390px, 420px on desktop. */
/* #212: the sides are swapped before the 180° turn, so the drawn tab is open against the screen edge. */
.report-tab { position: fixed; right: 0; top: 50%; z-index: 40; width: auto; min-height: 0; padding: 12px 6px; border-radius: 0 10px 10px 0;
  border: 2px solid var(--accent); border-left: 0; background: var(--card); color: var(--accent); font-size: .78rem; font-weight: 700;
  writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); box-shadow: 0 2px 10px rgb(0 0 0 / .18); opacity: .92; }
.report-tab:hover { opacity: 1; }
@media (pointer: coarse) { body.playing .report-tab { display: none; } }
body.reporting .report-tab { visibility: hidden; }
.report-backdrop { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .35); }
.report-backdrop[hidden], .report-panel[hidden] { display: none; }
.report-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(420px, 100vw); overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); color: var(--fg); border-left: 2px solid var(--accent); box-shadow: -8px 0 32px rgb(0 0 0 / .3); text-align: left;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 16px); transform: translateX(100%); transition: transform .22s ease-out; }
.report-panel.on { transform: none; }
.report-panel.drag { outline: 3px dashed var(--accent); outline-offset: -8px; }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.report-head h2 { margin: 0; font-size: 1.3rem; }
.report-x { width: auto; min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; line-height: 1; }
.report-body { display: block; margin-top: 10px; }
.report-body label[for="report-desc"] { display: block; margin-bottom: 6px; }
.report-body textarea { display: block; width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; resize: vertical; }
.report-body textarea:focus-visible, .report-pick:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.report-count { display: block; text-align: right; margin-top: 2px; }
.report-drop { margin: 12px 0 0; padding: 10px 12px; border: 2px dashed var(--line); border-radius: 10px; }
.report-drop small { display: block; }
.report-files { list-style: none; margin: 6px 0 0; padding: 0; }
.report-files li { display: flex; gap: 8px; align-items: baseline; margin: 4px 0; overflow-wrap: anywhere; }
.report-files li span { flex: 1 1 auto; min-width: 0; }
.report-files button.link { width: auto; min-height: 0; padding: 0; }
.report-pick { position: relative; display: inline-block; margin-top: 8px; padding: 6px 12px; border: 2px solid var(--accent); border-radius: 10px;
  color: var(--accent); font-weight: 700; cursor: pointer; }
.report-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; } /* the label is the button; still focusable */
.report-check { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; }
.report-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.report-ctx { margin: 12px 0 0; }
.report-ctx button.link { width: auto; min-height: 0; padding: 0; }
.report-ctx table { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: .8rem; }
.report-ctx th { text-align: left; color: var(--muted); font-weight: 600; padding: 2px 8px 2px 0; vertical-align: top; white-space: nowrap; }
.report-ctx td { padding: 2px 0; overflow-wrap: anywhere; }
.report-err { margin: 10px 0 0; }
.report-err:empty { display: none; }
.report-body button[type="submit"] { margin-top: 14px; }
.report-body button:disabled { opacity: .5; cursor: default; }
@media (prefers-reduced-motion: reduce) { .report-panel { transition: none; } }

/* #222: an unreleased game, seen by inner-circle members only (home list and leaderboard tab) */
.inner-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border: 1px solid var(--accent); border-radius: 999px;
  color: var(--accent); font-size: .7rem; font-weight: 700; line-height: 1.4; vertical-align: middle; white-space: nowrap; }
.tab.on .inner-tag { color: #fff; border-color: #fff; }
.code-go { margin: 10px 0 0; } /* #263: Pick my code on the results card */

/* #308: the Cards page (mock-ups approved in #307). Card families: q quality, s service level, b standards,
   g ladders/workstreams, r regulations, p personas, t ports. A card not owned shows its back. */
#app:has(> section.cards-page) { max-width: 1040px; }
:root { --q-bg:#efe3fa; --q-fg:#4a1d73; --q-bd:#b27ff0; --s-bg:#fff0e0; --s-fg:#7a3d00; --s-bd:#ffb066; --b-bg:#e6ebff; --b-fg:#1d2d7a; --b-bd:#8da2ef;
  --g-bg:#e4f6ea; --g-fg:#14532d; --g-bd:#6cc48a; --r-bg:#fde8e8; --r-fg:#7a1d1d; --r-bd:#ef8d8d; --t-bg:#d9f2ee; --t-fg:#0f4e47; --t-bd:#5fb8ab; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --q-bg:#3a2350; --q-fg:#f0e2ff; --s-bg:#4a2d10; --s-fg:#ffe2c4; --b-bg:#1d2550; --b-fg:#dfe5ff;
  --g-bg:#123522; --g-fg:#d8f5e2; --r-bg:#4a1c1c; --r-fg:#ffdede; --t-bg:#103a35; --t-fg:#d4f5ef; } }
:root[data-theme="dark"] { --q-bg:#3a2350; --q-fg:#f0e2ff; --s-bg:#4a2d10; --s-fg:#ffe2c4; --b-bg:#1d2550; --b-fg:#dfe5ff;
  --g-bg:#123522; --g-fg:#d8f5e2; --r-bg:#4a1c1c; --r-fg:#ffdede; --t-bg:#103a35; --t-fg:#d4f5ef; }
.cards-page h2 { margin: 12px 0 2px; }
.cards-page .album { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; margin: 12px 0; }
.cards-page .album.locked { opacity: .8; }
.cards-page .ah { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cards-page .ah h3 { margin: 0; font-size: 1rem; }
.cards-page .ah .bar { width: 120px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.cards-page .ah .bar i { display: block; height: 100%; background: var(--accent); }
.cards-page .ah small { color: var(--muted); }
.cards-page .later { font-size: 1rem; margin: 20px 0 0; }
.cards-page .cl { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin: 6px 0 4px; }
.cards-page .crow { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 6px; }
.cards-page .small { font-size: .82rem; }
.cd { position: relative; width: 74px; height: 94px; min-height: 0; padding: 4px; border-radius: 10px; border: 2px solid; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; font: inherit; font-weight: 600; cursor: pointer; flex: 0 0 auto; overflow: hidden; }
.cd.wide { width: 100px; }
.cd .ab { font: 800 1.3rem/1 system-ui, sans-serif; } .cd .nm { font-size: .6rem; line-height: 1.1; margin-top: 4px; } .cd .sp { font-size: .52rem; font-style: italic; opacity: .75; margin-top: 2px; }
.cd .avatar { width: 44px; height: 44px; }
.cd .ck { position: absolute; left: -4px; right: -4px; top: 40%; background: var(--card); color: var(--accent); border: 1.5px solid var(--accent); font-size: .55rem; font-weight: 800; transform: rotate(-8deg); }
.cd.chk > :not(.ck) { opacity: .45; }
.cd:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.cd.q { background: var(--q-bg); color: var(--q-fg); border-color: var(--q-bd); } .cd.s { background: var(--s-bg); color: var(--s-fg); border-color: var(--s-bd); }
.cd.b { background: var(--b-bg); color: var(--b-fg); border-color: var(--b-bd); } .cd.g { background: var(--g-bg); color: var(--g-fg); border-color: var(--g-bd); }
.cd.r { background: var(--r-bg); color: var(--r-fg); border-color: var(--r-bd); } .cd.t { background: var(--t-bg); color: var(--t-fg); border-color: var(--t-bd); }
.cd.p { background: var(--card); color: var(--fg); border-color: var(--s-bd); }
.cd.back { background: repeating-linear-gradient(45deg, var(--accent) 0 6px, #6a2aa0 6px 12px); border-color: var(--accent); }
.cd.back::before { content: ""; position: absolute; width: 30px; height: 26px; background: var(--card); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.cd.back::after { content: "?"; position: absolute; font: 800 1rem system-ui, sans-serif; color: var(--accent); }
.cd.empty { background: transparent; border: 2px dashed var(--line); color: var(--muted); cursor: default; } .cd.empty .nm { font-size: .55rem; }
.periodic { display: flex; gap: 8px; align-items: flex-end; overflow-x: auto; padding-bottom: 4px; }
.pcol { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tagged { display: flex; flex-direction: column; } .tagged .rq { font-size: .6rem; font-weight: 700; text-align: center; border-radius: 6px 6px 0 0; padding: 1px 0; margin-bottom: -3px; }
.rq.req { background: #e49b9b; color: #3a0d0d; } .rq.opt { background: #3aa66a; color: #fff; }
.ladders { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.ladder { display: flex; flex-direction: column; gap: 6px; align-items: center; border-left: 6px solid var(--line); border-right: 6px solid var(--line); padding: 4px 10px; }
.ladders p { max-width: 240px; align-self: center; }
.dpl { display: grid; grid-template-columns: 96px 80px 80px; gap: 8px; align-items: center; }
.hexports { display: grid; grid-template-columns: repeat(3, auto); grid-template-areas: ". d ." "i h o" "b . c"; gap: 8px; justify-content: start; align-items: center; justify-items: center; }
.hexcore { width: 110px; height: 96px; background: var(--accent); color: #fff; font-weight: 800; font-size: .8rem; display: grid; place-items: center;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.deck { display: flex; flex-wrap: wrap; row-gap: 10px; padding: 8px 0 8px 14px; } .deck .cd { margin-left: -14px; box-shadow: -3px 0 6px rgb(0 0 0 / .15); }
.deck .cd:nth-child(odd) { transform: rotate(-4deg); } .deck .cd:nth-child(even) { transform: rotate(4deg); }
.deck .cd:hover, .deck .cd:focus-visible { transform: none; z-index: 2; }
dialog.cardpanel { max-width: 420px; width: calc(100% - 32px); margin: auto; } /* .card's margin would pin it top-left */
dialog.cardpanel::backdrop { background: rgb(0 0 0 / .45); }
.cp-head { display: flex; gap: 10px; align-items: flex-start; } .cp-head > div { flex: 1; } .cp-head h3 { margin: 2px 0 0; }
.cp-head .sp { margin: 2px 0 0; font-style: italic; font-size: .85rem; color: var(--muted); }
.cp-x { min-height: 44px; min-width: 44px; font-size: 1.5rem; }
.cp-q { margin: 10px 0 4px; } .cardpanel .ways { margin: 6px 0 10px; padding-left: 20px; } .cardpanel .ways li { margin: 4px 0; } .cardpanel .ways .shut { color: var(--muted); }
.shelf-cards { color: var(--accent); font-weight: 700; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.shelf-cards:hover, .shelf-cards:focus-visible { text-decoration: underline; }
/* #328: the shelf's top bar on one line on a phone (the Cards link from #308 made it wrap at 390 px) */
.shelf-head b, .shelf-board, .shelf-cards { white-space: nowrap; }
@media (max-width: 430px) { .shelf-head { gap: 6px; } .shelf-head b { font-size: .98rem; } .shelf-board, .shelf-cards { font-size: .88rem; } }
@media (max-width: 560px) { .cd { width: 62px; height: 80px; } .cd .ab { font-size: 1.05rem; } .cd .nm { font-size: .52rem; } .cd.wide { width: 80px; }
  .dpl { grid-template-columns: 78px 66px 66px; } .dpl .cl { font-size: .56rem; letter-spacing: 0; } .hexcore { width: 84px; height: 74px; } .ladders { gap: 16px; } }

/* #309: earned cards turn over on the results screen. Each .flip holds the card's back over its face, in one grid
   cell; the back folds to its edge, then the face opens with an orange glow. --d staggers the cards. */
.earned .earn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 6px; justify-content: center; }
.earned .cards-link { color: var(--accent); font-weight: 700; }
.flip { display: grid; } .flip > * { grid-area: 1 / 1; cursor: default; }
.flip > .back { animation: card-fold .3s ease-in var(--d) forwards; }
.flip > :not(.back) { transform: scaleX(0); animation: card-open .3s ease-out calc(var(--d) + .3s) forwards, card-glow 1.4s ease-out calc(var(--d) + .6s); }
@keyframes card-fold { to { transform: scaleX(0); } }
@keyframes card-open { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes card-glow { 0% { box-shadow: 0 0 0 4px rgb(255 140 31 / .35), 0 0 26px rgb(255 140 31 / .6); } 100% { box-shadow: none; } }
.flip.still > .back { display: none; }
.flip.still > :not(.back) { transform: none; animation: none; }
@media (prefers-reduced-motion: reduce) { .flip > .back { display: none; } .flip > :not(.back) { transform: none; animation: none; } }
.cardnotice { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30; background: var(--card); color: var(--fg); border: 2px solid var(--accent);
  border-radius: 12px; padding: 8px 14px; font-weight: 700; white-space: pre-line; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.cardnotice:empty { display: none; }
.cardnotice.on { opacity: 1; }

/* #312: album badges and the Collector mark (art approved in #307). On a leaderboard row they sit after the code,
   in the same grid cell, and shrink before the score would move. */
.lbrow .who { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.lbrow .bs { display: inline-flex; align-items: center; gap: 2px; }
.lbrow .bs .badge { flex: 0 0 auto; }
.lbrow .more { font-size: .72rem; color: var(--muted); margin-left: 2px; } .lbrow.mine .more { color: #fff; }
.coll { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 800; color: #8a5f00; border: 1.5px solid #e0b030;
  border-radius: 999px; padding: 1px 7px; background: #fff7dc; white-space: nowrap; letter-spacing: 0; }
:root[data-theme="dark"] .coll { background: #3a2e05; color: #ffd76a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .coll { background: #3a2e05; color: #ffd76a; } }
.badges-card .badge-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; }
.badges-card .badge-item { width: 72px; text-align: center; } .badges-card .badge-item small { display: block; font-size: .66rem; color: var(--muted); line-height: 1.2; }
.badges-card .small { font-size: .82rem; } .badges-card a { color: var(--accent); font-weight: 700; }
