/* BRYME Play — game surface.
 *
 * Loads AFTER bryme-r3.css, so it inherits the brand tokens (paper, ink, brass,
 * forest, Fraunces/Inter) and only adds what a game needs. Nothing here
 * restyles the rest of the site: every selector is scoped under .pl-.
 *
 * Mobile-first. The layout is designed for a thumb, not a cursor:
 *  - the play area sits in the lower half of the screen where a thumb reaches
 *  - tap targets are 48px minimum
 *  - nothing critical lives within 16px of a screen edge
 *  - `touch-action: none` on the letter wheel so a swipe does not scroll the page
 */

/* ---------------------------------------------------------------- shell -- */

.pl-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.pl-mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
}

.pl-brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font: 800 15px/1 var(--display, Georgia, serif);
  letter-spacing: .01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
}

.pl-brand span {
  font: 600 12px/1 var(--sans, system-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brass);
}

.pl-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 11px/1 var(--sans, system-ui);
}

.pl-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--sheet);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.pl-chip b { color: var(--ink); font-weight: 700; }

/* -------------------------------------------------------- collection ----- */
/* The shelf on the profile. Same paper as the rest of the page; the only
   ornament is the word chips, because the words ARE the reward. */
.pl-coll-band {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sheet);
}

.pl-coll-top {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 8px;
}

.pl-coll-top b {
  font: 800 26px/1 var(--display, Georgia, serif);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.pl-coll-top span {
  font: 600 11px/1 var(--sans, system-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pl-coll-progress { margin: 0 0 7px; }

.pl-coll-band small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.pl-coll-week { color: var(--brass) !important; margin-top: 2px; }

.pl-coll-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.pl-coll-word {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--sheet);
  border: 1px solid var(--line);
  color: var(--ink);
  font: 600 13px/1 var(--sans, system-ui);
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-coll-word:hover { border-color: var(--brass); }

/* The wheel and Nib sit in one row so the character is beside the board, not
   stacked on top of it. The wheel keeps its own sizing; Nib takes the leftover
   width and shrinks first. */
.pl-wheel-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  /* The pair must fit a 360px phone without overlap. The wheel yields width to
     the character rather than the character sitting on top of the letters. */
  max-width: 100%;
}

.pl-wheel-row .pl-wheel-hold {
  margin: 0;
  /* Sized so wheel + gap + character always fit: 390 - 48 (page gutters) is
     the board keeps the page to itself and the pupil gets his own band. */
  width: min(56vw, 264px);
  max-height: 42vh;
}


@media (min-width: 420px) {
  .pl-wheel-row .pl-wheel-hold { width: min(56vw, 300px); }
}

.pl-nib-hero {
  width: 112px;
  height: auto;
  aspect-ratio: 80 / 140;
  margin: 0 auto;
}

.pl-hero-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.pl-hero-copy { flex: 1 1 auto; min-width: 0; }

.pl-hero-stat {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 0;
}

.pl-hero-stat b { color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 460px) {
  .pl-hero-row { gap: 8px; }
  .pl-nib-hero { width: 84px; height: auto; }
}

.pl-nib-dt { margin: 0 0 6px; }

.pl-nib-cl { margin-left: auto; align-self: flex-end; }

@media (min-width: 520px) {
  .pl-nib { width: 104px; height: auto; }
}

@media (max-width: 359px) {
  /* On the smallest phones the character yields to the board rather than
     squeezing it: the wheel is the game, he is the company. */
  .pl-nib { width: 66px; height: auto; }
}

/* --------------------------------------------------------------- yard ---- */
/* The pupil's band. An empty strip in the flow, drawn as the ground he stands
   on, so he can pace across the page and never once cover a letter, a word,
   the toast or a button. It is part of the layout, not an overlay: nothing can
   be tapped through him and nothing hides behind him.

   Height is fixed and modest - he is company, not the content. On a tall phone
   the board gets the room; here he gets a lane. */
.pl-yard {
  position: relative;
  height: 128px;
  margin: 4px 0 0;
  overflow: hidden;
  /* A faint ground line, so he is standing somewhere rather than floating. */
  border-bottom: 1px solid rgba(126, 82, 48, .10);
}

.pl-yard::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(to right,
      transparent, rgba(126, 82, 48, .22) 15%, rgba(126, 82, 48, .22) 85%, transparent);
}

/* Inside the yard he is positioned by transform alone (translateX), so walking
   never reflows the page: the compositor owns it. */
.pl-yard .pl-nib {
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 64px;
  height: auto;
  aspect-ratio: 64 / 112;
  will-change: transform;
}

@media (min-width: 420px) {
  .pl-yard { height: 148px; }
  .pl-yard .pl-nib { width: 74px; }
}

@media (max-height: 700px) {
  /* Short phones: he yields height to the board rather than pushing the
     buttons off screen. */
  .pl-yard { height: 108px; }
  .pl-yard .pl-nib { width: 58px; }
}

/* --------------------------------------------------------------- Nib ----- */
/* The character. Fixed slot in the flow, never an overlay: he cannot cover the
   board, cannot be tapped through, and cannot shift the layout when he moves
   because his box is sized once and the transforms stay inside it. */
.pl-nib {
  width: 90px;
  height: auto;
  aspect-ratio: 64 / 112;   /* one sprite frame; never stretch him */
  flex: 0 0 auto;
  pointer-events: none;
  align-self: flex-end;
}

.pl-nib .nib {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 92%;
  display: block;
}

/* The sprite. Two strips, one row each; a frame is 126x201 CSS pixels, and
   the element is scaled with background-size so the same strip serves a 52px
   phone slot and a 96px hero slot without a second download.

   WHY A SPRITE AND NOT THE MODEL
   ------------------------------
   He is the Biro Flick pupil from the-liars-game, whose source is a 1.75 MB
   glTF with skinned meshes. Those animations were rendered to frames and
   packed here (47 KB for all 25 of them), so this is the same character
   playing the same clips at 3% of the bytes. A word game on a 3G phone cannot
   justify a WebGL scene to show a boy clapping. */
.pl-nib .biro-body {
  width: 100%;
  height: 100%;
  /* Mirrored by JS when he walks left; the transform-origin keeps it planted. */
  background-repeat: no-repeat;
  background-size: 800% 800%;   /* 8 columns x 8 rows of 64x112 frames */
  image-rendering: auto;
  transform-origin: 50% 100%;
  will-change: background-position;
}

/* The lift is a transform on the host: the element's box never changes, so
   nothing around him can reflow when he jumps. */
.pl-nib.biro-lift .biro-body {
  animation: biro-lift .42s cubic-bezier(.3, 1.35, .5, 1);
}

@keyframes biro-lift {
  0%   { transform: translateY(0) scaleY(1); }
  30%  { transform: translateY(-7%) scaleY(1.02); }
  60%  { transform: translateY(0) scaleY(.985); }
  100% { transform: translateY(0) scaleY(1); }
}

/* Reduced motion: he holds a still frame. The sprite is not animation, so the
   JS stops advancing it and this makes sure nothing else moves him either. */
@media (prefers-reduced-motion: reduce) {
  .pl-nib.biro-lift .biro-body { animation: none; }
}

/* ---------------------------------------------------------- momentum ----- */
/* The combo meter. Present on every game, quiet until it matters: at 1x it is
   a thin rule under the score, and it only takes colour once the chain is real.
   Fixed height and width-independent so it cannot reflow the board. */
.pl-combo {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 18px;
  margin: 2px 0 4px;
  font: 600 10px/1 var(--sans, system-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .18s ease;
}

.pl-combo-x {
  min-width: 26px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  opacity: .55;
  transition: opacity .18s ease, color .18s ease;
}

.pl-combo-bar {
  position: relative;
  flex: 1 1 auto;
  max-width: 120px;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.pl-combo-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 2px;
  background: var(--brass);
  transition: width .22s cubic-bezier(.2, .8, .3, 1);
}

.pl-combo-label {
  flex: 0 0 auto;
  color: var(--brass);
  min-width: 0;
}

.pl-combo-goal {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--line) var(--goal, 0%), transparent var(--goal, 0%));
  white-space: nowrap;
}

.pl-combo.hot .pl-combo-x { opacity: 1; color: var(--brass); }
.pl-combo.blaze .pl-combo-x { color: #c2410c; }

.pl-combo.bump .pl-combo-label {
  animation: pl-combo-bump .34s cubic-bezier(.2, 1.4, .4, 1);
}

@keyframes pl-combo-bump {
  0%   { transform: translateY(2px) scale(.9); opacity: .4; }
  60%  { transform: translateY(0) scale(1.06); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 359px) {
  .pl-combo-goal { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pl-combo-fill { transition: none; }
  .pl-combo.bump .pl-combo-label { animation: none; }
}
.pl-chip.fire { border-color: var(--brass-deco); }
.pl-chip.fire b { color: var(--brass); }

/* --------------------------------------------------------------- hero ---- */

.pl-hero { padding: 18px 0 6px; }

.pl-kicker {
  font: 700 11.5px/1 var(--sans, system-ui);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--brass);
  display: block;
  margin-bottom: 12px;
}

.pl-hero h1 {
  font: 800 clamp(30px, 8.4vw, 46px)/.98 var(--display, Georgia, serif);
  letter-spacing: -.025em;
  color: var(--ink);
  margin: 0 0 12px;
  text-wrap: balance;
}

.pl-hero h1 em {
  font-style: italic;
  color: var(--brass);
}

.pl-hero p {
  font: 400 15px/1.55 var(--sans, system-ui);
  color: var(--muted);
  margin: 0 0 18px;
  max-width: 52ch;
}

/* ------------------------------------------------------- daily challenge -- */

.pl-daily {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--sheet);
  padding: 14px 14px 12px;
  margin: 4px 0 22px;
}

.pl-daily-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.pl-daily-head h2 {
  font: 800 12.5px/1 var(--sans, system-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}

.pl-daily-head time {
  font: 500 12px/1 var(--sans, system-ui);
  color: var(--dim);
}

.pl-daily-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.pl-daily-row:first-of-type { border-top: 0; }

.pl-daily-tick {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font: 800 12px/1 var(--sans, system-ui);
  color: transparent;
}

.pl-daily-tick.done {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--sheet);
}

.pl-daily-row b {
  font: 600 13px/1.3 var(--sans, system-ui);
  color: var(--ink);
  flex: 1 1 auto;
}

.pl-daily-row small {
  font: 500 12px/1 var(--sans, system-ui);
  color: var(--dim);
  white-space: nowrap;
}

/* ---------------------------------------------------------- game tiles --- */

.pl-games {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 26px;
}

@media (min-width: 560px) {
  .pl-games { grid-template-columns: 1fr 1fr; }
  .pl-games .pl-tile:first-child { grid-column: 1 / -1; }
}

.pl-tile {
  display: block;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--sheet);
  padding: 18px 16px 16px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.pl-tile:hover, .pl-tile:focus-visible {
  transform: translateY(-2px);
  border-color: var(--brass-deco);
  box-shadow: 0 10px 26px rgba(38,53,47,.10);
}

.pl-tile:active { transform: translateY(0); }

.pl-tile-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  color: var(--forest);
  font: 800 19px/1 var(--display, Georgia, serif);
  margin-bottom: 12px;
}

.pl-tile h3 {
  font: 800 20px/1.1 var(--display, Georgia, serif);
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 6px;
}

.pl-tile p {
  font: 400 13.5px/1.5 var(--sans, system-ui);
  color: var(--muted);
  margin: 0 0 12px;
}

.pl-tile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 11.5px/1 var(--sans, system-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brass);
}

.pl-tile-meta .pl-dot {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--line-strong);
}

.pl-tile.feature {
  background: linear-gradient(160deg, var(--forest) 0%, var(--forest-deep) 100%);
  border-color: var(--forest-deep);
}

.pl-tile.feature h3 { color: var(--sheet); }
.pl-tile.feature p { color: #c9d3cc; }
.pl-tile.feature .pl-tile-icon { background: rgba(255,255,255,.10); color: var(--brass-deco); }
.pl-tile.feature .pl-tile-meta { color: var(--brass-deco); }
.pl-tile.feature .pl-dot { background: rgba(255,255,255,.28); }

/* ------------------------------------------------------------ game page -- */

.pl-stage {
  display: flex;
  flex-direction: column;
  min-height: 68vh;
}
/* On a tall phone the wheel does not fill the screen. Rather than leave a
   dead slab of paper under the buttons, the control row is pushed to the
   bottom of the stage: that is also where a thumb naturally rests, so the
   space is used for reach instead of decoration. */
.pl-stage > .pl-controls:last-of-type,
.pl-stage > .pl-controls ~ .pl-note { margin-top: auto; }

.pl-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 10px;
}

.pl-bar h1 {
  font: 800 clamp(20px, 5vw, 26px)/1.05 var(--display, Georgia, serif);
  margin: 0;
  color: var(--ink);
}

.pl-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font: 700 11px/1 var(--sans, system-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  text-decoration: none;
  padding: 10px 2px;
  display: inline-block;
}

.pl-back:hover { color: var(--brass); }

/* ------------------------------------------------------ word connect ----- */

.pl-wc-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 16px;
  min-height: 34px;
}

.pl-slot {
  display: inline-flex;
  gap: 3px;
  padding: 5px 7px;
  border-radius: 8px;
  background: var(--paper-2);
  opacity: .55;
}

.pl-slot.found { background: transparent; opacity: 1; }

.pl-slot i {
  width: 16px;
  height: 17px;
  border-bottom: 2px solid var(--line-strong);
  font: 700 12px/17px var(--sans, system-ui);
  font-style: normal;
  text-align: center;
  color: var(--ink);
}

.pl-slot.found i {
  border-bottom-color: var(--brass);
  color: var(--brass);
}

/* the wheel, while the daily deck is still arriving */
[data-loading="1"] .pl-wheel-hold::after {
  content: "Loading today\2019s set\2026";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--muted, #8a8378);
  border-radius: 50%;
  border: 1px dashed rgba(0, 0, 0, .18);
}

/* the wheel */
.pl-wheel-hold {
  position: relative;
  /* Sized to the bank, not to the screen: the ring is a control, and on a
     3-letter level a full-height square is mostly empty paper. The height is
     capped so it never pushes the buttons below a thumb's reach. */
  width: min(78vw, 300px);
  aspect-ratio: 1;
  max-height: 46vh;
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.pl-wheel-hold svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pl-line {
  stroke: var(--brass);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: .82;
}

.pl-node {
  position: absolute;
  width: clamp(44px, 15vw, 60px);
  height: clamp(44px, 15vw, 60px);
  margin: calc(clamp(44px, 15vw, 60px) / -2) 0 0 calc(clamp(44px, 15vw, 60px) / -2);
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--sheet);
  color: var(--ink);
  font: 800 clamp(17px, 5vw, 21px)/1 var(--display, Georgia, serif);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent;
}

.pl-node.on {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--sheet);
  transform: scale(.94);
}

.pl-node.hint {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(126,82,48,.18);
}

.pl-current {
  height: 46px;
  display: grid;
  place-items: center;
  font: 800 26px/1 var(--display, Georgia, serif);
  letter-spacing: .06em;
  color: var(--ink);
  margin: 12px 0 4px;
  text-transform: lowercase;
}

.pl-current.shake { animation: pl-shake .3s ease; }
.pl-current.good { color: var(--brass); }

@keyframes pl-shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.pl-controls {
  display: flex;
  flex-wrap: wrap;          /* four buttons must be able to fall to a 2x2 grid */
  gap: 9px;
  justify-content: center;
  margin-top: 6px;
}

/* The in-game row under the word wheel. At 320px, Shuffle / Clear / Submit /
   Hint do not fit on one line: the row was 342px wide against a 272px stage and
   scrolled the whole page sideways. Two per row is legible and every target
   stays well over 44px tall. */
.pl-controls .pl-btn { flex: 1 1 auto; min-width: 0; }
@media (max-width: 380px) {
  .pl-controls .pl-btn { flex: 1 1 calc(50% - 5px); }
}

.pl-btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  color: var(--ink);
  border-radius: 11px;
  padding: 13px 18px;
  font: 700 12px/1 var(--sans, system-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 46px;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
  -webkit-tap-highlight-color: transparent;
}

.pl-btn:hover:not(:disabled) { border-color: var(--brass); color: var(--brass); }
.pl-btn:disabled { opacity: .42; cursor: default; }

.pl-btn.primary {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--sheet);
}

.pl-btn.primary:hover:not(:disabled) { background: var(--forest-deep); border-color: var(--forest-deep); color: var(--sheet); }

.pl-found {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.pl-found span {
  font: 600 12px/1 var(--sans, system-ui);
  color: var(--brass);
  background: var(--paper-2);
  border-radius: 6px;
  padding: 6px 9px;
}

.pl-found span.bonus {
  color: var(--dim);
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}

/* -------------------------------------------------------- vocab clash ---- */

.pl-clash-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 18px;
  /* The progress chip, the timer and the streak must stay on ONE line: a
     wrapped timer bar reads as a rendering fault. The chip is fixed-width so
     the bar can take the remainder. */
  flex-wrap: nowrap;
}
.pl-clash-top .pl-chip {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.pl-clash-top .pl-streak { flex: 0 0 auto; }

.pl-timer {
  flex: 1 1 auto;
  min-width: 40px;
  height: 6px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
}

.pl-timer i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--forest);
  transform-origin: left center;
  transition: transform .18s linear, background .3s ease;
}

.pl-timer.low i { background: var(--red, #a33); }

.pl-streak {
  font: 700 11px/1 var(--sans, system-ui);
  color: var(--brass);
  white-space: nowrap;
}

.pl-question {
  font: 700 clamp(19px, 5vw, 25px)/1.32 var(--display, Georgia, serif);
  color: var(--ink);
  margin: 0 0 18px;
  text-wrap: balance;
}

.pl-answers {
  display: grid;
  gap: 9px;
}

.pl-answer {
  appearance: none;
  text-align: left;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  border-radius: 12px;
  padding: 15px 16px;
  font: 500 15px/1.35 var(--sans, system-ui);
  color: var(--ink);
  cursor: pointer;
  min-height: 54px;
  transition: border-color .12s ease, background .12s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}

.pl-answer:hover:not(:disabled) { border-color: var(--brass); }
.pl-answer:active:not(:disabled) { transform: scale(.988); }

.pl-answer.right {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--sheet);
}

.pl-answer.wrong {
  border-color: var(--red, #a33);
  color: var(--red, #a33);
  background: #fbf1ef;
}

.pl-answer:disabled { cursor: default; }

.pl-explain {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 11px;
  background: var(--paper-2);
  font: 400 13.5px/1.55 var(--sans, system-ui);
  color: var(--muted);
  border-left: 3px solid var(--brass);
  animation: pl-fade .22s ease;
}

.pl-explain b { color: var(--ink); }

@keyframes pl-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------ overlays --- */

.pl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27,38,33,.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 90;
  animation: pl-fade .2s ease;
}

.pl-card {
  background: var(--paper);
  border-radius: 18px;
  padding: 26px 22px 22px;
  width: min(420px, 100%);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  max-height: 88vh;
  overflow: auto;
}

.pl-card h2 {
  font: 800 27px/1.1 var(--display, Georgia, serif);
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -.02em;
}

.pl-card p {
  font: 400 14px/1.55 var(--sans, system-ui);
  color: var(--muted);
  margin: 0 0 16px;
}

.pl-stat-row {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 16px 0 20px;
}

.pl-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pl-stat b {
  font: 800 24px/1 var(--display, Georgia, serif);
  color: var(--brass);
}

.pl-stat small {
  /* 11.5px is the readable floor the mobile test enforces; the label is the
     only thing telling a player what the number means, so it has to be legible
     at 320px. */
  font: 600 11.5px/1 var(--sans, system-ui);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--dim);
}

.pl-card .pl-controls { flex-wrap: wrap; }
.pl-card .pl-btn { flex: 1 1 auto; }

/* word detail */
.pl-word-def {
  text-align: left;
  background: var(--paper-2);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0 0;
  font: 400 13px/1.5 var(--sans, system-ui);
  color: var(--muted);
}

.pl-word-def b {
  display: block;
  font: 700 16px/1.2 var(--display, Georgia, serif);
  color: var(--ink);
  margin-bottom: 4px;
  text-transform: lowercase;
}

/* ------------------------------------------------------ detective game --- */

.pl-clues {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.pl-clue {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 14px;
  border-radius: 11px;
  background: var(--sheet);
  border: 1px solid var(--line);
  animation: pl-fade .26s ease;
}

.pl-clue b {
  font: 800 12px/1 var(--sans, system-ui);
  color: var(--brass);
  padding-top: 2px;
  flex: 0 0 auto;
}

.pl-clue span {
  font: 400 14px/1.5 var(--sans, system-ui);
  color: var(--ink);
}

.pl-input-row {
  display: flex;
  gap: 8px;
  /* A flex item defaults to min-width:auto, which is its content's intrinsic
     width. A text input's intrinsic width is ~180px, so on a 320px screen the
     input refused to shrink and pushed the Guess button 59px off the page.
     min-width:0 is the fix, and it belongs on the item, not the row. */
  align-items: stretch;
}

.pl-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--sheet);
  padding: 13px 14px;
  font: 500 16px/1.2 var(--sans, system-ui);
  color: var(--ink);
  min-height: 48px;
  /* 16px minimum stops iOS Safari zooming the page on focus */
}

.pl-input:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
  border-color: var(--brass);
}

.pl-attempts {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin: 14px 0 4px;
}

.pl-attempts i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
}

.pl-attempts i.used { background: var(--red, #a33); }

/* --------------------------------------------------------- progression -- */

.pl-xp-bar {
  height: 7px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  margin: 6px 0 4px;
}

.pl-xp-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brass-deco), var(--brass));
  transition: width .4s ease;
}

.pl-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.pl-progress-head b {
  font: 800 15px/1 var(--display, Georgia, serif);
  color: var(--ink);
}

.pl-progress-head small {
  font: 600 12px/1 var(--sans, system-ui);
  color: var(--dim);
}

.pl-ach {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.pl-ach div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--sheet);
  opacity: .48;
}

.pl-ach div.on {
  opacity: 1;
  border-color: var(--brass-deco);
}

.pl-ach b {
  display: block;
  font: 700 12px/1.3 var(--sans, system-ui);
  color: var(--ink);
  margin-bottom: 3px;
}

.pl-ach small {
  font: 400 12px/1.45 var(--sans, system-ui);
  color: var(--muted);
}

/* ------------------------------------------------------- toast / tell ---- */

.pl-toast {
  position: fixed;
  left: 50%;
  /* Sits ABOVE the action row, not on it. At bottom:26px the pill covered the
     HINT button, so pressing Hint hid both the button and its own counter. */
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(14px);
  background: var(--forest);
  color: var(--sheet);
  font: 600 13px/1.3 var(--sans, system-ui);
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  /* BELOW the result overlay (z 90), not above it. A toast that floats over a
     completion card hides the Next level button and the last words in the list -
     which is exactly what it did before this changed. Its job is to answer
     "did that register?" during play, not to talk over the results. */
  z-index: 80;
  max-width: min(90vw, 380px);
  text-align: center;
}

.pl-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --------------------------------------------------------- section hd ---- */

.pl-section-h {
  font: 800 12.5px/1 var(--sans, system-ui);
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 26px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.pl-note {
  font: 400 12.5px/1.6 var(--sans, system-ui);
  color: var(--dim);
  margin: 10px 0 0;
}

/* --------------------------------------------------------- cross-links --- */

.pl-lanes {
  display: grid;
  gap: 8px;
  margin: 26px 0 0;
}

.pl-lane {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
  text-decoration: none;
  color: inherit;
}

.pl-lane:hover { border-color: var(--brass-deco); }

.pl-lane b {
  font: 700 13px/1.2 var(--sans, system-ui);
  color: var(--ink);
  display: block;
}

.pl-lane small {
  font: 400 11.5px/1.4 var(--sans, system-ui);
  color: var(--dim);
  display: block;
  margin-top: 2px;
}

.pl-lane span.ar {
  font: 700 14px/1 var(--sans, system-ui);
  color: var(--brass);
  flex: 0 0 auto;
}

/* ------------------------------------------------------------- reduced --- */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Keep the play area clear of the thumb-zone: on a tall phone the wheel sits
   low, and nothing a finger must hit is within 16px of the bottom edge. */
@media (max-height: 700px) {
  .pl-stage { min-height: 60vh; }
  .pl-wheel-hold { width: min(66vw, 250px); max-height: 40vh; }
  .pl-current { height: 38px; font-size: 22px; }
}

/* A one-line standing sentence under each game's title: the gate requires real
 * rendered text on every indexable page, and a player deserves to know the
 * rules of the round before the timer starts. */
.pl-reason {
  font: 400 14px/1.55 var(--sans, system-ui);
  color: var(--muted);
  margin: 0 0 18px;
  max-width: 54ch;
}

/* ------------------------------------------- result screen: word summary --- */
/*
 * The recap must show EVERY word found - required and bonus - with its
 * definition. An Expert level can produce 100+ bonus words, so this is a
 * bounded, independently scrollable region rather than a long page: the card
 * itself already scrolls, and nesting an unbounded list inside it would push
 * the Next level button off-screen on a 320 px phone.
 *
 * -webkit-overflow-scrolling and overscroll-behavior keep a flick inside the
 * list from scrolling the page behind it on iOS.
 */
.pl-words {
  text-align: left;
  margin: 4px 0 18px;
  max-height: min(42vh, 340px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 2px 4px;
}

.pl-word-group + .pl-word-group { margin-top: 14px; }

.pl-word-group h3 {
  font: 700 11px/1.3 var(--sans, system-ui);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 8px;
  position: sticky;
  top: 0;
  background: var(--paper);
  padding: 4px 0;
}

.pl-word-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pl-word {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 9px;
  font: 400 13px/1.45 var(--sans, system-ui);
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px dotted var(--line);
}
.pl-word:last-child { border-bottom: 0; }

.pl-word b {
  font: 700 14px/1.2 var(--sans, system-ui);
  color: var(--ink);
  letter-spacing: .01em;
  /* a long bonus word must not overflow a 320 px card */
  overflow-wrap: anywhere;
}

/* bonus words read as a reward, not as a task */
.pl-word.bon b { color: var(--brass); }

/* a required word the player did not find: shown as dots, so the shape of what
   they missed is visible without simply handing them the answer */
.pl-word.missed b { color: var(--dim); letter-spacing: .18em; }

/* a bonus word that carries a definition gets a little more room */
.pl-word.bon span { color: var(--muted); }

.pl-word span {
  flex: 1 1 12ch;
  min-width: 0;
  font-size: 12px;
  color: var(--dim);
}

@media (max-width: 380px) {
  .pl-words { max-height: min(38vh, 300px); }
  .pl-word { font-size: 12.5px; gap: 3px 7px; }
  .pl-word b { font-size: 13.5px; }
  .pl-word span { font-size: 11.5px; }
}

/* --------------------------------------------------------- tier badge --- */
.pl-tag {
  display: inline-block;
  font: 700 11px/1 var(--sans, system-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid var(--brass-deco, rgba(150,110,40,.35));
  border-radius: 999px;
  padding: 6px 11px;
  margin: 2px 0 14px;
}

/* ---------------------------------------------------------- level map --- */
/*
 * The map is how a player sees where they are. Three states, visually distinct
 * without relying on colour alone (which a colour-blind player may not
 * distinguish): cleared levels get a tick, the current level is outlined and
 * bolder, locked levels are dimmed with a small lock glyph in the label.
 *
 * Tap targets are 44x44 minimum, per the mobile requirement.
 */
.pl-map {
  margin: 26px 0 10px;
  scroll-margin-top: 14px;
}

.pl-map h2 {
  font: 800 clamp(18px,4.6vw,22px)/1.15 var(--display, Georgia, serif);
  color: var(--ink);
  margin: 0 0 4px;
}

.pl-map .pl-map-sub {
  font: 400 13px/1.5 var(--sans, system-ui);
  color: var(--muted);
  margin: 0 0 14px;
}

.pl-tier {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  overflow: hidden;
}

.pl-tier > summary {
  cursor: pointer;
  padding: 13px 15px;
  font: 700 13px/1.3 var(--sans, system-ui);
  color: var(--ink);
  letter-spacing: .02em;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
}
.pl-tier > summary::-webkit-details-marker { display: none; }
.pl-tier > summary::after {
  content: "";
  margin-left: auto;
  width: 7px; height: 7px;
  border-right: 2px solid var(--dim);
  border-bottom: 2px solid var(--dim);
  transform: rotate(45deg);
  transition: transform .18s ease;
}
.pl-tier[open] > summary::after { transform: rotate(-135deg); }

.pl-tier-count {
  font: 600 12px/1 var(--sans, system-ui);
  color: var(--dim);
  letter-spacing: .06em;
  margin-left: auto;
  margin-right: 4px;
}

.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
  padding: 4px 14px 16px;
}

.pl-lv {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  text-decoration: none;
  font: 800 15px/1 var(--display, Georgia, serif);
  padding: 5px 2px;
  -webkit-tap-highlight-color: transparent;
}
.pl-lv small {
  font: 600 11.5px/1 var(--sans, system-ui);
  letter-spacing: .02em;
  color: var(--dim);
}

/* cleared */
.pl-lv.done {
  border-color: rgba(55,95,75,.42);
  background: rgba(55,95,75,.10);
}
.pl-lv.done::before {
  content: "\2713";
  position: absolute;
  top: 2px; right: 4px;
  font-size: 9px;
  color: #2f6b4f;
}

/* the level the player should play next */
.pl-lv.current {
  border-color: var(--brass);
  border-width: 2px;
  background: rgba(150,110,40,.09);
  box-shadow: 0 2px 10px rgba(150,110,40,.16);
}

/* not yet unlocked - reachable, but flagged */
/* A locked level is now inert rather than a dimmed link: it is a <span>, it
   has no hover, no pointer cursor and no focus ring, because there is nothing
   to activate. It reads as "not yet" rather than "click me and fail". */
.pl-lv.locked {
  opacity: .5;
  background: transparent;
  border-style: dashed;
  cursor: default;
  pointer-events: none;
  filter: grayscale(.6);
}

.pl-lv.locked span { font-size: 15px; opacity: .8; }

.pl-lv:hover, .pl-lv:focus-visible { border-color: var(--brass); }

/* The current level is the one thing the eye must find instantly on a 100-cell
   map. A soft brass halo plus a slow breathing pulse - the only looping
   animation in the product, and it stops under prefers-reduced-motion. */
.pl-lv.current {
  box-shadow: 0 0 0 2px var(--brass), 0 0 0 6px rgba(126,82,48,.13);
  animation: pl-current-breathe 3.4s ease-in-out infinite;
}

@keyframes pl-current-breathe {
  0%, 100% { box-shadow: 0 0 0 2px var(--brass), 0 0 0 6px rgba(126,82,48,.10); }
  50%      { box-shadow: 0 0 0 2px var(--brass), 0 0 0 9px rgba(126,82,48,.20); }
}

@media (max-width: 340px) {
  .pl-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; padding: 4px 11px 14px; }
  .pl-lv { min-height: 44px; font-size: 14px; }
}

/* clue recap rows on the result screen: number and text sit side by side */
.pl-clue-recap {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 7px;
  font: 400 13px/1.5 var(--sans, system-ui);
  color: var(--muted);
}
.pl-clue-recap b {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font: 700 10px/16px var(--sans, system-ui);
  text-align: center;
  color: var(--dim);
  margin-top: 2px;
}
.pl-clue-recap span { flex: 1 1 auto; min-width: 0; }

/* Result-screen buttons: keep the label on one line where it can fit, and let
   the row wrap as a unit rather than breaking a label mid-word. */
.pl-card .pl-controls { gap: 8px; }
.pl-card .pl-btn {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  padding-left: 12px;
  padding-right: 12px;
}
@media (max-width: 400px) {
  .pl-card .pl-btn { font-size: 12.5px; padding-left: 9px; padding-right: 9px; }
}

/* Four buttons in a row do not fit a 320px screen: the row measured 342px and
   pushed the whole page sideways. Two per row from 420px down, with a capped
   flex-basis so the pair divides evenly instead of one stretching. */
.pl-card .pl-controls { flex-wrap: wrap; }
.pl-card .pl-btn { flex: 1 1 calc(50% - 5px); max-width: 100%; }
@media (min-width: 420px) {
  .pl-card .pl-btn { flex: 1 1 auto; }
}

/* ------------------------------------------------- per-game progress rows --- */
.pl-ladder {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 4px 0 22px;
}

.pl-ladder-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name count" "bar bar" "go go";
  gap: 5px 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  text-decoration: none;
  color: var(--ink);
  min-height: 62px;
}
.pl-ladder-row:hover, .pl-ladder-row:focus-visible { border-color: var(--brass); }

.pl-ladder-name {
  grid-area: name;
  font: 700 14px/1.2 var(--sans, system-ui);
  color: var(--ink);
}
.pl-ladder-row > b {
  grid-area: count;
  font: 800 15px/1 var(--display, Georgia, serif);
  color: var(--brass);
}
.pl-ladder-bar {
  grid-area: bar;
  display: block;
  height: 5px;
  border-radius: 3px;
  background: var(--paper-2);
  overflow: hidden;
}
.pl-ladder-bar u {
  display: block;
  height: 100%;
  background: var(--brass);
  border-radius: 3px;
  text-decoration: none;
}
.pl-ladder-row > small {
  grid-area: go;
  font: 600 11.5px/1 var(--sans, system-ui);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ============================================================ game feel === */
/*
 * The effects layer. Everything here is created and destroyed by play-feel.js;
 * nothing is in the DOM when idle, so the cost of shipping it is a few hundred
 * bytes of CSS rather than a permanently running animation loop.
 *
 * The global prefers-reduced-motion rule near the top of this file already
 * collapses these animations to 0.01ms, and play-feel.js refuses to create the
 * elements at all when reduced motion is on. Two independent guards, because
 * this is the kind of thing that silently regresses.
 */

.pl-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;          /* above the board, below the toast (80)? no - see note */
  overflow: hidden;
  contain: strict;
}

/* The toast sits at z-index 80 and must stay readable, but the FX layer is
   pointer-events:none so it can safely sit above it; it never intercepts a
   tap and it never covers text for longer than half a second. */
.pl-fx { z-index: 95; }

.pl-fx-dot {
  position: absolute;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  will-change: transform, opacity;
  animation: pl-dot-fly var(--dur, 420ms) cubic-bezier(.2,.7,.4,1) forwards;
}

@keyframes pl-dot-fly {
  0%   { transform: translate3d(0,0,0) scale(1); opacity: 1; }
  70%  { opacity: .9; }
  100% { transform: translate3d(var(--dx,0), var(--dy,-40px), 0) scale(.35); opacity: 0; }
}

.pl-fx-dot.is-rain {
  animation-name: pl-dot-rain;
  animation-timing-function: cubic-bezier(.15,.6,.35,1);
}

@keyframes pl-dot-rain {
  0%   { transform: translate3d(0,0,0) scale(.6); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate3d(0, var(--dy,-120px), 0) scale(1); opacity: 0; }
}

.pl-fx-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font: 800 20px/1 var(--display, Georgia, serif);
  color: var(--brass, #7e5230);
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
  white-space: nowrap;
  animation: pl-pop-rise 900ms cubic-bezier(.2,.8,.3,1) forwards;
}

.pl-fx-pop.is-xp   { color: var(--ink, #252b29); }
.pl-fx-pop.is-gold { color: #b8862a; font-size: 26px; }

@keyframes pl-pop-rise {
  0%   { transform: translate(-50%,-50%) scale(.6); opacity: 0; }
  18%  { transform: translate(-50%,-64%) scale(1.14); opacity: 1; }
  34%  { transform: translate(-50%,-70%) scale(1); }
  100% { transform: translate(-50%,-150%) scale(1); opacity: 0; }
}

/* A punch, not a bounce: one quick scale-out and back. Used on the tile that
   was just tapped and on a word that was just accepted. */
.pl-punch { animation: pl-punch 220ms ease-out; }
.pl-punch-big { animation: pl-punch-big 320ms cubic-bezier(.2,.8,.3,1); }

@keyframes pl-punch {
  0%   { transform: scale(1); }
  38%  { transform: scale(1.09); }
  100% { transform: scale(1); }
}

@keyframes pl-punch-big {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.18); }
  60%  { transform: scale(.98); }
  100% { transform: scale(1); }
}

/* The victory panel arrives rather than appearing. 260ms is long enough to
   read as motion and short enough that it never feels like waiting. */
.pl-result.is-in { animation: pl-result-in 320ms cubic-bezier(.2,.8,.3,1); }

@keyframes pl-result-in {
  0%   { opacity: 0; transform: translateY(14px) scale(.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* A found word slot that just filled: it lifts as it settles, which reads as
   the word having been *placed* rather than merely printed. */
.pl-word.just-found { animation: pl-word-in 340ms cubic-bezier(.2,.8,.3,1); }

@keyframes pl-word-in {
  0%   { opacity: .25; transform: translateY(-6px) scale(.94); letter-spacing: .22em; }
  55%  { opacity: 1; transform: translateY(1px) scale(1.03); }
  100% { opacity: 1; transform: none; letter-spacing: inherit; }
}

/* Streak badge on a combo. Scale + a warm glow for one beat. */
.pl-combo-hot { animation: pl-combo-hot 520ms ease-out; }

@keyframes pl-combo-hot {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(216,169,58,.55); }
  35%  { transform: scale(1.13); box-shadow: 0 0 0 10px rgba(216,169,58,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(216,169,58,0); }
}

/* ========================================================== sound panel === */
/*
 * One row of small controls, not a settings modal. Three controls and a
 * three-stop volume slider do not warrant a dialog, and a dialog would have to
 * be dismissed before the player can start - which research on onboarding says
 * costs first sessions.
 */

.pl-sound {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 0;
  flex-wrap: wrap;
}

.pl-snd-btn {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--line, #d9dcd6);
  background: var(--paper, #fffdf8);
  color: var(--muted, #6b726d);
  border-radius: 999px;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  font: 600 12px/1 var(--sans, system-ui);
  letter-spacing: .04em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.pl-snd-btn:hover { border-color: var(--brass, #7e5230); color: var(--brass, #7e5230); }

.pl-snd-btn[aria-pressed="true"] {
  background: var(--brass, #7e5230);
  border-color: var(--brass, #7e5230);
  color: #fffdf8;
}

.pl-snd-btn:focus-visible {
  outline: 2px solid var(--brass, #7e5230);
  outline-offset: 2px;
}

.pl-snd-btn .pl-snd-ico { font-size: 14px; line-height: 1; }

.pl-snd-vol {
  -webkit-appearance: none;
  appearance: none;
  width: 62px;
  height: 34px;
  background: transparent;
  cursor: pointer;
}

/* The two sliders are visually paired and separated from the toggles by a
   divider, so "effects level" and "music level" are not mistaken for one
   control with two handles. */
#pl-snd-mvol { position: relative; margin-left: 2px; }

.pl-snd-vol:first-of-type::before { content: none; }

.pl-snd-vol::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: var(--line, #d9dcd6);
}

.pl-snd-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--brass, #7e5230);
  border: 2px solid var(--paper, #fffdf8);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.pl-snd-vol::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: var(--line, #d9dcd6);
}

.pl-snd-vol::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brass, #7e5230);
  border: 2px solid var(--paper, #fffdf8);
}

.pl-snd-vol:focus-visible {
  outline: 2px solid var(--brass, #7e5230);
  outline-offset: 3px;
  border-radius: 999px;
}

/* On very short screens the row compacts rather than disappearing. It must
   never be removed wholesale: shipping sound with no way to mute it is a real
   accessibility failure, and a landscape phone is exactly where a player is
   most likely to want silence. The volume slider is the only part that goes,
   and the two toggles keep a full 34px touch target. */
@media (max-height: 620px) {
  .pl-sound { gap: 4px; margin: 0; }
  .pl-snd-vol { width: 46px; }
  .pl-snd-btn { height: 30px; min-width: 30px; padding: 0 7px; font-size: 11px; }
}

/* Below 360px the labels go and the glyphs stay: the state is still carried by
   aria-pressed for assistive tech, and a full mute control is worth more than
   the word "Sound". */
@media (max-width: 359px) {
  .pl-snd-lbl { display: none; }
  .pl-snd-btn { padding: 0 9px; }
  .pl-snd-vol { width: 52px; }
}

/* ========================================================== word card === */
/*
 * The definition panel. A bottom sheet rather than a centred modal, because on
 * a phone the thumb is already at the bottom of the screen and a sheet does not
 * cover the board the player is looking at. It never takes focus and never
 * traps taps: it is readable at a glance and dismissible by a tap anywhere on
 * itself.
 */

.pl-defpanel {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 140%);
  width: min(420px, calc(100vw - 24px));
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--paper, #fffdf8);
  border: 1px solid var(--line, #d9dcd6);
  border-left: 4px solid var(--brass, #7e5230);
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(30, 26, 20, .22);
  padding: 13px 16px 15px;
  z-index: 92;
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.2,.8,.3,1), opacity .22s ease;
}

.pl-defpanel.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

/* The tint says why the card appeared, without a word of explanation. */
.pl-defpanel.is-bonus  { border-left-color: #b8703c; }
.pl-defpanel.is-wrong  { border-left-color: #b4472f; }
.pl-defpanel.is-correct{ border-left-color: #3f9c74; }

.pl-def-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 2px;
}

.pl-def-word {
  font: 800 22px/1.15 var(--display, Georgia, serif);
  letter-spacing: .01em;
  color: var(--ink, #252b29);
}

.pl-def-pos {
  font: 600 10px/1 var(--sans, system-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted, #6b726d);
  border: 1px solid var(--line, #d9dcd6);
  border-radius: 4px;
  padding: 3px 5px;
}

.pl-def-tag {
  font: 700 10px/1 var(--sans, system-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brass, #7e5230);
  margin-left: auto;
}

.pl-def-ipa {
  font: 400 14px/1.5 var(--sans, system-ui);
  color: var(--brass, #7e5230);
  letter-spacing: .02em;
  margin-bottom: 5px;
}

.pl-def-gloss {
  font: 400 15px/1.5 var(--sans, system-ui);
  color: var(--ink, #252b29);
  margin: 0 0 6px;
}

.pl-def-ex {
  font: 400 13.5px/1.5 var(--sans, system-ui);
  font-style: italic;
  color: var(--muted, #6b726d);
  margin: 0;
  padding-left: 9px;
  border-left: 2px solid var(--line, #d9dcd6);
}

/* On a landscape phone the sheet would cover the board's controls; a narrower
   card pinned to the right keeps both visible. */
@media (orientation: landscape) and (max-height: 520px) {
  .pl-defpanel {
    left: auto;
    right: 10px;
    transform: translate(0, 140%);
    width: min(320px, 44vw);
    max-height: 72vh;
  }
  .pl-defpanel.show { transform: translate(0, 0); }
}

/* ---- recap row detail: part of speech, pronunciation, example ---- */
/* These three pieces are added after the overlay is already on screen, so they
   must not shift the row layout when they arrive. Each is inline and each is
   allowed to be absent. */
.pl-word-pos {
  font: 600 9.5px/1 var(--sans, system-ui);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted, #6b726d);
  border: 1px solid var(--line, #d9dcd6);
  border-radius: 3px;
  padding: 2px 4px;
  margin-right: 6px;
  vertical-align: 2px;
  white-space: nowrap;
}

.pl-word-ipa {
  display: inline-block;
  font: 400 12px/1.2 var(--sans, system-ui);
  font-style: normal;
  color: var(--brass, #7e5230);
  margin-left: 7px;
  letter-spacing: .01em;
}

.pl-word-ex {
  display: block;
  font: italic 400 12.5px/1.45 var(--sans, system-ui);
  color: var(--muted, #6b726d);
  margin-top: 3px;
  padding-left: 8px;
  border-left: 2px solid var(--line, #d9dcd6);
}

/* ==================================================== detective verdict === */
/* The "feel clever" panel. A left rule and a warmer ground for a clean solve,
   a neutral one otherwise. No colour is used to scold. */
.dt-verdict {
  margin: 10px 0 8px;
  padding: 9px 12px;
  font: 600 14px/1.45 var(--sans, system-ui);
  color: var(--ink, #252b29);
  background: rgba(126, 82, 48, .06);
  border-left: 3px solid var(--brass, #7e5230);
  border-radius: 0 7px 7px 0;
}

.dt-verdict.is-gold {
  background: rgba(216, 169, 58, .14);
  border-left-color: #b8862a;
}

/* A clue the player never unlocked is shown in the recap for completeness but
   is visibly secondary - it was not part of their reasoning. */
.pl-clue-recap.is-unseen { opacity: .45; }

/* The recap rows are flex so the "decided it" tag can be pushed to the right
   with margin-left:auto without a wrapper element. */
.pl-clue-recap { display: flex; align-items: baseline; gap: 8px; }

.dt-decisive {
  margin-left: auto;
  font: 700 9.5px/1 var(--sans, system-ui);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #fffdf8;
  background: var(--brass, #7e5230);
  border-radius: 3px;
  padding: 3px 5px;
  align-self: center;
}

.dt-path {
  font: 500 13px/1.7 var(--sans, system-ui);
  color: var(--muted, #6b726d);
  word-spacing: .1em;
}

/* ================================================ clash: rule + misses === */
/* The scoring rule, stated before the round. Quiet, so it informs without
   competing with the Start button. */
.cl-rule {
  font: 400 12.5px/1.55 var(--sans, system-ui);
  color: var(--muted, #6b726d);
  background: rgba(126, 82, 48, .05);
  border-radius: 7px;
  padding: 9px 11px;
  margin: 0 0 14px;
  text-align: left;
}

.cl-miss-head {
  font: 700 11px/1 var(--sans, system-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted, #6b726d);
  margin: 4px 0 8px;
  text-align: left;
}

.cl-miss-list {
  max-height: 34vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
  margin-bottom: 14px;
  padding-right: 2px;
}

.cl-miss {
  padding: 10px 0 11px;
  border-top: 1px solid var(--line, #d9dcd6);
}

.cl-miss:first-child { border-top: 0; padding-top: 2px; }

.cl-miss-q {
  font: 500 13.5px/1.45 var(--sans, system-ui);
  color: var(--ink, #252b29);
  margin-bottom: 5px;
}

/* The wrong choice is struck through rather than coloured red: the player
   already knows they got it wrong, and a red word reads as a scolding. */
.cl-miss-said {
  font: 400 12.5px/1.4 var(--sans, system-ui);
  color: var(--muted, #6b726d);
  text-decoration: line-through;
  text-decoration-color: rgba(180, 71, 47, .6);
  margin-bottom: 2px;
}

.cl-miss-right {
  font: 700 13.5px/1.4 var(--sans, system-ui);
  color: #2f7d5c;
  margin-bottom: 4px;
}

.cl-miss-right::before {
  content: "\2713 ";
  font-weight: 700;
}

.cl-miss-why {
  font: 400 12.5px/1.55 var(--sans, system-ui);
  color: var(--muted, #6b726d);
}

/* ============================================================= profile === */
/*
 * One identity across three games. Rows, bars and a two-up rank header - the
 * same visual grammar as the level maps, so the profile reads as part of the
 * same product rather than a separate dashboard.
 */

.pl-profile { max-width: 640px; margin: 0 auto; }

.pl-prof-top {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 430px) {
  .pl-prof-top { grid-template-columns: 1fr; }
}

.pl-prof-rank, .pl-prof-xp {
  background: var(--paper, #fffdf8);
  border: 1px solid var(--line, #d9dcd6);
  border-radius: 12px;
  padding: 13px 15px;
}

.pl-prof-rank b, .pl-prof-xp b {
  display: block;
  font: 800 24px/1.1 var(--display, Georgia, serif);
  color: var(--ink, #252b29);
  margin: 3px 0 2px;
}

.pl-prof-rank small, .pl-prof-xp small {
  font: 400 12px/1.4 var(--sans, system-ui);
  color: var(--muted, #6b726d);
}

.pl-prof-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(126, 82, 48, .13);
  overflow: hidden;
  margin: 7px 0 0;
}

.pl-prof-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--brass, #7e5230);
  transition: width .5s cubic-bezier(.2,.8,.3,1);
}

.pl-prof-game {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--paper, #fffdf8);
  border: 1px solid var(--line, #d9dcd6);
  border-radius: 12px;
  padding: 13px 15px;
  margin-bottom: 9px;
  transition: border-color .15s ease, transform .12s ease;
}

.pl-prof-game:hover { border-color: var(--brass, #7e5230); transform: translateY(-1px); }

.pl-prof-game.is-new { border-style: dashed; opacity: .82; }

.pl-prof-game-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pl-prof-game-head b {
  font: 700 15px/1.2 var(--display, Georgia, serif);
  color: var(--ink, #252b29);
}

.pl-prof-game-head span {
  font: 700 13px/1 var(--sans, system-ui);
  color: var(--brass, #7e5230);
}

.pl-prof-game small {
  display: block;
  font: 400 12px/1.4 var(--sans, system-ui);
  color: var(--muted, #6b726d);
  margin-top: 6px;
}

.pl-profile h2 {
  font: 700 13px/1 var(--sans, system-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted, #6b726d);
  margin: 22px 0 10px;
}

.pl-prof-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

@media (max-width: 400px) {
  .pl-prof-stats { grid-template-columns: repeat(2, 1fr); }
}

.pl-ach-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line, #d9dcd6);
  border-radius: 9px;
  margin-bottom: 7px;
  opacity: .55;
}

.pl-ach-row.is-on {
  opacity: 1;
  border-color: rgba(126, 82, 48, .35);
  background: rgba(126, 82, 48, .04);
}

.pl-ach-mark {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 12px/1 var(--sans, system-ui);
  background: var(--line, #d9dcd6);
  color: var(--muted, #6b726d);
}

.pl-ach-row.is-on .pl-ach-mark {
  background: var(--brass, #7e5230);
  color: #fffdf8;
}

.pl-ach-row b {
  display: block;
  font: 700 13.5px/1.3 var(--sans, system-ui);
  color: var(--ink, #252b29);
}

.pl-ach-row small {
  display: block;
  font: 400 12px/1.4 var(--sans, system-ui);
  color: var(--muted, #6b726d);
  margin-top: 1px;
}

/* A single quiet link from the landing summary through to the profile page.
   Not a button: the summary is already useful, and this is an offer, not a
   demand. */
.pl-prof-link {
  display: inline-block;
  margin: 10px 0 4px;
  font: 600 13px/1.4 var(--sans, system-ui);
  color: var(--brass, #7e5230);
  text-decoration: none;
  border-bottom: 1px solid rgba(126, 82, 48, .3);
  padding-bottom: 1px;
}

.pl-prof-link:hover { border-bottom-color: var(--brass, #7e5230); }
