/* Minimum — table, cards, juice.
   Card size is set from JS (--card-w/--card-h) so the hand always fits the screen;
   there are no per-breakpoint card rules to keep in sync. */

:root {
  --felt-1: #1d5340;
  --felt-2: #06120e;
  --ink: #050d0a;
  --gold: #e8c78a;
  --gold-2: #c39a51;
  --gold-dim: #7d6538;
  --line: #1f4536;
  --paper: #fbf8f0;
  --red: #c0342a;
  --blue: #1f5fa8;
  --green: #1d7a4a;
  --black: #1b1f21;
  --good: #4fd694;
  --warn: #f0be4d;
  --bad: #f0674a;
  --dim: #7ea592;
  --card-w: 62px;
  --card-h: 88px;
  --ease: cubic-bezier(.22, 1.2, .36, 1);
  --slide: 460ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app { display: flex; flex-direction: column; height: 100dvh; }

/* ---------- splash ----------
   Same felt, same gold, same paper as the table — a title card for this game rather than a
   generic loader. Everything arrives on a staged clock so it reads as authored, not as a pile
   of elements fading in together. */

#splash {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(255, 245, 220, .09), transparent 70%),
    radial-gradient(ellipse 90% 75% at 50% 42%, var(--felt-1), var(--felt-2) 76%),
    var(--felt-2);
  transition: opacity .45s ease, transform .45s var(--ease);
}
#splash::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(0, 0, 0, .5) 1px, transparent 1px);
  background-size: 4px 4px; opacity: .3;
  box-shadow: inset 0 0 170px 50px rgba(0, 0, 0, .6);
}
#splash.gone { opacity: 0; transform: scale(1.04); pointer-events: none; }

.sp-inner { position: relative; z-index: 1; text-align: center; max-width: 420px; width: 100%; }

/* the fan: the cheapest possible hand, one card of each suit */
.sp-fan { position: relative; height: 132px; margin-bottom: 26px; }
.sp-card {
  position: absolute; left: 50%; top: 0;
  width: 60px; height: 86px; margin-left: -30px;
  border-radius: 7px; padding: 5px 6px;
  background: linear-gradient(158deg, #fffefa, var(--paper) 55%, #ebe4d3);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55);
  color: var(--black); text-align: left;
  font-weight: 800; font-size: 16px; line-height: 1.05;
  transform: translateY(26px) scale(.9) rotate(0deg); opacity: 0;
  animation: spDeal .62s var(--ease) forwards;
  animation-delay: calc(var(--i) * .09s + .12s);
}
.sp-card .s { display: block; font-size: 15px; font-weight: 400; }
.sp-card .big {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 34px; font-weight: 400; opacity: .16;
}
.sp-card.red { color: var(--red); }
@keyframes spDeal { to { opacity: 1; transform: var(--rest); } }

.sp-crest { width: 46px; height: 46px; margin: 0 auto 14px; display: block; opacity: 0;
  animation: spRise .5s var(--ease) forwards .5s; }
.sp-crest circle { fill: none; stroke: var(--gold-dim); stroke-width: 1.5; }
.sp-crest text { fill: var(--gold); font-size: 15px; text-anchor: middle; }

.sp-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(38px, 12vw, 58px); font-weight: 400;
  letter-spacing: .2em; text-indent: .2em;      /* letterspacing pads the right; pull it back */
  color: var(--gold); line-height: 1;
  text-shadow: 0 3px 30px rgba(0, 0, 0, .7);
  opacity: 0; animation: spRise .6s var(--ease) forwards .62s;
}
.sp-rule {
  width: 132px; height: 1px; margin: 18px auto 16px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  transform: scaleX(0); animation: spWiden .6s var(--ease) forwards .78s;
}
@keyframes spWiden { to { transform: scaleX(1) } }

.sp-tag {
  font-size: 15px; color: #a6c6b5; letter-spacing: .01em; line-height: 1.55;
  margin: 0 auto;
  opacity: 0; animation: spRise .5s var(--ease) forwards .9s;
}

.sp-actions {
  display: flex; gap: 10px; justify-content: center; margin-top: 26px; flex-wrap: wrap;
  opacity: 0; animation: spRise .5s var(--ease) forwards 1.04s;
}
.sp-go {
  font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 13px;
  padding: 13px 34px; border-radius: 11px;
  color: #1c1305; background: linear-gradient(#f0d69b, var(--gold-2));
  border: 1px solid #f5e3ba;
}
.sp-go:hover:not(:disabled) { background: linear-gradient(#f7e2ae, #d9ad5c); }
.sp-alt { padding: 13px 18px; border-radius: 11px; font-size: 13px; color: #a6c6b5; }

.sp-stat {
  margin-top: 22px; font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase;
  color: #55796a; min-height: 15px;
  opacity: 0; animation: spRise .5s ease forwards 1.2s;
}
.sp-stat b { color: var(--gold-dim); font-weight: 700; }

@keyframes spRise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

@media (max-height: 620px) {
  .sp-fan { height: 96px; margin-bottom: 16px; }
  .sp-card { width: 48px; height: 68px; margin-left: -24px; font-size: 13px; }
  .sp-crest { display: none }
  .sp-rule { margin: 12px auto 10px }
  .sp-actions { margin-top: 18px }
}

/* ---------- top bar ---------- */

#hud {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; z-index: 40;
  background: linear-gradient(#0d241b, #081712);
  border-bottom: 1px solid var(--line);
}
#brand {
  font-weight: 700; letter-spacing: .4em; font-size: 12.5px;
  color: var(--gold); text-transform: uppercase;
}
#roundinfo { font-size: 12px; color: var(--dim); letter-spacing: .03em; }
#hud .spacer { flex: 1; }

button {
  font: inherit; cursor: pointer; color: inherit;
  background: transparent; border: 1px solid #2b5f4a;
  border-radius: 9px; padding: 6px 13px;
  transition: background .18s, border-color .18s, transform .1s var(--ease), opacity .18s;
}
button:hover:not(:disabled) { background: #143528; border-color: var(--gold-dim); }
button:active:not(:disabled) { transform: scale(.96); box-shadow: inset 0 3px 9px rgba(0, 0, 0, .38); }
button:disabled { opacity: .35; cursor: not-allowed; }
.ghost { font-size: 12.5px; padding: 6px 11px; color: #a6c6b5; }
#btn-sound { position: relative; }
#btn-sound.muted { opacity: .45; }
#btn-sound.muted::after {            /* diagonal strike, so no font has to own a muted-note glyph */
  content: ''; position: absolute; left: 22%; right: 22%; top: 50%;
  border-top: 1.5px solid currentColor; transform: rotate(-32deg);
}

/* ---------- table ---------- */

#table {
  position: relative; flex: 1; overflow: hidden;
  background:
    radial-gradient(ellipse 62% 48% at 50% 44%, rgba(255, 245, 220, .07), transparent 70%),
    radial-gradient(ellipse 80% 66% at 50% 44%, var(--felt-1), var(--felt-2) 74%),
    var(--felt-2);
}
#table::after {                                   /* felt grain + vignette */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(0, 0, 0, .5) 1px, transparent 1px);
  background-size: 4px 4px; opacity: .3;
  box-shadow: inset 0 0 140px 40px rgba(0, 0, 0, .55);
}
#cards, #seats, #slots, #fx { position: absolute; inset: 0; }
#slots { z-index: 1; }
#seats { z-index: 10; pointer-events: none; }
/* Cards sit above the nameplates: a card in flight passing behind a label reads as broken.
   The seats never overlap a resting hand, so nothing important gets covered.
   pointer-events matter too — this is a full-bleed layer over the deck and discard slots, and
   without it the layer swallows every click aimed at them and the deck becomes undrawable. */
#cards { z-index: 30; pointer-events: none; }
#cards .card { pointer-events: auto; }
#fx    { z-index: 50; pointer-events: none; overflow: hidden; }

.slot {
  position: absolute; width: var(--card-w); height: var(--card-h);
  margin: calc(var(--card-h) / -2) 0 0 calc(var(--card-w) / -2);
  border: 1.5px dashed #2c5c49; border-radius: 9px;
}
.slot span {
  position: absolute; bottom: -19px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase;
  color: #4e7365; white-space: nowrap;
}
/* the discard label doubles as the way in to the full history — above the cards so it stays tappable */
.slot span.peek {
  pointer-events: auto; cursor: pointer; z-index: 45;
  padding: 4px 8px; margin-bottom: -4px; border-radius: 999px;
  border: 1px solid transparent;
}
.slot span.peek:hover { color: var(--gold); border-color: var(--gold-dim); background: rgba(6, 18, 13, .8); }
.slot span.peek.off { pointer-events: none; cursor: default; }
.slot span.peek.off:hover { color: #4e7365; border-color: transparent; background: none; }

/* the throw somebody just made, lit until the next player moves so the pile stays trackable */
.card.justthrown .face {
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5), 0 0 0 2.5px var(--gold), 0 0 24px rgba(232, 199, 138, .5);
}

/* Sits in the band above the deck, not on it, and carries its own backdrop so it stays
   readable whatever it lands over. */
#banner {
  position: absolute; left: 50%; top: 27%; transform: translate(-50%, -50%) scale(.86);
  z-index: 60; pointer-events: none; text-align: center; opacity: 0;
  padding: 12px 26px; border-radius: 16px;
  background: rgba(4, 12, 9, .84); border: 1px solid var(--gold-dim);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
  transition: opacity .25s, transform .4s var(--ease);
}
#banner.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#banner b {
  display: block; font-size: 26px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .9), 0 0 34px rgba(232, 199, 138, .45);
}
#banner i {
  display: block; font-style: normal; font-size: 13px; color: var(--paper);
  letter-spacing: .04em; margin-top: 4px; text-shadow: 0 2px 12px rgba(0, 0, 0, .9);
}

.plate {
  position: absolute; transform: translate(-50%, -50%);
  text-align: center; white-space: nowrap;
  padding: 4px 11px; border-radius: 20px;
  background: rgba(4, 14, 10, .72); border: 1px solid rgba(31, 69, 54, .8);
  transition: border-color .25s, box-shadow .25s, opacity .25s;
}
.plate .nm { font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.plate .sc { font-size: 10.5px; color: var(--dim); }
.plate.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 199, 138, .12), 0 0 24px rgba(232, 199, 138, .25); }
.plate.out { opacity: .32; }
.plate.danger { border-color: var(--bad); animation: threat 1.7s ease-in-out infinite; }
.plate.danger .sc { color: var(--bad); }
@keyframes threat {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 103, 74, 0) }
  50%      { box-shadow: 0 0 0 4px rgba(240, 103, 74, .22), 0 0 20px rgba(240, 103, 74, .3) }
}
.plate .called {
  display: block; font-size: 9px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--gold);
}

/* ---------- cards ---------- */

.card {
  position: absolute; width: var(--card-w); height: var(--card-h);
  margin: calc(var(--card-h) / -2) 0 0 calc(var(--card-w) / -2);
  transform-style: preserve-3d; perspective: 900px;
  transition: transform var(--slide) var(--ease);
  will-change: transform;
}
.card-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 440ms var(--ease);
  border-radius: 8px;
}
.card.down .card-inner { transform: rotateY(180deg); }

.face {
  position: absolute; inset: 0; border-radius: 8px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .12) inset;
  overflow: hidden;
  transition: box-shadow .28s ease;
}
/* A card in flight throws a longer, softer shadow — the cue that says it left the table
   rather than sliding across it. Applied for the length of the move, from place(). */
.card.moving .face { box-shadow: 0 15px 28px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .14) inset; }

/* pressing a card should feel like pressing a card. Front only — .back carries the
   rotateY(180deg) that makes the flip work, and overriding it would break the turn. */
.card.pick:active .front { transform: scale(.97); }
.card.pick:hover .face { box-shadow: 0 12px 26px rgba(0, 0, 0, .55), 0 0 0 2.5px var(--gold); }
.front {
  background: linear-gradient(158deg, #fffefa, var(--paper) 52%, #ebe4d3);
  color: var(--black);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 4px 5px;
}
/* Specular sheen plus a hairline edge. This is most of the difference between "a white
   rectangle" and "a printed card" — it gives the stock a surface that catches the light. */
.front::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  border-radius: 8px;
  background: linear-gradient(124deg,
    rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, .1) 26%,
    rgba(255, 255, 255, 0) 46%, rgba(0, 0, 0, .045) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07);
}
.front .r { font-size: calc(var(--card-w) * .27); font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.front .s { font-size: calc(var(--card-w) * .22); line-height: 1; }
.front .big {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 1;
  font-size: calc(var(--card-w) * .55); opacity: .15;
}
.front .corner { display: flex; flex-direction: column; align-items: center; z-index: 1; }
.front .corner.bl { align-self: flex-end; transform: rotate(180deg); }
/* What this card costs you — onboarding without words. Bottom-left is the only spot that
   survives a fanned hand: cards overlap rightward so the left edge always shows, and the
   rotated corner glyph occupies bottom-right. */
.front .pts {
  position: absolute; left: 4px; bottom: 3px; z-index: 2;
  font-size: calc(var(--card-w) * .16); font-weight: 700; color: #a8a08d; line-height: 1;
}

/* suit colour. two-colour by default; four-colour is a readability setting */
.front.s1, .front.s2 { color: var(--red); }
.fourcolour .front.s2 { color: var(--blue); }
.fourcolour .front.s3 { color: var(--green); }

.back, .stackback {
  background:
    repeating-linear-gradient(45deg, #8a322b 0 5px, #74241f 5px 10px),
    #74241f;
  border: 3px solid var(--paper);
}
.back { transform: rotateY(180deg); }
.back::after, .stackback::after {
  content: ''; position: absolute; inset: 4px; border-radius: 3px;
  border: 1px solid rgba(232, 199, 138, .5);
}
.stackback {                                    /* the undealt deck: decoration, not real card nodes */
  position: absolute; inset: 0; border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
}
/* the edges of throws already buried under the live group */
.pileback {
  position: absolute; inset: 0; border-radius: 8px;
  background: linear-gradient(158deg, #efe9db, #ddd5c3);
  box-shadow: 0 3px 9px rgba(0, 0, 0, .4);
}
#pileslot { border-color: transparent; }

#deckslot { cursor: pointer; border-color: transparent; }
#deckslot.pick .stackback:last-child { box-shadow: 0 6px 16px rgba(0, 0, 0, .5), 0 0 0 2.5px var(--gold); }
#deckslot.pick { animation: nudge 2s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }
#deckslot .count {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: #4e7365; letter-spacing: .1em; white-space: nowrap;
}

.card.fresh .face {                  /* the card you just picked up, so a sorted hand stays readable */
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5), 0 0 0 3px var(--gold), 0 0 22px rgba(232, 199, 138, .55);
}
.card.pick { cursor: pointer; }
.card.pick .face { box-shadow: 0 6px 16px rgba(0, 0, 0, .5), 0 0 0 2.5px var(--gold); }
.card.pick:hover, .card.sel { z-index: 60 !important; }
.card.sel .face { box-shadow: 0 14px 26px rgba(0, 0, 0, .55), 0 0 0 3px var(--good); }
.card.hintable .face { animation: hintpulse 1.7s ease-in-out infinite; }
@keyframes hintpulse {
  0%, 100% { box-shadow: 0 6px 16px rgba(0, 0, 0, .5), 0 0 0 0 rgba(79, 214, 148, 0); }
  50%      { box-shadow: 0 6px 16px rgba(0, 0, 0, .5), 0 0 0 4px rgba(79, 214, 148, .55); }
}

/* ---------- bottom bar ---------- */

#controls {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; z-index: 40;
  background: linear-gradient(#081712, #0d241b);
  border-top: 1px solid var(--line);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  transition: box-shadow .3s;
}

/* turn clock: a bar draining across the top edge of the controls */
#clock {
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  overflow: hidden; pointer-events: none;
}
#clock i {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: left;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
}
#controls.ticking #clock i { box-shadow: 0 0 10px rgba(232, 199, 138, .6); }
#controls.urgent #clock i { background: linear-gradient(90deg, #b8392a, var(--bad)); box-shadow: 0 0 12px rgba(240, 103, 74, .7); }
#controls.urgent { box-shadow: inset 0 3px 22px rgba(240, 103, 74, .22); }
#controls.urgent #totalbadge { animation: badgepop .95s ease-in-out infinite; }
#totalbadge {
  display: flex; align-items: baseline; gap: 7px; flex: none;
  padding: 6px 14px; border-radius: 11px;
  background: #071710; border: 1px solid rgba(31, 69, 54, .9);
  transition: border-color .3s, box-shadow .3s;
}
#totalbadge .lbl { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: #5f8574; }
#totalbadge .num { font-size: 23px; font-weight: 800; line-height: 1; transition: color .3s; }
#totalbadge.good { border-color: #2b7a53; box-shadow: 0 0 18px rgba(79, 214, 148, .18); }
#totalbadge.good .num { color: var(--good); }
#totalbadge.warn { border-color: #7a6427; } #totalbadge.warn .num { color: var(--warn); }
#totalbadge.bad  { border-color: #7a3b2b; } #totalbadge.bad .num  { color: var(--bad); }
#totalbadge.pop { animation: badgepop 620ms var(--ease); }
@keyframes badgepop { 0%, 100% { transform: scale(1) } 32% { transform: scale(1.2) } }
#totalbadge.shed { animation: shed 620ms ease-out; }
@keyframes shed {
  0%   { box-shadow: 0 0 0 0 rgba(79, 214, 148, .55) }
  100% { box-shadow: 0 0 0 16px rgba(79, 214, 148, 0) }
}

#hint { flex: 1; font-size: 13px; color: #a6c6b5; min-width: 0; }
#hint b { color: var(--paper); font-weight: 600; }

#btn-call {
  position: relative; overflow: hidden; flex: none;
  font-weight: 700; letter-spacing: .09em; text-transform: uppercase; font-size: 12.5px;
  padding: 12px 20px; border-radius: 11px;
  color: #1c1305; background: linear-gradient(#f0d69b, var(--gold-2));
  border: 1px solid #f5e3ba;
}
#btn-call:hover:not(:disabled) { background: linear-gradient(#f7e2ae, #d9ad5c); }
#btn-call:disabled { background: #10291f; color: #4e7365; border-color: #24513f; }
#btn-call.ready { animation: callpulse 1.6s ease-in-out infinite; }
#btn-call.ready::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 36%, rgba(255, 255, 255, .6) 50%, transparent 64%);
  animation: shine 2.4s ease-in-out infinite;
}
@keyframes callpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 199, 138, .6) }
  62%      { box-shadow: 0 0 0 14px rgba(232, 199, 138, 0) }
}
@keyframes shine { 0% { transform: translateX(-120%) } 55%, 100% { transform: translateX(120%) } }
#btn-discard { padding: 12px 16px; border-radius: 11px; flex: none; }

/* ---------- effects ---------- */

.spark {
  position: absolute; width: 11px; height: 11px; border-radius: 3px;
  background: var(--c, var(--gold)); transform: translate(-50%, -50%);
  box-shadow: 0 0 12px 2px var(--c, var(--gold));
  animation: spark 780ms cubic-bezier(.15, .8, .3, 1) forwards;
}
@keyframes spark {
  0%   { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(1.3) }
  70%  { opacity: .9 }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(.2) }
}
/* Named .shock, not .ring: the record screen's donut is also a "ring", and this keyframe
   expands to 210px and fades to nothing — an animation outranks normal declarations, so the
   collision silently inflated the chart and made it disappear. */
.shock {
  position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 4px solid var(--c, var(--gold)); transform: translate(-50%, -50%);
  box-shadow: 0 0 26px var(--c, var(--gold));
  animation: shock 660ms cubic-bezier(.2, .8, .3, 1) forwards;
}
@keyframes shock { to { width: 210px; height: 210px; opacity: 0; border-width: 1px } }

/* Front-loaded fade: at 90ms this used to still be near-invisible, so the label a good move
   earns was missed entirely. Full opacity by 8%. */
.pop {
  position: absolute; transform: translate(-50%, -50%);
  font-weight: 800; letter-spacing: .05em; white-space: nowrap; font-size: 21px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .9), 0 0 30px currentColor;
  animation: popup 1250ms cubic-bezier(.2, .9, .3, 1) forwards;
}
@keyframes popup {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.6) }
  8%   { opacity: 1; transform: translate(-50%, -70%) scale(1.22) }
  22%  { opacity: 1; transform: translate(-50%, -76%) scale(1) }
  72%  { opacity: 1 }
  100% { opacity: 0; transform: translate(-50%, -142%) scale(.94) }
}
.pop.good { color: var(--good) }
.pop.bad { color: var(--bad) }
.pop.combo { color: #ffe4ad; font-size: 28px; letter-spacing: .16em; text-transform: uppercase }

#sweep, #flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
#sweep { background: linear-gradient(105deg, transparent 32%, rgba(232, 199, 138, .32) 50%, transparent 68%); }
#sweep.on { animation: sweep 950ms ease-out; }
@keyframes sweep { 0% { opacity: 1; transform: translateX(-100%) } 100% { opacity: 0; transform: translateX(100%) } }
#flash { background: radial-gradient(ellipse at center, transparent 38%, rgba(240, 103, 74, .6)); }
#flash.on { animation: flash 760ms ease-out; }
@keyframes flash { 0% { opacity: 0 } 22% { opacity: 1 } 100% { opacity: 0 } }

.shake { animation: shake .5s }
@keyframes shake {
  10%, 90% { transform: translateX(-2px) } 20%, 80% { transform: translateX(4px) }
  30%, 50%, 70% { transform: translateX(-7px) } 40%, 60% { transform: translateX(7px) }
}

#toast {
  position: fixed; left: 50%; top: 68px; transform: translate(-50%, -14px);
  z-index: 90; padding: 9px 19px; border-radius: 999px;
  background: rgba(7, 23, 16, .96); border: 1px solid var(--gold-dim);
  color: var(--gold); font-size: 12.5px; letter-spacing: .03em;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .35s var(--ease);
}
#toast.on { opacity: 1; transform: translate(-50%, 0) }

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

#overlay {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  background: rgba(3, 9, 7, .78); backdrop-filter: blur(4px);
  padding: 16px;
}
#overlay.on { display: flex; animation: fade .22s ease both }
@keyframes fade { from { opacity: 0 } }

.sheet {
  width: min(720px, 100%); max-height: 88dvh; overflow: auto;
  background: linear-gradient(#123326, #0a1c15);
  border: 1px solid #2b5f4a; border-radius: 18px;
  padding: 24px 26px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .7);
  animation: rise .3s var(--ease) both;
  overscroll-behavior: contain;
}
@keyframes rise { from { transform: translateY(24px) scale(.97); opacity: 0 } }
.sheet h2 { font-size: 18px; letter-spacing: .06em; margin-bottom: 4px; color: var(--gold); text-transform: uppercase }
.sheet h3 { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: #5f8574; margin: 20px 0 9px }
.sheet p { color: #b3ccc0; margin-bottom: 9px }
.sheet .lead { font-size: 15.5px; color: var(--paper); margin-bottom: 14px }
.sheet ul { margin: 0 0 8px 18px; color: #b3ccc0 }
.sheet li { margin-bottom: 5px }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap }
.sheet .actions .primary { background: linear-gradient(#f0d69b, var(--gold-2)); color: #1c1305; border-color: #f5e3ba; font-weight: 600 }
.verdict { font-size: 25px; font-weight: 800; letter-spacing: .01em; margin-bottom: 6px }
.verdict.win { color: var(--good) } .verdict.lose { color: var(--bad) }

.row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; border-radius: 10px; margin-bottom: 6px;
  background: #09201700; border: 1px solid var(--line);
}
.row.zero { border-color: #2b7a53; background: #0c2b1e }
.row.caller { box-shadow: inset 3px 0 0 var(--gold) }
.row .who { width: 84px; font-weight: 600; font-size: 13px; flex: none }
.row .mini { display: flex; gap: 3px; flex: 1; flex-wrap: wrap; align-items: center; min-width: 0 }
.row .delta { width: 64px; text-align: right; font-weight: 800; font-size: 15px; flex: none }
.row .delta .run {              /* running match score under the round delta */
  display: block; font-weight: 500; font-size: 11px; color: var(--dim); margin-top: 1px;
}
.row .delta .run::before { content: 'match '; }
.row .tot { width: 62px; text-align: right; font-size: 11.5px; color: var(--dim); flex: none }

.mc {
  display: inline-grid; place-items: center;
  min-width: 25px; height: 32px; padding: 0 4px;
  border-radius: 4px; background: var(--paper); color: var(--black);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.mc.s1, .mc.s2 { color: var(--red) }
.fourcolour .mc.s2 { color: var(--blue) }
.fourcolour .mc.s3 { color: var(--green) }

/* ---------- the record ---------- */

.record {                              /* a personal best, called out on the round sheet */
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 0 4px; padding: 10px 13px; border-radius: 11px;
  background: linear-gradient(100deg, rgba(232, 199, 138, .17), rgba(232, 199, 138, .05));
  border: 1px solid var(--gold-dim);
  animation: rise .45s var(--ease) both .1s;
}
.record .tag {
  font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 800;
  color: #1c1305; background: var(--gold); padding: 3px 8px; border-radius: 999px;
}
.record .txt { color: var(--gold); font-weight: 600; font-size: 14px; }

/* the end of a match — the one screen that should feel like an award, not a table row */
.champion {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: 14px 0 4px; padding: 14px 16px; border-radius: 13px;
  background: linear-gradient(100deg, rgba(232, 199, 138, .2), rgba(232, 199, 138, .05));
  border: 1px solid var(--gold-dim);
  animation: rise .5s var(--ease) both .08s;
}
.champion .tag {
  font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; font-weight: 800;
  color: #1c1305; background: var(--gold); padding: 3px 9px; border-radius: 999px;
}
.champion .nm {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 24px; letter-spacing: .04em; color: var(--gold); flex: 1;
}
.champion .sc { font-size: 14px; font-weight: 700; color: var(--paper); }

.hero { display: flex; align-items: center; gap: 18px; margin: 6px 0 4px; }
.hero .chart.ring { width: 116px; height: 116px; flex: none; }
.heroside .big { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.heroside .sub { font-size: 12.5px; color: var(--dim); }
.heroside .sub.warnish { color: var(--warn); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; }
.tile {
  background: #09201799; border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 12px; animation: rise .4s var(--ease) both;
}
.tile:nth-child(2) { animation-delay: .05s } .tile:nth-child(3) { animation-delay: .1s }
.tile:nth-child(4) { animation-delay: .15s }
.tile .tv { font-size: 25px; font-weight: 800; line-height: 1.1; }
.tile .tl { font-size: 11px; color: var(--dim); margin-top: 3px; line-height: 1.3; }
.tile.good .tv { color: var(--good) } .tile.bad .tv { color: var(--bad) }

.chartwrap { background: #09201799; border: 1px solid var(--line); border-radius: 11px; padding: 12px 12px 8px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: #24513f; stroke-width: 1; }

/* bars grow from the baseline; --i staggers them left to right */
.chart .bar { fill: var(--gold-2); transform: scaleY(0); transform-box: fill-box; transform-origin: bottom; }
.chart.go .bar { animation: grow .55s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes grow { to { transform: scaleY(1) } }
.chart .bval { fill: var(--gold); font-size: 10px; font-weight: 700; text-anchor: middle; opacity: 0; }
.chart.go .bval { animation: fadein .4s ease both; animation-delay: calc(var(--i) * 70ms + .3s); }
@keyframes fadein { to { opacity: 1 } }
.chart .blab { fill: #5f8574; font-size: 10px; text-anchor: middle; }

/* the ring sweeps from empty to its value */
.chart.ring { overflow: visible; }
.ring-bg { fill: none; stroke: #143528; stroke-width: 9; }
.ring-fg {
  fill: none; stroke: var(--good); stroke-width: 9; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  stroke-dasharray: var(--c); stroke-dashoffset: var(--c);
}
.chart.ring.go .ring-fg { animation: sweepring .9s var(--ease) both .1s; }
@keyframes sweepring { to { stroke-dashoffset: var(--o) } }
.ring-num { fill: var(--paper); font-size: 24px; font-weight: 800; text-anchor: middle; }
.heroside .cap {
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  color: #5f8574; margin-bottom: 2px;
}

.chart .tick { opacity: 0; }
.chart .tick.win { fill: var(--good) } .chart .tick.loss { fill: #2c5544 }
.chart.go .tick { animation: fadein .3s ease both; animation-delay: calc(var(--i) * 18ms); }
.formnote { font-size: 12.5px; color: var(--dim); margin-top: 8px; }

/* the whole variant at a glance, before the fifteen rows of detail */
.rulechips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.rulechips .chip {
  font: inherit; font-size: 11.5px; line-height: 1; color: #a9c6ba; cursor: pointer;
  background: #0c261b; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px;
  transition: background .15s, color .15s, border-color .15s, transform .12s;
}
.rulechips .chip.house { color: var(--gold); border-color: #6a5423; background: #1a1408; }
.rulechips .chip:hover { background: #123324; }
.rulechips .chip:active { transform: scale(.94); }
.rulechips .chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.chipnote { font-size: 11.5px; color: #5f8574; margin-bottom: 4px !important; }

.widebtn {
  display: block; width: 100%; font: inherit; font-size: 15px; font-weight: 700;
  padding: 13px; border-radius: 11px; margin-bottom: 4px; cursor: pointer;
  background: #123324; border: 1px solid #2f6b53; color: var(--paper);
}
.widebtn:active { transform: scale(.98); }
.widebtn:disabled { opacity: .6; cursor: default; }

/* who has agreed to another match */
.readyrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.readypill {
  font-size: 12px; padding: 6px 11px; border-radius: 999px;
  background: #0c261b; border: 1px solid var(--line); color: #a9c6ba;
}
.readypill.on { background: #1c3a17; border-color: #3f6b34; color: var(--good); font-weight: 700; }
.readypill.gone { opacity: .45; text-decoration: line-through; }

/* ---------- table talk ---------- */

#btn-chat.unread {
  color: #06120e; background: var(--gold); border-color: var(--gold); font-weight: 700;
}

/* a message where the speaker sits, so chat happens at the table rather than in another screen */
.saybubble {
  position: absolute; transform: translate(-50%, -50%) scale(.9); transform-origin: 50% 50%;
  max-width: 60vw; padding: 8px 12px; border-radius: 13px;
  background: #f6f2e7; color: #14261d; font-size: 13.5px; line-height: 1.3;
  box-shadow: 0 8px 22px #0009; opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.saybubble.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.saybubble.mine { background: var(--gold); }
.saybubble .who { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: #5c6b60; margin-bottom: 2px; }
.saybubble .txt { display: block; word-break: break-word; }

.chatlog {
  background: #09201799; border: 1px solid var(--line); border-radius: 11px;
  padding: 10px; margin-bottom: 10px; max-height: 42vh; overflow-y: auto;
}
.chatlog .msg {
  max-width: 82%; margin-bottom: 7px; padding: 7px 11px; border-radius: 12px;
  background: #123324; color: var(--paper); font-size: 14px; line-height: 1.35; word-break: break-word;
}
.chatlog .msg.mine { margin-left: auto; background: #2c4a1f; }
.chatlog .msg .who {
  display: block; font-size: 10px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: #7fa993; margin-bottom: 2px;
}
.chatlog .seen { text-align: right; font-size: 10.5px; color: #5f8574; margin: -3px 2px 6px; }

/* one tap, no keyboard - the only kind of chat that works mid-turn */
.quickrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.quickrow .chip {
  font: inherit; font-size: 12.5px; color: #a9c6ba; cursor: pointer;
  background: #0c261b; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px;
}
.quickrow .chip:active { transform: scale(.94); }

.chatrow { display: flex; gap: 8px; }
.chatrow input {
  flex: 1; font: inherit; font-size: 15px; padding: 11px 13px; border-radius: 10px;
  background: #0c261b; border: 1px solid var(--line); color: var(--paper);
}
.chatrow input:focus { outline: none; border-color: var(--gold); }
.chatrow button {
  font: inherit; font-size: 14px; font-weight: 700; padding: 11px 18px; border-radius: 10px;
  border: none; background: var(--gold); color: #06120e; cursor: pointer;
}
.chatrow button:active { transform: scale(.96); }

@media (max-width: 420px) {
  .chatlog { max-height: 34vh }
  .quickrow .chip { font-size: 12px; padding: 6px 10px }
}

/* ---------- online lobby ---------- */

/* the code is the thing people read down a phone line, so it gets to be the biggest thing here */
.codebox {
  display: flex; align-items: center; gap: 12px; margin: 4px 0 6px;
  background: #09201799; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.codebox .code {
  font-size: 34px; font-weight: 800; letter-spacing: .22em; color: var(--gold);
  font-variant-numeric: tabular-nums; line-height: 1; flex: 1;
}
.codebox .ghost {
  font: inherit; font-size: 13px; padding: 9px 14px; border-radius: 9px; cursor: pointer;
  background: #123324; border: 1px solid var(--line); color: var(--paper);
}
.codebox .ghost:active { transform: scale(.95); }
.sheet .row .tot { font-size: 12px; color: var(--dim); letter-spacing: .04em; }
.sheet .row.zero .tot { color: var(--good); }

/* ---------- run of play: cumulative score by round ---------- */

.runbox {
  background: #09201799; border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 10px 4px; overflow: hidden;
}
/* the whole plot settles in, so the sheet does not just blink a finished chart into place */
.runbox .chart.run { opacity: 0; transform: scale(.93); transform-origin: 50% 60%; }
.runbox.go .chart.run { animation: settle .5s var(--ease) both; }
@keyframes settle { to { opacity: 1; transform: scale(1) } }

.chart.run .danger { fill: #c0342a; opacity: 0; }
.runbox.go .chart.run .danger { animation: dangerin .5s ease both .45s; }
@keyframes dangerin { to { opacity: .17 } }
.chart.run .bustline { stroke: #c0342a; stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.runbox.go .chart.run .bustline { animation: fadein .4s ease both .5s; }
.chart.run .dlab {
  fill: #e2685c; font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; opacity: 0;
}
.runbox.go .chart.run .dlab { animation: fadein .4s ease both .7s; }
.chart.run .rlab { fill: #4d7263; font-size: 9px; text-anchor: middle; }
.chart.run .blab { text-anchor: end; }

/* each line draws left to right — the match replaying itself */
.chart.run .ml {
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 900; stroke-dashoffset: 900;
}
.chart.run .ml.other { stroke: #2f6b53; stroke-width: 1.8; }
.chart.run .ml.you { stroke: var(--gold); stroke-width: 2.6; }
.runbox.go .chart.run .ml { animation: drawline .85s var(--ease) both; animation-delay: calc(var(--i) * 90ms + .3s); }
@keyframes drawline { to { stroke-dashoffset: 0 } }

.chart.run .dot { fill: #2f6b53; opacity: 0; }
.chart.run .dot.you { fill: var(--gold); }
.runbox.go .chart.run .dot { animation: dotin .3s var(--ease) both; animation-delay: calc(var(--i) * 90ms + 1.1s); }
@keyframes dotin { from { opacity: 0 } to { opacity: 1 } }

/* your latest standing keeps pulsing so the eye lands on it last */
.chart.run .ping { fill: none; stroke: var(--gold); stroke-width: 1.5; opacity: 0; }
.runbox.go .chart.run .ping { animation: pingout 1.8s ease-out 1.35s infinite; }
@keyframes pingout {
  0%   { opacity: .8; transform: scale(1) }
  70%  { opacity: 0;  transform: scale(2.6) }
  100% { opacity: 0;  transform: scale(2.6) }
}
.chart.run .ping { transform-box: fill-box; transform-origin: 50% 50%; }
.chart.run .you-lab { fill: var(--gold); font-size: 11px; font-weight: 800; text-anchor: middle; opacity: 0; }
.runbox.go .chart.run .you-lab { animation: fadein .35s ease both 1.3s; }

.runnote { font-size: 12.5px; color: var(--dim); margin-top: 9px; }
.runnote.hot { color: #e2685c; }

@media (prefers-reduced-motion: reduce) {
  .runbox .chart.run, .chart.run .danger, .chart.run .bustline, .chart.run .dlab,
  .chart.run .ml, .chart.run .dot, .chart.run .you-lab {
    opacity: 1; transform: none; stroke-dashoffset: 0; animation: none !important;
  }
  .chart.run .danger { opacity: .17 }
  .chart.run .ping { display: none }
}

/* ---------- rules reference ---------- */

.rulerow {
  border: 1px solid var(--line); border-radius: 11px; margin-bottom: 7px;
  background: #09201799; overflow: hidden;
  transition: border-color .2s, background .2s;
}
.rulerow.open { border-color: var(--gold-dim); background: #0c2a1e; }
.rulehead {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 12px 13px; user-select: none;
}
.rulehead:hover { background: rgba(232, 199, 138, .05) }
.rulehead .rl { flex: 1; font-size: 14px; font-weight: 600; }
.rulehead .rv {
  font-size: 12.5px; color: var(--gold); text-align: right; letter-spacing: .01em;
}
.rulehead .rc {
  color: #4e7365; font-size: 17px; line-height: 1; flex: none;
  transition: transform .25s var(--ease);
}
.rulerow.open .rc { transform: rotate(90deg); color: var(--gold); }
.rulebody { padding: 0 13px; }
.rulerow.open .rulebody { padding: 0 13px 12px; animation: fade .25s ease both }
.rulebody p { font-size: 13px; color: #b3ccc0; line-height: 1.5; margin: 0 0 2px; }

/* ---------- walkthrough ---------- */

.tour-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tour-bucket {
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase; font-weight: 800;
  color: #1c1305; background: var(--gold); padding: 3px 9px; border-radius: 999px;
}
.tour-n { font-size: 11.5px; color: #5f8574; letter-spacing: .08em; }
.tour-dots { display: flex; gap: 5px; margin: 12px 0 16px; }
.tour-dots i {
  height: 3px; flex: 1; border-radius: 2px; background: #1d3a2d;
  transition: background .25s;
}
.tour-dots i.done { background: var(--gold-dim); }
.tour-dots i.on { background: var(--gold); }

/* Animated illustrations. Each scene is a little stage of real card shapes on a looping
   keyframe, so the mechanic is shown rather than described. Same paper and felt as the table. */
.scene {
  position: relative; height: 112px; margin: 10px 0 2px;
  border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, #14382a, #0a1d16 78%);
  border: 1px solid var(--line);
}
.sc {                                     /* a card in a scene */
  position: absolute; top: 50%; left: 50%; width: 30px; height: 42px; margin: -21px 0 0 -15px;
  border-radius: 5px; background: linear-gradient(158deg, #fffefa, var(--paper) 55%, #ebe4d3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
  color: var(--black); font-size: 12px; font-weight: 800; line-height: 1;
  display: grid; place-items: center;
}
.sc.red { color: var(--red) }
.sc.back {
  background: repeating-linear-gradient(45deg, #8a322b 0 4px, #74241f 4px 8px), #74241f;
  border: 2px solid var(--paper); color: transparent;
}
.sc-label {
  position: absolute; bottom: 6px; left: 0; right: 0; text-align: center;
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: #4e7365;
}

/* deal / throw loop — a card travels from the stock to a hand, then one leaves for the pile */
.scene.turn .st { left: 22%; }
.scene.turn .pl { left: 50%; }
.scene.turn .hd { left: 78%; }
.scene.turn .fly { animation: scPick 3.4s ease-in-out infinite; }
.scene.turn.rev .fly { animation: scThrow 3.4s ease-in-out infinite; }
@keyframes scPick {
  0%, 8%    { left: 22%; opacity: 1; transform: rotate(0deg) }
  34%, 46%  { left: 78%; opacity: 1; transform: rotate(6deg) }
  70%, 100% { left: 50%; opacity: 1; transform: rotate(-4deg) }
}
@keyframes scThrow {
  0%, 8%    { left: 78%; opacity: 1; transform: rotate(0deg) }
  34%, 46%  { left: 50%; opacity: 1; transform: rotate(-6deg) }
  70%, 100% { left: 22%; opacity: 1; transform: rotate(4deg) }
}

/* a whole group leaving the hand at once */
.scene.group .g { animation: scGroup 3s ease-in-out infinite; }
@keyframes scGroup {
  0%, 14%   { transform: translate(0, 0) rotate(0deg) }
  46%, 62%  { transform: translate(calc(var(--to) * 1px), -26px) rotate(calc(var(--rot) * 1deg)) }
  92%, 100% { transform: translate(calc(var(--to) * 1px), -26px) rotate(calc(var(--rot) * 1deg)); opacity: 0 }
}

/* a joker sliding into the hole in a run */
.scene.wild .jk { animation: scWild 3s ease-in-out infinite; }
@keyframes scWild {
  0%, 12%   { transform: translate(0, 34px) scale(.9); opacity: 0 }
  40%, 100% { transform: translate(0, 0) scale(1); opacity: 1 }
}
.scene.wild .lit { animation: scLit 3s ease-in-out infinite; }
@keyframes scLit {
  0%, 44%   { box-shadow: 0 4px 10px rgba(0, 0, 0, .45) }
  62%, 88%  { box-shadow: 0 4px 10px rgba(0, 0, 0, .45), 0 0 0 2px var(--gold) }
  100%      { box-shadow: 0 4px 10px rgba(0, 0, 0, .45) }
}

/* the badge falling into range and the button waking up */
.sc-badge {
  position: absolute; left: 16%; top: 50%; transform: translateY(-50%);
  min-width: 46px; padding: 7px 10px; border-radius: 9px; text-align: center;
  background: #071710; border: 1px solid #7a3b2b; color: var(--bad);
  font-size: 19px; font-weight: 800;
  animation: scBadge 3.4s ease-in-out infinite;
}
@keyframes scBadge {
  0%, 26%   { border-color: #7a3b2b; color: var(--bad) }
  44%, 100% { border-color: #2b7a53; color: var(--good) }
}
.sc-btn {
  position: absolute; right: 8%; top: 50%; transform: translateY(-50%);
  padding: 9px 16px; border-radius: 9px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  background: #10291f; color: #4e7365; border: 1px solid #24513f;
  animation: scBtn 3.4s ease-in-out infinite;
}
@keyframes scBtn {
  0%, 40%   { background: #10291f; color: #4e7365; border-color: #24513f; box-shadow: none }
  58%, 100% { background: linear-gradient(#f0d69b, var(--gold-2)); color: #1c1305; border-color: #f5e3ba;
              box-shadow: 0 0 18px rgba(232, 199, 138, .45) }
}

/* two hands turning over, one right and one punished */
.scene.reveal .fl { animation: scFlip 3.6s ease-in-out infinite; }
@keyframes scFlip {
  0%, 18%  { transform: rotateY(180deg) }
  40%, 100% { transform: rotateY(0deg) }
}
.sc-tag {
  position: absolute; font-size: 12px; font-weight: 800; opacity: 0;
  animation: scTag 3.6s ease-in-out infinite;
}
@keyframes scTag { 0%, 46% { opacity: 0 } 62%, 100% { opacity: 1 } }
.sc-tag.good { color: var(--good) } .sc-tag.bad { color: var(--bad) }

.tour-cards { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; }
.tc { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tc .mc { min-width: 38px; height: 50px; font-size: 15px; border-radius: 6px; }
.tc .tag { font-size: 10.5px; color: #5f8574; letter-spacing: .06em; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px }
.fld { background: #09201799; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px }
.fld label { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #5f8574; margin-bottom: 5px }
.fld .desc { font-size: 11.5px; color: #5f8574; margin-top: 5px; line-height: 1.35 }
/* a setting that cannot matter under the current rules — visibly inert rather than silently ignored */
.fld.inert { opacity: .4; }
.fld.inert input, .fld.inert select { cursor: not-allowed; }
.fld select, .fld input[type=number], .fld input[type=text] {
  width: 100%; font: inherit; font-size: 14px; color: var(--paper);
  background: #061510; border: 1px solid #2b5f4a; border-radius: 7px; padding: 7px 8px;
}
.fld input[type=checkbox] {   /* native unchecked box renders stark white on the dark sheet */
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
  border: 1.5px solid #2b5f4a; background: #061510;
  display: inline-grid; place-content: center; vertical-align: -5px;
  transition: background .15s, border-color .15s;
}
.fld input[type=checkbox]::after {
  content: ''; width: 10px; height: 10px; border-radius: 2px;
  transform: scale(0); transition: transform .15s var(--ease);
  background: #1c1305;
}
.fld input[type=checkbox]:checked { background: var(--gold); border-color: var(--gold) }
.fld input[type=checkbox]:checked::after { transform: scale(1) }
.presets { display: flex; flex-wrap: wrap; gap: 8px }

/* progressive disclosure — the fine print is there, but not on arrival */
.morebtn {
  display: block; width: 100%; margin: 18px 0 0; padding: 11px;
  font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: #a6c6b5;
  border-style: dashed;
}
.more { display: none }
.more.on { display: block; animation: fade .25s ease both }
.presets button.on { border-color: var(--gold); color: var(--gold); background: #14352899 }

.notes { margin-top: 16px }
.note {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 12.5px; line-height: 1.4; padding: 9px 11px;
  border-radius: 9px; margin-bottom: 6px;
}
.note::before { content: '!'; font-weight: 800; flex: none; width: 16px; text-align: center }
.note.warn { background: rgba(240, 190, 77, .09); border: 1px solid rgba(240, 190, 77, .35); color: #e6cf98 }
.note.err  { background: rgba(240, 103, 74, .1); border: 1px solid rgba(240, 103, 74, .45); color: #f2ac99 }

/* Keyboard users need to see where they are. Cards are focusable via the game's own handlers. */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
button:focus-visible { outline-offset: 3px; }

/* Respect the OS setting. Cards jump straight to their destination rather than sliding, and the
   flourishes stop moving — but the floating labels still fade so no information is lost. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; transition-delay: 0ms !important;
  }
  .pop {
    animation: fadeonly 1400ms ease-out forwards !important;
    transform: translate(-50%, -120%) !important;
  }
  @keyframes fadeonly { 0%, 72% { opacity: 1 } 100% { opacity: 0 } }
  .spark, .shock { display: none }
}

@media (max-width: 720px) {
  #hud { padding: 8px 10px; gap: 5px }
  #hud .ghost { padding: 6px 8px; font-size: 12px }
  #brand { letter-spacing: .2em; font-size: 10px }
  .hero { gap: 12px }
  .hero .chart.ring { width: 96px; height: 96px }
  .heroside .big { font-size: 21px }
  #roundinfo { display: none }
  #hint { display: none }
  #controls { padding: 9px 10px; gap: 8px }
  #totalbadge { padding: 6px 11px; gap: 5px }
  #totalbadge .lbl { display: none }
  #btn-call { flex: 1; padding: 13px 12px; font-size: 12px; letter-spacing: .06em }
  #btn-discard { padding: 13px 13px; font-size: 13px }
  .sheet { padding: 20px 17px; border-radius: 16px }
  .row .who { width: 66px }
  .row .tot { display: none }
}

/* five controls plus a wordmark is too much for the narrowest phones — the game keeps the room */
@media (max-width: 400px) {
  #brand { display: none }
  #hud .ghost { padding: 6px 7px; font-size: 11.5px }
}
