/* audit.css — client audit pass. Loaded after royal.css/spin.css, before perf.css.
   Nothing here adds backdrop-filter or filter to animated elements. */

/* The overlay class set by the overlay MutationObserver in js/ui.js; perf.css
   pauses the home sheens on it. Kept here too so the class works even if
   perf.css is trimmed. */
body.has-overlay .hero-card::after,
body.has-overlay .league-badge.lg::after { animation-play-state: paused; }

/* Result card: what the match earned, under the standings. */
.result-earn { margin: -4px 0 14px; display: grid; gap: 2px; text-align: center; }
.result-earn b { font-family: var(--serif); font-size: 22px; color: var(--brass-hi); }
.result-earn span { font-size: 12px; color: var(--ink-3); }
.result-social { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.result-social .btn { flex: 1 1 40%; }

/* Bots wear a plain "Computer" tag on their chip and in the lobby. */
.chip-bot { font-weight: 500; font-size: 11px; color: var(--ink-3); letter-spacing: .02em; }

/* Chat bubble that can be reported: a faint affordance only. */
.chat-bubble.is-reportable { cursor: pointer; }

/* Daily spin: the odds line under the wheel, and the close button while the wheel turns. */
.spin-odds { font-size: 11px; color: var(--ink-3); text-align: center; margin: 2px 0 0; }
#btn-spin-close:disabled { opacity: .35; pointer-events: none; }

/* Shop: a price the player cannot meet yet, dimmed, with the gap beside it. */
.shop-btn.is-short { opacity: .62; }
.coin-pill[type="button"] { cursor: pointer; font: inherit; }

/* League empty state: the player's own row and the way in. */
.league-me { margin-bottom: 8px; }
.league-enter-chip {
  display: inline-block; margin: 6px auto 10px; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; color: var(--brass-hi); border: 1px solid rgba(214, 176, 94, .45);
  background: rgba(214, 176, 94, .08);
}

/* Friends pager: the second page is "More", not an unlabelled arrow. */
#screen-friends .pager-bar .icon-btn[data-d="1"] { width: auto; padding: 0 10px; }
#screen-friends .pager-bar .icon-btn[data-d="1"]::before { content: none; }
#screen-friends .pager-bar .icon-btn[data-d="1"]::after { content: "More ›"; font-size: 12px; color: var(--ink-2); line-height: 36px; }
/* One page, no dots. */
.pager-bar .pager-dots:has(i:only-child) { visibility: hidden; }

/* Hero size badge is a button now. */
.hero-badge[role="button"] { cursor: pointer; }
.hero-badge[role="button"]:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }

/* Settings: the notifications system row. */
.notify-system-row { width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.notify-system-row.is-off .fold-value { color: var(--ink-3); }

/* Name-ask: the terms line. */
.name-ask-terms { font-size: 11px; text-align: center; margin-top: 8px; }
.name-ask-terms a { color: var(--brass-hi); }

/* A toast that opens something on tap. */
.toast.is-tappable { cursor: pointer; text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); }

/* ───────────────────────── one list per section, no "second screen"
   Paging is off (js/pager.js), so every section is a plain list that
   scrolls up and down. The screens that are not tabs have no tab bar to
   clear, but do need room for the Android gesture area. */
.pager-bar { display: none !important; }
#screen-settings .scroller, #screen-family .scroller, #screen-war .scroller, #screen-watch .scroller {
  padding-bottom: calc(28px + var(--sab, env(safe-area-inset-bottom, 0px)));
}
#screen-settings .scroller > .pad { display: block; }

/* ───────────────────────── the winning card: a coronation
   Gold rays turn slowly behind the card; a marigold toran hangs across its
   top; a jewelled crown stands in place of the crest with sparks around
   it; a crimson banner says Congratulations; flowers fall. Everything that
   moves is moved by transform or opacity only (see css/perf.css). */
.win-rays, .win-crown, .win-sparks, .win-banner, .win-line { display: none; }
.result-card.is-win { overflow: visible; }
.result-card.is-win .result-crest .ico-league { display: none; }

/* rays: a repeating conic wedge, masked to a soft disc, turning behind the card */
.overlay:has(.result-card.is-win) .win-rays {
  display: block; position: fixed; left: 50%; top: 50%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax;
  pointer-events: none; z-index: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255, 206, 110, .16) 0deg 9deg, transparent 9deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .55) 28%, transparent 62%);
  mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .55) 28%, transparent 62%);
  animation: win-rays 36s linear infinite;
}
@keyframes win-rays { to { transform: rotate(360deg); } }
.overlay:has(.result-card.is-win) .result-card { position: relative; z-index: 1; }
.overlay:has(.result-card.is-win) .confetti { z-index: 2; }

/* the banner: crimson velvet, scalloped gold edge, under the toran's dip */
.result-card.is-win .win-banner {
  display: block; position: relative; z-index: 1;
  margin: -26px -24px 14px; padding: 13px 18px 11px; border-radius: 20px 20px 0 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #a3263a 0%, #6a1020 100%);
  box-shadow: 0 6px 18px rgba(30, 4, 8, .55), inset 0 1px 0 rgba(255, 224, 160, .4), inset 0 -2px 0 rgba(228, 184, 96, .6);
  animation: banner-drop .5s var(--royal-ease, ease-out) .35s both;
}
.result-card.is-win .win-banner::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 11px; pointer-events: none;
  background:
    radial-gradient(circle at 50% 0, transparent 0 8px, #e4b860 8.5px 10px, transparent 10.5px) 0 0 / 24px 11px repeat-x,
    radial-gradient(circle at 50% 0, #6a1020 0 9px, transparent 9.5px) 0 0 / 24px 11px repeat-x;
}
.win-banner span {
  display: block; font-family: var(--serif, "Lora", serif); font-weight: 700; font-size: 22px; letter-spacing: .06em;
  color: #ffe7a8; text-shadow: 0 1px 0 #4a0a14, 0 0 18px rgba(255, 196, 96, .5);
}
@keyframes banner-drop { from { opacity: 0; transform: translateY(-12px) scaleX(.92); } to { opacity: 1; transform: none; } }

/* the crown, rising into a halo, with sparks */
.result-card.is-win .result-crest { position: relative; width: 136px; height: 136px; margin: 14px auto 0; overflow: visible;
  background: radial-gradient(circle at 50% 58%, rgba(255, 210, 120, .32), rgba(255, 210, 120, .08) 48%, transparent 66%); border-radius: 50%; }
.result-card.is-win .win-crown {
  display: block; width: 124px; height: auto; margin: 0 auto; position: relative; z-index: 1;
  animation: crown-rise .7s cubic-bezier(.3, 1.35, .5, 1) .15s both, crown-float 3.2s ease-in-out 1s infinite;
}
@keyframes crown-rise { from { opacity: 0; transform: translateY(26px) scale(.5); } to { opacity: 1; transform: none; } }
@keyframes crown-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.result-card.is-win .win-sparks { display: block; position: absolute; inset: 0; pointer-events: none; }
.win-sparks i {
  position: absolute; left: 50%; top: 55%; width: 7px; height: 7px; margin: -3px; border-radius: 50%;
  background: radial-gradient(circle, #fff6d2, #ffcf6a 60%, transparent 70%);
  animation: spark-fly 1.6s ease-out var(--sd, 0s) infinite;
}
.win-sparks i:nth-child(1) { --sa: 0deg;   --sd: .2s; } .win-sparks i:nth-child(2) { --sa: 45deg;  --sd: .5s; }
.win-sparks i:nth-child(3) { --sa: 90deg;  --sd: .1s; } .win-sparks i:nth-child(4) { --sa: 135deg; --sd: .7s; }
.win-sparks i:nth-child(5) { --sa: 180deg; --sd: .35s; } .win-sparks i:nth-child(6) { --sa: 225deg; --sd: .9s; }
.win-sparks i:nth-child(7) { --sa: 270deg; --sd: .6s; } .win-sparks i:nth-child(8) { --sa: 315deg; --sd: 1.1s; }
@keyframes spark-fly {
  0% { opacity: 0; transform: rotate(var(--sa)) translateX(30px) scale(.4); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--sa)) translateX(88px) scale(1); }
}

/* the headline under the crown */
.result-card.is-win .win-line {
  display: block; margin: 4px 0 2px; font-family: var(--serif, "Lora", serif); font-size: 15px; color: var(--brass-hi, #f2d28a);
  letter-spacing: .02em; animation: royal-rise .4s var(--royal-ease, ease-out) .5s both;
}
.result-card.is-win h2 { font-size: 28px; margin-top: 0; }
.result-card.is-win .standings { margin-bottom: 12px; }
.result-card.is-win { max-height: none; }

@media (prefers-reduced-motion: reduce) {
  .win-rays, .win-crown, .win-sparks i, .result-card.is-win .win-banner { animation: none !important; }
}

.confetti i {
  width: calc(var(--s, 1) * 9px); height: calc(var(--s, 1) * 14px); border-radius: 2px;
  background: var(--c); opacity: .95; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  animation: confetti-fall 3.4s linear var(--d) 2 forwards;
}
.confetti i.cf-rb { width: calc(var(--s, 1) * 6px); height: calc(var(--s, 1) * 22px); border-radius: 3px; }
@keyframes confetti-fall {
  0%   { transform: translate3d(0, -10vh, 0) rotate(var(--r)) rotateX(0deg); opacity: 0; }
  6%   { opacity: 1; }
  50%  { transform: translate3d(var(--sway, 14px), 50vh, 0) rotate(calc(var(--r) + 260deg)) rotateX(180deg); }
  100% { transform: translate3d(calc(var(--sway, 14px) * -1), 106vh, 0) rotate(calc(var(--r) + 540deg)) rotateX(360deg); opacity: .9; }
}

/* ───────────────────────── cowries in the player's own colour
   The shells in the tray, and the one that dances at home, take the colour
   the player chose: an ivory shell washed with that colour, white where the
   light hits, deep where it falls away. */
.shells[class*="pc-"] .cowrie .cs0 { stop-color: color-mix(in srgb, var(--pc-hi) 55%, #fff); }
.shells[class*="pc-"] .cowrie .cs1 { stop-color: color-mix(in srgb, var(--pc) 70%, var(--pc-hi)); }
.shells[class*="pc-"] .cowrie .cs2 { stop-color: var(--pc); }
.shells[class*="pc-"] .cowrie .cs3 { stop-color: color-mix(in srgb, var(--pc-lo) 88%, #000); }
.shells[class*="pc-"] .cowrie ellipse[fill="none"] { stroke: color-mix(in srgb, var(--pc-lo) 70%, #000); }

/* a sogtī reaching Ghar: your own piece celebrates on the home cell.
   It swells, twirls and hops three times inside a glow in its own colour;
   the arrive animation then shrinks it away. Body and halo only: both are
   moved by transform/opacity, never by filter. */
.pawn.is-celebrating { z-index: 8; }
.pawn.is-celebrating::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 340%; height: 340%; margin: -170% 0 0 -170%; border-radius: 50%; z-index: -1;
  background:
    radial-gradient(circle, transparent 0 30%, color-mix(in srgb, var(--pc-hi) 90%, transparent) 31% 33%, transparent 34%),
    radial-gradient(circle, #fff7d6 0%, color-mix(in srgb, var(--pc-hi) 85%, #fff4c8) 14%, color-mix(in srgb, var(--pc) 60%, transparent) 38%, transparent 66%);
  animation: sogti-halo 1.5s ease-out both;
}
.pawn.is-celebrating .pawn-body { animation: sogti-celebrate 1.5s cubic-bezier(.3, .9, .4, 1) both; transform-origin: 50% 85%; }
@keyframes sogti-celebrate {
  0%   { transform: translateY(0) scale(1) rotate(0deg); }
  8%   { transform: translateY(0) scale(1.5, 1.1) rotate(0deg); }
  20%  { transform: translateY(-85%) scale(1.8, 1.9) rotate(-14deg); }
  32%  { transform: translateY(0) scale(1.9, 1.5) rotate(0deg); }
  46%  { transform: translateY(-110%) scale(2.1) rotate(200deg); }
  58%  { transform: translateY(0) scale(1.9, 1.5) rotate(360deg); }
  70%  { transform: translateY(-70%) scale(2) rotate(372deg); }
  82%  { transform: translateY(0) scale(1.85, 1.55) rotate(352deg); }
  92%  { transform: translateY(-40%) scale(1.9) rotate(364deg); }
  100% { transform: translateY(0) scale(1.8) rotate(360deg); }
}
@keyframes sogti-halo { 0% { opacity: 0; transform: scale(.3); } 14% { opacity: 1; } 70% { opacity: .95; transform: scale(1); } 100% { opacity: 0; transform: scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .pawn.is-celebrating .pawn-body, .pawn.is-celebrating::before { animation: none !important; } }

/* a cut sogtī walking home, head down: it dims a little and sags as it goes,
   and each cell is a small shuffle rather than a hop. transform/opacity only. */
.pawn.is-retreating { z-index: 6; transition: transform .07s linear; }
.pawn-body.is-slumping { animation: slump .32s ease-in-out infinite; opacity: .82; }
@keyframes slump {
  0%, 100% { transform: translateY(0) scale(1, .92) rotate(-5deg); }
  50% { transform: translateY(-10%) scale(.96, .96) rotate(5deg); }
}
@media (prefers-reduced-motion: reduce) { .pawn-body.is-slumping { animation: none; } }

/* ───────────────────────── a steady table
   Nothing at the table changes size when the turn passes or when something
   happens to a player. The status line keeps its full two-line height
   (padding included - it was counted inside the reserve, so a wrapped line
   grew it by 6px and pushed the throw area down and up), the chips have
   fixed widths with the "inner ring unlocked" mark floated in the corner
   instead of widening them, and a long name wraps rather than being cut. */
#screen-game .status { min-height: calc(2 * 1.45em + 6px); box-sizing: border-box; }
.chip { position: relative; }
#seat-top .chip, #seat-bottom .chip { width: 188px; min-width: 188px; box-sizing: border-box; }
.chip-body { min-width: 0; flex: 1 1 auto; }
.chip-body b { overflow: visible; white-space: normal; line-height: 1.2; overflow-wrap: anywhere; }
.chip-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-badge { position: absolute; top: 5px; right: 9px; line-height: 1; }
.chip-bot { opacity: .85; font-weight: 600; }

/* the left and right seats: a small "Computer" label over the name, the name
   free to take two or three short lines - no more "Compu..." */
.seat-left .chip, .seat-right .chip { width: 54px; padding: 6px 2px; box-sizing: border-box; }
.seat-left .chip b, .seat-right .chip b {
  display: block; font-size: 11px; line-height: 1.15; max-width: 100%; letter-spacing: 0;
  white-space: normal; overflow: hidden; text-overflow: clip; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4;
}
.seat-left .chip .chip-bot, .seat-right .chip .chip-bot { display: block; font-size: 8.5px; letter-spacing: 0; white-space: nowrap; text-transform: uppercase; opacity: .8; margin-bottom: 1px; }
.seat-left .chip .chip-sep, .seat-right .chip .chip-sep { display: none; }
.seat-left .chip .chip-name, .seat-right .chip .chip-name { display: block; }
.seat-left .chip .pips em, .seat-right .chip .pips em { font-size: 11px; }

/* ───────────────────────── home: a bigger board, quieter side tiles
   The board is the logo and the centre of the screen; Live and League are
   shortcuts and sit smaller at its sides so the three balance. */
#screen-menu .home-mid { grid-template-columns: 68px 1fr 68px; }
#screen-menu .home-mid .brand-mark { width: clamp(92px, 15.5dvh, 138px); height: clamp(92px, 15.5dvh, 138px); }
#screen-menu .home-mid .brand .deva { font-size: clamp(20px, 3dvh, 26px); }
#screen-menu .home-live { width: 66px; padding: 6px 3px 5px; }
#screen-menu .home-live-ico { width: 38px; height: 38px; }
#screen-menu .home-live-ico img.ico { width: 32px; height: 32px; }
#screen-menu .home-live-label { font-size: 11px; }
#screen-menu .home-mid .chip-league { width: 66px; padding: 6px 3px 5px; font-size: 11px; }
#screen-menu .home-mid .chip-league img.ico { width: 30px; height: 30px; }

/* the gift sheet drops away at once when a gift is sent (the animation is already playing) */
.gift-sheet { transition-duration: .14s; }
.gift-scrim { transition-duration: .12s; }

/* ───────────────────────── short phones (360x640): the whole table on one screen
   The game screen was 722px tall at 640 and the Throw button sat below the
   fold, so the player scrolled every turn. Every band gives a little back -
   the bar, the gaps, the chips' padding, the status line, the button - and
   the board keeps its size. Portrait only: landscape has its own grid. */
@media (max-height: 700px) and (orientation: portrait) {
  #screen-game .topbar { padding-top: max(6px, var(--sat, env(safe-area-inset-top, 0px))); padding-bottom: 6px; }
  #screen-game .table { gap: 6px; }
  #screen-game .board { width: min(93vw, 50dvh, 470px); }
  #seat-top .chip, #seat-bottom .chip { padding-top: 4px; padding-bottom: 4px; }
  #screen-game .status { margin: auto 16px 6px; padding-top: 2px; font-size: 14.5px; line-height: 1.35; min-height: calc(2 * 1.35em + 2px); }
  .btn-throw { min-height: 52px; }
  .throw-area .tray { padding-top: 6px; padding-bottom: 6px; }
  .turn-timer { margin-top: 6px; margin-bottom: 4px; }
}
/* At 360 wide the tray was 10px wider than its box and the empty throw-value
   slot slid under the Throw button. */
@media (max-width: 374px) {
  .throw-area .tray { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .shells { gap: 5px; }
}

/* ───────────────────────── home on narrow phones (360 wide)
   The "2 players" badge sat on Play online's globe, and the family line was
   cut to "anoth…". The badge rides the tile's top edge, smaller, clear of
   the icon; the family line may take a second line. */
@media (max-width: 374px) {
  #screen-menu .mode-tile.is-big .hero-badge { top: -7px; right: 4px; padding: 1px 6px; font-size: 11px; letter-spacing: .02em; }
  #screen-menu .home-family-copy em { white-space: normal; line-height: 1.15; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
}

/* ───────────────────────── home on tablets
   The 2x2 grid took every spare pixel, so each tile grew ~300px tall around
   a 44px icon. Tiles stop at a card's height, the icon and type scale up, and
   the spare height falls below the grid. */
@media (min-width: 600px) {
  #screen-menu .mode-row.is-grid { grid-template-rows: minmax(0, 210px) minmax(0, 210px) auto; align-content: start; }
  #screen-menu .mode-tile.is-big .mode-tile-ico { width: clamp(44px, 6dvh, 72px); height: clamp(44px, 6dvh, 72px); }
  #screen-menu .mode-tile.is-big b { font-size: 18px; }
  #screen-menu .mode-tile.is-big em { font-size: 13px; }
}

/* A line in the narrow lane beside the far chip (placeInTopLane, ui.js):
   a smaller face and padding so a short sentence fits in ~86px of width. */
.chat-bubble.is-lane-tight { font-size: 12px; padding: 5px 8px 6px; }
.chat-bubble.is-lane-tight .bubble-who { font-size: 11px; padding: 0 4px; }

/* ---- invite banner: drops in from the top on every screen, green Join ---- */
.invite-toast {
  bottom: auto;
  top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 10px);
  z-index: 95;
  animation: inviteDown .42s cubic-bezier(.2, 1.2, .4, 1) both;
}
@keyframes inviteDown { from { opacity: 0; transform: translateY(-28px) scale(.97); } to { opacity: 1; transform: none; } }
/* On the board the banner sits below the topbar (as .call-banner does), so
   the quit/back button under it stays tappable. */
/* Every screen but home has a topbar (back button on the left), so the
   banner sits below it everywhere except the menu. */
html:not([data-screen="menu"]) .invite-toast { top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 66px); }
.invite-toast .btn-primary {
  background: linear-gradient(180deg, #4fc46f, #1f8a45);
  color: #fff; border-color: #15733a;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.invite-toast .btn-primary:active { background: linear-gradient(180deg, #43b062, #19743a); }

/* ───────────────────────── home on short screens: scroll, don't crush
   The four play tiles shared whatever height was left and shrank to fit -
   18px tall at 568, 58px at 667, and in landscape they went to nothing
   behind the tab bar - while the menu, which can scroll, never overflowed.
   Below 760px tall each tile keeps a floor and the grid stops shrinking, so
   the menu scrolls instead. Taller screens never reach the floor. */
@media (max-height: 760px) {
  #screen-menu .mode-row.is-grid { flex: 1 0 auto; grid-template-rows: 1fr 1fr auto; grid-auto-rows: 1fr; }
  #screen-menu .mode-tile.is-big { min-height: 84px; }
}
/* The Bluetooth row is a fixed 58px; at 320 wide its line wrapped and pushed
   the title into the top edge. One line, cut short. */
@media (max-width: 340px) {
  #screen-menu #btn-nearby-menu .nearby-copy { min-width: 0; }
  #screen-menu #btn-nearby-menu em { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ───────────────────────── 320x568: the whole table on one screen
   Throw sat at 517-575 on a 568 screen and the history button was cut off
   at the right edge. The near chip narrows so chat - chip - history fit in
   320, and the board gives back ~23px of height. 360x640 is untouched. */
@media (max-width: 340px) {
  #seat-bottom .chip { width: 150px; min-width: 150px; }
}
@media (max-height: 600px) and (orientation: portrait) {
  #screen-game .board { width: min(93vw, 46dvh, 470px); }
}

/* The turn pill stays one line in every language: a Tamil "your turn" took
   two lines at 320 and pushed Throw off the screen. */
.turn-pill .dot { flex: none; }
/* At EVERY width, not just the narrow ones: a long player name made the pill
   two lines (38 -> 57px) at 393px, and the whole table slid down 11px each
   time the turn passed to them. Fixed height, one line, ellipsis. */
.turn-pill { min-width: 0; min-height: 38px; box-sizing: border-box; }
.turn-pill #turn-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 340px) {
  .turn-pill { font-size: 12px; padding-left: 12px; padding-right: 12px; gap: 7px; }
}

/* ───────────────────────── How to play on short screens
   The card scrolls, and Back / Next scrolled away with it - at 568 they sat
   below the screen. They now stay pinned to the bottom of the card. */
@media (max-height: 700px) {
  #howto { padding-top: 12px; padding-bottom: 12px; }
  #howto .hw-nav {
    position: sticky; bottom: -20px; z-index: 1;
    margin: 0 -22px -20px; padding: 12px 22px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0), var(--velvet-lo) 12px);
  }
}

/* ───────────────────────── four at the table: side chips off the cells
   The left and right chips are meant to ride the board's carved frame, but
   at 62px wide they reached ~15px onto the cells and half covered the blue
   and green nests. The chips are 54px now (the rule above) and, on a phone, the board
   gives up just enough width that frame + gutter hold a whole chip:
   (100vw - W) / 2 + W * 11/122 >= 55px  <=>  W <= 122vw - 135px.
   Only tables with a side seat; a two-player board keeps its size. */
@media (orientation: portrait) {
  #screen-game .table:has(.seat-left .chip, .seat-right .chip) .board { max-width: calc(122vw - 135px); }
}

/* A toast that carries a tap (the "played - your turn" one, an in-app push)
   must receive it: plain toasts are pointer-events:none so they never block
   the screen under them. */
.toast.is-tappable { pointer-events: auto; cursor: pointer; }

/* Reduced motion: the global .01ms transition still lets a bubble be measured
   mid-slide, so its "never cover the speaker's chip" check misses. Bubbles
   only fade there. */
@media (prefers-reduced-motion: reduce) {
  .chat-bubble { transition-property: opacity; }
}

/* Shop header coin pill: painted gold coin, gold number (the button default
   left the figure black on the maroon pill). */
#screen-shop .coin-pill {
  color: var(--brass-hi);
  border-color: rgba(224, 176, 85, .55);
  background: linear-gradient(180deg, rgba(224, 176, 85, .16), rgba(125, 84, 19, .22)), var(--well);
  box-shadow: inset 0 1px 0 rgba(255, 234, 180, .18);
  gap: 7px; padding: 5px 14px 5px 9px;
}
#screen-shop .coin-pill img.ico { width: 26px; height: 26px; flex: none; }
#screen-shop .coin-pill b {
  font-size: 18px; font-weight: 800; letter-spacing: .01em;
  background: linear-gradient(180deg, #fff1c4 10%, #f0c15e 55%, #c98f2c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
}

/* ---- host's answer to a guest's rematch request (askHostRematch, ui.js) ---- */
.rematch-ask {
  position: fixed; left: 50%; bottom: calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 24px);
  transform: translateX(-50%); z-index: 96; width: min(340px, calc(100vw - 32px));
  padding: 12px 14px; border-radius: 16px; text-align: center;
  background: linear-gradient(180deg, var(--surface, #2a1f17), var(--surface-2, #1d150f));
  border: 1px solid var(--brass, #c9a24a); box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.4));
  animation: inviteDown .3s ease-out both;
}
.rematch-ask p { margin: 0 0 10px; font-size: 15px; }
.rematch-ask-row { display: flex; gap: 8px; }
.rematch-ask-row .btn { flex: 1; min-height: 44px; }

/* The family code is six spaced letters: one line at any phone width. */
#family-code { white-space: nowrap; font-size: clamp(24px, 8vw, 40px); letter-spacing: clamp(.04em, 1.2vw, .14em); }

/* ---- profile card: change your own name ---- */
.pf-rename {
  display: inline-block; margin-top: 4px; padding: 4px 0; min-height: 32px;
  background: none; border: 0; color: var(--brass, #d9b45a);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.pf-name-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.pf-name-edit input {
  flex: 1 1 120px; min-width: 0; min-height: 44px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--edge, rgba(255,255,255,.18));
  background: var(--surface-2, rgba(0,0,0,.25)); color: inherit; font: inherit; font-size: 15px;
}
.pf-name-edit .btn { min-height: 44px; padding: 0 14px; }
.pf-name-status { flex-basis: 100%; margin: 0; color: var(--danger, #ff8a7a); font-size: 13px; }

/* Move history button hidden for now (kept in the DOM and in the row so the
   chip stays centred; the log sheet code is untouched). */
#log-toggle { visibility: hidden; pointer-events: none; }

/* ---- chat strip: a line with no room beside its seat (bubble(), ui.js) ----
   Centred under the in-game topbar, above the board, below the invite banner. */
#bubbles .chat-bubble.chat-strip {
  position: fixed; left: 50%; right: auto;
  top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 66px);
  max-width: min(300px, 90vw); width: max-content;
  transform: translateX(-50%); z-index: 90; pointer-events: none;
  animation: chatStripIn .22s ease-out both;
  transition: opacity .3s, transform .3s;
}
#bubbles .chat-bubble.chat-strip.is-out { opacity: 0; transform: translateX(-50%) translateY(-6px); }
@keyframes chatStripIn { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { #bubbles .chat-bubble.chat-strip { animation: none; transition: opacity .2s; } }

/* Lobby: once a friend has joined, Start is THE action - fresh green, large,
   and pinned to the bottom of the lobby pane so it is visible without
   scrolling past the colour and pawn pickers. */
#screen-lobby #btn-lobby-start {
  position: sticky; bottom: 0; z-index: 5; align-self: stretch; margin-top: auto;
  min-height: 58px; font-size: 19px; font-weight: 800; letter-spacing: .01em;
  color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
  background: linear-gradient(180deg, #5ad37d 0%, #2fae5c 55%, #1f8a45 100%);
  border: 1px solid #15733a;
  box-shadow: 0 -16px 14px -6px rgba(58, 21, 25, .96), 0 6px 18px rgba(31, 138, 69, .5), inset 0 1px 0 rgba(255, 255, 255, .35);
}
#screen-lobby #btn-lobby-start:not([disabled]):active { background: linear-gradient(180deg, #49bd6c, #1b7a3d); transform: translateY(1px); }
#screen-lobby #btn-lobby-start[disabled] { background: linear-gradient(180deg, #5a6b5f, #3f4d44); border-color: #2c372f; box-shadow: none; opacity: .85; }
#screen-lobby .lobby-wrap { padding-bottom: calc(14px + var(--sab, env(safe-area-inset-bottom, 0px))); }

/* Starting a turn-based match with a friend: same fresh green as the live Start. */
#btn-async-start {
  color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
  background: linear-gradient(180deg, #5ad37d 0%, #2fae5c 55%, #1f8a45 100%);
  border: 1px solid #15733a;
  box-shadow: 0 6px 16px rgba(31, 138, 69, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
}
#btn-async-start:not([disabled]):active { background: linear-gradient(180deg, #49bd6c, #1b7a3d); }

/* ───────────────────────── daily spin: the "collected" popup
   Layered over the spin card inside #daily-spin. Rays, glow, coins and
   confetti move by transform/opacity only - no filters (see perf.css). */
.spin-reward {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(20, 6, 4, .62); animation: royal-fade .2s ease both;
}
.spin-reward[hidden] { display: none; }
.spin-reward-confetti { position: fixed; z-index: 0; }
.spin-reward-card {
  position: relative; z-index: 1; width: min(340px, 100%); max-height: calc(100% - 8px); overflow: hidden;
  padding: 16px 18px 16px; text-align: center; animation: spin-reward-pop .42s cubic-bezier(.2, 1.4, .4, 1) both;
}
.spin-reward-card::after { display: none; }
@keyframes spin-reward-pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
.spin-reward-wallet {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 5px; border-radius: 999px;
  background: rgba(0, 0, 0, .28); border: 1px solid rgba(228, 184, 96, .35); font-size: 14px; color: var(--gold-satin-hi);
}
.spin-reward-wallet .ico { width: 20px; height: 20px; }
.spin-reward-wallet.is-bump { animation: spin-wallet-bump .22s ease; }
@keyframes spin-wallet-bump { 50% { transform: scale(1.14); } }
.spin-reward-card h2 { margin: 6px 0 0; font-size: 22px; }
.spin-reward-prize { position: relative; width: 150px; height: 150px; margin: 2px auto 0; }
.spin-reward-rays, .spin-reward-glow { position: absolute; inset: -18px; border-radius: 50%; pointer-events: none; }
.spin-reward-rays {
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 120, .55) 0deg 9deg, rgba(255, 214, 120, 0) 9deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 28%, transparent 70%); mask: radial-gradient(circle, #000 28%, transparent 70%);
  animation: spin-rays 9s linear infinite;
}
.spin-reward-glow { inset: 14px; background: radial-gradient(circle, rgba(255, 226, 150, .95) 0%, rgba(243, 190, 80, .55) 40%, rgba(243, 190, 80, 0) 72%); }
@keyframes spin-rays { to { transform: rotate(360deg); } }
.spin-reward-img {
  position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; object-fit: contain;
  animation: spin-prize-in .55s cubic-bezier(.2, 1.5, .4, 1) .08s both;
}
@keyframes spin-prize-in { from { opacity: 0; transform: scale(.3) rotate(-20deg); } to { opacity: 1; transform: none; } }
#spin-reward .spin-reward-amount {
  margin: 0; font-size: 42px; font-weight: 900; line-height: 1.05; color: var(--gold-satin-hi);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35); font-variant-numeric: tabular-nums;
}
#spin-reward .spin-reward-label { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.35; }
#spin-reward .spin-reward-mult { margin: 4px 0 0; font-size: 13px; color: var(--gold-satin-hi); opacity: .9; }
.spin-reward-double, .spin-reward-collect { margin-top: 12px; }
.spin-reward-collect { margin-top: 8px; }
#btn-spin-double {
  display: flex; font-size: 16px; line-height: 1.2; padding-left: 12px; padding-right: 12px; align-items: center; justify-content: center; gap: 8px;
  color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
  background: linear-gradient(180deg, #5ad37d 0%, #2fae5c 55%, #1f8a45 100%);
  border: 1px solid #15733a;
  box-shadow: 0 6px 16px rgba(31, 138, 69, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.spin-reward-double[hidden] { display: none; }
.spin-reward-play { flex: none; }
@media (max-width: 340px) { #btn-spin-double { font-size: 14.5px; gap: 6px; } }
.spin-reward-double:not([disabled]):active { background: linear-gradient(180deg, #49bd6c, #1b7a3d); }
.spin-reward-double[disabled] { opacity: .7; }
.spin-reward-card.is-doubled .spin-reward-amount { animation: spin-doubled .5s cubic-bezier(.2, 1.5, .4, 1) both; }
.spin-reward-card.is-doubled .spin-reward-img { animation: spin-prize-in .5s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes spin-doubled { from { transform: scale(1.5); opacity: .4; } to { transform: none; opacity: 1; } }
.spin-fly { position: fixed; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; z-index: 9999; pointer-events: none; will-change: transform, opacity; }
@media (max-height: 600px) {
  .spin-reward-prize { width: 116px; height: 116px; }
  .spin-reward-img { width: 76px; height: 76px; margin: -38px 0 0 -38px; }
  #spin-reward .spin-reward-amount { font-size: 34px; }
  .spin-reward-card h2 { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .spin-reward, .spin-reward-card, .spin-reward-rays, .spin-reward-img, .spin-reward-wallet.is-bump,
  .spin-reward-card.is-doubled .spin-reward-amount, .spin-reward-card.is-doubled .spin-reward-img { animation: none !important; }
  .spin-reward-confetti { display: none; }
}

/* Shop: subscription terms and the legal links (iOS, guideline 3.1.2). */
.shop-terms { font-size: 12px; line-height: 1.45; margin-top: 10px; }
.shop-legal { font-size: 12px; text-align: center; margin-top: 6px; }
.shop-legal a { color: var(--brass-hi); text-decoration: underline; }

/* iOS: nearby (Bluetooth) play is Android-only in v1; its entry points are hidden. */
.mode-tile[hidden], .rooms-nearby[hidden] { display: none !important; }
