/* Game page. Layout classes on <html> (set by js/site.js):
   l-phone (default) · l-landscape · l-tablet · l-wide (≥1024) · l-desktop (≥1200, with l-wide) */

:root {
  --outer: 0px;
  --cpad: 16px;
  --felt-radius: 0px;
}

.l-landscape {
  --outer: 8px;
  --cpad: 8px;
  --felt-radius: 8px;
}

.l-tablet,
.l-wide {
  --outer: 16px;
  --cpad: 0px;
  --felt-radius: 12px;
}

.l-desktop {
  --outer: 24px;
}

/* Board metrics for the space reserved before the first deal is drawn. Same
   pad, gap and card-width cap as LAYOUTS in js/board.js; in phone landscape
   the cap also follows the screen height, as in Board.metrics(). */
:root {
  --b-pad: 8px;
  --b-gap: 4px;
  --b-max: 96px;
}

.l-landscape {
  --b-gap: 6px;
  --b-max: min(56px, (100vh - 93px) / 5.96);
}

.l-tablet {
  --b-pad: 16px;
  --b-gap: 8px;
  --b-max: 84px;
}

.l-wide {
  --b-pad: 16px;
  --b-gap: 8px;
  --b-max: 80px;
}

.l-desktop {
  --b-pad: 24px;
  --b-gap: 12px;
  --b-max: 96px;
}

body.game {
  padding-bottom: var(--dock-h);
}

/* Bottom bar on phone and tablet: reserve the control bar's 64px and start
   --dock-h at the bar's full height (ad band + controls, + footer links on
   tablet), so nothing moves when the script fills it in. app.js then keeps
   --dock-h exact. Phone landscape has no bottom bar. */
#dock-slot {
  min-height: 64px;
}

:root {
  --dock-h: calc(126px + env(safe-area-inset-bottom, 0px));
}

.l-tablet {
  --dock-h: calc(205px + env(safe-area-inset-bottom, 0px));
}

.l-landscape {
  --dock-h: 0px;
}

/* From 1024px up the bar is just the pinned ad strip (controls are in the header). */
.l-wide {
  --dock-h: calc(115px + env(safe-area-inset-bottom, 0px));
}

.l-wide #dock-slot {
  min-height: 0;
}

.game .site-header .inner {
  padding: 10px max(var(--outer), 12px);
}


/* Desktop header (time and moves, New game, Undo, Hint, menu) is shared with
   the content pages: see css/controls.css and css/site.css. */

/* ---- Ad bands and rail ------------------------------------------------- */

.ad-band {
  display: flex;
  justify-content: center;
  padding: 6px 0;
  background: var(--chrome);
}

.ad-band-top {
  border-bottom: 1px solid var(--chrome-line);
}

.ad-band .ad-728x90,
.ad-band .ad-fluid {
  display: none;
}

/* From 1024px up: one banner up to 970x90 in the pinned strip. */
.l-wide .dock .ad-band {
  padding: 12px var(--outer);
  border-top: 1px solid var(--chrome-line);
}

.l-wide .dock .ad-band .ad-320x50 {
  display: none;
}

.l-wide .dock .ad-band .ad-fluid {
  display: flex;
}

.l-tablet .ad-band {
  padding: 6px 8px;
}

.l-tablet .ad-band .ad-320x50 {
  display: none;
}

.l-tablet .ad-band .ad-728x90 {
  display: flex;
}

.l-tablet .dock .ad-band {
  border-top: 1px solid var(--chrome-line);
}

.l-landscape .ad-band-top,
.l-wide .ad-band-top {
  display: none;
}

.rail {
  display: none;
  flex: none;
  width: 300px;
}

.l-landscape .rail,
.l-wide .rail {
  display: block;
}

.rail .ad-300x600 {
  display: none;
}

/* From 1024px up: the tall 300x600 when the board area is at least 600px
   tall (screen 812px+), otherwise 300x250. */
@media (min-height: 812px) {
  .l-wide .rail .ad-300x600 {
    display: flex;
  }

  .l-wide .rail .ad-300x250 {
    display: none;
  }
}

.ad-fluid {
  width: 100%;
  max-width: 970px;
  height: 90px;
}

/* ---- Main column ------------------------------------------------------- */

.game-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  margin: 0 auto;
  padding: var(--outer);
}

/* The game page uses the full screen width; header and footer line up with it. */
.game .site-header .inner,
.game .site-footer {
  max-width: none;
}

.board-col {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Lets the felt below size itself from the column width (cqw). */
.board-col {
  container-type: inline-size;
}

.felt {
  position: relative;
  isolation: isolate;
  min-height: 200px;
  border-radius: var(--felt-radius);
  background: var(--felt);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Until board.js draws the first deal (and adds .ready), hold the height of a
   fresh deal so the text, ads and footer below never move: 2·pad + 4.04·cw,
   where cw = min((width − 2·pad − 6·gap) / 7, cap), as in Board.metrics(),
   and never less than the felt's own 200px minimum. */
.felt:not(.ready) {
  --felt-est: max(200px, calc(2 * var(--b-pad) + 4.04 * min((100cqw - 2 * var(--b-pad) - 6 * var(--b-gap)) / 7, var(--b-max))));
  min-height: var(--felt-est);
}

/* The felt fills the screen to the bottom on every layout (board.js sets the
   exact height): on phone and tablet portrait it runs on behind the pinned
   bar; elsewhere it stops one outer margin above the pinned strip or the
   screen's bottom. It starts 111px down on phones (header + top ad), 167px on
   tablets (header + 728x90 ad + margin) and 73px in phone landscape. */
.l-phone .felt:not(.ready) {
  min-height: max(var(--felt-est), calc(100svh - 111px));
}

.l-tablet .felt:not(.ready) {
  min-height: max(var(--felt-est), calc(100svh - 167px));
}

.l-landscape .felt:not(.ready) {
  min-height: max(var(--felt-est), calc(100svh - 73px));
}

/* 1024px up: felt top (81px, or 89px from 1200px), pinned strip, margin. */
.l-wide .felt:not(.ready) {
  min-height: max(var(--felt-est), calc(100svh - 81px - var(--dock-h) - 16px));
}

.l-desktop .felt:not(.ready) {
  min-height: max(var(--felt-est), calc(100svh - 89px - var(--dock-h) - 24px));
}

/* The page is locked while the board is in view (js/app.js), and this arrow,
   centred on the board just above the pinned bar, glides down to the text
   below. It pulses on hover and keyboard focus. */
html.board-locked,
html.board-locked body {
  overflow: hidden;
}

.more-arrow {
  position: fixed;
  left: 50%; /* app.js centres it on the board */
  bottom: calc(var(--dock-h) + 6px);
  z-index: 15;
  width: 44px;
  height: 28px;
  margin-left: -22px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: #fbfaf6;
  cursor: pointer;
}

.more-arrow[hidden] {
  display: none;
}

/* Where the felt stops above the bar (or the screen's bottom), the arrow sits
   inside the felt's bottom edge. */
.l-landscape .more-arrow,
.l-wide .more-arrow {
  bottom: calc(var(--dock-h) + var(--outer) + 8px);
}

.more-arrow svg {
  width: 20px;
  height: 20px;
}

.anim .more-arrow:hover,
.anim .more-arrow:focus-visible {
  animation: morePulse 1.1s ease-in-out infinite;
}

html:not(.anim) .more-arrow:hover,
html:not(.anim) .more-arrow:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

@keyframes morePulse {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 0 0 0 rgba(246, 198, 96, 0.6); }
  50% { transform: translateY(2px) scale(1.1); box-shadow: 0 0 0 7px rgba(246, 198, 96, 0); }
}

#more {
  scroll-margin-top: 49px; /* below the sticky header */
}

.l-landscape #more {
  scroll-margin-top: 65px;
}

.l-wide #more {
  scroll-margin-top: 89px;
}

/* The text below the board runs the full width of the board column. */
.intro {
  flex: 1;
  padding: 0 var(--cpad) 32px;
}

/* Same type scale as the content pages (.page-main in site.css). */
.intro h1 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: pretty;
}

.intro h2 {
  margin: 26px 0 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.intro h3 {
  margin: 14px 0 4px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.intro p,
.intro ul {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--page-muted);
  text-wrap: pretty;
}

.intro ul {
  padding-left: 18px;
}

.intro li + li {
  margin-top: 4px;
}

.intro strong {
  color: var(--page-fg);
}

.intro a {
  font-weight: 600;
  text-decoration: none;
}

.intro a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.game .site-footer {
  display: none;
}

.l-landscape .game .site-footer,
.l-wide .game .site-footer {
  display: block;
}

/* ---- Bottom dock (phone and tablet portrait) ---------------------------- */

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--chrome);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.l-landscape .dock {
  display: none;
}

.dock-footer {
  display: none;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--chrome-line);
  color: var(--chrome-muted);
}

.l-tablet .dock-footer {
  display: flex;
}

.dock-footer a,
.dock-footer .linklike {
  color: var(--chrome-muted);
  font-weight: 600;
  text-decoration: none;
}

.dock-footer a:hover,
.dock-footer .linklike:hover {
  color: var(--chrome-fg);
}

/* ---- Cards (Card.dc.html) ------------------------------------------------ */

.card,
.slot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: calc(var(--cw) * 1.4);
}

.card {
  touch-action: none;
  cursor: pointer;
}

/* Cards resize as the tallest column grows or shrinks (board.js): ease it. */
.anim .card {
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1), width 0.22s ease-out, height 0.22s ease-out;
}

.anim .slot {
  transition: width 0.22s ease-out, height 0.22s ease-out;
}

.anim .card.no-tr,
.card.no-tr {
  transition: none;
}

.ci {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: calc(var(--cw) * 0.085);
  background: var(--card);
  box-shadow: 0 1px 2px var(--ci-shadow, rgba(0, 0, 0, 0.28));
}

.anim .ci {
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  visibility: hidden;
  pointer-events: none;
  -webkit-user-drag: none;
}

.card.up .face {
  visibility: visible;
}

.back {
  position: absolute;
  inset: calc(var(--cw) * 0.065);
  border-radius: calc(var(--cw) * 0.05);
  background-color: var(--back);
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 7px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.card.up .back {
  display: none;
}

/* ---- Mobile faces (style 1a, handoff mobile-faces/README.md) -------------
   Below 600px face-up cards are drawn here instead of the Royal or Classic
   image: rank top-left, small suit top-right, one big pip at the bottom; the
   same layout for every rank, no figures, no bottom index. Each part is a
   mask of one shared SVG (loaded once, then cached) filled with the suit
   colour, and every size is a fraction of the card width W (--cw). Board.js
   uses the same 600px breakpoint and skips the image download on phones. */
.mf {
  display: none;
}

@media (max-width: 599.98px) {
  .card.up .face {
    visibility: hidden;
  }

  .card.up {
    --ci-shadow: rgba(0, 0, 0, 0.3);
  }

  .card.up .mf {
    display: block;
    position: absolute;
    inset: 0;
    color: #1b1b1b;
    pointer-events: none;
  }

  .card[data-s="H"] .mf,
  .card[data-s="D"] .mf {
    color: #cb161f;
  }

  .mf > div {
    position: absolute;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
  }

  /* Rank: height 0.32 W at its natural width, 0.06 W from the left, 0.05 W from the top. */
  .mf-rank {
    left: calc(var(--cw) * 0.06);
    top: calc(var(--cw) * 0.05);
    width: calc(var(--cw) * 0.32 * var(--ra));
    height: calc(var(--cw) * 0.32);
    -webkit-mask-image: var(--rank);
    mask-image: var(--rank);
  }

  /* Corner suit: 0.24 W wide, 0.06 W from the right, centred on the rank (0.21 W down). */
  .mf-suit {
    right: calc(var(--cw) * 0.06);
    top: calc(var(--cw) * 0.21 - var(--cw) * 0.12 / var(--pa));
    width: calc(var(--cw) * 0.24);
    height: calc(var(--cw) * 0.24 / var(--pa));
    -webkit-mask-image: var(--pip);
    mask-image: var(--pip);
  }

  /* Centre pip: W × min(0.72, 0.82 × aspect) wide, centred, 0.08 W from the bottom. */
  .mf-pip {
    left: 50%;
    bottom: calc(var(--cw) * 0.08);
    width: calc(var(--cw) * min(0.72, 0.82 * var(--pa)));
    height: calc(var(--cw) * min(0.72, 0.82 * var(--pa)) / var(--pa));
    transform: translateX(-50%);
    -webkit-mask-image: var(--pip);
    mask-image: var(--pip);
  }

  /* Shapes and their width ÷ height. */
  .card[data-r="A"] { --rank: url(/cards-mobile/letters/A.svg); --ra: 1.203; }
  .card[data-r="2"] { --rank: url(/cards-mobile/letters/2.svg); --ra: 0.833; }
  .card[data-r="3"] { --rank: url(/cards-mobile/letters/3.svg); --ra: 0.825; }
  .card[data-r="4"] { --rank: url(/cards-mobile/letters/4.svg); --ra: 0.859; }
  .card[data-r="5"] { --rank: url(/cards-mobile/letters/5.svg); --ra: 0.805; }
  .card[data-r="6"] { --rank: url(/cards-mobile/letters/6.svg); --ra: 0.814; }
  .card[data-r="7"] { --rank: url(/cards-mobile/letters/7.svg); --ra: 0.785; }
  .card[data-r="8"] { --rank: url(/cards-mobile/letters/8.svg); --ra: 0.853; }
  .card[data-r="9"] { --rank: url(/cards-mobile/letters/9.svg); --ra: 0.819; }
  .card[data-r="10"] { --rank: url(/cards-mobile/letters/10.svg); --ra: 1.508; }
  .card[data-r="J"] { --rank: url(/cards-mobile/letters/J.svg); --ra: 0.906; }
  .card[data-r="Q"] { --rank: url(/cards-mobile/letters/Q.svg); --ra: 1.153; }
  .card[data-r="K"] { --rank: url(/cards-mobile/letters/K.svg); --ra: 1.347; }
  .card[data-s="S"] { --pip: url(/cards-mobile/pips/S.svg); --pa: 0.916; }
  .card[data-s="H"] { --pip: url(/cards-mobile/pips/H.svg); --pa: 1.046; }
  .card[data-s="D"] { --pip: url(/cards-mobile/pips/D.svg); --pa: 0.763; }
  .card[data-s="C"] { --pip: url(/cards-mobile/pips/C.svg); --pa: 0.963; }
}

.card.buried .ci {
  box-shadow: none;
}

.card.in-hand {
  cursor: grabbing;
}

.card.in-hand .ci {
  transform: rotate(4deg) scale(1.05);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.card.ghost {
  opacity: 0.3;
  pointer-events: none;
}

.card.ghost .ci {
  box-shadow: none;
}

.card.target .ci {
  box-shadow: 0 0 0 3px var(--accent), 0 1px 2px rgba(0, 0, 0, 0.25);
}

.card.hint .ci,
.slot.hint {
  animation: hintPulse 1.2s ease-in-out infinite;
}

.card.deal .ci {
  animation: deal 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.card.flip .ci {
  animation: flip 0.24s ease-out;
}

.card.shake .ci {
  animation: shake 0.3s ease-in-out;
}

html:not(.anim) .card.hint .ci,
html:not(.anim) .slot.hint {
  animation: none;
  box-shadow: 0 0 0 3px var(--accent);
}

@keyframes deal {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: none; }
}

@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 7px rgba(246, 198, 96, 0); }
  50% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 9px rgba(246, 198, 96, 0.35); }
}

@keyframes flip {
  from { transform: scaleX(0.1); }
  to { transform: none; }
}

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

/* Empty piles */
.slot {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--cw) * 0.085);
  background: rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--line);
  font-size: calc(var(--cw) * 0.36);
  font-weight: 700;
  line-height: 1;
}

.slot.target {
  background: rgba(246, 198, 96, 0.12);
  box-shadow: 0 0 0 3px var(--accent), inset 0 0 0 1.5px var(--line);
}

.slot-stock {
  cursor: pointer;
}

.slot-stock .glyph {
  font-size: calc(var(--cw) * 0.5);
}

.pass-caption {
  position: absolute;
  left: -8px;
  right: -8px;
  top: calc(var(--cw) * 1.4 + 3px);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  color: var(--card);
  opacity: 0.8;
}

.pip {
  width: calc(var(--cw) * 0.42);
  height: calc(var(--cw) * 0.42);
  background: var(--line);
  -webkit-mask: var(--pip) center / contain no-repeat;
  mask: var(--pip) center / contain no-repeat;
}

.pip-S { --pip: url('/assets/pips/S.svg'); }
.pip-H { --pip: url('/assets/pips/H.svg'); }
.pip-D { --pip: url('/assets/pips/D.svg'); }
.pip-C { --pip: url('/assets/pips/C.svg'); }

/* ---- Toasts (3b, 3d) -------------------------------------------------- */

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(24px, calc(var(--dock-h) + 10px));
  z-index: 40;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--chrome);
  color: var(--chrome-fg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  animation: pop 0.2s ease-out both;
}

.toast-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-size: 15px;
  font-weight: 700;
}

.toast-sub {
  font-size: 12px;
  color: var(--chrome-muted);
}

/* ---- Game dialogs ------------------------------------------------------- */

.win-dialog {
  max-width: 340px;
  gap: 18px;
  padding: 24px;
}

.daily-dialog,
.paused-dialog {
  gap: 14px;
}

.paused-dialog {
  position: relative;
  max-width: 280px;
  align-items: center;
  text-align: center;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}


.eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--chrome-muted);
}

.big-title {
  margin: 4px 0 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

.daily-dialog .big-title,
.paused-dialog .big-title {
  font-size: 28px;
}

.paused-dialog .big-title {
  margin: 0;
  letter-spacing: -0.02em;
}

.paused-stats {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.paused-dialog .dialog-text {
  font-size: 13px;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--btn);
}

.tile-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--chrome-muted);
}

.tile-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Win box: New game pulses from 3s into the confetti. */
.btn.pulse {
  animation: btn-pulse 1.2s ease-in-out infinite;
}

@keyframes btn-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* "Not enough points": the standard dialog, text a little larger and with
   more room around it. */
.np-dialog {
  width: auto;
  max-width: calc(100vw - 32px);
  gap: 0;
  padding: min(50px, 9vw) min(70px, 10vw) min(50px, 9vw) min(58px, 9vw);
}

.np-title {
  font-size: 21px;
}

.np-text {
  font-size: 16px;
}

/* Points shop */
.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-right: 18px; /* clear of the close badge */
}

.shop-rows {
  display: flex;
  flex-direction: column;
}

.shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--chrome-line);
}

.shop-name {
  font-size: 15px;
  font-weight: 600;
}

.shop-sub {
  margin: 0;
  font-size: 12px;
  color: var(--chrome-muted);
}

.shop-need {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
}

.shop-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step {
  width: 36px;
  height: 36px;
  border: 1px solid var(--chrome-line);
  border-radius: 9px;
  background: var(--btn);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

.step:hover {
  background: var(--btn-hover);
}

.step.shake {
  animation: shake 0.3s ease-in-out;
}

.step-n {
  min-width: 16px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.shop-dialog .btn.shake {
  animation: shake 0.3s ease-in-out;
}

.win-points {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  text-align: center;
}

.wp-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.wp-parts {
  font-size: 12px;
  font-weight: 500;
  color: var(--chrome-muted);
}

.win-points:empty {
  display: none;
}

.streak {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--btn);
}

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

.streak-count {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.streak-best {
  font-size: 12px;
  color: var(--chrome-muted);
  white-space: nowrap;
}

.dots {
  display: flex;
  justify-content: space-between;
}

.dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--btn);
  box-shadow: inset 0 0 0 1px var(--chrome-line);
}

.dot.on {
  background: var(--accent);
  box-shadow: none;
}

.dot.today {
  box-shadow: 0 0 0 2px var(--chrome), 0 0 0 4px var(--accent);
}

.next-daily {
  font-size: 13px;
  text-align: center;
  color: var(--chrome-muted);
}

.next-daily strong {
  color: var(--chrome-fg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Win sequence: scrim fades in, card pops, then the ad. */
.win-overlay .scrim {
  animation: fadeIn 0.4s ease-out both;
}

.win-overlay .dialog {
  animation: pop 0.3s ease-out 0.1s both;
}

.win-overlay .ad {
  animation: pop 0.3s ease-out 0.25s both;
}

html:not(.anim) .overlay *,
html:not(.anim) .toast,
html:not(.anim) .ng-menu,
html:not(.anim) .nav-sheet {
  animation: none !important;
}

/* Fireworks move into the open win/daily overlay too: above the dimmed page,
   below the dialog. */
.overlay .fx {
  z-index: auto;
}

/* Sits inside the open win/daily overlay, between the scrim and the dialog. */
.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Win dialog: "🎉 You won 🎉" centred; the close badge sits on the corner. */
.win-dialog .dialog-head {
  justify-content: center;
}

.win-dialog .big-title {
  margin: 0;
}

/* "🎉 You won 🎉": both poppers point in at the text. The emoji's cone is
   bottom-left and it sprays up-right, so the left one is as drawn and the
   right one is mirrored. Same font size as the text. */
.win-title {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.popper {
  --flip: 1;
  /* The slot is exactly as wide as the emoji's drawing (measured on load in
     js/app.js from the device's own emoji font), so mirroring is symmetric
     and both poppers sit the same distance from the text. */
  display: inline-block;
  flex: none;
  width: var(--popper-w, 1em);
  text-indent: var(--popper-shift, 0em);
  white-space: nowrap;
  font-size: 1em;
  line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  transform: scaleX(var(--flip));
  transform-origin: 50% 85%; /* centre, so mirroring doesn't shift it sideways */
  animation: popperIn 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) 0.2s both, popper 2.4s ease-in-out 0.8s infinite;
}

.popper-r {
  --flip: -1;
  animation-delay: 0.3s, 0.9s;
}

/* Narrow phones: shrink the whole line (text and poppers together) to fit. */
@media (max-width: 339px) {
  .win-title {
    font-size: 27px;
  }
}

@keyframes popperIn {
  from { transform: scaleX(var(--flip)) scale(0) rotate(-40deg); }
  to { transform: scaleX(var(--flip)); }
}

@keyframes popper {
  0%, 30%, 100% { transform: scaleX(var(--flip)); }
  6% { transform: scaleX(var(--flip)) rotate(-14deg) scale(0.92); }
  13% { transform: scaleX(var(--flip)) rotate(12deg) scale(1.14); }
  20% { transform: scaleX(var(--flip)) rotate(-5deg) scale(1.02); }
}

.fx {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 55;
  width: 100vw;
  height: calc(100vh - var(--dock-h));
  pointer-events: none;
}

/* Foundation burst: over the board, under the toasts, dialogs and sheets. */
.sparks {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 35;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

/* Settings sheet (3f) */
.settings-sheet {
  padding: 8px 20px 24px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.deck-tiles {
  display: flex;
  flex: none;
  gap: 8px;
}

.deck-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 5px;
  border: 0;
  border-radius: 10px;
  background: var(--btn);
  color: var(--chrome-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.deck-tile img {
  width: 30px;
  height: 42px;
  border-radius: 3px;
}

.deck-tile[aria-checked='true'] {
  box-shadow: 0 0 0 2px var(--accent);
  color: var(--chrome-fg);
}

/* Settings sits in the middle of the screen on every layout. */
.settings-sheet {
  top: 0;
  bottom: 0;
  height: fit-content;
  max-width: 440px;
  max-height: calc(100% - 48px);
  margin: auto;
  padding-top: 18px;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.settings-sheet .grabber {
  display: none;
}

/* Only the list scrolls, so the corner badge can sit over the box's edge. */
.settings-sheet {
  overflow: visible;
  max-height: none;
}

.settings-sheet .sheet-body {
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  overflow-y: auto;
}

.settings-sheet > .close-badge {
  top: -10px;
  right: -8px;
}

/* Phones: keep a margin at the sides so the box and its badge float. */
@media (max-width: 480px) {
  .settings-sheet {
    left: 14px;
    right: 14px;
  }
}

/* Interstitial (3i, 4e) */
.interstitial {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: #101312;
  color: var(--chrome-fg);
}

/* The logo sits exactly where the game page header puts it: the same side
   padding, and the same drop as the header centring it beside its controls
   (none on phone and tablet, 36px controls in landscape, 44px on wide). */
.inter-top {
  --logo-drop: 0px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px max(var(--outer), 12px) 0;
}

.l-landscape .inter-top {
  --logo-drop: 4px;
}

.l-wide .inter-top {
  --logo-drop: 8px;
}

.inter-logo {
  flex: none;
  height: 28px;
  width: auto;
  margin-top: var(--logo-drop);
}

/* Skip control centred on the logo (it is 8px taller). */
.inter-top .skip-wait,
.inter-top .skip-btn {
  margin-top: calc(var(--logo-drop) - 4px);
}

.inter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chrome-muted);
}

.skip-wait {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--btn);
  font-size: 13px;
  font-weight: 600;
  color: var(--chrome-muted);
}

.skip-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 36px;
  padding: 0 12px 0 14px;
  border: 0;
  border-radius: 18px;
  background: var(--chrome-fg);
  color: var(--chrome);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.skip-btn span {
  font-size: 18px;
  line-height: 1;
}

.inter-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
}

.inter-body .ad {
  max-height: calc(100vh - 140px);
}

.inter-note {
  font-size: 13px;
  color: var(--chrome-muted);
}

/* Loading (4f) */
.loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--chrome);
  transition: opacity 0.25s ease-out;
}

/* Safety net: if the script never runs, the loading screen still clears. */
.loading {
  animation: loadingOut 0.3s ease-out 4s forwards;
}

@keyframes loadingOut {
  to { opacity: 0; visibility: hidden; }
}

.loading.done {
  opacity: 0;
  pointer-events: none;
}

.loading img {
  height: 36px;
  width: auto;
}

.progress {
  width: 160px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--btn);
}

.progress-bar {
  width: 8%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.2s ease-out;
}

.loading-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--chrome-muted);
}
