/* Strange Company, the player app. Phone first, and comfortable on a
   wide screen. Colors are tokens so light and dark share every rule. */

:root {
  color-scheme: light;
  --paper: #f7f2e8;
  --surface: #fffdf7;
  --sunken: #efe8d9;
  --ink: #1b1915;
  --muted: #6c6557;
  --line: #e2dac8;
  --accent: #d9f36a;
  --dot: #ff6a3d;
  --turn-corner: rgb(169 118 26 / .8);
  --primary: #1b1915;
  --on-primary: #fbf8f0;
  --easy: #186d46;
  --medium: #8b5700;
  --hard: #ad3826;
  --g0: #f6d75a;
  --g1: #8ecbf2;
  --g2: #ffa978;
  --g3: #c9aef6;
  --on-group: #1b1915;
  --shadow: 0 1px 2px rgb(60 45 20 / .06), 0 6px 18px rgb(60 45 20 / .07);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --radius: 1.15rem;
  --tab-height: 4rem;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --paper: #171714;
    --surface: #23221c;
    --sunken: #1d1c17;
    --ink: #f4f0e6;
    --muted: #b1ab9c;
    --line: #3b392f;
    --turn-corner: rgb(240 189 79 / .8);
    --dot: #d9f36a;
    --primary: #d9f36a;
    --on-primary: #171714;
    --easy: #6fd39b;
    --medium: #f0b54a;
    --hard: #ff8a73;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 22px rgb(0 0 0 / .28);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #171714;
  --surface: #23221c;
  --sunken: #1d1c17;
  --ink: #f4f0e6;
  --muted: #b1ab9c;
  --line: #3b392f;
  --turn-corner: rgb(240 189 79 / .8);
  --dot: #d9f36a;
  --primary: #d9f36a;
  --on-primary: #171714;
  --easy: #6fd39b;
  --medium: #f0b54a;
  --hard: #ff8a73;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 22px rgb(0 0 0 / .28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: .4rem; }
/* A heading or picture is given focus so a screen reader reads it. It is not a control, so it draws no ring. */
:is(h2, figure)[tabindex='-1']:focus-visible { outline: none; }
small { font-size: .82rem; color: var(--muted); }

.icon {
  width: 1.4rem; height: 1.4rem; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- App bar and tabs ---------- */

.app-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem max(1rem, env(safe-area-inset-left)) .6rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
}
/* The blur sits on a layer of its own. On the bar itself it would trap the
   fixed tab bar inside the header. */
.app-bar::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.035em;
  text-decoration: none;
}
.wordmark span { color: var(--dot); }
.streak {
  display: inline-flex; align-items: center; gap: .2rem;
  padding: .3rem .65rem .3rem .45rem; border-radius: 99px;
  background: var(--sunken); color: var(--muted); font-weight: 700; font-size: .92rem;
  font-variant-numeric: tabular-nums;
}
.streak .icon { width: 1.1rem; height: 1.1rem; }
.streak.lit { background: var(--accent); color: #1b1915; }
.streak.lit .icon { fill: #ff6a3d; stroke: #1b1915; }

#tabs {
  position: fixed; inset: auto 0 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
#tabs a {
  display: grid; justify-items: center; gap: .1rem;
  padding: .4rem 0 .3rem; border-radius: .9rem;
  color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 650; white-space: nowrap;
}
@media (max-width: 359px) { #tabs a { font-size: .62rem; letter-spacing: -.01em; } }
#tabs a[hidden] { display: none; }
#tabs a[aria-current='page'] { color: var(--ink); }
#tabs a[aria-current='page'] .icon { fill: var(--accent); }
#tabs a:active { background: var(--sunken); }

#view {
  width: min(100% - 2rem, 40rem);
  margin-inline: auto;
  padding: .6rem 0 calc(var(--tab-height) + 2.5rem + env(safe-area-inset-bottom));
  display: grid; gap: 1.5rem; align-content: start;
}

@media (min-width: 760px) {
  .app-bar { padding-inline: max(2rem, calc((100% - 62rem) / 2)); }
  #tabs {
    position: static; display: flex; gap: .25rem; padding: 0; border: 0; background: none;
    backdrop-filter: none; -webkit-backdrop-filter: none; margin-left: auto;
  }
  #tabs a { display: flex; align-items: center; gap: .4rem; padding: .5rem .8rem; font-size: .95rem; }
  #tabs a[aria-current='page'] { background: var(--surface); box-shadow: var(--shadow); }
  #view { padding-top: 1.5rem; padding-bottom: 4rem; }
}
/* Between a tablet and a desktop the names fit without their marks. */
@media (min-width: 760px) and (max-width: 979px) { #tabs a .icon { display: none; } }
/* Today on a wide screen: the day's puzzle beside the week around it. */
.today-main, .today-side { display: grid; gap: 1.5rem; align-content: start; min-width: 0; }
@media (min-width: 900px) {
  #view.view-wide {
    width: min(100% - 4rem, 62rem); grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2.5rem; align-items: start;
  }
  #view.view-wide > :not(.today-main, .today-side) { grid-column: 1 / -1; }
}

body.stacked .app-bar { display: none; }

/* ---------- Shared pieces ---------- */

.page-head { display: grid; gap: .3rem; }
.page-head h1 {
  font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 8vw, 2.7rem);
  line-height: 1; letter-spacing: -.045em;
}
.eyebrow { color: var(--muted); font-weight: 650; font-size: .9rem; }
.lede { color: var(--muted); font-size: 1.02rem; }
.section { display: grid; gap: .7rem; }
.section > h2 {
  font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em;
}
.loading { color: var(--muted); text-align: center; padding: 3rem 0; }
.fine { font-size: .82rem; color: var(--muted); }
.center { text-align: center; }
.note { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-weight: 600; }
.note .icon { color: var(--easy); }
.more-link {
  display: inline-flex; align-items: center; gap: .1rem; justify-self: start; min-height: 2.75rem;
  color: var(--muted); font-weight: 650; text-decoration: none;
}
.more-link .icon { width: 1.1rem; height: 1.1rem; }
.page-head .segmented { justify-self: start; margin-top: .5rem; }
.tag {
  display: inline-block; margin-left: .45rem; padding: .08rem .45rem; border-radius: 99px;
  background: var(--sunken); color: var(--muted); font-size: .68rem; font-weight: 750;
  letter-spacing: .04em; text-transform: uppercase; vertical-align: middle;
}

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 2.9rem; padding: .6rem 1.15rem; border: 0; border-radius: 99px;
  font-weight: 700; font-size: 1rem; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, opacity .12s ease;
}
.button:active { transform: scale(.97); }
.button:disabled { opacity: .38; cursor: default; }
.button-primary { background: var(--primary); color: var(--on-primary); }
.button-secondary { background: var(--accent); color: #1b1915; }
.button-quiet { background: var(--sunken); color: var(--ink); }
.button-quiet.danger { color: var(--hard); }
.button-wide { width: 100%; }
.button .icon { width: 1.15rem; height: 1.15rem; }
.icon-button {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; flex: none;
  border: 0; border-radius: 50%; background: none;
}
.icon-button:active { background: var(--sunken); }

.difficulty {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.difficulty-easy { color: var(--easy); }
.difficulty-medium { color: var(--medium); }
.difficulty-hard { color: var(--hard); }
.pips { display: inline-flex; gap: 2px; }
.pips i { width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; opacity: .22; }
.pips i.on { opacity: 1; }

.empty {
  display: grid; justify-items: center; gap: .7rem; text-align: center;
  padding: 2.2rem 1.2rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.empty h2 { font-family: var(--display); font-size: 1.35rem; letter-spacing: -.03em; }
.empty p { color: var(--muted); max-width: 26rem; }
.empty-icon {
  display: grid; place-items: center; width: 3.4rem; height: 3.4rem; border-radius: 50%;
  background: var(--accent); color: #1b1915;
}

/* ---------- Today ---------- */

.day-meta { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-weight: 650; }
.day-card {
  display: grid; gap: .9rem; padding: 1.1rem; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.day-new { grid-template-columns: auto 1fr; align-items: center; column-gap: 1rem; }
.day-new > :not(.day-art, h2) { grid-column: 1 / -1; }
.day-new h2 { font-family: var(--display); font-weight: 800; font-size: 1.55rem; letter-spacing: -.035em; line-height: 1.05; text-wrap: balance; }
.day-text { display: grid; gap: .35rem; }
.day-text p:not(.fine) { color: var(--muted); }
/* Sixteen small cards in the four group colors. */
.day-art { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; width: 4.6rem; }

.day-art i { aspect-ratio: 1; border-radius: .3rem; background: var(--g0); }
.day-art i:is(:nth-child(1), :nth-child(8), :nth-child(10), :nth-child(15)) { background: var(--g1); }
.day-art i:is(:nth-child(3), :nth-child(5), :nth-child(12), :nth-child(14)) { background: var(--g2); }
.day-art i:is(:nth-child(4), :nth-child(6), :nth-child(11), :nth-child(13)) { background: var(--g3); }
.day-art.day-art-empty { width: 5.4rem; gap: .3rem; }
.day-art.day-art-empty i:nth-child(n) { background: none; border: 1.5px dashed color-mix(in srgb, var(--muted) 55%, transparent); }
.day-score { display: flex; align-items: baseline; gap: .55rem; }
.day-score strong {
  font-family: var(--display); font-weight: 800; font-size: 3.6rem; line-height: .85; letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.day-score span { color: var(--muted); font-weight: 650; }
.day-detail { color: var(--muted); }
.points-meter { display: flex; align-items: center; gap: .3rem; }
.points-meter i {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: .5rem;
  background: var(--sunken); color: var(--muted); font-style: normal; font-weight: 800; font-size: .9rem;
}
.meter-group.on { color: #1b1915; }
.meter-group.on:nth-child(1) { background: var(--g0); }
.meter-group.on:nth-child(2) { background: var(--g1); }
.meter-group.on:nth-child(3) { background: var(--g2); }
.meter-group.on:nth-child(4) { background: var(--g3); }
.meter-plus { display: grid; margin-inline: .25rem .05rem; color: var(--muted); }
.meter-plus .icon { width: 1.1rem; height: 1.1rem; fill: currentColor; stroke: none; }
.points-meter i.meter-bonus { width: 1.25rem; height: 1.25rem; border-radius: 50%; }
.meter-bonus.on { background: var(--accent); box-shadow: inset 0 0 0 2px #1b1915; }
.empty-day { padding-block: 2.6rem; }
/* The week in review (PE-24): last week's card, on Today and in a sheet from You. */
.week-review {
  display: grid; gap: .55rem; padding: 1.1rem; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); min-width: 0;
}
.week-review > * { margin: 0; }
.week-review-title { font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; line-height: 1.1; }
.week-review-points { color: var(--muted); font-weight: 650; }
.week-review-points strong {
  font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: .9; letter-spacing: -.05em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.week-review-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; padding: .2rem 0; list-style: none; }
.week-review-day { display: grid; justify-items: center; gap: .2rem; min-width: 0; }
.week-review-day small { color: var(--muted); font-size: .72rem; font-weight: 800; }
.week-review-stamp {
  display: grid; place-items: center; width: min(2.3rem, 100%); aspect-ratio: 1; border-radius: .55rem;
  background: var(--accent); color: #1b1915; font-weight: 800; font-size: .9rem; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1.5px #1b1915; transform: rotate(-5deg);
}
.week-review-day:nth-child(even) .week-review-stamp { transform: rotate(4deg); }
.week-review-late .week-review-stamp { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.week-review-playing .week-review-stamp { background: var(--sunken); color: var(--ink); box-shadow: none; }
.week-review-missed .week-review-stamp { background: var(--ink); color: var(--paper); box-shadow: none; }
.week-review-none .week-review-stamp { background: none; box-shadow: none; border: 1.5px dashed color-mix(in srgb, var(--muted) 55%, transparent); }
.week-review-line { font-weight: 650; }
.week-review-note, .week-review-stamps { color: var(--muted); font-size: .92rem; }
.week-review .button { margin-top: .35rem; }
.week-review-sheet .week-review { padding: 0; background: none; box-shadow: none; }
.fact { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .8rem; padding: .8rem .9rem; }
.fact > span:last-child { display: grid; gap: .1rem; min-width: 0; }
.fact-mark {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .75rem;
  background: var(--sunken); color: var(--ink);
}
.fact-mark.lit { background: var(--accent); color: #1b1915; }
.fact-mark.lit .icon { fill: #ff6a3d; }
.week { display: grid; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.week li { display: grid; grid-template-columns: 2.3rem auto 1fr auto; align-items: center; gap: .7rem; padding: .5rem .9rem; }
.week li + li { border-top: 1px solid var(--line); }
.week-day { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.week-mark { display: grid; color: var(--muted); }
.week-mark .icon { width: 1.2rem; height: 1.2rem; }
.week-text { display: grid; min-width: 0; }
.week-text strong { font-size: .98rem; }
.week-today { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.week-today .week-day, .week-today .week-mark { color: var(--ink); }
.week-today .tag { background: var(--ink); color: var(--paper); }
/* PE-5: the player's week. */
.week-total { display: grid; gap: .45rem; margin-bottom: .6rem; }
.week-sum { margin: 0; color: var(--muted); font-size: .95rem; }
.week-sum strong { color: var(--ink); font-size: 1.35rem; font-weight: 800; }
.week-bar { display: block; height: .5rem; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.week-bar i { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--accent); box-shadow: inset 0 0 0 1.5px #1b1915; }
.week-total .week-bar i[style*="width:0%"] { box-shadow: none; }
.week-end { display: grid; justify-items: end; gap: .1rem; text-align: right; }
.week-end small { color: var(--muted); font-size: .72rem; line-height: 1.15; }
.week-score { font-size: .98rem; font-weight: 800; color: var(--ink); white-space: nowrap; }
.week-missed .week-score, .week-ahead, .week-none { color: var(--muted); }
.week-missed .week-score { font-weight: 600; font-style: italic; }
.week-ahead .week-text strong, .week-none .week-text strong { font-weight: 600; }
.week-ahead { opacity: .72; }

.bonus-card, .explore-card, .plus-banner {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem;
  width: 100%; padding: .85rem .9rem; border: 0; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); text-align: left; text-decoration: none;
}
.bonus-card > span:nth-child(2), .explore-card > span:nth-child(2),
.plus-banner > span:nth-child(2) { display: grid; gap: .1rem; min-width: 0; }
.bonus-card strong, .explore-card strong, .plus-banner strong { font-size: 1.05rem; }
.bonus-card > .icon, .explore-card > .icon, .plus-banner > .icon { color: var(--muted); }
/* Inside the day's card the bonus round sits on the page color, and an open one is the next thing to do. */
.day-card .bonus-card { background: var(--sunken); box-shadow: none; }
.day-card .bonus-open { background: var(--primary); color: var(--on-primary); }
.day-card .bonus-open small, .day-card .bonus-open > .icon { color: color-mix(in srgb, var(--on-primary) 72%, transparent); }
.bonus-mark, .explore-icon, .plus-mark {
  display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: .8rem;
  background: var(--accent); color: #1b1915;
}
.bonus-mark .icon { fill: #1b1915; stroke: none; }
.explore-icon { background: var(--sunken); color: var(--ink); }
.plus-banner { background: var(--ink); color: var(--paper); }
.plus-banner small { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.plus-banner > .icon { color: inherit; }

/* ---------- Rows (the archive, a bundle, yesterday) ---------- */

.rows { display: grid; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.rows li + li { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem;
  width: 100%; padding: .7rem .9rem; border: 0; background: none; text-align: left;
}
.row:active { background: var(--sunken); }
.row:disabled { cursor: default; }
.row-date {
  display: grid; place-items: center; align-content: center; width: 2.8rem; height: 2.8rem; border-radius: .75rem;
  background: var(--sunken); line-height: 1;
}
.row-date small { font-size: .6rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.row-date strong { font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.row-solved .row-date { background: var(--accent); color: #1b1915; }
.row-solved .row-date small { color: #1b1915; }
.row-text { display: grid; gap: .1rem; min-width: 0; }
.row-text strong { font-size: 1.02rem; }
.row-text small { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .7rem; }
.row-end { color: var(--muted); display: grid; }
.row-solved .row-end { color: var(--easy); }

/* ---------- Bundles ---------- */

.pack-grid { display: grid; gap: .8rem; margin: 0; padding: 0; list-style: none; }
.pack-grid > li { display: grid; }
@media (min-width: 560px) { .pack-grid { grid-template-columns: 1fr 1fr; } }
/* The bundle row on the Archive (LR-2): cards that scroll sideways and snap
   at each card. The next card shows at the edge, so there is more to see. */
.pack-row { display: grid; gap: .7rem; min-width: 0; }
.pack-row .section-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.pack-row .section-head h2 { font-size: 1.25rem; }
.pack-row-steps { display: flex; gap: .4rem; }
.pack-row-steps[hidden] { display: none; }
.pack-row-step {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.pack-row-step:disabled { color: var(--muted); opacity: .45; cursor: default; }
.pack-row-step .icon { width: 1.2rem; height: 1.2rem; }
.pack-row-track {
  display: flex; gap: .8rem; margin: -.4rem -.4rem 0; padding: .4rem .4rem .9rem; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: .4rem;
  scrollbar-width: thin;
}
.pack-row-track > li { display: grid; flex: 0 0 min(78%, 15.5rem); scroll-snap-align: start; }
.pack-row-track .pack-card { min-height: 10.5rem; }
.pack-cover {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .8rem;
  background: rgb(255 255 255 / .55); color: #1b1915;
}
.pack-cover .icon { width: 1.4rem; height: 1.4rem; }
.pack-card:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pack-card {
  display: grid; gap: .35rem; align-content: start; min-height: 9.5rem; padding: 1rem;
  border-radius: var(--radius); color: #1b1915; text-decoration: none; box-shadow: var(--shadow);
  background-image: radial-gradient(circle at 100% 0, rgb(255 255 255 / .5), transparent 45%);
}
.pack-0 { background-color: var(--g1); }
.pack-1 { background-color: var(--g2); }
.pack-2 { background-color: var(--g3); }
.pack-3 { background-color: var(--g0); }
.pack-card strong { font-family: var(--display); font-weight: 800; font-size: 1.6rem; letter-spacing: -.04em; line-height: 1.05; }
.pack-card small { color: rgb(27 25 21 / .72); font-size: .9rem; }
.pack-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; font-size: .8rem; font-weight: 750; }
.pack-count { letter-spacing: .05em; text-transform: uppercase; }
.pack-card > .pack-count { font-size: .8rem; font-weight: 750; }
.pack-price { padding: .2rem .65rem; border-radius: 99px; background: #1b1915; color: #fbf8f0; }
.pack-price.owned { background: rgb(255 255 255 / .6); color: #1b1915; }
.pack-meta, .pack-pictures-count { color: var(--muted); font-weight: 650; font-size: .9rem; }
/* The bundle's Strange Pictures (LR-45): the count before buying, and the owner's list with its Restart. */
.pack-pictures { font-weight: 650; }
.row-thumb { padding: 0; overflow: hidden; }
.row-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pack-pictures-section { display: grid; gap: .8rem; margin-top: 1.4rem; }
.pack-pictures-section .section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem .8rem; }
.pack-pictures-section .section-head h2 { font-size: 1.25rem; }
.pack-pictures-section > .button { justify-self: start; }
.pack-inside small { color: var(--muted); }
.pack-special { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .7rem; font-weight: 650; }
.back-link { display: inline-flex; align-items: center; gap: .1rem; margin-left: -.35rem; color: var(--muted); font-weight: 650; text-decoration: none; }
.back-link .icon { width: 1.15rem; height: 1.15rem; }

/* ---------- You ---------- */

.avatar {
  display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--g3); color: #1b1915; font-family: var(--display); font-weight: 800; font-size: 1.3rem;
}
/* The rows on You, each a link to its page under You (LR-1). */
.you-rows .row { grid-template-columns: 1fr auto; min-height: 3.5rem; text-decoration: none; }
.you-rows .row:focus-visible { outline-offset: -3px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.stat {
  display: grid; gap: .1rem; justify-items: center; padding: .85rem .3rem;
  border-radius: 1rem; background: var(--surface); box-shadow: var(--shadow); text-align: center;
}
.stat strong { font-family: var(--display); font-weight: 800; font-size: 1.65rem; letter-spacing: -.03em; line-height: 1; }
.card { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-line, .setting {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .8rem .9rem;
}
.card > * + * { border-top: 1px solid var(--line); }
.card-line > span:first-child:not(.avatar), .card-main { display: grid; gap: .1rem; min-width: 0; }
.card-main { flex: 1; }
.card-line .button { flex: none; }
.setting > span { font-weight: 700; }
.button-pair { display: flex; gap: .4rem; }
.segmented { display: flex; padding: .2rem; border-radius: 99px; background: var(--sunken); }
.segmented button {
  min-height: 2.75rem; padding: .25rem .8rem; border: 0; border-radius: 99px; background: none;
  font-weight: 650; font-size: .88rem; color: var(--muted); white-space: nowrap;
}
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
.stand-ins { display: grid; gap: .6rem; padding-top: .4rem; }
.stand-ins > summary { cursor: pointer; color: var(--muted); font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: -.03em; }
.stand-ins > * + * { margin-top: .6rem; }
.card-line-wrap { flex-wrap: wrap; }
/* The account screens (AC-5). */
.email-shown { overflow-wrap: anywhere; }
.account-form, .account-form form { display: grid; gap: .9rem; }
.account-actions { display: grid; gap: .5rem; }
.account-actions .button { width: 100%; min-height: 2.75rem; }
.account-actions .button[hidden] { display: none; }
.account-outcome { margin: 0; }
.account-other-ways { display: grid; gap: .5rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.account-other-ways[hidden], .passkey-offer[hidden] { display: none; }
.account-other-ways p { margin: 0; }
/* Sign in with Apple (AC-15), in Apple's black style: the logo and the words, as Apple's guidelines for the button ask. In dark mode, white. */
.button-apple { background: #000; color: #fff; gap: .45rem; }
.button-apple .apple-logo { width: 1rem; height: 1rem; fill: currentColor; flex: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .button-apple { background: #fff; color: #000; } }
:root[data-theme='dark'] .button-apple { background: #fff; color: #000; }
.apple-first { display: grid; gap: .5rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.other-way { display: grid; gap: .5rem; }
.apple-first[hidden], .other-way[hidden] { display: none; }
.apple-first p { margin: 0; }
.account-outcome:focus { outline: none; }
.avatar .icon { width: 1.4rem; height: 1.4rem; }
.nudge { display: grid; gap: .6rem; padding: .85rem .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.nudge p { margin: 0; }
.nudge-actions { display: flex; gap: .5rem; }
.nudge-actions .button { flex: 1; min-height: 2.75rem; }
.sheet .nudge { box-shadow: none; background: var(--sunken); }
/* The invitation to subscribe on Today and on the day's result (LR-3). */
.subscribe-invite {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6rem .8rem; align-items: center;
  padding: .85rem .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: left;
}
.subscribe-invite-mark {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: .8rem; background: var(--ink); color: var(--paper);
}
.subscribe-invite-text { display: grid; gap: .1rem; min-width: 0; }
.subscribe-invite-text strong { font-size: 1.05rem; }
.subscribe-invite-text small { color: var(--muted); text-wrap: pretty; }
.subscribe-invite-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; }
.subscribe-invite-actions .button { flex: 1 1 auto; min-height: 2.75rem; padding-inline: 1rem; }
.sign-out { display: grid; justify-items: center; }
@media (max-width: 420px) {
  .setting { flex-direction: column; align-items: stretch; }
  .segmented button { flex: 1; }
}

/* ---------- Leaderboard ---------- */

.ranks {
  width: 100%; border-collapse: separate; border-spacing: 0; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden; font-variant-numeric: tabular-nums;
}
.ranks th, .ranks td { padding: .7rem .5rem; text-align: left; }
.ranks thead th {
  font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.ranks tbody tr + tr > * { border-top: 1px solid var(--line); }
.ranks :is(th, td):first-child { padding-left: .9rem; width: 3rem; }
.ranks :is(th, td):last-child { padding-right: .9rem; }
.ranks .rank { font-family: var(--display); font-weight: 800; font-size: 1.05rem; color: var(--muted); }
.ranks tbody th { font-weight: 700; overflow-wrap: anywhere; }
.ranks .num { width: 4rem; text-align: right; color: var(--muted); }
.ranks td.lead { color: var(--ink); font-weight: 800; }
.rank-you > * { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.rank-you .rank { color: var(--ink); }
.own-rank .card-line { flex-wrap: wrap; }
.own-rank .card-line > span:first-child { flex: 1 1 11rem; }
.rank-badge { font-family: var(--display); font-weight: 800; font-size: 1.6rem; letter-spacing: -.03em; }
.ranks .report-name { display: inline-grid; vertical-align: middle; width: 2.75rem; height: 2.75rem; margin: -.7rem -.6rem -.7rem .1rem; color: var(--muted); }
.ranks .report-name .icon { width: 1rem; height: 1rem; }
.name-hidden { color: var(--muted); font-style: italic; font-weight: 600; }
.ranks .player { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.ranks .player-main { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem; min-width: 0; }
.ranks .player-name { overflow-wrap: anywhere; min-width: 0; }
/* Report flags line up at the end of the player's cell. */
.ranks .player .report-name { margin-left: auto; }
@media (max-width: 379px) {
  .ranks th, .ranks td { padding-inline: .35rem; }
  .ranks :is(th, td):first-child { padding-left: .7rem; width: 2.4rem; }
  .ranks :is(th, td):last-child { padding-right: .7rem; }
  .ranks .num { width: 3rem; }
  /* These come before the streak rules below, so they name the table to win. */
  .ranks td.streak-cell { width: 3.5rem; }
  .ranks .streak-mark { gap: .1rem; padding: .1rem .3rem .1rem .2rem; font-size: .8rem; }
  .ranks .streak-mark .icon { width: .9rem; height: .9rem; }
  .ranks tbody th { font-size: .94rem; }
  /* The flag keeps its 44px target and overlaps the cell's padding. */
  .ranks .player .report-name { margin-inline: -.55rem -.7rem; }
}
/* The rows around a player below the top 50 (PE-8), set off by a dashed rule. */
.ranks .around-head th {
  padding: .55rem .9rem .45rem; border-top: 2px dashed var(--line);
  font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.ranks .around tr.around-head + tr > * { border-top: 0; }
.rank-guest .tag { background: var(--surface); }
/* The Hot Streak: the board's four groups in their colors. The flame stays the Play Streak's. */
.icon-hot { stroke: #1b1915; stroke-width: 1.3; }
.icon-hot path:nth-child(1) { fill: var(--g0); }
.icon-hot path:nth-child(2) { fill: var(--g1); }
.icon-hot path:nth-child(3) { fill: var(--g2); }
.icon-hot path:nth-child(4) { fill: var(--g3); }
/* The one streak a row shows: the Hot Streak's four squares or the Play Streak's flame, with its length. */
.ranks .streak-cell { width: 4.6rem; }
.streak-mark {
  display: inline-flex; align-items: center; gap: .2rem; padding: .14rem .45rem .14rem .3rem; border-radius: 99px;
  background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink); font-size: .88rem; font-weight: 800; line-height: 1.2; white-space: nowrap;
}
.streak-mark .icon { width: 1.05rem; height: 1.05rem; }
.streak-play .icon { fill: #ff6a3d; }
.no-streak { color: var(--muted); }
.streak-key { display: grid; gap: .45rem; margin-top: 1rem; }
.streak-key p { display: flex; align-items: center; gap: .6rem; margin: 0; color: var(--muted); font-size: .88rem; }
.streak-key strong { color: var(--ink); }
.streak-key .fine { margin-top: .2rem; }
.key-mark { display: grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; border-radius: .6rem; background: var(--sunken); color: var(--ink); }
.key-mark .icon { width: 1.1rem; height: 1.1rem; }
.key-play .icon { fill: #ff6a3d; }
.stat-note { font-size: .72rem; }
.report-reasons { border: 0; margin: 0; padding: 0; display: grid; gap: .35rem; }
.report-reasons legend { font-weight: 700; margin-bottom: .35rem; }
.report-reason { display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; }
.delete-list { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .3rem; }

/* ---------- Stacked screens: board and bonus round ---------- */

/* Nothing on the board's screen may push it sideways, such as a stamp as it lands. */
#stack { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; overflow-x: clip; }
.stack-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: calc(.35rem + env(safe-area-inset-top)) .4rem .35rem;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.stack-title { display: grid; justify-items: center; gap: .05rem; min-width: 0; }
/* Equal sides keep the title centered when one side holds two buttons. */
.stack-side { flex: 1 0 0; display: flex; align-items: center; gap: .15rem; }
.stack-side-end { justify-content: flex-end; }
.stack-title h1 { font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.03em; text-align: center; }
.stack-detail { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .78rem; font-weight: 650; }
.score { font-family: var(--display); font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack-bar .score { margin-right: .5rem; padding: .3rem .7rem; border-radius: 99px; background: var(--accent); color: #1b1915; font-size: .92rem; }

.play {
  width: min(100% - 1.2rem, 33rem); margin-inline: auto;
  padding: .3rem 0 calc(1.5rem + env(safe-area-inset-bottom));
  display: grid; gap: .55rem; align-content: start;
}
/* On a wide screen, keep the whole board on one screen. */
@media (min-width: 760px) and (max-height: 900px) { .play { width: min(100% - 1.2rem, 29rem); } }

.grid, .groups { display: grid; gap: .4rem; }
.grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.groups:empty { display: none; }
.cell { position: relative; aspect-ratio: 1; min-width: 0; }
.tile {
  display: grid; width: 100%; height: 100%; padding: 0; border: 0; border-radius: .7rem;
  background: var(--surface); color: var(--ink); overflow: hidden;
  box-shadow: 0 1px 2px rgb(0 0 0 / .1);
  transition: transform .13s cubic-bezier(.3, 1.6, .5, 1), box-shadow .13s ease;
  -webkit-user-select: none; user-select: none;
}
.tile .text-card { border-radius: .7rem; min-height: 0; }
.tile:has(.text-card) { padding: 0; }
.tile img { pointer-events: none; -webkit-user-drag: none; }
.rebus.picture { display: grid; place-items: center; width: 100%; height: 100%; background: #fbf7ee; }
.rebus.picture .rebus-artwork { width: 100%; height: 100%; object-fit: contain; }
.rebus-artwork.pixel { image-rendering: pixelated; }
.rebus-lettering {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: clamp(.6rem, 2.6vw, .9rem); color: #1b1915;
}
/* A card that can turn over carries a gold dog-ear in its bottom corner,
   translucent, with a tiny black circular arrow on it (85% of a circle). A double tap turns
   the card. The gold is darker in light mode and brighter in dark mode, at
   80% so the card shows faintly through. The arrow sits in the triangle's
   incircle: the box is .46 of the leg, inset .07 from each straight edge.
   The triangle sits just inside the card's rounded edge, which would
   otherwise clip its point. */
.tile-turns {
  --corner: 1.3rem;
  --turn-arrow: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><g fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M13.9 5.7A6.6 6.6 0 1 1 8.0 6.7'/><path d='M3.6 7.0 L8.0 6.7 L7.6 11.1'/></g></svg>");
}
.tile-turns::before {
  content: ''; position: absolute; right: .25rem; bottom: .25rem; z-index: 1;
  width: var(--corner); height: var(--corner);
  background:
    var(--turn-arrow) right calc(var(--corner) * .07) bottom calc(var(--corner) * .07) / calc(var(--corner) * .46) no-repeat,
    linear-gradient(to bottom right, transparent 50%, var(--turn-corner) 50%);
  pointer-events: none;
}
.cell:has(.turn-away, .turn-in) { perspective: 24rem; }
.tile[aria-pressed='true'] {
  transform: scale(.92);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink);
}
/* The shared card sheet draws its own inner ring. The outer ring above is enough. */
.tile[aria-pressed='true'] .text-card, .tile[aria-pressed='true'] .has-title-artwork::after { box-shadow: none; }
.tile[aria-pressed='true']::after {
  content: ''; position: absolute; top: .3rem; left: .3rem; width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: #1b1915 no-repeat center / .7rem
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d9f36a' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.500 10 17.500 19 7'/%3E%3C/svg%3E");
  box-shadow: 0 0 0 2px var(--paper);
}

/* A found group is a full band in its colour (TF-34, after TF-30). */
.band {
  position: relative; display: grid; gap: .35rem; padding: .5rem .5rem .55rem; border-radius: .9rem;
  background: var(--band); color: var(--on-group);
}
.band-0 { --band: var(--g0); }
.band-1 { --band: var(--g1); }
.band-2 { --band: var(--g2); }
.band-3 { --band: var(--g3); }
.band h2 { font-size: .95rem; font-weight: 800; text-align: center; line-height: 1.2; text-wrap: balance; }
.band-scored h2 { padding-inline: 2.7rem; }
/* What the group earned: a stamp in the colour of the points (the running
   score in the dock and the bonus badge), tilted over the band's corner with
   a paper ring, so it reads as points scored rather than a label. */
.band-points {
  position: absolute; top: -.3rem; right: -.3rem; display: grid; place-items: center;
  min-width: 2.35rem; height: 2.35rem; padding-inline: .3rem; border-radius: .75rem;
  background: var(--accent); color: #1b1915; transform: rotate(-8deg); pointer-events: none;
  box-shadow: 0 0 0 2.5px var(--paper), 0 3px 8px rgb(27 25 21 / .22);
  font-family: var(--display); font-weight: 800; font-size: 1.12rem; letter-spacing: -.03em; line-height: 1;
}
.band .answer-cards { margin: 0; gap: .35rem; }
/* A card travelling from the grid into its band rises above the rest (play-view.js). */
.band .answer-cards > li { position: relative; }
/* The stamp's ink ring, which shows only as the stamp strikes (PE-10). */
.band-points::after {
  content: ''; position: absolute; inset: -.2rem; border-radius: .95rem;
  border: 2px solid var(--accent); opacity: 0; pointer-events: none;
}
.band { --inspect-radius: .55rem; }
.band .text-card { border-radius: .55rem; }
/* A group shown after a loss: the band's colour as an outline, no stamp. */
.band-revealed { background: var(--sunken); color: var(--ink); box-shadow: inset 0 0 0 2px var(--band); }

/* The board's controls. On a phone they are a dock on the bottom edge, where
   the tab bar is on the other screens. On a wide or very short screen they
   are a panel under the grid. */
.play-dock { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.dock-inner { display: grid; gap: .5rem; padding: .6rem; }
.misses { display: flex; align-items: center; justify-content: space-between; gap: .6rem; min-height: 2.1rem; color: var(--muted); font-weight: 650; font-size: .92rem; }
.misses-left { display: inline-flex; align-items: center; gap: .4rem; }
.misses .score { padding: .3rem .7rem; border-radius: 99px; background: var(--accent); color: #1b1915; font-size: .92rem; }
/* Guesses left, as a deck. The top card carries the number, and each further
   guess is a card edge behind it, up and to the right. */
.guess-deck { display: grid; width: 1.7rem; height: 1.7rem; margin: .4rem .7rem 0 0; }
.guess-deck b {
  --edge: var(--surface);
  --card: var(--primary);
  display: grid; place-items: center; border-radius: .45rem; background: var(--card); color: var(--on-primary);
  font-family: var(--display); font-weight: 800; font-size: 1.05rem; line-height: 1; font-variant-numeric: tabular-nums;
}
.guess-deck[data-left='2'] b { box-shadow: .1rem -.1rem 0 var(--edge), .24rem -.24rem 0 color-mix(in srgb, var(--card) 62%, var(--edge)); }
.guess-deck[data-left='3'] b {
  box-shadow: .1rem -.1rem 0 var(--edge), .24rem -.24rem 0 color-mix(in srgb, var(--card) 62%, var(--edge)),
    .34rem -.34rem 0 var(--edge), .48rem -.48rem 0 color-mix(in srgb, var(--card) 38%, var(--edge));
}
.guess-deck:not([data-left='0'], [data-left='1'], [data-left='2'], [data-left='3']) b {
  box-shadow: .1rem -.1rem 0 var(--edge), .24rem -.24rem 0 color-mix(in srgb, var(--card) 62%, var(--edge)),
    .34rem -.34rem 0 var(--edge), .48rem -.48rem 0 color-mix(in srgb, var(--card) 38%, var(--edge)),
    .58rem -.58rem 0 var(--edge), .72rem -.72rem 0 color-mix(in srgb, var(--card) 20%, var(--edge));
}
/* The last guess is the last card. */
.guess-deck[data-left='1'] b { --card: var(--hard); color: var(--surface); }
.guess-deck[data-left='0'] b { background: none; color: var(--muted); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--muted) 60%, transparent); }
/* Four columns, as the grid has. Submit takes the middle two. */
.play-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.play-actions .button { min-height: 3.5rem; padding: .4rem .3rem; border-radius: .7rem; }
.dock-tool { flex-direction: column; gap: .15rem; font-size: .76rem; }
.dock-tool .icon { width: 1.35rem; height: 1.35rem; }
.dock-submit { grid-column: span 2; gap: .5rem; font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
/* The same check that marks a picked card. */
.dock-submit .icon {
  width: 1.35rem; height: 1.35rem; padding: .22rem; border-radius: 50%;
  background: var(--on-primary); stroke: var(--primary); stroke-width: 3.4;
}
@media (max-width: 759px) and (min-height: 481px) {
  .play-dock {
    position: fixed; inset: auto 0 0; z-index: 9; border-radius: 0; box-shadow: none; border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .dock-inner {
    width: min(100% - 1.2rem, 33rem); margin-inline: auto;
    padding: .45rem max(0rem, env(safe-area-inset-right) - .6rem) calc(.55rem + env(safe-area-inset-bottom)) max(0rem, env(safe-area-inset-left) - .6rem);
  }
  /* The board on a phone with the dock. The grid stays where it starts, and
     each solved group stacks above it into the space under the bar, so the
     cards left on the board do not move when a group is found. Cards stay
     square on every phone (Adam, November 30, 2026), so a tall phone keeps
     some room above the board. The bar, the dock and the width are known
     here, so the sizes come from the small viewport, which does not change
     while a browser's toolbar slides away. */
  .play:has(> .play-dock:not([hidden])) {
    --bar: calc(3.52rem + env(safe-area-inset-top));
    --dock: calc(7.1rem + 1px + env(safe-area-inset-bottom));
    --room: calc(100svh - var(--bar) - var(--dock) - .3rem);
    --card-w: calc((min(100vw - 1.2rem, 33rem) - 1.2rem) / 4);
    /* Half of what the full grid leaves, and never less than the room to
       scroll the last cards clear of the dock. */
    --under: max(1.44rem, (var(--room) - 4 * var(--card-w) - 1.2rem) / 2);
    align-content: end; padding-bottom: calc(var(--dock) + var(--under));
  }
  /* A card that takes focus scrolls clear of the dock. */
  .play:has(> .play-dock:not([hidden])) .tile { scroll-margin-bottom: calc(var(--dock) + 1.44rem); }
  /* Over the dock's guesses-left row, which holds no button, so it covers no
     card and no button. Its bottom edge sits just above Shuffle, Submit and
     Clear: the dock's bottom padding, the buttons and the gap above them. It
     takes two lines at most, so it stays inside the gap under the grid. */
  body.stacked:has(.play-dock:not([hidden])) #toast {
    bottom: calc(4.7rem + env(safe-area-inset-bottom));
    max-width: min(24rem, calc(100vw - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
    padding: .5rem 1rem;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  }
  body.stacked:has(.play-dock:not([hidden])) #toast:empty { display: none; }
  /* A first-board tip sits in the room under the grid, over the dock, where
     the board keeps its slack for scrolling. The cards stay where they are,
     and the tip covers none of them. A toast takes its place for the moment
     it shows, as it reaches the same room. */
  .play:has(> .play-dock:not([hidden])) > .coach {
    position: fixed; z-index: 8; bottom: calc(var(--dock) + .15rem);
    left: 50%; translate: -50% 0; width: min(100vw - 1.2rem, 33rem);
  }
  body:has(#toast.show) .play > .coach { visibility: hidden; }
}

/* ---------- First-board tips (PE-9) ---------- */

/* A tip sits above the cards, in the room a phone board leaves there, so the
   cards stay where they are when it comes and goes. It holds no focus and
   covers no card, and the board is whole without it. */
.coach {
  display: flex; align-items: center; gap: .3rem;
  padding: .15rem .15rem .15rem .7rem; border-radius: .7rem;
  background: var(--surface); border: 1px solid var(--line); border-left: .3rem solid var(--turn-corner);
  box-shadow: var(--shadow);
}
.coach[hidden] { display: none; }
/* Two lines high whatever the tip says, so the cards stay put as the tips change. */
.coach p { flex: 1; min-width: 0; min-height: 2.44em; display: flex; align-items: center; font-size: .78rem; line-height: 1.22; font-weight: 650; text-wrap: balance; }
.coach-dismiss {
  flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.coach-dismiss .icon { width: 1.05rem; height: 1.05rem; }
.coach-dismiss:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
/* What the tip points at. Without motion the gold corner stays larger and the
   eye keeps a ring, so it still stands out. */
.coach-turn .tile-turns::before { transform: scale(1.35); transform-origin: right bottom; }
.stack-bar .inspector-eye.coach-target { box-shadow: 0 0 0 3px var(--turn-corner); }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion='reduce']) {
    .coach-turn .tile-turns::before { animation: coach-corner 1.3s ease-in-out infinite; }
    .stack-bar .inspector-eye.coach-target { animation: coach-eye 1.3s ease-in-out infinite; }
  }
}
@keyframes coach-corner { 50% { transform: scale(1.7); } }
@keyframes coach-eye { 50% { box-shadow: 0 0 0 6px transparent; } }

/* Hints on the board (PE-22): the control on the status line, and the hints
   taken, above the cards. */
/* A 44 px target that keeps the status line its usual height. */
.misses .hint-button { min-height: 2.75rem; min-width: 2.75rem; margin: -.35rem 0 -.35rem auto; padding: .2rem .9rem; font-size: .88rem; }
.misses .hint-button[hidden] { display: none; }
.hints { display: grid; gap: .35rem; }
.hints[hidden] { display: none; }
.hint {
  margin: 0; padding: .45rem .7rem; border-radius: .7rem; font-size: .84rem; line-height: 1.3;
  background: var(--surface); border: 1px solid var(--line); border-left: .3rem solid var(--accent); color: var(--ink);
}
.hint-stronger { border-left-color: var(--turn-corner); }
.hint .hint-card { color: var(--muted); font-weight: 650; }
.hint .hint-text { display: block; margin-top: .15rem; }
/* The hint just asked for again, when it was already showing. */
.hint.hint-again { outline: 2px solid var(--ink); outline-offset: 1px; }

.result { display: grid; gap: .8rem; padding-top: .4rem; }
.result-head { display: grid; gap: .2rem; text-align: center; padding: .6rem 0 .2rem; }
.result-head h2 { font-family: var(--display); font-weight: 800; font-size: 2.2rem; letter-spacing: -.045em; line-height: 1; }
.result-head p { color: var(--muted); }
.result-head .result-points { font-family: var(--display); font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; color: var(--ink); }
.result-next { color: var(--muted); text-align: center; text-wrap: balance; }
.next-up { color: var(--muted); text-align: center; text-wrap: balance; font-weight: 650; font-variant-numeric: tabular-nums; }
.bonus-intro .next-up { margin: 0; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.result-actions > :first-child { grid-column: 1 / -1; }
/* An odd button out takes the whole row. */
.result-actions > :last-child:nth-child(even) { grid-column: 1 / -1; }
.liner-notes { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); padding: .2rem .9rem; }
.liner-notes summary { padding: .7rem 0; font-weight: 750; cursor: pointer; }
.liner-notes ul { display: grid; gap: .8rem; padding-bottom: .9rem; }
.liner-notes li { display: grid; gap: .15rem; font-size: .93rem; }
.liner-notes p { color: var(--muted); }
.liner-notes a { font-weight: 650; }
/* How was this one? (PE-23, rating-view.js): five scores in a row, each a
   44 px target, that fit at 320 px. */
.rating { display: grid; gap: .55rem; padding: .85rem .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.rating[hidden] { display: none; }
.rating-head { display: flex; align-items: center; gap: .45rem; }
.rating-head h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.rating-scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .3rem; }
.rating-score {
  display: grid; justify-items: center; gap: .05rem; min-height: 2.9rem; padding: .3rem .1rem;
  border: 0; border-radius: .7rem; background: var(--sunken); color: var(--ink);
}
.rating-score b { font-family: var(--display); font-weight: 800; font-size: 1.15rem; line-height: 1.1; }
.rating-score small { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.rating-score[aria-pressed='true'] { background: var(--accent); color: #1b1915; box-shadow: inset 0 0 0 2px currentColor; }
.rating-score[aria-pressed='true'] small { color: inherit; }
.rating-status { margin: 0; }
.rating-note summary { font-weight: 700; cursor: pointer; padding: .2rem 0; }
.rating-note[open] { display: grid; gap: .4rem; }
.rating-text { width: 100%; font: inherit; font-size: 1rem; padding: .55rem .6rem; border-radius: .6rem; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); resize: vertical; }
.rating-text:focus { outline: none; border-color: var(--ink); }
.rating-note-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.rating-note-actions .button { min-height: 2.75rem; }

.how-to { display: grid; gap: .8rem; }
.how-to ol { display: grid; gap: .45rem; padding-left: 1.3rem; list-style: decimal; }

/* ---------- Bonus round ---------- */

.bonus-round {
  width: min(100% - 2rem, 30rem); margin-inline: auto; padding: .5rem 0 2rem;
  display: grid; gap: .9rem; align-content: start;
}
.bonus-intro { display: grid; justify-items: center; gap: .8rem; text-align: center; padding-top: 1.5rem; }
.bonus-intro h2 { font-family: var(--display); font-weight: 800; font-size: 2.3rem; letter-spacing: -.045em; line-height: 1; }
.bonus-intro p { color: var(--muted); max-width: 22rem; }
.bonus-badge {
  display: grid; place-items: center; width: 4.6rem; height: 4.6rem; border-radius: 1.4rem;
  background: var(--accent); color: #1b1915; transform: rotate(-6deg);
}
.bonus-badge .icon { width: 2.4rem; height: 2.4rem; fill: #1b1915; stroke: none; }
/* 13 of 13 (PE-10): the score stamp, large, with rays in the four group colours. */
.perfect-day { position: relative; display: grid; place-items: center; width: 9rem; height: 9rem; }
.perfect-stamp {
  display: grid; place-items: center; align-content: center; gap: .1rem; width: 5.1rem; height: 5.1rem;
  border-radius: 1.25rem; background: var(--accent); color: #1b1915; transform: rotate(-8deg);
  box-shadow: 0 0 0 3px var(--paper), 0 6px 16px rgb(27 25 21 / .25);
  font-family: var(--display); font-weight: 800; line-height: 1;
}
.perfect-stamp b { font-size: 2.35rem; letter-spacing: -.06em; }
.perfect-stamp small { font-size: .78rem; letter-spacing: .01em; }
.perfect-rays span {
  --turn: calc(var(--i) * 45deg);
  position: absolute; left: 50%; top: 50%; width: .42rem; height: 1rem; margin: -.5rem 0 0 -.21rem;
  border-radius: 99px; background: var(--g0); transform: rotate(var(--turn)) translateY(-3.95rem);
}
.perfect-rays span:nth-child(4n + 2) { background: var(--g1); }
.perfect-rays span:nth-child(4n + 3) { background: var(--g2); }
.perfect-rays span:nth-child(4n) { background: var(--g3); }
/* One mark for each clue, with its level beneath. */
.bonus-dots { display: flex; justify-content: center; gap: 1.1rem; }
.bonus-dots li { display: grid; justify-items: center; gap: .2rem; min-width: 3.4rem; }
.bonus-dot-mark {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--sunken); color: var(--muted); font-weight: 750; font-size: .9rem;
}
.bonus-dot-level { font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bonus-dots .current .bonus-dot-mark { background: var(--ink); color: var(--paper); }
.bonus-dots .current .bonus-dot-level { color: var(--ink); }
.bonus-dots .correct .bonus-dot-mark { background: var(--accent); color: #1b1915; }
.bonus-dots .missed .bonus-dot-mark { background: var(--g2); color: #1b1915; }
.bonus-dots .closed { opacity: .5; }
.bonus-dots .icon { width: 1.1rem; height: 1.1rem; stroke-width: 2.6; }
.bonus-line { font-weight: 750; font-size: 1.05rem; text-align: center; }
.bonus-clue { display: grid; justify-items: center; }
.bonus-clue img {
  display: block; width: min(100%, 46dvh); aspect-ratio: 1; object-fit: contain;
  border-radius: var(--radius); background: #fbf7ee; box-shadow: var(--shadow);
}
.bonus-clue figcaption { width: 100%; padding: 1rem; border-radius: var(--radius); background: #fbf7ee; color: #1b1915; box-shadow: var(--shadow); }
.bonus-clue, .bonus-verdict, .band h2, .result h2, .tile { scroll-margin-top: calc(4rem + env(safe-area-inset-top)); }
/* With the keyboard up, or the verdict showing, the picture gives up room so the answer field stays in view. */
@media (pointer: coarse) {
  .bonus-round:has(.bonus-form input:focus) .bonus-clue img,
  .bonus-round:has(.bonus-verdict) .bonus-clue img { width: min(100%, 24dvh); }
}
.bonus-form { display: grid; gap: .6rem; }
.bonus-form input, .field input {
  width: 100%; min-height: 3.1rem; padding: .6rem 1rem; border: 2px solid var(--line); border-radius: 1rem;
  background: var(--surface); font-size: 1.1rem;
}
.bonus-form input:focus, .field input:focus { outline: none; border-color: var(--ink); }
.bonus-feedback { display: grid; gap: .7rem; justify-items: center; text-align: center; }
.bonus-feedback:empty { display: none; }
.bonus-verdict { font-family: var(--display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.03em; }
.bonus-verdict.right { color: var(--easy); }
.bonus-answer { width: min(11rem, 55%); }
.bonus-name { font-weight: 800; font-size: 1.15rem; }
.bonus-given { color: var(--muted); }
/* A Strange Picture (LR-45): the guesses left, the line after an answer, and the other right answers. */
.picture-left { text-align: center; color: var(--muted); font-weight: 700; }
.picture-feedback { font-weight: 700; }
.picture-feedback.near { color: var(--ink); }
.picture-feedback.wrong { color: var(--hard); }
.picture-also { color: var(--muted); }
.bonus-error, .field-error { color: var(--hard); font-weight: 650; }
.field-error:empty { display: none; }
.bonus-answers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; width: 100%; }
.bonus-answers li { position: relative; display: grid; gap: .3rem; align-content: start; justify-items: center; text-align: center; }
.bonus-answers .answer-card { width: 100%; }
.bonus-thumb { display: block; width: 100%; border-radius: .7rem; overflow: hidden; background: #fbf7ee; box-shadow: 0 1px 2px rgb(0 0 0 / .1); }
.bonus-thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.bonus-answers .bonus-name { font-size: .82rem; line-height: 1.2; overflow-wrap: anywhere; }
.bonus-answers [class^='bonus-mark-'] {
  position: absolute; top: -.35rem; right: -.35rem; display: grid; place-items: center; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; box-shadow: 0 0 0 2px var(--paper);
}
.bonus-mark-right { background: var(--accent); color: #1b1915; }
.bonus-mark-wrong { background: var(--g2); color: #1b1915; }
.bonus-answers [class^='bonus-mark-'] .icon { width: .95rem; height: .95rem; stroke-width: 2.8; }

/* ---------- Waldo, the guide (PE-30) ---------- */

/* His pictures are cutouts, so he stands on whatever surface he is on, light
   or dark, and each is drawn whole. He is small wherever he is. He moves
   three ways: he settles in when he first has something to say, he rises to
   peek in on an empty screen, and he nods when a practice is done. All three
   are below, with the other motion, and all stop with the Motion setting. */
.waldo-face { display: block; flex: none; width: 2.6rem; height: 2.6rem; object-fit: contain; }
/* A cutout has clear room around him. In a row that room is taken back, so his words keep their width. */
.waldo-aside .waldo-face { margin-inline: -.3rem; }

/* One line from him and one thing to do: a row to tap, as the app's other
   rows are. It has no card of its own unless the place gives it one. */
.waldo-aside { display: flex; align-items: center; min-width: 0; }
.waldo-aside-go {
  flex: 1; display: flex; align-items: center; gap: .6rem; min-width: 0; min-height: 2.75rem; padding: 0;
  border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.waldo-aside-go span { flex: 1; min-width: 0; font-size: .9rem; line-height: 1.3; font-weight: 600; text-wrap: pretty; }
.waldo-aside-go > .icon { flex: none; width: 1.1rem; height: 1.1rem; color: var(--muted); }
.waldo-aside-close {
  flex: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin-right: -.6rem; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.waldo-aside-close .icon { width: 1.05rem; height: 1.05rem; }
/* Under Play, in a new player's day card. */
.waldo-hello { padding-top: .7rem; border-top: 1px solid var(--line); }
.waldo-hello span { color: var(--muted); }
/* On Today, below the day's card. */
.waldo-news { padding: .5rem .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
/* At the top of How to play. */
.waldo-offer { padding: .45rem .8rem; border-radius: var(--radius); background: var(--surface); }
/* In an empty screen. */
.waldo-line {
  display: flex; align-items: flex-end; gap: .55rem; margin-top: .3rem; padding-right: .3rem; text-align: left;
  border-bottom: 1.5px solid var(--line); font-size: .86rem; line-height: 1.9rem; font-weight: 600; color: var(--muted);
}
/* He peeks over the rule under his words. The window shows the lower part of
   the picture, which is where all of him is, and hides him as he rises. */
.waldo-peeks { flex: none; display: block; overflow: hidden; }
.waldo-line .waldo-face { width: 3rem; height: 1.3rem; object-fit: cover; object-position: bottom; }

/* The guide. Its head and buttons stay put; only what is between them
   scrolls, so nothing is drawn under the buttons on a short phone. */
.waldo-guide[open] { display: flex; flex-direction: column; overflow: hidden; }
.waldo-guide .sheet-head, .waldo-guide .sheet-actions { flex: none; }
.waldo-guide .sheet-head h2:focus { outline: none; }
.waldo-guide .sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.waldo-guide .sheet-actions { padding-top: .7rem; border-top: 1px solid var(--line); }
.waldo-stage, .waldo-demo, .waldo-practice { display: grid; gap: .75rem; }
/* Waldo and what he is saying. The words keep three lines of room, so the
   cards do not move as he says something new. */
.waldo-says { display: flex; align-items: flex-start; gap: .6rem; }
.waldo-says .waldo-face { width: 2.9rem; height: 2.9rem; margin-top: -.15rem; }
.waldo-says p {
  flex: 1; min-width: 0; margin: 0; padding: .55rem .75rem; border-radius: .25rem .9rem .9rem .9rem;
  background: var(--surface); font-size: .92rem; line-height: 1.3; font-weight: 600; text-wrap: pretty;
}
.waldo-demo .waldo-says p { min-height: calc(3.9em + 1.1rem); }
.waldo-demo h3 { font-family: var(--display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.waldo-demo h3:focus { outline: none; }

.waldo-topics { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.waldo-topic {
  display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 3.2rem; padding: .45rem .5rem .45rem .9rem;
  border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer;
}
.waldo-topic > span:first-child { flex: 1; display: grid; gap: .1rem; min-width: 0; }
.waldo-topic strong { font-weight: 700; }
.waldo-topic small { color: var(--muted); font-size: .82rem; text-wrap: pretty; }
.waldo-topic .tag { margin: 0; background: var(--accent); color: #1b1915; }
.waldo-topic > .icon { flex: none; width: 1.1rem; height: 1.1rem; color: var(--muted); }
.waldo-topic-done { flex: none; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent); color: #1b1915; }
.waldo-topic-done .icon { width: .95rem; height: .95rem; stroke-width: 2.8; }

/* The practice cards are a board's cards, smaller where there are fewer. */
.waldo-grid { gap: .4rem; }
.waldo-grid[hidden] { display: none; }
.waldo-grid-one { grid-template-columns: minmax(0, 7.5rem); justify-content: center; }
.waldo-grid-two { grid-template-columns: repeat(2, minmax(0, 7rem)); justify-content: center; }
.waldo-groups:empty { display: none; }
.waldo-band { gap: .1rem; text-align: center; }
.waldo-band p { margin: 0; font-size: .88rem; }
.waldo-band .waldo-band-label { font-weight: 800; font-size: .95rem; }
.waldo-row { display: flex; align-items: center; justify-content: center; gap: .7rem; }
.waldo-row .button { min-width: 8rem; }
/* The gold corner is its own button over the card's corner, so a keyboard can reach it. */
.waldo-corner {
  position: absolute; right: 0; bottom: 0; z-index: 2; width: 2.4rem; height: 2.4rem; padding: 0;
  border: 0; border-radius: 0 0 .7rem 0; background: transparent; cursor: pointer;
}
.waldo-corner:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.waldo-rebus {
  display: grid; place-content: center; justify-items: center; gap: .25rem; width: 100%; height: 100%;
  background: #fbf7ee; color: #1b1915; font-family: var(--display); font-weight: 800;
  font-size: clamp(.8rem, 4vw, 1.05rem); letter-spacing: .05em;
}
.waldo-rebus-line { width: 4.2em; height: .14rem; background: currentColor; }
.waldo-picture { background: #fbeca0; }
.waldo-picture img { width: 100%; height: 100%; object-fit: cover; }
.waldo-eye-row { justify-content: flex-start; }

.waldo-about { display: flex; align-items: center; gap: .8rem; padding: .8rem .9rem; }
.waldo-about .waldo-face { width: 3.6rem; height: 3.6rem; }
.waldo-about p { margin: 0; text-wrap: pretty; }
.waldo-more { padding: 0 .9rem; }
/* A list item, so the summary keeps its disclosure marker. */
.waldo-more summary { display: list-item; padding: .7rem 0; color: var(--muted); font-weight: 650; cursor: pointer; }
.waldo-more p { margin: 0 0 .85rem; }

@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion='reduce']) {
    .waldo-aside .waldo-face { animation: waldo-settle .5s cubic-bezier(.3, 1.4, .5, 1) .15s both; }
    .waldo-line .waldo-face { animation: waldo-rise .7s cubic-bezier(.3, 1.2, .5, 1) .45s both; }
    .waldo-face.waldo-nod { animation: waldo-nod .45s ease; }
  }
}
@keyframes waldo-settle { from { opacity: 0; transform: translateY(.35rem) rotate(-10deg); } }
@keyframes waldo-rise { from { transform: translateY(100%); } }
@keyframes waldo-nod { 35% { transform: translateY(.14rem) rotate(7deg); } 70% { transform: rotate(-3deg); } }

/* ---------- Sheets and toast ---------- */

.sheet {
  width: 100%; max-width: 32rem; max-height: 88dvh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 1.5rem 1.5rem 0 0; background: var(--paper); color: var(--ink);
  box-shadow: 0 -8px 40px rgb(0 0 0 / .25);
}
.sheet::backdrop { background: rgb(15 13 10 / .5); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem .6rem .2rem 1.2rem; }
.sheet-head h2 { font-family: var(--display); font-weight: 800; font-size: 1.45rem; letter-spacing: -.035em; }
.sheet-body { padding: .5rem 1.2rem 1.2rem; }
.sheet-actions { display: flex; gap: .5rem; padding: 0 1.2rem calc(1.2rem + env(safe-area-inset-bottom)); }
.sheet-actions .button { flex: 1; }
@media (min-width: 640px) {
  .sheet { margin: auto; border-radius: 1.5rem; }
}
.offer { display: grid; gap: .9rem; }
.offer-plan, .offer-pack { display: grid; gap: .65rem; padding: 1rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.offer h3 { display: flex; align-items: center; gap: .45rem; font-family: var(--display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.offer ul { display: grid; gap: .35rem; padding-left: 1.2rem; list-style: disc; color: var(--muted); }
.offer-buy { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.offer-terms { display: grid; gap: .45rem; }
.offer-links a { color: inherit; text-decoration: underline; }
.field { display: grid; gap: .3rem; font-weight: 650; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-height) + 1.4rem + env(safe-area-inset-bottom)); z-index: 60;
  width: max-content; max-width: min(92vw, 24rem); padding: .6rem 1.1rem; border-radius: 1.3rem;
  background: var(--ink); color: var(--paper); font-weight: 650; font-size: .95rem; text-align: center;
  transform: translate(-50%, .6rem); opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.sheet-toast { position: sticky; top: 0; z-index: 1; margin: .5rem 1.2rem; padding: .7rem 1rem; border-radius: 1rem; background: var(--ink); color: var(--paper); font-weight: 650; }
.sheet-toast:not(.show) { display: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast:empty { display: none; }
/* Below the board's buttons, clear of the cards. */
body.stacked #toast { bottom: calc(1.6rem + env(safe-area-inset-bottom)); }
@media (min-width: 760px) { #toast { bottom: 2rem; } }

/* ---------- Motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(.7rem); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes shake { 20%, 60% { translate: -.3rem 0; } 40%, 80% { translate: .3rem 0; } }
@keyframes turn-away { to { rotate: y 90deg; } }
@keyframes turn-in { from { rotate: y -90deg; } }
@keyframes corner-wait { to { opacity: .35; } }
@keyframes band-in { from { opacity: 0; transform: scale(.94); } }
@keyframes pop { 50% { transform: scale(1.06) rotate(-1deg); } }
@keyframes stamp { from { opacity: 0; transform: scale(1.8) rotate(-20deg); } }
/* The stamp comes down large and tilted, strikes a little small, and settles
   at its tilt. Its ring spreads from the strike and fades. */
@keyframes stamp-land {
  0% { opacity: 0; transform: translateY(-.5rem) scale(2.1) rotate(-24deg); }
  40% { opacity: 1; }
  55% { transform: scale(.88) rotate(-5deg); }
  78% { transform: scale(1.06) rotate(-9deg); }
  100% { transform: rotate(-8deg); }
}
@keyframes stamp-ring { 0%, 52% { opacity: 0; transform: scale(.85); } 58% { opacity: .9; } 100% { opacity: 0; transform: scale(1.75); } }
/* The band's colour fills in under its arriving cards. */
@keyframes band-fill { from { background-color: transparent; box-shadow: inset 0 0 0 2px var(--band); } }
@keyframes ray-out { from { opacity: 0; transform: rotate(var(--turn)) translateY(-2rem) scaleY(.2); } }

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

@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion='reduce']) {
    .day-card, .empty-day { animation: rise .35s ease both; }
    .band-enter .band-points { animation: stamp-land .42s cubic-bezier(.3, .8, .4, 1) .22s both; }
    .band-enter .band-points::after { animation: stamp-ring .42s ease-out .22s backwards; }
    .band-travel .band-points, .band-travel .band-points::after { animation-delay: .5s; }
    .band-enter.band-travel { animation: band-fill .45s ease both; }
    .band-travel h2, .band-travel > p { animation: rise .3s ease .28s both; }
    .sheet[open] { animation: sheet-up .28s cubic-bezier(.2, .9, .3, 1); }
    .tile.shake { animation: shake .4s ease; }
    /* The card turns edge-on, changes sides, and turns the rest of the way. */
    .tile.turn-away { animation: turn-away .15s ease-in forwards; }
    .tile.turn-in { animation: turn-in .17s ease-out; }
    .guess-deck.dealt b { animation: pop .5s ease; }
    .tile.is-asking::before { animation: corner-wait .7s ease-in-out .3s infinite alternate; }
    .band-enter { animation: band-in .32s cubic-bezier(.3, 1.5, .5, 1) both; }
    /* After the last group's stamp has landed. */
    .result-celebrate .result-head h2 { animation: pop .5s ease .55s; }
    .bonus-perfect .bonus-badge { animation: pop .6s ease 2; }
    .perfect-live .perfect-stamp { animation: stamp-land .55s cubic-bezier(.3, .8, .4, 1) .15s both; }
    .perfect-live .perfect-rays span { animation: ray-out .5s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(.38s + var(--i) * 30ms); }
  }
}
:root[data-motion='reduce'] *, :root[data-motion='reduce'] *::before, :root[data-motion='reduce'] *::after {
  animation: none !important; transition: none !important;
}

/* ---------- Your record, the 90-day calendar and the day in numbers (PE-15) ---------- */

.record { display: grid; gap: 1rem; }
.record-lead { margin: 0; font-weight: 650; text-wrap: balance; }
.record-empty { display: grid; gap: .3rem; padding: .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.record-empty p { margin: 0; color: var(--muted); }
.record-block { display: grid; gap: .5rem; }
.record-block h3, .day-numbers h3 { margin: 0; font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.record-block .fine, .day-numbers .fine { margin: 0; }

/* Bars: a count above, the step below. The fill is for the eye; the chart's label is for a screen reader. */
.bars { display: flex; align-items: flex-end; gap: .35rem; padding: .7rem .7rem .55rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.bar { flex: 1; display: grid; grid-template-rows: auto 4.4rem auto; justify-items: center; gap: .2rem; min-width: 0; }
.bar b { font-size: .85rem; font-variant-numeric: tabular-nums; }
.bar small { color: var(--muted); font-size: .72rem; font-weight: 700; }
.bar-fill { display: flex; align-items: flex-end; width: 100%; max-width: 2.2rem; height: 100%; border-radius: .4rem .4rem .15rem .15rem; background: var(--sunken); overflow: hidden; }
.bar-fill i { display: block; width: 100%; background: var(--accent); box-shadow: inset 0 0 0 1.5px #1b1915; border-radius: inherit; min-height: 0; }
.bar-fill i[style*="height:0%"] { box-shadow: none; }
.bar-you .bar-fill { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.bar-you small { color: var(--ink); }

.features { display: grid; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.features li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .7rem; padding: .55rem .9rem; }
.features li + li { border-top: 1px solid var(--line); }
.features .week-mark { color: var(--muted); }
.features .week-mark .icon { width: 1.2rem; height: 1.2rem; }
.feature-text { display: grid; gap: .1rem; min-width: 0; }
.feature-text small { color: var(--muted); font-size: .76rem; }
.feature-bar { display: block; height: .4rem; margin-top: .2rem; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.feature-bar i { display: block; height: 100%; background: var(--accent); box-shadow: inset 0 0 0 1.5px #1b1915; border-radius: inherit; }
.feature-avg { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.feature-none { opacity: .7; }
.bonus-stats { display: grid; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.bonus-stats li { display: flex; justify-content: space-between; gap: .8rem; padding: .6rem .9rem; }
.bonus-stats li + li { border-top: 1px solid var(--line); }
.bonus-stats span { color: var(--muted); }

.calendar-block { display: grid; gap: .6rem; }
.calendar-summary { margin: 0; color: var(--muted); }
.calendar { display: grid; gap: .25rem; padding: .7rem .6rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.calendar-head, .calendar-week { display: grid; grid-template-columns: 2rem repeat(7, minmax(0, 1fr)); gap: .25rem; align-items: center; }
.calendar-head span { text-align: center; font-size: .68rem; font-weight: 800; color: var(--muted); }
.calendar-month { font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.day-cell {
  position: relative; display: grid; place-items: center; height: 2.2rem; min-width: 0; padding: 0; border: 1.5px solid transparent;
  border-radius: .5rem; background: var(--sunken); color: var(--ink); font: inherit; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
button.day-cell { cursor: pointer; }
.day-cell .icon { position: absolute; right: .12rem; bottom: .08rem; width: .65rem; height: .65rem; }
.day-cell-blank { background: none; }
.day-cell-none { background: none; color: var(--muted); opacity: .45; font-weight: 600; }
.day-cell-solved { background: var(--accent); border-color: #1b1915; color: #1b1915; }
.day-cell-lost { background: var(--surface); border-color: var(--hard); color: var(--hard); }
.day-cell-playing { background: var(--surface); border-color: var(--ink); border-style: dashed; }
.day-cell-missed { background: var(--sunken); border-color: var(--line); color: var(--muted); }
.day-cell-open { background: var(--surface); border-color: var(--ink); }
.calendar-key { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin: 0; font-size: .76rem; color: var(--muted); }
.key::before { content: ''; display: inline-block; width: .8rem; height: .8rem; margin-right: .35rem; vertical-align: -.1rem; border-radius: .25rem; border: 1.5px solid transparent; }
.key-solved::before { background: var(--accent); border-color: #1b1915; }
.key-lost::before { background: var(--surface); border-color: var(--hard); }
.key-missed::before { background: var(--sunken); border-color: var(--line); }

.closing { display: grid; gap: .9rem; }
.day-numbers { display: grid; gap: .5rem; padding: .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.day-numbers p { margin: 0; }
.numbers-head { font-weight: 750; font-size: 1.05rem; text-wrap: balance; }
.numbers-you, .numbers-wait { color: var(--muted); text-wrap: pretty; }
.group-numbers { display: grid; gap: .5rem; margin-top: .3rem; }
.group-numbers h4 { margin: 0; font-size: .95rem; }
.group-numbers ul { display: grid; gap: .6rem; }
.group-numbers li { display: grid; gap: .15rem; }
.gn-line { display: grid; grid-template-columns: 7.2rem 1fr; align-items: center; gap: .5rem; }
.gn-line small { color: var(--muted); font-variant-numeric: tabular-nums; }
.gn-top small { color: var(--ink); font-weight: 750; }
.gn-bar { display: block; height: .42rem; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.gn-bar i { display: block; height: 100%; background: var(--accent); box-shadow: inset 0 0 0 1.5px #1b1915; border-radius: inherit; }
.gn-bar i[style*="width:0%"] { box-shadow: none; }
/* A chart inside the day's card sits on the card, not on a second one. */
.day-numbers .bars { padding-inline: 0; background: none; box-shadow: none; }

/* ---------- Stamps (PE-12) ---------- */

/* A stamp is the score stamp's cousin: a tilted disc in a group's colour
   with a dashed ring and a mark. Colours with dark ink read the same in
   light and dark. One not yet earned is its outline, upright and quiet. */
.stamp {
  --stamp: var(--accent);
  position: relative; display: grid; place-items: center; width: 3.5rem; height: 3.5rem; flex: none;
  border-radius: 50%; background: var(--stamp); color: #1b1915; transform: rotate(-8deg);
  box-shadow: 0 0 0 2.5px var(--paper), 0 3px 8px rgb(27 25 21 / .22);
}
.stamp::before { content: ''; position: absolute; inset: .28rem; border-radius: 50%; border: 1.5px dashed rgb(27 25 21 / .5); }
.stamp .icon { width: 1.55rem; height: 1.55rem; stroke-width: 2; }
.stamp-fullWeek, .stamp-features { --stamp: var(--g1); }
.stamp-playStreak { --stamp: var(--g2); }
.stamp-hotStreak { --stamp: var(--g0); }
.stamp-subject { --stamp: var(--g3); }
.stamp-hotStreak .icon-hot { stroke-width: 1.2; }
.stamp-step {
  position: absolute; right: -.35rem; bottom: -.2rem; min-width: 1.3rem; padding: .08rem .28rem; border-radius: 99px;
  background: #1b1915; color: #fbf8f0; font-family: var(--display); font-weight: 800; font-size: .7rem; line-height: 1.1; text-align: center;
}
.stamp-todo { background: none; color: var(--muted); transform: none; box-shadow: inset 0 0 0 1.5px var(--line); }
.stamp-todo::before { border-color: var(--line); }
.stamp-todo .stamp-step { background: var(--sunken); color: var(--muted); }
.stamp-todo .icon-hot path { fill: none; }
.stamp-todo .icon-hot { stroke: currentColor; }
.stamp-small { width: 2.6rem; height: 2.6rem; }
.stamp-small::before { inset: .2rem; }
.stamp-small .icon { width: 1.15rem; height: 1.15rem; }

.stamps { display: grid; gap: 1rem; }
.stamp-block { display: grid; gap: .6rem; }
.stamp-block h3 { margin: 0; font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stamp-lead { margin: 0; font-weight: 650; }
.stamp-empty { display: grid; gap: .3rem; padding: .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stamp-empty p { margin: 0; color: var(--muted); }
.stamp-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.4rem, 1fr)); gap: .9rem .4rem; }
.stamp-shelf li { display: grid; justify-items: center; gap: .45rem; text-align: center; }
.stamp-name { font-size: .78rem; font-weight: 700; line-height: 1.15; text-wrap: balance; }
.stamp-list { display: grid; }
.stamp-line { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .75rem; padding: .65rem .9rem; }
.card.stamp-list > li + li, .stamp-all .stamp-list > li + li { border-top: 1px solid var(--line); }
.stamp-line-text { display: grid; gap: .1rem; min-width: 0; }
.stamp-line-text small { text-wrap: pretty; }
.stamp-progress { color: var(--ink); font-weight: 650; }
.stamp-line-earned .stamp-progress { color: var(--easy); }
.stamp-bar { display: block; height: .4rem; margin-top: .25rem; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.stamp-bar i { display: block; height: 100%; background: var(--accent); box-shadow: inset 0 0 0 1.5px #1b1915; border-radius: inherit; }
.stamp-bar i[style*="width:0%"] { box-shadow: none; }
.stamp-all { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stamp-all > summary { padding: .8rem .9rem; font-weight: 750; cursor: pointer; }
.stamp-all[open] > summary { border-bottom: 1px solid var(--line); }

/* The moment a round earns stamps, on its result. */
.stamp-news {
  display: flex; align-items: center; gap: .9rem; padding: .8rem .9rem; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); text-align: left;
}
.stamp-news-discs { display: flex; flex: none; padding-left: .55rem; }
.stamp-news-discs .stamp { margin-left: -.55rem; }
.stamp-news-text { display: grid; gap: .1rem; margin: 0; text-wrap: pretty; }
.stamp-news-text strong { font-weight: 800; }
@media (max-width: 359px) {
  .stamp-news { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion='reduce']) {
    .stamp-news .stamp { animation: stamp .45s cubic-bezier(.3, 1.6, .5, 1) both; }
    .stamp-news .stamp:nth-child(2) { animation-delay: .12s; }
    .stamp-news .stamp:nth-child(3) { animation-delay: .24s; }
    .stamp-news .stamp:nth-child(4) { animation-delay: .36s; }
  }
}

/* ---------- Daily reminder (PE-11) ---------- */
.reminder-time select {
  min-height: 2.75rem; padding: .4rem .9rem; border: 2px solid var(--line); border-radius: 99px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 650;
}
.card .card-note { margin: 0; padding: .7rem .9rem .85rem; text-wrap: pretty; }
.reminder-line small { text-wrap: pretty; }

/* ---------- Friends (PE-26) ---------- */
.friend-list li + li { border-top: 1px solid var(--line); }
.friend-list strong, .friend-day-main strong { overflow-wrap: anywhere; }
.friends-lead { margin: 0; }
.invite-link { font-size: .95rem !important; text-overflow: ellipsis; }
.invite-card { overflow: hidden; }
.invite-card .card-main small { color: var(--muted); }
.invite-body { display: grid; gap: .7rem; padding: .9rem; }
.invite-body p { margin: 0; text-wrap: pretty; }
.invite-done .nudge { width: 100%; text-align: left; }
.friends-day { display: grid; gap: .5rem; padding: .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.friends-day h3 { margin: 0; font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.friends-day p { margin: 0; }
.friends-wait { color: var(--muted); text-wrap: pretty; }
.friends-rows { display: grid; }
.friend-day { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .5rem 0; }
.friend-day + .friend-day { border-top: 1px solid var(--line); }
.friend-day-main { display: grid; gap: .05rem; flex: 1 1 9rem; min-width: 0; }
.friend-day-main small { color: var(--muted); }
.friend-marks { display: flex; flex-wrap: wrap; gap: .25rem; order: 3; flex-basis: 100%; }
.friend-marks b {
  display: grid; place-items: center; min-width: 1.75rem; height: 1.6rem; padding: 0 .3rem; border-radius: .45rem;
  background: var(--sunken); font-size: .82rem; font-weight: 800;
}
.friend-marks .mark-miss { color: var(--muted); }
