/* ==========================================================================
   31 — table styling. One file, no build step.
   ========================================================================== */

:root {
  --felt-lit:   #1c6349;
  --felt:       #10402f;
  --felt-deep:  #071c15;
  --rail:       #2e1d14;
  --rail-lit:   #462e20;
  --gold:       #dcb872;
  --gold-soft:  #f0d9a8;
  --gold-dim:   rgba(220, 184, 114, 0.5);
  --cream:      #f6f2e8;
  --ink:        #1b1b1b;
  --card-red:   #c1272d;
  --danger:     #d1493c;
  --good:       #6fd39b;
  --dim:        rgba(246, 242, 232, 0.56);
  --dimmer:     rgba(246, 242, 232, 0.3);
  --line:       rgba(220, 184, 114, 0.22);
  --radius:     14px;
  --card-w:     84px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--cream);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* The room around the table: dark, with light falling on the centre. */
body {
  /* The solid colour underneath matters: the home screen scrolls well past one
     viewport, and a fixed-attachment gradient alone leaves bare page below it
     (and iOS drops fixed attachment altogether). */
  background-color: #04120d;
  background-image:
    radial-gradient(110% 70% at 50% 38%, rgba(255, 255, 255, 0.05) 0%, transparent 60%),
    radial-gradient(140% 100% at 50% 40%, #123526 0%, #0a2119 55%, #04120d 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}
html { background-color: #04120d; }

.hidden { display: none !important; }
.spacer { flex: 1; }
.center { text-align: center; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(12px + env(safe-area-inset-top)) 16px
    calc(12px + env(safe-area-inset-bottom));
}
#home, #lobby { align-items: center; justify-content: center; }

/* ---------------------------------------------------------------- panels */

.panel {
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.44));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 26px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand { text-align: center; margin-bottom: 26px; }
.brand-mark {
  display: block;
  font-size: 76px; font-weight: 800; letter-spacing: -0.05em; line-height: 1;
  color: var(--gold);
  text-shadow: 0 6px 30px rgba(220, 184, 114, 0.28);
}
.tagline { margin: 10px 0 0; color: var(--dim); font-size: 14px; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; color: var(--dim); margin: 0 0 8px; }
.hint { font-size: 13px; color: var(--dim); line-height: 1.55; }
.error { color: #ffb3aa; font-size: 13px; min-height: 18px; margin: 10px 0 0; text-align: center; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 7px; }

input, select {
  width: 100%; padding: 14px;
  font-size: 16px; font-family: inherit; color: var(--cream);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(220, 184, 114, 0.15); }
select { appearance: none; }

/* ---------------------------------------------------------------- buttons */

.btn {
  padding: 14px 18px;
  font-size: 15px; font-weight: 600; font-family: inherit; color: var(--cream);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary {
  width: 100%;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #241a06; border-color: transparent;
  box-shadow: 0 10px 24px rgba(220, 184, 114, 0.22);
}
.btn.primary:disabled { background: none; color: var(--dim); border: 1px solid var(--line); box-shadow: none; opacity: 1; }
.btn.tiny { padding: 8px 12px; font-size: 12px; border-radius: 10px; }
.btn.ghost { background: none; }
.btn.ghost.muted { color: var(--dimmer); }
.btn.link { width: 100%; background: none; border: none; color: var(--dimmer); font-size: 12px; margin-top: 16px; padding: 8px; }
.btn.link:hover { color: var(--dim); background: none; }
.btn.knock {
  background: linear-gradient(180deg, #e0594a, var(--danger));
  border-color: transparent; padding: 13px 26px;
  box-shadow: 0 10px 22px rgba(209, 73, 60, 0.3);
}
.btn.knock.confirming { animation: nudge 0.45s ease; }
.btn.warn { background: rgba(209, 73, 60, 0.24); border-color: rgba(209, 73, 60, 0.5); }

.dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); margin-left: 6px; vertical-align: middle;
}

.or { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--dimmer); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.join-row { display: flex; gap: 10px; }
#codeInput { text-transform: uppercase; letter-spacing: 0.34em; text-align: center; font-weight: 700; }
.join-row .btn { flex: 0 0 auto; }

.rules { margin-top: 24px; font-size: 13px; color: var(--dim); }
.rules summary { cursor: pointer; color: var(--gold); padding: 4px 0; }
.rules p { line-height: 1.65; }

/* ------------------------------------------------------- landing page */

/* The home screen scrolls, unlike the table, so it stops centring itself and
   simply stacks: hero, the one thing you came to do, then the reasons why. */
#home.home {
  justify-content: flex-start;
  align-items: center;
  gap: 26px;
  padding-top: calc(30px + env(safe-area-inset-top));
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.home-hero { text-align: center; width: min(560px, 100%); }

/* Three cards adding to exactly 31, fanned as if just laid down. */
.hero-fan {
  display: flex; justify-content: center; align-items: flex-end;
  height: 154px; margin-bottom: 14px;
}
.hero-fan .card {
  --card-w: 84px;
  /* Enough overlap to read as one hand, little enough that all three ranks show. */
  margin: 0 -6px;
  transform-origin: 50% 130%;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.5);
  animation: fan-in 0.7s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.hero-fan .card:nth-child(1) { transform: rotate(-15deg); animation-delay: 0.05s; }
.hero-fan .card:nth-child(2) { transform: rotate(0deg) translateY(-14px); animation-delay: 0.14s; z-index: 2; }
.hero-fan .card:nth-child(3) { transform: rotate(15deg);  animation-delay: 0.23s; }

@keyframes fan-in {
  from { opacity: 0; transform: translateY(34px) rotate(0deg) scale(0.9); }
}

#home .brand-mark {
  margin: 0;
  font-size: clamp(72px, 17vw, 112px);
  background: linear-gradient(175deg, #fdf1d2 6%, var(--gold) 46%, #a97f37 78%, #f3dfb2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;   /* Safari needs this alongside the clip */
  text-shadow: none;                      /* or the base rule's glow bleeds through */
  filter: drop-shadow(0 8px 26px rgba(220, 184, 114, 0.3));
}
#home .tagline { font-size: 15px; color: var(--gold-dim); letter-spacing: 0.02em; }
.hero-sub {
  margin: 14px auto 0; max-width: 42ch;
  font-size: 14px; line-height: 1.65; color: var(--dim);
}

.home-panel { width: min(430px, 100%); }

.feature-row {
  list-style: none; margin: 0; padding: 0;
  width: min(880px, 100%);
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.feature-row li {
  display: grid; gap: 5px;
  padding: 18px 18px 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.2));
  border: 1px solid var(--line);
}
.feature-icon { font-size: 22px; line-height: 1; margin-bottom: 3px; }
.feature-row b { font-size: 14px; color: var(--gold-soft); }
.feature-row span:last-child { font-size: 13px; line-height: 1.6; color: var(--dim); }

.home-rules { width: min(620px, 100%); }
.rule-steps {
  margin: 0; padding: 0; list-style: none;
  counter-reset: rule;
  display: grid; gap: 10px;
}
.rule-steps li {
  counter-increment: rule;
  position: relative;
  padding: 13px 16px 13px 50px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  font-size: 13.5px; line-height: 1.6; color: var(--dim);
}
.rule-steps li::before {
  content: counter(rule);
  position: absolute; left: 14px; top: 12px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #241a06;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
}
.rule-steps b { color: var(--cream); }
.rule-steps em { color: var(--gold); font-style: normal; font-weight: 700; }

.home-foot {
  margin: 0; font-size: 12px; color: var(--dimmer); text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .hero-fan .card { animation: none; }
}

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

.code-display { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.code-display span {
  font-size: 42px; font-weight: 800; letter-spacing: 0.16em; color: var(--gold);
  text-shadow: 0 4px 20px rgba(220, 184, 114, 0.25);
}

/* Getting the link from a laptop onto a phone, without typing it out. */
.share {
  display: flex; align-items: center; gap: 14px;
  margin-top: 18px; padding: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.qr {
  flex: 0 0 auto;
  width: 96px; height: 96px;
  border-radius: 8px;
  background: var(--cream);
  padding: 5px;
  display: block;
}
.share-copy { min-width: 0; }
.share-title { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--gold); }
.share-copy .hint { font-size: 12px; }

.seat-list { list-style: none; padding: 0; margin: 22px 0 0; }
.seat-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  animation: slide-in 0.3s ease both;
}
.host-pill {
  margin-left: auto; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gold); border: 1px solid var(--line); padding: 3px 8px; border-radius: 20px;
}
.bot-pill {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #9fd8ff; border: 1px solid rgba(159, 216, 255, 0.35);
  padding: 3px 8px; border-radius: 20px;
}
.seat-list li .spacer { flex: 1; }
.kick-bot {
  background: none; border: none; cursor: pointer;
  color: var(--dimmer); font-size: 16px; line-height: 1; padding: 4px 6px;
}
.kick-bot:hover { color: #ffb3aa; }

.btn.wide { width: 100%; margin-top: 10px; border-style: dashed; }

/* On Obama: no counter left, just the one last life. */
.obama {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: #ffd9a0;
  border: 1px solid rgba(255, 217, 160, 0.5);
  background: rgba(255, 217, 160, 0.1);
  padding: 2px 7px; border-radius: 20px;
  animation: obama-glow 2.4s ease-in-out infinite;
}
.life-block .obama { font-size: 11px; padding: 3px 9px; }
@keyframes obama-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 217, 160, 0.35); }
  50%      { box-shadow: 0 0 12px 2px rgba(255, 217, 160, 0.28); }
}

.avatar {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #16241f;
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
}
.avatar.sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 11px; }
.avatar.xs { width: 22px; height: 22px; flex-basis: 22px; font-size: 9px; }

.settings { margin: 20px 0 4px; padding-top: 18px; border-top: 1px solid var(--line); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; font-size: 14px; }
.toggle-row select { width: auto; padding: 8px 12px; }
.toggle-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); }

/* ================================================================ TABLE */

#table { justify-content: flex-start; gap: 10px; }

.topbar {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--dim);
  width: 100%; max-width: 760px; margin: 0 auto;
}
.room-tag b { color: var(--gold); letter-spacing: 0.16em; }

.table-area {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  width: 100%; max-width: 760px; margin: 0 auto;
}

/* ---- the felt: a rail, a gold inlay, and cloth with a woven texture ---- */

.felt-table {
  position: relative;
  width: 100%;
  padding: 16px;
  border-radius: 999px / 46%;
  background:
    linear-gradient(165deg, var(--rail-lit) 0%, var(--rail) 45%, #1b0f09 100%);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, 0.6),
    inset 0 2px 3px rgba(255, 255, 255, 0.09),
    inset 0 -3px 8px rgba(0, 0, 0, 0.55);
}

/* The thin gold line between the padded rail and the cloth. */
.rail {
  position: absolute; inset: 11px;
  border-radius: 999px / 46%;
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 12px rgba(220, 184, 114, 0.18);
  pointer-events: none;
}

.cloth {
  position: relative;
  border-radius: 999px / 46%;
  padding: 22px 18px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background:
    radial-gradient(70% 90% at 50% 34%, var(--felt-lit) 0%, var(--felt) 58%, var(--felt-deep) 100%);
  box-shadow: inset 0 6px 22px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

/* Woven cloth: two faint diagonal grids, cheaper and calmer than an image. */
.cloth::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.022) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.03) 0 2px, transparent 2px 4px);
  pointer-events: none;
}

.cloth-motto {
  margin: 2px 0 0;
  font-family: ui-serif, Georgia, serif;
  font-size: 10px; letter-spacing: 0.34em; text-transform: uppercase;
  color: rgba(220, 184, 114, 0.26);
  text-align: center;
}

/* -- opponent seats, arced along the top of the cloth -- */

.opponents { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; position: relative; z-index: 1; }

.seat {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 13px 7px 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 40px;
  transition: border-color 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}
.seat.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(220, 184, 114, 0.3), 0 0 26px rgba(220, 184, 114, 0.2);
}
.seat.active .avatar { animation: pulse 1.9s ease-in-out infinite; }
.seat.out { opacity: 0.32; }
.seat.away { opacity: 0.6; }
.seat-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.seat-name { font-size: 13px; font-weight: 600; line-height: 1; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-meta { display: flex; align-items: center; gap: 6px; }

.life-pips { display: flex; gap: 3px; }
.life-pip {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  box-shadow: 0 0 6px rgba(220, 184, 114, 0.4);
}
.life-pip.spent { background: rgba(255, 255, 255, 0.13); box-shadow: none; }
.life-block .life-pip { width: 11px; height: 11px; }

.tag { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; border-radius: 10px; padding: 2px 6px; line-height: 1.4; }
.tag.knocked { color: #ffd9a0; border: 1px solid rgba(255, 217, 160, 0.45); }
.tag.away { color: #ffb3aa; border: 1px solid rgba(255, 179, 170, 0.4); }
.tag.gone { color: var(--dimmer); border: 1px solid rgba(255, 255, 255, 0.12); }

.mini-fan { display: flex; }
.mini-fan i {
  width: 13px; height: 19px; border-radius: 2px; margin-left: -5px;
  background: linear-gradient(140deg, #a34141, #6d2222);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.35);
}
.mini-fan i:first-child { margin-left: 0; }

/* -- the two piles, and the labels that say what taking each one does -- */

.middle { display: flex; justify-content: center; align-items: flex-start; gap: 24px; position: relative; z-index: 1; }
.pile-group { display: flex; flex-direction: column; align-items: center; gap: 8px; width: calc(var(--card-w) + 40px); }

.pile {
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  padding: 0; border: none; background: none;
  border-radius: 9px;
  cursor: default; position: relative;
  transition: transform 0.14s ease;
}
/* Cut-out slot where the card sits, so an empty pile still reads as a place. */
.pile.empty {
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.4);
}
.pile.actionable { cursor: pointer; }
.pile.actionable::after {
  content: "";
  position: absolute; inset: -5px;
  border-radius: 14px;
  border: 2px solid var(--gold);
  box-shadow: 0 0 22px rgba(220, 184, 114, 0.45);
  animation: breathe 2.2s ease-in-out infinite;
  pointer-events: none;
}
.pile.actionable:hover { transform: translateY(-6px); }

.pile-caption {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--dimmer); text-align: center; line-height: 1.5;
  min-height: 30px;
}
.pile-caption b { display: block; font-size: 11px; letter-spacing: 0.04em; text-transform: none; }
.pile-caption.offered { color: var(--gold); }
.pile-caption .gain { color: var(--good); }

/* -- what the last player took -- */

.draw-note {
  position: relative; z-index: 2;
  margin: 14px auto 0;
  display: flex; align-items: center; gap: 8px;
  width: max-content; max-width: 100%;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  font-size: 12px; color: var(--cream);
  animation: draw-note-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
/* Once that player's turn is over it is history: still readable, less loud. */
.draw-note.settled { opacity: 0.55; box-shadow: none; }

.draw-note-who { display: flex; align-items: center; gap: 6px; }
.draw-note-who b { font-weight: 700; }
.draw-note-text { color: var(--dim); }

/* The card itself, small but face up, so there is no ambiguity about which one. */
.draw-note-card .card {
  width: 38px; border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.draw-note-card { display: flex; }
.draw-note.from-deck .draw-note-card .card { opacity: 0.8; }
/* A face-up card is the point of the note, so give it a little more presence. */
.draw-note:not(.from-deck) .draw-note-card .card {
  box-shadow: 0 0 0 1.5px var(--gold-dim), 0 3px 10px rgba(0, 0, 0, 0.5);
}

@keyframes draw-note-in {
  from { opacity: 0; transform: translateY(8px) scale(0.94); }
}

/* The drawn card's flight from pile to seat. Fixed layer, above the felt and
   below the overlays, and never interactive. */
.flight-deck { position: fixed; inset: 0; pointer-events: none; z-index: 34; }
.card.in-flight {
  position: fixed;
  margin: 0;
  transition: transform 0.62s cubic-bezier(0.35, 0, 0.2, 1), opacity 0.62s ease-in;
  will-change: transform, opacity;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.55);
}
@media (prefers-reduced-motion: reduce) {
  .card.in-flight { display: none; }
  .draw-note { animation: none; }
}

/* -- cards -- */

.card {
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  border: none; padding: 0;
  border-radius: 9px;
  background: linear-gradient(170deg, #fffdf8 0%, var(--cream) 60%, #e8e1d2 100%);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(0, 0, 0, 0.09);
  overflow: hidden; position: relative; display: block;
  transition: transform 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.3), box-shadow 0.2s ease;
}
.card.red { color: var(--card-red); }
.card.back { background: none; }
.card-svg { display: block; width: 100%; height: 100%; }

.card.playable { cursor: pointer; }
.card.playable:hover, .card.playable:focus-visible {
  transform: translateY(-14px);
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.09);
  outline: none;
}
.card.scoring::after {
  content: "";
  position: absolute; inset: 0; border-radius: 9px;
  box-shadow: inset 0 0 0 2.5px var(--gold), 0 0 18px rgba(220, 184, 114, 0.35);
  pointer-events: none;
}
.card.locked { opacity: 0.5; filter: grayscale(0.45); }
.card.mini { width: 46px; border-radius: 6px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); }
.card.mini.scoring::after { border-radius: 6px; box-shadow: inset 0 0 0 2px var(--gold); }
.card.dealt { animation: deal-in 0.34s cubic-bezier(0.2, 0.8, 0.3, 1.1) both; }
.card.drawn { animation: draw-in 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.2) both; }

/* -- your hand, with a label under each card saying what throwing it leaves -- */

.hand { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; min-height: 148px; align-items: flex-start; }

.hand-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.card-note {
  font-size: 10px; letter-spacing: 0.03em; color: var(--dimmer);
  text-align: center; min-height: 15px; line-height: 1.3;
}
.card-note.leaves { color: var(--dim); }
.card-note.best { color: var(--good); font-weight: 700; }
.card-note.blocked { color: #ffb3aa; }

/* -- the instruction block: what you must do, right now -- */

.instruction { text-align: center; display: grid; gap: 6px; place-items: center; min-height: 74px; }
.turn-banner { margin: 0; font-size: 16px; font-weight: 700; }
.turn-banner.you { color: var(--gold); }
.step-hint {
  margin: 0; font-size: 13px; color: var(--dim);
  max-width: 40ch; line-height: 1.45;
  white-space: pre-line;   /* the knock notice is appended on its own line */
}

.step-dots { display: flex; gap: 8px; }
.step {
  font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1); color: var(--dimmer);
}
.step.now { border-color: var(--gold); color: var(--gold); background: rgba(220, 184, 114, 0.1); }
.step.done { border-color: rgba(111, 211, 155, 0.4); color: var(--good); }

/* -- dashboard -- */

.dashboard { display: flex; align-items: center; justify-content: center; gap: 22px; min-height: 56px; }
.score-block, .life-block { display: flex; flex-direction: column; gap: 5px; align-items: center; }
.score-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dimmer); }
.score-value { font-size: 26px; font-weight: 800; color: var(--gold); line-height: 1; }
.score-value.max { color: var(--good); text-shadow: 0 0 18px rgba(111, 211, 155, 0.5); }
.score-meter { width: 84px; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.score-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width 0.35s ease; }
.score-meter i.max { background: linear-gradient(90deg, #3ea86f, var(--good)); }

/* -- emoji bar -- */

.emoji-bar { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.emoji-btn {
  font-size: 19px; line-height: 1;
  padding: 7px 9px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px; cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.emoji-btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-3px); }
.emoji-btn:active { transform: scale(0.9); }

/* Reactions are deliberately absurd. They land across the whole screen rather
   than drifting politely up a corner, so a full screen layer, not the felt. */
.reactions {
  position: fixed; inset: 0;
  pointer-events: none; overflow: hidden;
  z-index: 35;
}
.reaction {
  position: absolute; top: 46%; left: 50%;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: emoji-slam 2.3s cubic-bezier(0.18, 1.3, 0.32, 1) forwards;
}
.reaction .glyph {
  font-size: clamp(150px, 40vmin, 380px);
  line-height: 1;
  filter: drop-shadow(0 20px 44px rgba(0, 0, 0, 0.7));
}
.reaction .who {
  font-size: clamp(15px, 2.8vmin, 26px);
  font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--cream);
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
}

/* ------------------------------------------------------- turn clock */

.banner-row { display: flex; align-items: center; justify-content: center; gap: 12px; }

.turn-clock {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.turn-clock svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.turn-clock circle { fill: none; stroke-width: 3; }
.clock-track { stroke: rgba(255, 255, 255, 0.12); }
.clock-arc {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: 97.4;          /* 2 * pi * r, r = 15.5 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.95s linear, stroke 0.3s ease;
}
.turn-clock b {
  font-size: 14px; font-weight: 700; color: var(--dim);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}
.turn-clock.mine b { color: var(--gold); }
.turn-clock.warn .clock-arc { stroke: #ffc46b; }
.turn-clock.warn b { color: #ffc46b; }
.turn-clock.critical .clock-arc { stroke: var(--danger); }
.turn-clock.critical b { color: #ff9b8d; }
.turn-clock.critical { animation: clock-pulse 1s ease-in-out infinite; }

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

/* ------------------------------------------------------- floating chat */

.chat-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24, 70, 53, 0.95), rgba(8, 30, 22, 0.95));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  cursor: pointer; z-index: 28;
  display: grid; place-items: center;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.chat-fab:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55); }
.chat-fab-icon { font-size: 21px; line-height: 1; }
.chat-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px;
  background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 19px; text-align: center;
}

/* ---------------------------------------------------------------- chat */

.chat-panel {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: min(360px, 90vw);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(8, 28, 21, 0.97), rgba(4, 16, 12, 0.97));
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.5);
  z-index: 30;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom));
  animation: slide-left 0.22s ease both;
}
.chat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chat-head .eyebrow { margin: 0; }

.chat-log {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 9px;
  padding: 6px 2px;
}
.chat-msg { display: flex; gap: 8px; align-items: flex-start; animation: slide-in 0.2s ease both; }
.chat-msg .body { min-width: 0; }
.chat-msg .who { font-size: 11px; color: var(--gold); font-weight: 600; }
.chat-msg .text { font-size: 13px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.chat-msg.mine .who { color: var(--good); }
.chat-sys { font-size: 11px; color: var(--dimmer); text-align: center; font-style: italic; }
.chat-empty { font-size: 12px; color: var(--dimmer); text-align: center; margin: auto 0; line-height: 1.6; }

.chat-form { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.chat-form input { padding: 11px 12px; font-size: 15px; }
.chat-form .btn { flex: 0 0 auto; }

/* ---------------------------------------------------------------- overlay */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 16, 12, 0.88);
  backdrop-filter: blur(7px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  animation: fade-in 0.25s ease both;
}
.overlay-card {
  width: min(540px, 100%);
  background: linear-gradient(180deg, rgba(20, 60, 46, 0.55), rgba(0, 0, 0, 0.5));
  border: 1px solid var(--line);
  border-radius: 22px; padding: 28px 24px; text-align: center;
  animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.3, 1.05) both;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.overlay-card h2 { margin: 0 0 8px; font-size: 28px; color: var(--gold); }
.headline { margin: 0 0 22px; font-size: 15px; line-height: 1.55; }

.reveal { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.reveal-row {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 8px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  animation: slide-in 0.35s ease both;
}
.reveal-row .cards { display: flex; gap: 4px; flex: 0 0 auto; }
.reveal-row .who { flex: 1; min-width: 0; }
.reveal-row .who .n { font-size: 14px; font-weight: 600; display: block; }
.reveal-row .who .s { font-size: 11px; color: var(--dim); }
.reveal-row .pts { font-size: 22px; font-weight: 800; color: var(--dim); }
.reveal-row.loser { background: rgba(209, 73, 60, 0.14); }
.reveal-row.loser .who .n { color: #ffb3aa; }
.reveal-row.winner { background: rgba(220, 184, 114, 0.14); }
.reveal-row.winner .who .n, .reveal-row.winner .pts { color: var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.88); border: 1px solid var(--line);
  color: var(--cream); padding: 11px 18px; border-radius: 30px;
  font-size: 13px; z-index: 50; max-width: 90vw; text-align: center;
  animation: rise 0.22s ease both;
}

/* ------------------------------------------------- flash announcements */

/* A knock changes the whole shape of a round, so it gets more than a toast. */
.flash {
  position: fixed; inset: 0; z-index: 45;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  background: radial-gradient(50% 40% at 50% 50%, rgba(4, 16, 12, 0.72), transparent 70%);
  animation: fade-in 0.18s ease both;
}
.flash-card {
  text-align: center; padding: 22px 34px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(24, 70, 53, 0.92), rgba(6, 24, 18, 0.92));
  border: 1px solid var(--gold-dim);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 40px rgba(220, 184, 114, 0.14);
  animation: flash-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  max-width: min(420px, 88vw);
}
.flash-kicker {
  margin: 0 0 6px; font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--dimmer);
}
.flash-title {
  margin: 0; font-size: 28px; font-weight: 800; color: var(--gold);
  letter-spacing: -0.01em; line-height: 1.15;
}
.flash-sub { margin: 8px 0 0; font-size: 14px; color: var(--dim); line-height: 1.45; }
.flash.knock .flash-card { border-color: rgba(224, 89, 74, 0.6); box-shadow: 0 24px 70px rgba(0,0,0,0.6), 0 0 40px rgba(209, 73, 60, 0.22); }
.flash.knock .flash-title { color: #ff9b8d; }

/* ------------------------------------------------ between round standings */

.standings {
  display: grid; gap: 8px;
  margin: 4px 0 22px; padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.standings-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dimmer);
}
.standing {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}
.standing .who { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.standing .lost { font-size: 11px; color: #ffb3aa; margin-left: 6px; font-weight: 400; }
.standing.eliminated { opacity: 0.45; }
.standing.eliminated .who { text-decoration: line-through; }
.standing .status { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dimmer); }
.next-up {
  font-size: 12px; color: var(--dim); text-align: center; margin: 2px 0 0;
}
.next-up b { color: var(--gold); font-weight: 600; }

#podiumBtn { width: 100%; margin-top: 8px; }

/* ================================================== the podium finish */

.podium-screen {
  position: fixed; inset: 0; z-index: 55;
  overflow-y: auto;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(220, 184, 114, 0.12), transparent 60%),
    linear-gradient(180deg, #0a2019 0%, #04120d 100%);
  animation: fade-in 0.4s ease both;
}
.fireworks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.podium-inner {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  gap: 6px;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto;
}
/* A soft shadow behind the classification, so a sky full of fireworks never
   costs you the ability to read who came second. */
.podium-inner::before {
  content: "";
  position: absolute; inset: -6% -12%;
  background: radial-gradient(58% 48% at 50% 52%, rgba(3, 14, 10, 0.86) 0%, rgba(3, 14, 10, 0.55) 55%, transparent 78%);
  z-index: -1;
  pointer-events: none;
}
.podium-title {
  margin: 0 0 26px; text-align: center;
  font-size: clamp(26px, 5vmin, 40px); font-weight: 800; color: var(--gold);
  text-shadow: 0 2px 18px rgba(3, 14, 10, 0.9);
  animation: rise 0.5s 0.15s ease both;
}

/* Three blocks: second on the left, first raised in the middle, third on the right. */
.podium-steps {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 10px;
  margin-bottom: 26px;
}
.step-block { display: flex; flex-direction: column; align-items: center; }

.step-figure { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 10px; }
.step-name {
  font-size: clamp(13px, 2.1vmin, 17px); font-weight: 700; text-align: center;
  max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 10px rgba(3, 14, 10, 0.95);
}
.step-meta {
  font-size: 11px; color: rgba(246, 242, 232, 0.55);
  text-shadow: 0 1px 10px rgba(3, 14, 10, 0.95);
}

.step-plinth {
  width: 100%;
  border-radius: 8px 8px 3px 3px;
  display: grid; place-items: center;
  font-size: clamp(28px, 6vmin, 48px); font-weight: 900;
  color: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 14px 30px rgba(0, 0, 0, 0.5);
  animation: plinth-rise 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.05) both;
}
.step-block.first  .step-plinth { height: 132px; background: linear-gradient(180deg, #f4dfa8, #d4ac5e); animation-delay: 0.5s; }
.step-block.second .step-plinth { height: 96px;  background: linear-gradient(180deg, #e6e8ea, #a8adb3); animation-delay: 0.25s; }
.step-block.third  .step-plinth { height: 72px;  background: linear-gradient(180deg, #e0a878, #ad6f42); animation-delay: 0.35s; }

.step-block.first .avatar  { width: 56px; height: 56px; flex-basis: 56px; font-size: 20px; }
.step-block.second .avatar,
.step-block.third .avatar  { width: 42px; height: 42px; flex-basis: 42px; font-size: 15px; }
.step-block.second .avatar { background: linear-gradient(160deg, #f2f4f6, #aeb3b8); }
.step-block.third .avatar  { background: linear-gradient(160deg, #eeb98c, #b5734a); }

.step-block.first .step-figure { animation: rise 0.5s 0.75s ease both; }
.step-block.second .step-figure { animation: rise 0.5s 0.5s ease both; }
.step-block.third .step-figure { animation: rise 0.5s 0.6s ease both; }

.crown { font-size: 22px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }

/* Everyone from fourth down, listed plainly. */
.podium-rest {
  list-style: none; margin: 0 0 24px; padding: 0;
  display: grid; gap: 6px;
  animation: rise 0.5s 0.95s ease both;
}
.podium-rest li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 14px;
}
.podium-rest .place {
  font-size: 12px; font-weight: 700; color: var(--dimmer);
  min-width: 26px; font-variant-numeric: tabular-nums;
}
.podium-rest .who { flex: 1; min-width: 0; }

.podium-actions { display: grid; gap: 10px; animation: rise 0.5s 1.1s ease both; }

@keyframes plinth-rise {
  0%   { opacity: 0; transform: scaleY(0.05); transform-origin: bottom; }
  70%  { opacity: 1; transform: scaleY(1.06); transform-origin: bottom; }
  100% { opacity: 1; transform: scaleY(1); transform-origin: bottom; }
}

@media (max-width: 460px) {
  .podium-steps { gap: 6px; }
  .step-block.first  .step-plinth { height: 104px; }
  .step-block.second .step-plinth { height: 76px; }
  .step-block.third  .step-plinth { height: 58px; }
}

/* ============================================================== hints */

/* On a phone the topbar is tight, so the button keeps only its bulb. */
@media (max-width: 430px) {
  #hintsBtn { font-size: 0; padding: 8px 10px; }
  #hintsBtn::first-letter { font-size: 14px; }
}

#hintsBtn.on {
  color: #0f2b22;
  background: linear-gradient(180deg, #f4d98a, #d8b26a);
  border-color: #f0d290;
  box-shadow: 0 0 0 1px rgba(216, 178, 106, 0.35), 0 4px 14px rgba(216, 178, 106, 0.28);
}

.coach {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 10px; padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(216, 178, 106, 0.14), rgba(216, 178, 106, 0.06));
  border: 1px solid rgba(216, 178, 106, 0.32);
  animation: rise 0.28s ease both;
}
.coach-tag {
  flex: none;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #0f2b22; font-weight: 800;
  background: #d8b26a;
  padding: 3px 7px; border-radius: 999px;
  margin-top: 2px;
}
.coach-body { min-width: 0; }
.coach-line {
  margin: 0; font-size: 14px; font-weight: 700; color: #f3e8cf;
}
.coach-why {
  margin: 3px 0 0; font-size: 12px; line-height: 1.45;
  color: rgba(243, 232, 207, 0.72);
}

/* The one thing the coach is pointing at. Deliberately calmer than .actionable,
   so a beginner reads it as advice rather than as the only legal move. */
.suggested {
  position: relative;
  outline: 2px dashed rgba(216, 178, 106, 0.85);
  outline-offset: 3px;
  border-radius: 10px;
  animation: coach-pulse 1.8s ease-in-out infinite;
}
@keyframes coach-pulse {
  0%, 100% { outline-color: rgba(216, 178, 106, 0.85); }
  50%      { outline-color: rgba(216, 178, 106, 0.32); }
}
@media (prefers-reduced-motion: reduce) {
  .suggested { animation: none; }
}

/* ============================================ victory and elimination */

.celebration {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  pointer-events: none;
  overflow: hidden;
}
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; }

.celebration-inner {
  position: relative; z-index: 1;
  text-align: center;
  padding: 24px;
  max-width: min(680px, 92vw);
}
.celebration-kicker {
  margin: 0 0 10px;
  font-size: clamp(11px, 1.6vmin, 14px);
  letter-spacing: 0.4em; text-transform: uppercase;
}
.celebration-title {
  position: relative;          /* so the shine anchors to the word, not the panel */
  display: inline-block;
  overflow: hidden;            /* and is clipped to it */
  margin: 0;
  font-size: clamp(56px, 13vmin, 150px);
  font-weight: 900; letter-spacing: -0.03em; line-height: 0.95;
  padding: 0 0.08em;           /* room for the glow without cropping the letters */
}
.celebration-sub {
  margin: 14px 0 0;
  font-size: clamp(15px, 2.4vmin, 22px);
}
.celebration-hand { display: flex; gap: 10px; justify-content: center; margin-top: 26px; }
.celebration-hand .card { width: clamp(58px, 9vmin, 92px); }

/* -- winning -- */

.celebration.victory {
  background:
    radial-gradient(closest-side at 50% 45%, rgba(220, 184, 114, 0.25), transparent 70%),
    rgba(4, 16, 12, 0.9);
  animation: fade-in 0.3s ease both;
}
.celebration.victory .celebration-kicker { color: var(--gold-soft); animation: rise 0.5s 0.3s ease both; }
.celebration.victory .celebration-title {
  color: var(--gold);
  text-shadow:
    0 0 18px rgba(220, 184, 114, 0.55),
    0 0 70px rgba(220, 184, 114, 0.35),
    0 8px 0 rgba(0, 0, 0, 0.35);
  animation: victory-slam 0.75s cubic-bezier(0.15, 1.4, 0.35, 1) both;
}
.celebration.victory .celebration-sub { color: var(--cream); animation: rise 0.5s 0.5s ease both; }
.celebration.victory .celebration-hand { animation: rise 0.6s 0.65s ease both; }

/* A light sweeping across the word, once it has landed. */
.celebration.victory .celebration-title::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.55) 50%, transparent 62%);
  mix-blend-mode: overlay;
  animation: shine 1.5s 0.85s ease-out;
}

/* Gold rings pushing outwards from the middle. */
.celebration.victory::before,
.celebration.victory::after {
  content: "";
  position: absolute; left: 50%; top: 45%;
  width: 24vmin; height: 24vmin; margin: -12vmin 0 0 -12vmin;
  border: 3px solid var(--gold);
  border-radius: 50%;
  animation: shockwave 1.5s ease-out forwards;
}
.celebration.victory::after { animation-delay: 0.34s; }

/* -- being knocked out -- */

.celebration.eliminated {
  background:
    radial-gradient(closest-side at 50% 45%, rgba(209, 73, 60, 0.22), transparent 72%),
    rgba(3, 8, 6, 0.94);
  animation: fade-in 0.25s ease both;
}
.celebration.eliminated .celebration-kicker { color: rgba(255, 179, 170, 0.75); animation: rise 0.5s 0.45s ease both; }
.celebration.eliminated .celebration-title {
  color: #ff8574;
  text-shadow: 0 0 30px rgba(209, 73, 60, 0.6), 0 6px 0 rgba(0, 0, 0, 0.45);
  animation: eliminated-slam 0.8s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}
.celebration.eliminated .celebration-sub { color: var(--dim); animation: rise 0.5s 0.7s ease both; }
.celebration.eliminated .celebration-hand { animation: sink 1.1s 0.5s cubic-bezier(0.5, 0, 0.75, 0) both; }

/* One hard red pulse, like a light being cut. */
.celebration.eliminated::before {
  content: "";
  position: absolute; inset: 0;
  box-shadow: inset 0 0 22vmin rgba(209, 73, 60, 0.6);
  animation: red-pulse 1.4s ease-out both;
}

@keyframes victory-slam {
  0%   { opacity: 0; transform: scale(2.6) rotate(-6deg); filter: blur(14px); }
  55%  { opacity: 1; transform: scale(0.92) rotate(1deg); filter: blur(0); }
  75%  { transform: scale(1.06) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes eliminated-slam {
  0%   { opacity: 0; transform: scale(1.9); filter: blur(10px); letter-spacing: 0.3em; }
  60%  { opacity: 1; transform: scale(0.96); filter: blur(0); letter-spacing: -0.03em; }
  70%  { transform: scale(1) translateX(-8px); }
  78%  { transform: scale(1) translateX(7px); }
  86%  { transform: scale(1) translateX(-4px); }
  100% { transform: scale(1) translateX(0); }
}
@keyframes shockwave {
  0%   { opacity: 0.9; transform: scale(0.2); border-width: 5px; }
  100% { opacity: 0; transform: scale(6); border-width: 0.5px; }
}
@keyframes shine {
  0%   { transform: translateX(-120%); opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}
@keyframes red-pulse {
  0%   { opacity: 0; }
  18%  { opacity: 1; }
  100% { opacity: 0.35; }
}
@keyframes sink {
  0%   { opacity: 1; transform: translateY(0) rotate(0); }
  100% { opacity: 0; transform: translateY(60vh) rotate(14deg); }
}

/* ---------------------------------------------------------------- motion */

@keyframes deal-in { from { opacity: 0; transform: translateY(-70px) rotate(-8deg) scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes draw-in { from { opacity: 0; transform: translateY(-40px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide-left { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes breathe { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 184, 114, 0.5); }
  50%      { box-shadow: 0 0 0 7px rgba(220, 184, 114, 0); }
}
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes flash-in {
  0%   { opacity: 0; transform: scale(0.86) translateY(10px); }
  60%  { opacity: 1; transform: scale(1.03) translateY(0); }
  100% { opacity: 1; transform: scale(1); }
}
/* Rockets in from nothing, overshoots, wobbles, then falls away. */
@keyframes emoji-slam {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.05) rotate(-25deg); }
  22%  { opacity: 1; transform: translate(-50%, -50%) scale(1.18) rotate(6deg); }
  34%  { transform: translate(-50%, -50%) scale(0.94) rotate(-4deg); }
  46%  { transform: translate(-50%, -50%) scale(1.04) rotate(2deg); }
  62%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -20%) scale(0.85) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- sizes */

@media (max-width: 430px) {
  :root { --card-w: 70px; }
  .brand-mark { font-size: 62px; }
  .panel { padding: 24px 20px; }
  .code-display span { font-size: 36px; }
  .card.mini { width: 40px; }
  .cloth { padding: 16px 10px 20px; }
  .felt-table { padding: 11px; border-radius: 999px / 34%; }
  .rail { inset: 8px; border-radius: 999px / 34%; }
  .cloth { border-radius: 999px / 34%; }
  .middle { gap: 16px; }
  .pile-group { width: calc(var(--card-w) + 18px); }
  .cloth-motto { letter-spacing: 0.2em; font-size: 9px; }
  .emoji-btn { font-size: 17px; padding: 6px 7px; }
  .emoji-bar { gap: 4px; }
}

@media (min-width: 760px) {
  :root { --card-w: 96px; }
  .table-area { gap: 18px; }
}

/* ==========================================================================
   The showpiece layer. Everything above makes the game work; everything below
   is there to make it feel like a real table in a good room. No image files:
   the textures are inline SVG noise and the light is all gradients.
   ========================================================================== */

:root {
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --foil: linear-gradient(100deg, #8a6a2c 0%, #dcb872 18%, #fff3cf 32%, #dcb872 46%, #9c7833 60%, #f0d9a8 78%, #b8904a 100%);
  --ease-out: cubic-bezier(0.2, 0.9, 0.25, 1);
  --spring: cubic-bezier(0.3, 1.5, 0.5, 1);
}

/* ---- the room: a slow drift of warm light over dark green ---- */

body::before {
  content: "";
  position: fixed; inset: -20%;
  z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 30% at 28% 22%, rgba(220, 184, 114, 0.10), transparent 70%),
    radial-gradient(34% 28% at 76% 70%, rgba(40, 150, 105, 0.16), transparent 70%),
    radial-gradient(30% 26% at 70% 16%, rgba(193, 39, 45, 0.06), transparent 70%);
  animation: room-drift 26s ease-in-out infinite alternate;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: -1; pointer-events: none;
  background-image: var(--noise);
  opacity: 0.05; mix-blend-mode: overlay;
}
@keyframes room-drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(3%, 3%, 0) scale(1.08); }
}

/* ---- the landing page ---- */

.home { position: relative; overflow: hidden; }
.home > * { position: relative; z-index: 1; }

/* Suits drifting up through the dark behind the hero. Built in app.js. */
.suit-drift { position: absolute !important; inset: 0; z-index: 0 !important; pointer-events: none; overflow: hidden; }
.suit-drift span {
  position: absolute; bottom: -12%;
  left: var(--x); font-size: var(--size);
  color: var(--tint);
  opacity: 0;
  filter: blur(var(--blur));
  animation: suit-rise var(--dur) linear var(--delay) infinite;
}
@keyframes suit-rise {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  12%  { opacity: var(--alpha); }
  85%  { opacity: var(--alpha); }
  100% { transform: translate3d(var(--sway), -125vh, 0) rotate(var(--spin)); opacity: 0; }
}

.home-hero { perspective: 900px; padding-top: 10px; }

.hero-fan {
  height: 196px; margin-bottom: 4px;
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--ry, 0) * -7deg + 6deg)) rotateY(calc(var(--rx, 0) * 10deg));
  transition: transform 0.35s var(--ease-out);
  filter: drop-shadow(0 34px 30px rgba(0, 0, 0, 0.55));
}
.hero-fan .card {
  --card-w: 112px;
  margin: 0 -13px;
  border-radius: 12px;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.6) inset, 0 0 0 1px rgba(0, 0, 0, 0.12) inset, 0 10px 22px rgba(0, 0, 0, 0.45);
  animation: fan-in 0.9s var(--spring) both, hero-float 7s ease-in-out 1.2s infinite;
}
.hero-fan .card:nth-child(1) { --rot: -17deg; --lift: 0px;   transform: rotate(-17deg) translateZ(0); }
.hero-fan .card:nth-child(2) { --rot: 0deg;   --lift: -22px; transform: rotate(0deg) translateY(-22px) translateZ(28px); }
.hero-fan .card:nth-child(3) { --rot: 17deg;  --lift: 0px;   transform: rotate(17deg) translateZ(0); animation-delay: 0.23s, 1.6s; }
.hero-fan .card:nth-child(2) { animation-delay: 0.14s, 1.4s; }
@keyframes hero-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -7px; }
}
/* A band of light crossing each card now and then, like a lamp catching the gloss. */
.hero-fan .card::before, .card.playable::before, .celebration-hand .card::before {
  content: "";
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.7) 50%, transparent 62%);
  background-size: 260% 100%; background-position: 130% 0;
  mix-blend-mode: soft-light;
}
.hero-fan .card::before { animation: gloss 5.5s ease-in-out 1.4s infinite; }
.hero-fan .card:nth-child(2)::before { animation-delay: 1.7s; }
.hero-fan .card:nth-child(3)::before { animation-delay: 2s; }
.card.playable:hover::before { animation: gloss 0.9s ease-out; }
.celebration-hand .card::before { animation: gloss 2.2s ease-in-out 0.6s infinite; }
@keyframes gloss {
  0%, 55% { background-position: 130% 0; }
  100%    { background-position: -40% 0; }
}

/* The wordmark: gold foil with a sheen that travels across it. */
.brand-mark {
  margin: 0;
  font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(104px, 26vw, 176px);
  font-weight: 700; letter-spacing: -0.04em; line-height: 0.92;
  background: var(--foil);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 0 rgba(60, 40, 8, 0.9)) drop-shadow(0 14px 34px rgba(220, 184, 114, 0.32));
  animation: foil-slide 7s ease-in-out infinite alternate, mark-in 1s var(--ease-out) 0.3s both;
}
@keyframes foil-slide {
  from { background-position: 0% 0; }
  to   { background-position: 100% 0; }
}
@keyframes mark-in {
  from { opacity: 0; transform: translateY(18px) scale(0.94); letter-spacing: 0.1em; }
}
.tagline {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-family: ui-serif, Georgia, serif; font-style: italic;
  animation: rise 0.8s ease 0.55s both;
}
.tagline::before, .tagline::after {
  content: ""; height: 1px; flex: 0 1 64px;
  background: linear-gradient(90deg, transparent, var(--gold-dim));
}
.tagline::after { transform: scaleX(-1); }
.hero-sub { animation: rise 0.8s ease 0.7s both; }

/* Glass panels with a gold hairline that brightens toward the top. */
.panel, .overlay-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 22%),
    linear-gradient(180deg, rgba(8, 34, 26, 0.72), rgba(2, 12, 9, 0.82));
  border: 1px solid transparent;
  background-clip: padding-box;
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.panel::before, .overlay-card::before {
  content: "";
  position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: linear-gradient(170deg, rgba(240, 217, 168, 0.75), rgba(220, 184, 114, 0.12) 38%, rgba(220, 184, 114, 0.04) 70%, rgba(220, 184, 114, 0.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.home-panel { animation: rise 0.8s var(--ease-out) 0.8s both; }

.btn { transition: transform 0.14s var(--ease-out), box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.985); }
.btn.primary {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #fbeecb 0%, #e9c987 42%, #c99a4b 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 -2px 0 rgba(120, 80, 20, 0.35) inset, 0 12px 30px rgba(220, 184, 114, 0.28);
  font-weight: 700; letter-spacing: 0.02em;
}
.btn.primary::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%);
  transform: translateX(-120%);
}
.btn.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 -2px 0 rgba(120, 80, 20, 0.35) inset, 0 18px 40px rgba(220, 184, 114, 0.42); }
.btn.primary:hover:not(:disabled)::after { transform: translateX(120%); transition: transform 0.7s ease; }
.btn.primary:disabled::after { display: none; }

.feature-row li { transition: transform 0.25s var(--ease-out), border-color 0.25s ease, box-shadow 0.25s ease; }
.feature-row li:hover { transform: translateY(-4px); border-color: var(--gold-dim); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4); }
.feature-icon { filter: drop-shadow(0 4px 10px rgba(220, 184, 114, 0.35)); }

/* ---- the lobby ---- */

#roomCode {
  font-family: ui-serif, Georgia, serif;
  background: var(--foil); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: foil-slide 6s ease-in-out infinite alternate;
}
.qr { box-shadow: 0 0 0 1px var(--gold-dim), 0 10px 26px rgba(0, 0, 0, 0.5); }
.seat-list li { animation: slide-in 0.35s var(--ease-out) both; }
.away-pill { color: var(--danger); border-color: rgba(209, 73, 60, 0.5); }

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

.felt-table {
  padding: 20px;
  background:
    var(--noise),
    radial-gradient(120% 60% at 50% 0%, rgba(255, 220, 170, 0.16), transparent 60%),
    linear-gradient(165deg, #5a3a26 0%, #3a2417 30%, #24140c 62%, #120a06 100%);
  background-blend-mode: overlay, normal, normal;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(0, 0, 0, 0.8),
    inset 0 2px 2px rgba(255, 230, 190, 0.22),
    inset 0 -6px 14px rgba(0, 0, 0, 0.7);
}
/* Stitching along the leather. */
.felt-table::after {
  content: "";
  position: absolute; inset: 6px;
  border-radius: 999px / 46%;
  border: 1.5px dashed rgba(240, 217, 168, 0.22);
  pointer-events: none;
}
.rail {
  inset: 16px;
  border: 2px solid transparent;
  background: var(--foil) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  box-shadow: none; opacity: 0.85;
  z-index: 2;
}
.cloth {
  padding: 26px 20px 30px;
  background:
    var(--noise),
    radial-gradient(60% 75% at 50% 30%, rgba(255, 255, 255, 0.10) 0%, transparent 62%),
    radial-gradient(75% 95% at 50% 36%, #23785a 0%, #145038 48%, #0a2c20 82%, #061a13 100%);
  background-blend-mode: soft-light, normal, normal;
  box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.65), inset 0 -4px 14px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
/* An engraved 31 in the middle of the felt, the way a casino marks its tables. */
.cloth::before {
  content: "31";
  position: absolute; left: 50%; top: 52%;
  width: 230px; height: 230px; margin: -115px 0 0 -115px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-family: ui-serif, Georgia, serif; font-size: 96px; font-weight: 700; letter-spacing: -0.04em;
  color: rgba(240, 217, 168, 0.07);
  border: 1px solid rgba(240, 217, 168, 0.09);
  box-shadow: 0 0 0 9px rgba(240, 217, 168, 0.025), inset 0 0 0 9px rgba(240, 217, 168, 0.025);
  pointer-events: none;
}
.cloth > * { position: relative; z-index: 1; }
.cloth-motto { color: rgba(240, 217, 168, 0.34); }

/* Seats sit along the far curve of the table. --arc is set per seat in app.js. */
.opponents { gap: 9px; align-items: flex-start; }
.seat {
  transform: translateY(var(--arc, 0px));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0.5));
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform 0.4s var(--ease-out), border-color 0.25s ease, opacity 0.25s ease, box-shadow 0.3s ease;
}
.seat.active {
  transform: translateY(var(--arc, 0px)) scale(1.06);
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(220, 184, 114, 0.35), 0 0 34px rgba(220, 184, 114, 0.35), 0 10px 24px rgba(0, 0, 0, 0.45);
  z-index: 3;
}
/* The countdown ring on the active seat: it drains as their time does. */
.seat .avatar { position: relative; }
.seat.active .avatar { animation: none; }
.seat.active .avatar::after {
  content: "";
  position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(var(--ring, var(--gold)) calc(var(--frac, 1) * 360deg), rgba(255, 255, 255, 0.12) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  filter: drop-shadow(0 0 5px var(--ring, var(--gold)));
}
.seat.active.warn { --ring: #f0a04b; }
.seat.active.critical { --ring: var(--danger); animation: seat-alarm 0.6s ease-in-out infinite alternate; }
@keyframes seat-alarm { to { box-shadow: 0 0 0 1px rgba(209, 73, 60, 0.6), 0 0 34px rgba(209, 73, 60, 0.5); border-color: var(--danger); } }

.avatar {
  background: radial-gradient(120% 120% at 30% 20%, #fff3cf, var(--gold) 55%, #9c7833);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -2px 3px rgba(90, 60, 10, 0.4), 0 2px 6px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.life-pip { box-shadow: 0 0 8px rgba(220, 184, 114, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.7); }
.mini-fan i { background: linear-gradient(140deg, #b44848, #5e1b1b); transform-origin: 50% 120%; }
.mini-fan i:nth-child(1) { transform: rotate(-10deg); }
.mini-fan i:nth-child(3) { transform: rotate(10deg); }
.mini-fan i:nth-child(4) { transform: rotate(20deg); }

/* The deck has thickness; the discard pile sits a little crooked, as thrown cards do. */
.pile { transition: transform 0.22s var(--spring); }
#stockPile:not(.empty) .card {
  box-shadow:
    0 1px 0 #d9d2c2, 0 2px 0 #6d2222, 0 3px 0 #d9d2c2, 0 4px 0 #6d2222, 0 5px 0 #d9d2c2, 0 6px 0 #5a1b1b,
    0 18px 26px rgba(0, 0, 0, 0.55);
  transform: translateY(-4px);
}
#discardPile .card { transform: rotate(3deg); box-shadow: -3px 3px 0 -1px rgba(0, 0, 0, 0.25), 0 12px 22px rgba(0, 0, 0, 0.5); animation: thrown 0.38s var(--spring) both; }
@keyframes thrown { from { transform: translateY(46px) rotate(-14deg) scale(1.12); opacity: 0.4; } }
.pile.actionable:hover { transform: translateY(-8px) scale(1.03); }
.pile.actionable::after { inset: -7px; border-radius: 16px; box-shadow: 0 0 30px rgba(220, 184, 114, 0.6), inset 0 0 18px rgba(220, 184, 114, 0.25); }

/* Cards: paper with weight. */
.card {
  background: linear-gradient(168deg, #ffffff 0%, #fbf7ee 45%, #ece4d2 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 0 0 1px rgba(0, 0, 0, 0.1) inset, 0 8px 18px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
}
.hand { perspective: 1000px; padding-top: 14px; }
.hand .card { --card-w: 96px; border-radius: 11px; }
.hand-slot { transition: transform 0.3s var(--ease-out); transform-origin: 50% 160%; }
/* A held hand fans. Three cards, then four once you have drawn. */
.hand-slot:nth-child(1):nth-last-child(3) { transform: rotate(-5deg) translateY(4px); }
.hand-slot:nth-child(3):nth-last-child(1) { transform: rotate(5deg) translateY(4px); }
.hand-slot:nth-child(1):nth-last-child(4) { transform: rotate(-7deg) translateY(8px); }
.hand-slot:nth-child(2):nth-last-child(3) { transform: rotate(-2.3deg); }
.hand-slot:nth-child(3):nth-last-child(2) { transform: rotate(2.3deg); }
.hand-slot:nth-child(4):nth-last-child(1) { transform: rotate(7deg) translateY(8px); }
.card.playable:hover, .card.playable:focus-visible {
  transform: translateY(-20px) scale(1.05);
  box-shadow: 0 0 0 2px var(--gold), 0 30px 44px rgba(0, 0, 0, 0.55), 0 0 30px rgba(220, 184, 114, 0.35);
}
.card.scoring::after { animation: scoring-glow 2.6s ease-in-out infinite; }
@keyframes scoring-glow {
  0%, 100% { box-shadow: inset 0 0 0 2.5px var(--gold), 0 0 14px rgba(220, 184, 114, 0.3); }
  50%      { box-shadow: inset 0 0 0 2.5px var(--gold-soft), 0 0 26px rgba(220, 184, 114, 0.6); }
}
/* The deal: each card flips in from the deck. */
.card.dealt { animation: deal-flip 0.6s var(--ease-out) both; backface-visibility: hidden; }
@keyframes deal-flip {
  0%   { transform: translate3d(0, -160px, 0) rotateY(180deg) rotate(-20deg) scale(0.6); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: none; }
}
.card.drawn { animation: draw-in 0.5s var(--spring) both; }
@keyframes draw-in { from { transform: translate3d(0, -90px, 0) rotate(12deg) scale(0.7); opacity: 0; } }
.flight-deck .card { box-shadow: 0 24px 40px rgba(0, 0, 0, 0.6); transition-timing-function: cubic-bezier(0.5, 0, 0.2, 1) !important; }

.turn-banner { font-family: ui-serif, Georgia, serif; font-size: 22px; letter-spacing: 0.01em; }
.turn-banner.you {
  background: var(--foil); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  animation: foil-slide 3s ease-in-out infinite alternate, banner-pop 0.45s var(--spring);
}
@keyframes banner-pop { from { transform: scale(0.8); opacity: 0; } }
.score-value { font-family: ui-serif, Georgia, serif; font-size: 34px; }
.score-value.max { animation: banner-pop 0.5s var(--spring); }
.btn.knock { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 12px 28px rgba(209, 73, 60, 0.45); }
.btn.knock:hover { transform: translateY(-2px) scale(1.03); }
.emoji-btn:hover { transform: translateY(-4px) scale(1.2) rotate(-6deg); }

/* ---- announcements, reveals and the podium ---- */

.flash { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.flash-card { position: relative; }
.flash-card::before {
  content: "";
  position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  background: repeating-conic-gradient(from 0deg, rgba(220, 184, 114, 0.13) 0 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 72%); mask: radial-gradient(closest-side, #000 10%, transparent 72%);
  animation: rays 14s linear infinite; z-index: -1; pointer-events: none;
}
@keyframes rays { to { transform: rotate(360deg); } }
.flash-title {
  font-family: ui-serif, Georgia, serif;
  background: var(--foil); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  animation: foil-slide 2.4s ease-in-out infinite alternate;
}
.overlay { -webkit-backdrop-filter: blur(10px) brightness(0.7); backdrop-filter: blur(10px) brightness(0.7); }
.overlay-card h2, .podium-title, .celebration-title { font-family: ui-serif, Georgia, serif; letter-spacing: -0.01em; }
.reveal-row.winner { box-shadow: inset 0 0 0 1px var(--gold), 0 0 26px rgba(220, 184, 114, 0.25); }
.reveal-row .pts { font-family: ui-serif, Georgia, serif; }

/* Searchlights sweeping behind the podium. */
.podium-screen::before {
  content: "";
  position: fixed; left: 50%; bottom: -10%; width: 180vmax; height: 180vmax; margin-left: -90vmax;
  background:
    conic-gradient(from -28deg at 50% 100%, transparent 0deg, rgba(240, 217, 168, 0.13) 6deg, transparent 13deg),
    conic-gradient(from 12deg at 50% 100%, transparent 0deg, rgba(240, 217, 168, 0.10) 6deg, transparent 13deg),
    conic-gradient(from -8deg at 50% 100%, transparent 0deg, rgba(255, 255, 255, 0.07) 5deg, transparent 11deg);
  transform-origin: 50% 100%;
  animation: searchlights 7s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes searchlights { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.podium-inner { position: relative; }
.podium-title {
  background: var(--foil); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  animation: foil-slide 4s ease-in-out infinite alternate;
}
.step-plinth { position: relative; overflow: hidden; font-family: ui-serif, Georgia, serif; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }
.step-block.first .step-plinth  { background: linear-gradient(180deg, #fff3cf 0%, #e3bf78 30%, #b8904a 70%, #7d5c22 100%); }
.step-block.second .step-plinth { background: linear-gradient(180deg, #ffffff 0%, #d5d9de 30%, #9aa1a9 70%, #5f666e 100%); }
.step-block.third .step-plinth  { background: linear-gradient(180deg, #f7d3b0 0%, #cf9460 30%, #9a623a 70%, #5f3a20 100%); }
.step-plinth::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.6) 48%, transparent 60%);
  background-size: 250% 100%;
  animation: gloss 4.5s ease-in-out 1s infinite;
}
.step-block.first .avatar { box-shadow: 0 0 0 3px rgba(240, 217, 168, 0.5), 0 0 40px rgba(220, 184, 114, 0.7); }
.crown { display: inline-block; filter: drop-shadow(0 6px 14px rgba(220, 184, 114, 0.7)); animation: crown-bob 1.8s ease-in-out infinite; }
@keyframes crown-bob { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-9px) rotate(5deg); } }
.celebration.victory .celebration-title {
  background: var(--foil); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  animation: foil-slide 2s ease-in-out infinite alternate;
  filter: drop-shadow(0 10px 40px rgba(220, 184, 114, 0.5));
}

/* ---- the reconnecting dot: small, and only after three seconds offline ---- */

.conn-dot {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 70;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 10px; border-radius: 20px;
  background: rgba(0, 0, 0, 0.72); border: 1px solid var(--line);
  font-size: 11px; letter-spacing: 0.06em; color: var(--dim);
  animation: rise 0.25s ease both;
}
.conn-dot i { width: 8px; height: 8px; border-radius: 50%; background: #f0a04b; animation: pulse 1.1s ease-in-out infinite; }

/* ---- wide screens get a bigger table ---- */

@media (min-width: 760px) {
  .table-area, .topbar { max-width: 900px; }
  .middle { gap: 40px; }
}
/* Only when there is height to spare, so the hand never falls off a laptop screen. */
@media (min-width: 760px) and (min-height: 980px) {
  .cloth { min-height: 330px; justify-content: space-between; padding: 30px 28px 34px; }
  .middle .pile, .middle .pile .card { --card-w: 100px; }
  .hand .card { --card-w: 112px; }
  .cloth::before { width: 290px; height: 290px; margin: -145px 0 0 -145px; font-size: 124px; }
}
/* Laptop heights: tighten everything so your hand is always on screen. */
@media (max-height: 979px) and (min-width: 461px) {
  .table-area { gap: 10px; }
  .cloth { padding: 18px 18px 20px; gap: 10px; }
  .cloth-motto { display: none; }
  .instruction { min-height: 56px; gap: 5px; }
  .hand { min-height: 0; padding-top: 10px; }
  .hand .card { --card-w: 90px; }
  .dashboard { min-height: 48px; }
}
@media (max-height: 700px) and (min-width: 461px) {
  .table-area { gap: 8px; }
  .cloth { padding: 16px 18px 18px; gap: 8px; }
  .hand .card { --card-w: 80px; }
  .hand { min-height: 0; padding-top: 6px; }
  .instruction { min-height: 52px; }
  .cloth-motto { display: none; }
}

/* ---- phones in portrait ---- */

@media (max-width: 460px) {
  .hero-fan { height: 166px; }
  .hero-fan .card { --card-w: 92px; margin: 0 -11px; }
  .felt-table { padding: 13px; border-radius: 120px / 90px; }
  .felt-table::after { inset: 4px; border-radius: 116px / 86px; }
  .rail { inset: 10px; border-radius: 110px / 80px; }
  .cloth { border-radius: 108px / 78px; padding: 20px 10px 22px; }
  .cloth::before { width: 170px; height: 170px; margin: -85px 0 0 -85px; font-size: 70px; }
  .hand .card { --card-w: 78px; }
  .hand { gap: 6px; }
  .seat { transform: none; }
  .seat.active { transform: scale(1.04); }
  /* Room under the emoji row, so the chat button never sits on top of it. */
  #table { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .emoji-btn { font-size: 17px; padding: 6px 7px; }
  .turn-banner { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, .suit-drift span, .hero-fan .card, .hero-fan .card::before, .brand-mark, #roomCode,
  .turn-banner.you, .flash-card::before, .podium-screen::before, .step-plinth::after, .crown,
  .card.scoring::after, .podium-title, .flash-title, .celebration-hand .card::before { animation: none !important; }
  .suit-drift { display: none; }
  .hero-fan { transition: none; }
}

/* With hints on, the coach says everything the plain instructions do, so the
   instructions step aside and the hand stays on screen. */
.instruction:has(#coach:not(.hidden)) .step-hint,
.instruction:has(#coach:not(.hidden)) .step-dots { display: none; }

@media (max-width: 460px) {
  .tagline::before, .tagline::after { display: none; }
}
