/* ==========================================================================
   Rummy — styles
   ========================================================================== */

/* Bundled fonts (SIL Open Font License, see fonts/LICENSE-*.txt), latin subset. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/playfair-display-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/playfair-display-latin-wght-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --felt-hi: #1d4f78;
  --felt: #133a5b;
  --felt-lo: #0a2238;
  --felt-edge: #040f1c;

  --gold: #e2bd6e;
  --gold-hi: #f6e2b0;
  --gold-lo: #b88a3c;
  --gold-line: rgba(226, 189, 110, 0.24);
  --gold-glow: rgba(226, 189, 110, 0.5);

  --ink: #f2eee4;
  --ink-dim: rgba(242, 238, 228, 0.72);
  --ink-faint: rgba(242, 238, 228, 0.46);

  --panel: rgba(4, 13, 26, 0.62);
  --panel-solid: rgba(6, 17, 32, 0.95);

  --card-face: #fdfaf3;
  --card-face-lo: #f3ecdc;
  --red: #b8213a;
  --black: #16161d;
  --back: #1f6a52;
  --back-hi: #2b8366;
  --back-lo: #0c3a2b;

  /* one color per seat: you, then the computer players clockwise */
  --p0: #e2bd6e;
  --p1: #f2a58e;
  --p2: #8fd6b4;
  --p3: #c4b3f0;
  --pos: #9fe2b9;
  --neg: #f3a2ab;

  --cw: 100px;
  --ch: 140px;
  --move: 460ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Playfair Display', 'Bodoni 72', Didot, Georgia, serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--felt-edge);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

.probe {
  position: fixed;
  visibility: hidden;
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-top: env(safe-area-inset-top, 0px);
}

/* Inline card names in text: "7♥" drawn with the suit symbol, not an emoji-prone glyph. */
.ct {
  display: inline-flex;
  align-items: baseline;
  gap: 0.05em;
  font-weight: 700;
  white-space: nowrap;
}

.ct svg {
  width: 0.78em;
  height: 0.78em;
  align-self: center;
  color: var(--ink);
}

.ct.red svg {
  color: #ff8d9c;
}

/* ----- Table felt ------------------------------------------------------- */

.table {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 50% 44%, rgba(255, 255, 255, 0.07), transparent 70%),
    radial-gradient(ellipse 120% 95% at 50% 46%, var(--felt-hi) 0%, var(--felt) 38%, var(--felt-lo) 78%, var(--felt-edge) 100%);
}

.table::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.table::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 85% 80% at 50% 46%, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
}

.decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.table.idle .decor {
  opacity: 0;
}

.meld-zone {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 22px;
  border: 1px dashed rgba(226, 189, 110, 0.17);
  background: rgba(0, 0, 0, 0.07);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.14);
}

.meld-zone-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 0 12px;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: rgba(226, 189, 110, 0.36);
  transition: opacity 0.4s ease;
}

.meld-zone-empty svg {
  width: 44px;
  height: 44px;
  color: rgba(0, 0, 0, 0.2);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.05));
}

.pile-slot.empty span {
  opacity: 1;
}

.meld-zone.has-melds .meld-zone-empty {
  opacity: 0;
}

.meld-zone.cramped .meld-zone-empty svg {
  display: none;
}

.pile-slot {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 9px;
  border: 1.5px dashed rgba(226, 189, 110, 0.24);
  display: grid;
  place-items: center;
}

.pile-slot span {
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(226, 189, 110, 0.42);
}

/* ----- Cards ------------------------------------------------------------ */

.card-layer {
  position: absolute;
  inset: 0;
}

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  container-type: inline-size;
  perspective: 900px;
  transition:
    transform var(--move) var(--ease),
    opacity 0.35s ease;
  will-change: transform;
  --lift: 0%;
  --flip: 0deg;
}

.card.down {
  --flip: 180deg;
}

.card.flying {
  z-index: 450 !important;
}

.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateY(var(--lift)) rotateY(var(--flip));
  transition: transform 0.5s var(--ease);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 7cqw;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow:
    0 0.4cqw 0.8cqw rgba(0, 0, 0, 0.16),
    0 3cqw 7cqw rgba(0, 0, 0, 0.26);
  transition: box-shadow 0.3s ease;
}

.card-front {
  background: linear-gradient(162deg, #fffdf8 0%, var(--card-face) 45%, var(--card-face-lo) 100%);
  color: var(--black);
}

.card-front.red {
  color: var(--red);
}

.card-front::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0.6px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.card-front svg,
.card-back svg {
  display: block;
  overflow: visible;
}

/* indices */
.corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 16cqw;
  line-height: 1;
}

.corner.tl {
  top: 5cqw;
  left: 3.5cqw;
}

.corner.br {
  bottom: 5cqw;
  right: 3.5cqw;
  transform: rotate(180deg);
}

.corner .rk {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18cqw;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums;
}

.corner .rk.ten {
  font-size: 15.5cqw;
  letter-spacing: -0.1em;
  margin-left: -1.2cqw;
}

.corner .cs {
  width: 11cqw;
  height: 11cqw;
  margin-top: 1.6cqw;
}

/* pip cards */
.pips {
  position: absolute;
  left: 32%;
  right: 32%;
  top: 16%;
  bottom: 16%;
}

.pip {
  position: absolute;
  width: 17cqw;
  height: 17cqw;
  transform: translate(-50%, -50%);
}

.pip.inv {
  transform: translate(-50%, -50%) rotate(180deg);
}

/* aces */
.ace {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38cqw;
  height: 38cqw;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
}

.ace .ace-pip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ace-spade {
  width: 62cqw;
  height: 62cqw;
}

.ace-spade .ace-pip {
  inset: 13%;
  width: 74%;
  height: 74%;
  filter: drop-shadow(0 0.6cqw 0.6cqw rgba(0, 0, 0, 0.18));
}

.ace-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 0.9cqw solid var(--gold-lo);
  box-shadow:
    inset 0 0 0 1.6cqw var(--card-face),
    inset 0 0 0 2cqw rgba(184, 138, 60, 0.55);
  background: radial-gradient(circle, rgba(226, 189, 110, 0.12), transparent 70%);
}

/* court cards */
.court {
  position: absolute;
  left: 21%;
  right: 21%;
  top: 12.5%;
  bottom: 12.5%;
  border-radius: 2.6cqw;
  overflow: hidden;
  border: 0.8cqw solid currentColor;
  box-shadow:
    inset 0 0 0 1.2cqw rgba(255, 252, 245, 0.92),
    inset 0 0 0 1.6cqw rgba(184, 138, 60, 0.75);
}

.card-front.red .court {
  background:
    repeating-linear-gradient(45deg, rgba(184, 33, 58, 0.07) 0 1.2cqw, transparent 1.2cqw 3.6cqw),
    linear-gradient(180deg, #fff6f1, #fbe9e3);
}

.card-front.black .court {
  background:
    repeating-linear-gradient(45deg, rgba(22, 22, 29, 0.055) 0 1.2cqw, transparent 1.2cqw 3.6cqw),
    linear-gradient(180deg, #fcf6e9, #f2e8d2);
}

.court::after {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  border-top: 0.5cqw solid currentColor;
  opacity: 0.3;
}

.court-half {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 6cqw;
  gap: 0.5cqw;
}

.court-half.flip {
  top: 50%;
  transform: rotate(180deg);
}

.crown {
  width: 24cqw;
  height: 16cqw;
  color: #d6ab58;
  stroke: var(--black);
  stroke-width: 3.5;
  stroke-linejoin: round;
  paint-order: stroke;
}

.card-front.red .crown {
  stroke: var(--red);
}

.court-letter {
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: 25cqw;
  line-height: 0.82;
}

.court-mid {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13cqw;
  height: 13cqw;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--card-face);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 0.5cqw rgba(184, 138, 60, 0.7);
  z-index: 1;
}

.court-suit {
  position: absolute;
  inset: 19%;
  width: 62%;
  height: 62%;
}

/* back */
.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fffdf8, var(--card-face-lo));
}

.back-field {
  position: absolute;
  inset: 4.5cqw;
  border-radius: 4cqw;
  overflow: hidden;
  background:
    repeating-linear-gradient(45deg, rgba(226, 189, 110, 0.3) 0 0.7cqw, transparent 0.7cqw 7cqw),
    repeating-linear-gradient(-45deg, rgba(226, 189, 110, 0.3) 0 0.7cqw, transparent 0.7cqw 7cqw),
    radial-gradient(ellipse at 50% 40%, var(--back-hi), var(--back) 45%, var(--back-lo) 100%);
  box-shadow:
    inset 0 0 0 1.1cqw var(--back-lo),
    inset 0 0 0 1.7cqw rgba(226, 189, 110, 0.85),
    inset 0 0 6cqw rgba(0, 0, 0, 0.35);
}

.back-medallion {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44cqw;
  height: 44cqw;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 9cqw;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #1d6650, #0a3427);
  border: 0.9cqw solid var(--gold);
  box-shadow:
    0 0 0 1.6cqw var(--back-lo),
    0 0 0 2.2cqw rgba(226, 189, 110, 0.55),
    0 1cqw 3cqw rgba(0, 0, 0, 0.4);
  color: var(--gold);
}

.back-pip {
  position: absolute;
  inset: 14%;
  width: 72%;
  height: 72%;
  transform: rotate(-45deg);
  filter: drop-shadow(0 0.5cqw 0.6cqw rgba(0, 0, 0, 0.35));
}

/* card states */
.card.playable {
  cursor: pointer;
}

@media (hover: hover) {
  .card.playable:hover {
    --lift: -7%;
  }
  .card.playable:hover .card-front {
    box-shadow:
      0 0.4cqw 0.8cqw rgba(0, 0, 0, 0.16),
      0 6cqw 12cqw rgba(0, 0, 0, 0.34),
      0 0 0 1cqw rgba(226, 189, 110, 0.5);
  }
}

.card.selected,
.card.selected.playable:hover {
  --lift: -16%;
}

.card.selected .card-front,
.card.selected.playable:hover .card-front {
  box-shadow:
    0 6cqw 12cqw rgba(0, 0, 0, 0.34),
    0 0 0 1.4cqw var(--gold);
}

.card.playable:focus {
  outline: none;
}

.card.playable:focus-visible .card-front {
  box-shadow: 0 0 0 1.4cqw #fff, 0 0 0 2.6cqw var(--gold), 0 6cqw 12cqw rgba(0, 0, 0, 0.34);
}

.card.fresh .card-front {
  animation: fresh 1.7s ease-out;
}

@keyframes fresh {
  0%,
  40% {
    box-shadow: 0 0 0 1.4cqw var(--gold-hi), 0 0 12cqw var(--gold-glow), 0 3cqw 7cqw rgba(0, 0, 0, 0.26);
  }
  100% {
    box-shadow: 0 0.4cqw 0.8cqw rgba(0, 0, 0, 0.16), 0 3cqw 7cqw rgba(0, 0, 0, 0.26);
  }
}

.card.gone {
  opacity: 0;
  visibility: hidden;
  transition:
    transform 0.55s var(--ease),
    opacity 0.3s ease 0.22s,
    visibility 0s linear 0.55s;
}

.card.shake .card-inner {
  animation: shake 0.42s ease;
}

.no-anim .card,
.no-anim .card-inner,
.card.no-anim,
.card.no-anim .card-inner {
  transition: none !important;
}

@keyframes shake {
  0%,
  100% {
    transform: translateY(var(--lift)) translateX(0);
  }
  20% {
    transform: translateY(var(--lift)) translateX(-6%);
  }
  40% {
    transform: translateY(var(--lift)) translateX(5%);
  }
  60% {
    transform: translateY(var(--lift)) translateX(-3%);
  }
  80% {
    transform: translateY(var(--lift)) translateX(2%);
  }
}

/* static cards (menus, dialogs) */
.card.static {
  position: relative;
  transition: none;
  will-change: auto;
  flex: none;
}

/* ----- Piles and melds (click targets over the cards) -------------------- */

.hit-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pile-hit,
.meld-slot {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 280;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 10px;
  pointer-events: auto;
  cursor: pointer;
  transition: box-shadow 0.25s ease;
}

.pile-hit:disabled,
.meld-slot:disabled {
  cursor: default;
  pointer-events: none;
}

.pile-hit.active {
  box-shadow: 0 0 0 2px rgba(226, 189, 110, 0.75), 0 0 26px rgba(226, 189, 110, 0.45);
  animation: glow 1.8s ease-in-out infinite;
}

@media (hover: hover) {
  .pile-hit.active:hover {
    box-shadow: 0 0 0 3px var(--gold-hi), 0 0 34px rgba(226, 189, 110, 0.6);
  }
  .meld-slot:not(:disabled):hover {
    box-shadow: 0 0 0 1.5px rgba(226, 189, 110, 0.45);
  }
  .meld-slot.target:not(:disabled):hover {
    box-shadow: 0 0 0 3px var(--gold-hi), 0 0 30px rgba(226, 189, 110, 0.6);
  }
}

.pile-hit.drop {
  box-shadow: 0 0 0 2px rgba(226, 189, 110, 0.6), 0 0 22px rgba(226, 189, 110, 0.3);
}

.pile-hit.hinted,
.meld-slot.hinted,
.btn.hinted {
  animation: hinted 0.9s ease-in-out 3;
}

.pile-hit:focus-visible,
.meld-slot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(226, 189, 110, 0.55), 0 0 18px rgba(226, 189, 110, 0.3);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(226, 189, 110, 0.95), 0 0 30px rgba(226, 189, 110, 0.55);
  }
}

@keyframes hinted {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px #fff, 0 0 36px rgba(255, 255, 255, 0.6);
  }
}

.pile-count {
  position: absolute;
  right: -8px;
  bottom: -8px;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel-solid);
  border: 1px solid var(--gold-line);
  color: var(--gold-hi);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transition: opacity 0.3s;
}

.pile-count:empty {
  opacity: 0;
}

.meld-slot::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -5px;
  height: 3px;
  border-radius: 3px;
  background: var(--owner, var(--gold));
  opacity: 0.55;
}

.meld-slot.owner-0 {
  --owner: var(--p0);
}
.meld-slot.owner-1 {
  --owner: var(--p1);
}
.meld-slot.owner-2 {
  --owner: var(--p2);
}
.meld-slot.owner-3 {
  --owner: var(--p3);
}

.meld-slot.target {
  box-shadow: 0 0 0 2px rgba(226, 189, 110, 0.8), 0 0 24px rgba(226, 189, 110, 0.45);
}

.meld-slot.picking.target {
  animation: glow 1.2s ease-in-out infinite;
}

.meld-slot.fresh::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: meld-flash 1.4s ease-out forwards;
  pointer-events: none;
}

@keyframes meld-flash {
  0% {
    box-shadow: 0 0 0 2px var(--owner, var(--gold)), 0 0 30px var(--owner, var(--gold));
    opacity: 1;
  }
  100% {
    box-shadow: 0 0 0 2px var(--owner, var(--gold)), 0 0 30px var(--owner, var(--gold));
    opacity: 0;
  }
}

/* ----- Nameplates ------------------------------------------------------- */

.plates {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.plates.hidden {
  opacity: 0;
}

.plate {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 360;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 15px 5px 5px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--gold-line);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  --seat: var(--p0);
}

.plate.seat-1 {
  --seat: var(--p1);
}
.plate.seat-2 {
  --seat: var(--p2);
}
.plate.seat-3 {
  --seat: var(--p3);
}

.plate.turn {
  border-color: rgba(226, 189, 110, 0.85);
  box-shadow:
    0 0 0 1px rgba(226, 189, 110, 0.5),
    0 0 28px rgba(226, 189, 110, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.25);
}

.avatar {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: rgba(10, 10, 20, 0.82);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.55), transparent 50%, rgba(0, 0, 0, 0.22)),
    var(--seat);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.plate.turn .avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  animation: pulse 1.6s ease-in-out infinite;
}

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

.dealer-chip {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--card-face);
  color: #222;
  font: 700 9.5px/17px var(--font-ui);
  font-style: normal;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 0 0 1.5px var(--gold-lo);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s, transform 0.3s var(--ease);
}

.plate.dealer .dealer-chip {
  opacity: 1;
  transform: scale(1);
}

.plate-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 56px;
}

.plate-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.plate-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-dim);
  min-height: 18px;
}

.plate-status .chip {
  display: inline-block;
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--seat) 20%, transparent);
  color: color-mix(in srgb, var(--seat) 55%, #fff);
  font-weight: 700;
  font-size: 11.5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.plate-status .count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.plate-status .count i {
  width: 8px;
  height: 11px;
  border-radius: 2px;
  background: linear-gradient(160deg, var(--back-hi), var(--back-lo));
  box-shadow: inset 0 0 0 1px rgba(253, 250, 243, 0.85);
}

.plate-status .count b {
  color: var(--ink);
  font-weight: 600;
}

.muted {
  color: var(--ink-faint);
}

.bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  min-width: 46px;
  padding: 6px 14px;
  border-radius: 14px;
  background: var(--card-face);
  color: var(--black);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.7);
  pointer-events: none;
}

.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  border: 7px solid transparent;
  border-top-color: var(--card-face);
  transform: translateX(-50%);
}

.bubble.big {
  font-style: italic;
  color: var(--red);
}

.bubble .ct svg {
  color: var(--black);
}

.bubble .ct.red svg {
  color: var(--red);
}

.bubble.show {
  animation: bubble 2.1s var(--ease-out) forwards;
}

.plate.opp .bubble {
  bottom: auto;
  top: calc(100% + 10px);
}

.plate.opp .bubble::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--card-face);
}

@keyframes bubble {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.7);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.06);
  }
  20% {
    transform: translate(-50%, 0) scale(1);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -6px) scale(0.96);
  }
}

/* your own plate on small screens: avatar and score only */
.plate.compact {
  flex-direction: column;
  gap: 4px;
  padding: 5px 6px 6px;
  border-radius: 16px;
}

.plate.compact .plate-text {
  align-items: center;
  min-width: 0;
}

.plate.compact .plate-name,
.plate.compact .count {
  display: none;
}

/* ----- Banner & prompt -------------------------------------------------- */

.banner {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 390;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(4, 14, 28, 0.78);
  border: 1px solid var(--gold-line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 22px;
  color: var(--gold-hi);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
  pointer-events: none;
}

.banner svg {
  width: 22px;
  height: 22px;
  color: var(--gold);
}

.banner.show {
  animation: banner 1.9s var(--ease-out) forwards;
}

@keyframes banner {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.03);
  }
}

.prompt {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 385;
  width: max-content;
  max-width: min(520px, calc(100vw - 24px));
  padding: 7px 16px;
  border-radius: 16px;
  background: rgba(60, 12, 20, 0.88);
  border: 1px solid rgba(243, 162, 171, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #ffd9de;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(6px);
  transition:
    opacity 0.25s ease,
    transform 0.25s var(--ease);
  pointer-events: none;
}

.prompt.tip {
  background: rgba(6, 18, 34, 0.92);
  border-color: rgba(226, 189, 110, 0.55);
  color: var(--gold-hi);
}

.prompt.show {
  opacity: 1;
  transform: translate(-50%, -100%);
}

/* ----- Dock: your turn's actions ---------------------------------------- */

.dock {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 380;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: var(--panel-solid);
  border: 1px solid var(--gold-line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  transform: translate(-50%, -100%) translateY(8px);
  transition:
    opacity 0.25s ease,
    transform 0.3s var(--ease);
}

.dock.show {
  opacity: 1;
  transform: translate(-50%, -100%);
}

.dock-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold-hi);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-text .warn {
  color: #ffc2ca;
}

.dock-btns {
  display: flex;
  flex: none;
  gap: 6px;
}

.dock.drawing {
  padding: 9px 20px;
}

.dock.drawing .dock-btns {
  display: none;
}

.btn.btn-sm {
  padding: 8px 16px;
  font-size: 13.5px;
}

.btn:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  filter: saturate(0.6);
}

.btn:disabled:active {
  transform: none;
}

.btn.ready {
  border-color: rgba(226, 189, 110, 0.75);
  background: rgba(226, 189, 110, 0.16);
  color: var(--gold-hi);
}

@media (max-width: 559px) {
  .dock {
    flex-direction: column;
    gap: 7px;
    padding: 8px 8px 8px;
    border-radius: 20px;
  }
  .dock-text {
    width: 100%;
    font-size: 12.5px;
    white-space: normal;
    line-height: 1.3;
  }
  .dock.drawing {
    padding: 9px 16px;
  }
  .btn.btn-sm {
    padding: 8px 13px;
    font-size: 13px;
  }
}

/* ----- Buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease),
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s,
    filter 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-gold {
  color: #1d1607;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  box-shadow: 0 8px 24px rgba(226, 189, 110, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn-ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
}

@media (hover: hover) {
  .btn-gold:hover:not(:disabled) {
    filter: brightness(1.06);
    box-shadow: 0 10px 30px rgba(226, 189, 110, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  }
  .btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(226, 189, 110, 0.4);
  }
  .icon-btn:hover:not(:disabled) {
    background: rgba(10, 30, 52, 0.88);
    border-color: rgba(226, 189, 110, 0.5);
  }
  .score-pill:hover {
    border-color: rgba(226, 189, 110, 0.5);
  }
}

.btn-danger {
  color: #ffe3e6;
  background: rgba(184, 33, 58, 0.3);
  border-color: rgba(243, 162, 171, 0.35);
}

.btn-danger:hover {
  background: rgba(184, 33, 58, 0.45);
}

.btn-lg {
  padding: 15px 34px;
  font-size: 16px;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.seg button:focus-visible,
.link-btn:focus-visible,
.score-pill:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  text-decoration: underline;
  text-decoration-color: rgba(226, 189, 110, 0.35);
  text-underline-offset: 4px;
}

.link-btn:hover {
  text-decoration-color: var(--gold);
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--gold-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  color: var(--ink);
  transition:
    background 0.2s,
    border-color 0.2s,
    opacity 0.2s,
    transform 0.18s var(--ease);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn .ico-off,
.icon-btn.muted .ico-on {
  display: none;
}

.icon-btn.muted .ico-off {
  display: block;
}

#btnSort.by-rank svg {
  transform: scaleY(-1);
}

/* segmented control */
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.seg button {
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}

.seg button:hover {
  color: var(--ink);
}

.seg button.on {
  background: rgba(226, 189, 110, 0.18);
  color: var(--gold-hi);
  box-shadow: inset 0 0 0 1px rgba(226, 189, 110, 0.35);
}

/* ----- HUD -------------------------------------------------------------- */

.hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  transition:
    opacity 0.4s ease,
    transform 0.4s var(--ease);
}

.hud > * {
  pointer-events: auto;
}

.hud.hidden {
  opacity: 0;
  transform: translateY(-8px);
}

.hud.hidden > * {
  pointer-events: none;
}

.score-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 16px 8px 14px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--gold-line);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s;
}

.sp-hand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.15;
}

.sp-meta {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sp-meta b {
  color: var(--gold);
  font-weight: 700;
}

.hud-actions {
  display: flex;
  gap: 8px;
}

/* ----- Start screen ----------------------------------------------------- */

.start {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  background: radial-gradient(ellipse at 50% 40%, rgba(3, 12, 24, 0.15), rgba(3, 12, 24, 0.7));
  transition: opacity 0.5s ease, visibility 0s;
}

.start.leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}

.start-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 560px;
  width: 100%;
}

.showcase {
  position: relative;
  width: 300px;
  height: 196px;
  margin-bottom: 6px;
}

.showcase .card {
  position: absolute;
  left: 50%;
  top: auto;
  bottom: 0;
  margin-left: calc(var(--cw) / -2);
  transform-origin: 50% 120%;
  animation: deal-in 0.9s var(--ease-out) both;
}

.showcase .card .card-face {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 18px 40px rgba(0, 0, 0, 0.4);
}

@keyframes deal-in {
  from {
    opacity: 0;
    transform: translateY(40px) rotate(0deg);
  }
  to {
    opacity: 1;
    transform: translateY(var(--y, 0)) rotate(var(--r));
  }
}

.title {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(68px, 15vw, 128px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fbefcf 10%, var(--gold) 55%, var(--gold-lo) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 22px rgba(0, 0, 0, 0.45));
  padding: 0 0.08em 0.08em;
}

.tagline {
  margin: 8px 0 28px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 26px;
}

.continue-sub {
  font-weight: 500;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 22px;
  margin-bottom: 18px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opt-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ----- Dialogs ---------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 8, 16, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade 0.25s ease both;
}

.overlay.closing {
  animation: fade-out 0.2s ease both;
}

.dialog {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 28px 26px 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(14, 38, 64, 0.98), rgba(6, 18, 34, 0.98));
  border: 1px solid var(--gold-line);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: pop 0.38s var(--ease) both;
  user-select: text;
  -webkit-user-select: text;
}

.overlay.closing .dialog {
  animation: pop-out 0.2s ease both;
}

.dialog.wide {
  width: min(560px, 100%);
}

.dialog h2 {
  margin: 4px 0 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
}

.dialog h3 {
  margin: 20px 0 6px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-hi);
}

.dialog p,
.dialog li {
  color: var(--ink-dim);
}

.dialog p {
  margin: 0 0 10px;
}

.dialog ul {
  margin: 0;
  padding-left: 18px;
}

.dialog li {
  margin-bottom: 6px;
}

.dialog li b,
.dialog p b {
  color: var(--ink);
  font-weight: 600;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.dialog .sub {
  margin-bottom: 18px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.dialog-actions .btn {
  flex: 1 1 auto;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.menu-row:last-of-type {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.menu-row span {
  font-weight: 500;
}

.seat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--seat, var(--p0));
  box-shadow: 0 0 8px var(--seat, var(--p0));
}

.seat-0 {
  --seat: var(--p0);
}
.seat-1 {
  --seat: var(--p1);
}
.seat-2 {
  --seat: var(--p2);
}
.seat-3 {
  --seat: var(--p3);
}

/* hand summary: the cards each player was left holding */
.caught {
  display: grid;
  gap: 2px;
  margin: 0 0 16px;
}

.caught-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.caught-row:first-child {
  border-top: none;
}

.caught-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.caught-cards {
  display: flex;
  flex-wrap: wrap;
  row-gap: 4px;
  min-height: 20px;
}

.caught-cards .card + .card {
  margin-left: calc(var(--cw) * -0.45);
}

.caught-cards .card .card-face {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.caught-cards .none {
  font-size: 13px;
  font-style: italic;
  color: var(--ink-faint);
}

.caught-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink-dim);
}

.sum-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

.sum-table th {
  padding: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: right;
  color: var(--ink-faint);
}

.sum-table th:first-child {
  text-align: left;
}

.sum-table td {
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: right;
  color: var(--ink);
}

.sum-table td:first-child {
  text-align: left;
  color: var(--ink-dim);
}

.sum-table .who {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 500;
}

.sum-table .pos {
  color: var(--pos);
  font-weight: 600;
}

.sum-table .zero {
  color: var(--ink-faint);
}

.sum-table .total {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
}

.sum-table tr.lead .total {
  color: var(--gold-hi);
}

.sum-table tfoot td {
  padding-top: 10px;
  border-top: 1px solid var(--gold-line);
}

/* score sheet */
.sheet-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.sheet {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 14px;
}

.sheet th,
.sheet td {
  padding: 6px 6px;
  text-align: right;
  white-space: nowrap;
}

.sheet th:first-child,
.sheet td:first-child {
  text-align: left;
  padding-left: 0;
  color: var(--ink-faint);
}

.sheet thead th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--seat, var(--ink-faint));
  padding-bottom: 8px;
}

.sheet tbody td {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--ink-faint);
}

.sheet td.win {
  color: var(--pos);
  font-weight: 600;
}

.sheet td.wash {
  font-style: italic;
}

.sheet .star {
  color: var(--gold);
  margin-left: 2px;
}

.sheet tfoot td {
  border-top: 1px solid var(--gold-line);
  padding-top: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
}

.sheet tfoot td:first-child {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
}

.sheet-empty {
  margin: 8px 0 0;
  font-style: italic;
}

/* game over */
.dialog.over {
  text-align: center;
}

.over .medal {
  width: 74px;
  height: 74px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 35%, var(--gold-hi), var(--gold) 50%, var(--gold-lo));
  color: #1d1607;
  box-shadow: 0 0 0 6px rgba(226, 189, 110, 0.15), 0 14px 40px rgba(226, 189, 110, 0.3);
}

.over .medal.lost {
  background: radial-gradient(circle at 40% 35%, #dfe9f3, #9fb6cc 50%, #5d7690);
  box-shadow: 0 0 0 6px rgba(159, 182, 204, 0.12), 0 14px 40px rgba(0, 0, 0, 0.3);
  color: #0c1826;
}

.over .medal svg {
  width: 40px;
  height: 40px;
}

.standings {
  display: grid;
  gap: 4px;
  margin: 16px auto 8px;
  max-width: 300px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.standings li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.standings li.first {
  background: rgba(226, 189, 110, 0.12);
  box-shadow: inset 0 0 0 1px rgba(226, 189, 110, 0.35);
}

.standings .place {
  width: 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
}

.standings .name {
  flex: 1;
  font-weight: 600;
}

.standings .pts {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  font-variant-numeric: tabular-nums lining-nums;
}

.standings li.first .pts {
  color: var(--gold-hi);
}

/* rules */
.rules-melds {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin: 10px 0 4px;
}

.rules-meld {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-faint);
}

.rules-meld .fan {
  display: flex;
}

.rules-meld .fan .card + .card {
  margin-left: calc(var(--cw) * -0.55);
}

.kbd {
  display: inline-block;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: var(--ink);
}

/* confetti */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  overflow: hidden;
}

.confetti i {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translate(var(--drift), 110vh) rotate(var(--spin));
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

@keyframes pop-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

/* ----- Small screens ---------------------------------------------------- */

@media (max-height: 620px) {
  .score-pill {
    padding: 6px 12px 6px 11px;
    border-radius: 13px;
  }
  .sp-hand {
    font-size: 16px;
  }
  .sp-meta {
    font-size: 10px;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  .hud-actions {
    gap: 6px;
  }
  .plate {
    gap: 8px;
    padding: 4px 12px 4px 4px;
  }
  .avatar {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  .plate-name {
    font-size: 12.5px;
  }
  .plate-status {
    font-size: 11px;
    min-height: 16px;
  }
  .banner {
    font-size: 18px;
    padding: 8px 16px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .score-pill {
    padding: 6px 12px 6px 11px;
    border-radius: 13px;
  }

  .sp-hand {
    font-size: 16px;
  }

  .sp-meta {
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .hud-actions {
    gap: 6px;
  }

  .plate {
    gap: 7px;
    padding: 4px 11px 4px 4px;
  }

  .avatar {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .plate-text {
    min-width: 0;
  }

  .plate-name {
    font-size: 12.5px;
  }

  .plate-status {
    font-size: 11px;
    gap: 5px;
    min-height: 16px;
  }

  .plate-status .chip {
    font-size: 10.5px;
    padding: 0 5px;
    min-width: 20px;
  }

  .bubble {
    font-size: 16px;
    padding: 5px 11px;
  }

  .banner {
    font-size: 17px;
    padding: 8px 16px;
  }

  .dialog {
    padding: 22px 18px 18px;
    border-radius: 20px;
  }

  .dialog h2 {
    font-size: 27px;
  }

  .caught-row {
    grid-template-columns: 62px 1fr auto;
    gap: 8px;
  }

  .showcase {
    width: 250px;
    height: 160px;
  }

  .tagline {
    letter-spacing: 0.24em;
    font-size: 12px;
  }

  .options {
    gap: 10px 16px;
  }
}

@media (max-width: 380px) {
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .hud-actions {
    gap: 5px;
  }
  .icon-btn svg {
    width: 17px;
    height: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --move: 200ms;
  }
  .card-inner {
    transition-duration: 0.15s;
  }
  .plate.turn .avatar::after,
  .pile-hit.active,
  .meld-slot.picking.target {
    animation: none;
  }
}
