/* =========================================================
   Up the River - table styles
   Tokens first, then themes, then components.
   ========================================================= */
:root {
  /* type */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 11px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 24px; --fs-2xl: 34px;

  /* palette */
  --gold: #e8b64a;
  --gold-hi: #f8dc8e;
  --gold-lo: #a8741a;
  --ink: #f4ecd8;
  --ink-dim: #c9b894;
  --panel: #1b1109;
  --panel-2: #2a190c;
  --good: #7ee2a0;
  --bad: #ff8f84;

  /* table theme (green felt default) */
  --felt-1: #1f8556; --felt-2: #0e5a3a; --felt-3: #06301e;
  --rail-1: #8a5530; --rail-2: #5a3418; --rail-3: #2e1809;
  --brass: #d9a22f;
  --room-1: #2a190c; --room-2: #120a05;

  /* deck theme (classic) */
  --paper-1: #fffdf6; --paper-2: #efe6cf; --card-line: rgba(0,0,0,.35);
  --face-bg: #fff8e6;
  --c-S: #17171c; --c-C: #17171c; --c-H: #c2352b; --c-D: #c2352b;

  /* sizing */
  --cw: clamp(42px, min(12.5vw, 7.6vh), 72px);
  --ch: calc(var(--cw) * 1.4);
  --hw: clamp(52px, min(15.5vw, 9.6vh), 92px);
  --hand-h: calc(var(--hw) * 1.4 + 46px);
}

/* ----- table themes ----- */
html[data-table="midnight"] {
  --felt-1: #2f4f94; --felt-2: #19305f; --felt-3: #0a1633;
  --rail-1: #5b6277; --rail-2: #353b4f; --rail-3: #171a28; --brass: #c8d2ee;
  --room-1: #0f1424; --room-2: #070a14;
}
html[data-table="burgundy"] {
  --felt-1: #9a2c3e; --felt-2: #681828; --felt-3: #350812;
  --rail-1: #6a4a2a; --rail-2: #3e2812; --rail-3: #1e1006; --brass: #e0b25a;
  --room-1: #2a0e14; --room-2: #12050a;
}
html[data-table="wood"] {
  --felt-1: #c58b4f; --felt-2: #9a6430; --felt-3: #5c3416;
  --rail-1: #3b2a20; --rail-2: #231710; --rail-3: #0f0905; --brass: #e8b64a;
  --room-1: #22160e; --room-2: #0e0803;
}

/* ----- deck themes ----- */
html[data-deck="fourcolor"] { --c-D: #1f62c8; --c-C: #1f8a3a; }
html[data-deck="dark"] {
  --paper-1: #2b2e42; --paper-2: #171926; --card-line: rgba(232,182,74,.6); --face-bg: #222538;
  --c-S: #ece6d4; --c-C: #ece6d4; --c-H: #ff7468; --c-D: #ff7468;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--room-2); overscroll-behavior: none; }
body {
  font-family: var(--font-ui); color: var(--ink); touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
.hidden { display: none !important; }
.play { position: fixed; inset: 0; max-width: 640px; margin: 0 auto; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* =========================================================
   Buttons
   ========================================================= */
.primary {
  font-weight: 800; font-size: var(--fs-lg); letter-spacing: .02em; color: #3a2605; border: 0; border-radius: 16px; padding: 15px 18px;
  background: linear-gradient(#fbe39a, #e1a93a 55%, #c28a22); cursor: pointer; position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -2px 0 rgba(120,70,0,.35), 0 5px 0 #8e5f12, 0 12px 20px rgba(0,0,0,.4);
  transition: transform .08s, box-shadow .08s;
}
.primary:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 0 #8e5f12, 0 6px 10px rgba(0,0,0,.4); }
.primary:disabled { filter: grayscale(.8) brightness(.7); }
.ghost {
  font-weight: 700; font-size: var(--fs-md); color: var(--ink); background: rgba(255,255,255,.05); border: 1px solid rgba(232,182,74,.45);
  border-radius: 14px; padding: 13px 16px; cursor: pointer; transition: background .15s, transform .08s;
}
.ghost:active { background: rgba(232,182,74,.18); transform: scale(.98); }
.chip-btn {
  font-size: var(--fs-sm); font-weight: 700; color: var(--ink); background: linear-gradient(rgba(255,255,255,.12), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.2); border-radius: 11px; padding: 8px 11px; cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.chip-btn:active { transform: translateY(1px); box-shadow: none; }
.chip-btn.small { padding: 6px 9px; font-size: 12px; }
.chip-btn:disabled { opacity: .35; }
.hintbtn:not(:disabled) { border-color: var(--gold); color: var(--gold-hi); }
.linkish { background: none; border: 0; color: #bfe3cd; text-decoration: underline; font-size: var(--fs-md); cursor: pointer; }

/* =========================================================
   Title + setup screens
   ========================================================= */
.title, .setup {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.14), transparent 55%),
    radial-gradient(ellipse at 50% 35%, var(--felt-1) 0%, var(--felt-2) 50%, var(--felt-3) 100%);
  padding: max(18px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom)); overflow-y: auto;
}
.title::before, .setup::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background-image: var(--felt-noise);
}
.title::after, .setup::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0,0,0,.55) 100%);
}
.title > *, .setup > * { position: relative; z-index: 1; }
.title { align-items: center; justify-content: center; text-align: center; gap: 0; }
.fan { position: relative; height: calc(var(--aw) * 1.4 + 40px); width: 100%; margin-bottom: 6px; --aw: 86px; }
.fan .fc-card { position: absolute; left: 50%; top: 22px; margin-left: calc(var(--aw) / -2); transform-origin: 50% 190%; animation: fanin .9s cubic-bezier(.2,.9,.3,1.2) backwards; }
.fan .card { --cw: var(--aw); --ch: calc(var(--aw) * 1.4); box-shadow: 0 10px 20px rgba(0,0,0,.55), 0 1px 0 #fff inset; }
@keyframes fanin { from { transform: rotate(0) translateY(60px) scale(.6); opacity: 0; } }
.logo {
  margin: 0; font-family: var(--font-display); font-size: clamp(38px, 12vw, 54px); line-height: .95; letter-spacing: -.5px; font-weight: 700;
  background: linear-gradient(#fff6d2, #f0c250 55%, #b57d1a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.45)) drop-shadow(0 8px 14px rgba(0,0,0,.4));
}
.logo small { display: block; margin-top: 8px; font-size: .48em; font-style: italic; font-weight: 400; letter-spacing: .02em; }
.river-line { width: 150px; height: 14px; margin: 14px auto 22px; opacity: .9; }
.menu-col { display: grid; gap: 12px; width: min(340px, 100%); }
.menu-row { display: flex; gap: 10px; }
.menu-row > * { flex: 1; }
.record { text-align: center; color: #a9d4ba; font-size: var(--fs-sm); margin: 16px 0 0; min-height: 1.2em; }
.resume-card {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 18px; color: #3a2605; border: 0; border-radius: 16px;
  background: linear-gradient(#fbe39a, #e1a93a 55%, #c28a22); cursor: pointer; text-align: left; font-size: var(--fs-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 5px 0 #8e5f12, 0 12px 20px rgba(0,0,0,.4);
}
.resume-card span { display: grid; gap: 2px; }
.resume-card small { font-size: 12px; opacity: .8; font-weight: 600; }
.resume-card b { font-size: 26px; }

.back-link { color: #bfe3cd; text-decoration: none; font-size: var(--fs-md); display: inline-block; padding: 4px 0; background: none; border: 0; cursor: pointer; text-align: left; }
.setup h2 { font-family: var(--font-display); font-size: var(--fs-2xl); margin: 10px 0 14px; color: #fff4d6; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.setup-card {
  background: linear-gradient(rgba(0,0,0,.34), rgba(0,0,0,.24)); border: 1px solid rgba(232,182,74,.28); border-radius: 20px; padding: 18px;
  display: grid; gap: 16px; backdrop-filter: blur(4px); box-shadow: 0 14px 30px rgba(0,0,0,.35); max-width: 520px; width: 100%; margin: 0 auto;
}
.setup-card label { min-width: 0; display: grid; gap: 8px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #cfe8d8; }
.setup-card input#name { width: 100%; min-width: 0;
  font: inherit; font-size: var(--fs-lg); letter-spacing: 0; text-transform: none; color: #fff; font-weight: 600;
  background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.22); border-radius: 12px; padding: 12px 14px; -webkit-user-select: text; user-select: text;
}
.setup-card label.check { display: flex; align-items: center; gap: 12px; text-transform: none; letter-spacing: 0; font-size: var(--fs-md); color: #fff; font-weight: 600; }
.setup-card label.check span { display: grid; gap: 2px; }
.setup-card label.check small { color: #9fcbb2; font-size: 12px; font-weight: 400; }
.setup-card label.check input { width: 24px; height: 24px; accent-color: var(--gold); flex: none; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button, .segmented button {
  font-weight: 700; color: #fff; background: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.05)); border: 1px solid rgba(255,255,255,.22);
  border-radius: 12px; cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.stepper button { width: 46px; height: 46px; font-size: 22px; }
.stepper output { min-width: 42px; text-align: center; font-size: var(--fs-xl); font-weight: 800; letter-spacing: 0; color: #fff; font-family: var(--font-display); }
.segmented { display: flex; gap: 8px; }
.segmented button { flex: 1; padding: 12px 0; font-size: var(--fs-md); }
.segmented button.on { background: linear-gradient(#fbe39a, #d9a22f); color: #3a2605; border-color: var(--gold); box-shadow: 0 2px 0 #8e5f12; }
.hint { margin: 0; font-size: var(--fs-sm); color: #9fcbb2; min-height: 1.2em; }
.friends { font-weight: 800; font-size: var(--fs-md); color: var(--ink); background: rgba(255,255,255,.06); border: 1px solid rgba(232,182,74,.55); border-radius: 14px; padding: 13px; cursor: pointer; }

/* style picker */
.swatches { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.swatch { width: 62px; text-align: center; font-size: 11px; color: var(--ink-dim); background: none; border: 0; padding: 0; cursor: pointer; }
.swatch i { display: block; width: 62px; height: 62px; border-radius: 50%; margin-bottom: 5px; border: 3px solid transparent; box-shadow: 0 4px 10px rgba(0,0,0,.5), inset 0 0 0 5px var(--r); background: radial-gradient(circle at 50% 40%, var(--f1), var(--f3)); }
.swatch.on i { border-color: var(--gold); box-shadow: 0 0 0 2px #000, 0 0 16px rgba(232,182,74,.7), inset 0 0 0 5px var(--r); }
.swatch.on { color: var(--gold-hi); font-weight: 700; }
.deckprev { display: flex; gap: 10px; flex-wrap: wrap; }
.deckopt { background: none; border: 2px solid transparent; border-radius: 14px; padding: 8px; cursor: pointer; color: var(--ink-dim); font-size: 11px; display: grid; gap: 6px; justify-items: center; }
.deckopt.on { border-color: var(--gold); color: var(--gold-hi); font-weight: 700; background: rgba(232,182,74,.08); }
.deckopt .pair { display: flex; }
.deckopt .card { --cw: 40px; --ch: 56px; margin-left: -10px; }
.deckopt .card:first-child { margin-left: 0; }

/* =========================================================
   Table screen
   ========================================================= */
.table-screen { background: var(--room-2); }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: max(8px, env(safe-area-inset-top)) 10px 8px; z-index: 5;
  background: linear-gradient(var(--panel-2), var(--panel)); border-bottom: 2px solid #000; box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.round-info { flex: 1; min-width: 0; display: grid; line-height: 1.15; }
.round-info strong { font-family: var(--font-display); font-size: var(--fs-lg); white-space: nowrap; }
.round-info span { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.trump { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); line-height: 1.1; color: var(--ink-dim); white-space: nowrap; }
.trump b { color: #fff4d6; font-size: 12px; }
.trump .card { --cw: 30px; --ch: 42px; }
.trump.flip .card { animation: flip .7s ease-out; }
@keyframes flip { 0% { transform: rotateY(90deg) scale(.7); } 60% { transform: rotateY(-12deg) scale(1.15); } 100% { transform: none; } }

.table-wrap { position: relative; flex: 1; min-height: 0; padding: 10px 10px 2px; background: radial-gradient(ellipse at 50% 100%, var(--room-1), var(--room-2)); }
.table {
  position: relative; width: 100%; height: 100%; border-radius: 46% / 40%;
  border: 15px solid transparent;
  background:
    radial-gradient(ellipse at 50% 28%, rgba(255,255,255,.16), transparent 62%) padding-box,
    radial-gradient(ellipse at 50% 46%, var(--felt-1) 0%, var(--felt-2) 58%, var(--felt-3) 100%) padding-box,
    repeating-linear-gradient(97deg, rgba(255,255,255,.07) 0 2px, rgba(0,0,0,.09) 2px 5px, transparent 5px 9px) border-box,
    linear-gradient(160deg, var(--rail-1), var(--rail-2) 55%, var(--rail-3)) border-box;
  box-shadow:
    0 0 0 2px #000,
    inset 0 0 0 2px rgba(0,0,0,.5), inset 0 0 0 4px color-mix(in srgb, var(--brass) 55%, transparent),
    0 20px 34px rgba(0,0,0,.6), 0 4px 0 rgba(0,0,0,.5);
  transition: box-shadow .2s;
}
.table > .felt-fx {
  position: absolute; inset: 0; border-radius: 46% / 40%; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 38%, rgba(0,0,0,.55) 100%),
    var(--felt-noise);
  mix-blend-mode: multiply; opacity: .9;
  box-shadow: inset 0 14px 38px rgba(0,0,0,.55), inset 0 -6px 22px rgba(0,0,0,.35);
}
.table.drop-ready { box-shadow: 0 0 0 2px #000, inset 0 0 0 4px var(--gold), 0 20px 34px rgba(0,0,0,.6); }
.table.shake { animation: shake .55s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%,90% { transform: translate3d(-2px,0,0); } 20%,80% { transform: translate3d(4px,2px,0); } 30%,50%,70% { transform: translate3d(-7px,-2px,0); } 40%,60% { transform: translate3d(7px,2px,0); } }
.felt-ring { position: absolute; inset: 9%; border-radius: 46% / 40%; border: 1.5px solid color-mix(in srgb, var(--brass) 38%, transparent); pointer-events: none; z-index: 1; }
.suit-mark { position: absolute; left: 50%; top: 50%; width: 38%; max-width: 160px; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; z-index: 1; opacity: .16; fill: #000; transition: opacity .4s; }
.suit-mark.red { fill: #5a0a05; opacity: .22; }
.seats, .center { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.center { z-index: 4; }
.confetti { position: absolute; inset: -14px; width: calc(100% + 28px); height: calc(100% + 28px); pointer-events: none; z-index: 9; }
.spot {
  position: absolute; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(255,225,150,.34), rgba(255,225,150,.1) 45%, transparent 70%); mix-blend-mode: screen;
  transition: left .55s cubic-bezier(.3,.8,.3,1), top .55s cubic-bezier(.3,.8,.3,1), opacity .3s;
}
.deck { position: absolute; left: 50%; top: 40%; z-index: 3; width: var(--cw); height: var(--ch); transform: translate(-50%, -50%); pointer-events: none; opacity: 0; transition: opacity .25s; }
.deck.on { opacity: 1; }
.deck .card { position: absolute; inset: 0; width: 100%; height: 100%; }
.deck .card:nth-child(1) { transform: translate(-2px, 3px) rotate(-3deg); }
.deck .card:nth-child(2) { transform: translate(-1px, 1.5px) rotate(1deg); }

/* seats */
.seat { position: absolute; transform: translate(-50%, -50%); width: 90px; text-align: center; transition: filter .3s; }
.avatar {
  position: relative; width: 50px; height: 50px; margin: 0 auto; border-radius: 50%; overflow: visible;
  background: radial-gradient(circle at 35% 28%, var(--c1), var(--c2)); border: 2.5px solid rgba(255,255,255,.85);
  box-shadow: 0 4px 9px rgba(0,0,0,.55), inset 0 -4px 8px rgba(0,0,0,.25);
}
.avatar .av-svg { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.avatar.pop { animation: avpop .5s ease-out; }
@keyframes avpop { 40% { transform: scale(1.22) rotate(-4deg); } }
.seat.active .avatar { box-shadow: 0 0 0 3px var(--gold), 0 0 20px 5px rgba(232,182,74,.8); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 28px 9px rgba(232,182,74,.95); } }
.dealer-dot {
  position: absolute; right: -7px; bottom: -5px; width: 20px; height: 20px; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 35% 30%, #fff, #e8d9ae); color: #5a3a08; font-size: 11px; font-weight: 900; display: grid; place-items: center;
  border: 1.5px solid var(--gold); box-shadow: 0 2px 4px rgba(0,0,0,.5);
}
.plate {
  margin-top: 5px; padding: 3px 6px 4px; border-radius: 11px; line-height: 1.15;
  background: linear-gradient(rgba(10,6,2,.72), rgba(10,6,2,.55)); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 3px 8px rgba(0,0,0,.4);
}
.plate .nm { display: block; font-size: var(--fs-xs); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .02em; }
.plate .bt { display: block; font-size: var(--fs-xs); color: #e8d9ae; white-space: nowrap; }
.plate .bt b { color: #fff; display: inline-block; }
.plate .bt.ok b { color: var(--good); }
.plate .bt.over b { color: var(--bad); }
.plate .bt.dim { color: #9fb5a6; }
.plate .bt.bidpop b { animation: bidpop .55s ease-out; }
@keyframes bidpop { 0% { transform: scale(2.4); opacity: 0; } 60% { transform: scale(.9); } 100% { transform: scale(1); opacity: 1; } }
.plate .sc { display: block; font-size: 10px; color: #9fcbb2; }
.backs { display: flex; justify-content: center; height: 14px; margin-top: 3px; }
.backs i { width: 10px; height: 14px; margin-left: -5px; border-radius: 2px; border: 1px solid #fff; background: var(--card-back) center / 100% 100%; }
.backs i:first-child { margin-left: 0; }
.backs span { font-size: 10px; margin-left: 4px; align-self: center; color: #bcd; }
.seats.compact .seat { width: 72px; }
.seats.compact .avatar { width: 38px; height: 38px; border-width: 2px; }
.seats.compact .plate .sc, .seats.compact .backs { display: none; }
.seats.compact .plate .nm, .seats.compact .plate .bt { font-size: 10px; }

.bubble {
  position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 2px; z-index: 6; white-space: nowrap;
  background: #fff4d6; color: #2b1c08; font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,.5);
  animation: bub 1.9s ease-out forwards;
}
.bubble::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: #fff4d6; }
@keyframes bub { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.7); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 20% { transform: translate(-50%, 0) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -6px); } }
.float { position: absolute; transform: translate(-50%, -50%); font-family: var(--font-display); font-weight: 900; font-size: 30px; text-shadow: 0 2px 6px rgba(0,0,0,.7); animation: floatup 1.2s ease-out forwards; z-index: 7; }
.float.plus { color: #8ff0b0; }
@keyframes floatup { from { opacity: 0; margin-top: 10px; scale: .6; } 15% { opacity: 1; scale: 1.2; } to { opacity: 0; margin-top: -54px; scale: 1; } }
.status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 66%; text-align: center; font-family: var(--font-display); font-style: italic; font-size: var(--fs-md); color: rgba(255,244,214,.82); pointer-events: none; text-shadow: 0 2px 4px rgba(0,0,0,.6); transition: opacity .2s; z-index: 3; }
.status.hide { opacity: 0; }
.round-banner {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%) scale(.8); text-align: center; opacity: 0; pointer-events: none; z-index: 8; white-space: nowrap;
  background: linear-gradient(rgba(10,6,2,.86), rgba(10,6,2,.74)); border: 1px solid rgba(232,182,74,.7); border-radius: 18px; padding: 14px 28px;
  box-shadow: 0 0 0 4px rgba(0,0,0,.3), 0 14px 30px rgba(0,0,0,.6);
}
.round-banner strong { display: block; font-family: var(--font-display); font-size: var(--fs-2xl); color: #fff4d6; }
.round-banner span { color: var(--gold); font-size: var(--fs-sm); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.round-banner.show { animation: banner 1.6s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); } 28% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -64%) scale(1); } }

/* =========================================================
   Cards
   ========================================================= */
.card {
  position: relative; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .11); flex: none; overflow: hidden;
  background: linear-gradient(160deg, var(--paper-1), var(--paper-2)); color: var(--sc, var(--c-S)); font-family: var(--font-display);
  border: 1px solid var(--card-line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 -2px 3px rgba(0,0,0,.08), 0 2px 5px rgba(0,0,0,.5);
}
.card[data-suit="S"] { --sc: var(--c-S); } .card[data-suit="C"] { --sc: var(--c-C); }
.card[data-suit="H"] { --sc: var(--c-H); } .card[data-suit="D"] { --sc: var(--c-D); }
.card svg.sx { fill: var(--sc); display: block; }
.card.tr { box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 2px 5px rgba(0,0,0,.5), inset 0 0 0 2px color-mix(in srgb, var(--brass) 65%, transparent); }
.cn { position: absolute; left: 4%; top: 2.5%; display: grid; justify-items: center; gap: calc(var(--cw) * .02); line-height: 1; font-size: calc(var(--cw) * .3); font-weight: 700; z-index: 2; width: calc(var(--cw) * .24); }
.cn .sx { width: calc(var(--cw) * .18); height: calc(var(--cw) * .18); }
.cn.br { left: auto; right: 5%; top: auto; bottom: 3%; transform: rotate(180deg); }
.pp { position: absolute; width: calc(var(--cw) * .2); height: calc(var(--cw) * .2); transform: translate(-50%, -50%); }
.pp.dn { transform: translate(-50%, -50%) rotate(180deg); }
.pp.ace { width: calc(var(--cw) * .56); height: calc(var(--cw) * .56); filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.card .face { position: absolute; left: 15%; top: 5%; width: 70%; height: 90%; }
.card.back {
  background: var(--card-back) center / 100% 100% no-repeat; border: 1px solid rgba(0,0,0,.5); color: transparent;
}
.card.back > * { display: none; }
.tcard {
  position: absolute; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); z-index: var(--z, 1);
  transition: left .44s cubic-bezier(.2,.8,.25,1), top .44s cubic-bezier(.2,.8,.25,1), opacity .4s, transform .44s;
}
.tcard .card { box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 10px 14px rgba(0,0,0,.45), 0 2px 3px rgba(0,0,0,.5); }
.tcard.win .card { box-shadow: 0 0 0 3px var(--gold), 0 0 26px rgba(248,220,142,.95), 0 10px 14px rgba(0,0,0,.45); }
.tcard.gone { opacity: 0; transform: translate(-50%, -50%) scale(.5) rotate(calc(var(--rot, 0deg) + 160deg)); transition-duration: .46s; }
.flyer { position: absolute; z-index: 5; pointer-events: none; will-change: transform; left: 0; top: 0; }
.flyer .card { --cw: 22px; --ch: 31px; }
.spark { position: absolute; z-index: 8; pointer-events: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-hi); box-shadow: 0 0 8px 2px rgba(248,220,142,.9); will-change: transform, opacity; left: 0; top: 0; }

/* =========================================================
   Me bar, hand, bid panel
   ========================================================= */
.me-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); font-size: var(--fs-sm); z-index: 4; border-top: 1px solid rgba(232,182,74,.25); }
.me-bar .avatar { width: 38px; height: 38px; margin: 0; border-width: 2px; }
.me-bar .who { flex: 1; min-width: 0; line-height: 1.2; }
.me-bar .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.me-bar .who span { color: var(--ink-dim); font-size: 12px; }
.me-bar.active { background: linear-gradient(90deg, #4f3607, var(--panel)); }
.me-bar.active .avatar { box-shadow: 0 0 0 3px var(--gold), 0 0 14px rgba(232,182,74,.7); }
.me-bar .tally { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 800; white-space: nowrap; }
.me-bar .tally small { font-family: var(--font-ui); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-dim); margin-left: 3px; }
.me-bar .tally.pop { animation: bidpop .5s ease-out; }

.hand {
  --cw: var(--hw); --ch: calc(var(--hw) * 1.4);
  position: relative; height: var(--hand-h); padding-bottom: env(safe-area-inset-bottom); overflow: visible; touch-action: none;
  background: radial-gradient(ellipse at 50% 120%, #2c1a0b, var(--room-2) 70%);
}
.hand.lifting { overflow: visible; z-index: 20; }
.hand .hc { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; transform-origin: 50% 150%; transition: transform .2s cubic-bezier(.2,.8,.25,1), filter .2s; cursor: pointer; }
.hand .hc .card { box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 -2px 8px rgba(0,0,0,.35), 0 3px 6px rgba(0,0,0,.55); }
.hand.lifting .hc { transition: none; }
.hand.dealing .hc { animation: deal .62s cubic-bezier(.25,.9,.3,1.1) backwards; animation-delay: calc(var(--i) * 70ms + 200ms); }
@keyframes deal {
  0% { opacity: 0; translate: 0 -330px; scale: .35; rotate: -40deg; }
  55% { opacity: 1; translate: 0 -90px; scale: 1.08; rotate: 8deg; }
}
.hand .hc.dim { filter: brightness(.55) saturate(.55); }
.hand .hc.sel .card { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(248,220,142,.7), 0 10px 18px rgba(0,0,0,.6); }
.hand .hc.hint .card { animation: hintglow 1s ease-in-out infinite; }
@keyframes hintglow { 50% { box-shadow: 0 0 0 4px #7ee2a0, 0 0 22px rgba(126,226,160,.9); } }

.bid-panel {
  position: absolute; left: 8px; right: 8px; bottom: calc(var(--hand-h) + 50px); z-index: 8; padding: 11px 12px;
  background: linear-gradient(rgba(30,18,8,.95), rgba(14,8,3,.94)); border: 1px solid rgba(232,182,74,.6); border-radius: 18px;
  box-shadow: 0 14px 34px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.08); animation: rise .28s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.bid-panel h3 { margin: 0 0 3px; font-family: var(--font-display); font-size: var(--fs-lg); }
.bid-panel p { margin: 0 0 8px; font-size: 12px; color: var(--ink-dim); line-height: 1.4; }
.bid-panel p b { color: #fff; }
.bid-panel p.pressure { color: var(--gold-hi); }
.bid-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.bid-grid button {
  min-width: 38px; height: 42px; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 800; color: #fff;
  background: linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.05)); border: 1px solid rgba(255,255,255,.25); border-radius: 12px; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,.45); transition: transform .08s;
}
.bid-grid button.suggest { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 3px 0 rgba(0,0,0,.45); color: var(--gold-hi); }
.bid-grid button.board { background: linear-gradient(#f0675a, #a52f25); border-color: #ffb0a8; padding: 0 12px; font-size: var(--fs-md); font-family: var(--font-ui); letter-spacing: .04em; text-transform: uppercase; }
.bid-grid button:disabled { opacity: .25; text-decoration: line-through; }
.bid-grid button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.45); }

/* =========================================================
   Sheets
   ========================================================= */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.62); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet-body {
  width: 100%; max-width: 640px; max-height: 88dvh; display: flex; flex-direction: column; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(#241509, #150c05); border-top: 2px solid var(--gold); box-shadow: 0 -10px 40px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.1);
  animation: rise .3s cubic-bezier(.2,.9,.3,1.1);
}
.sheet-body::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.22); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 6px; min-height: 48px; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-size: var(--fs-xl); color: #fff4d6; }
.sheet-content { overflow: auto; padding: 4px 18px 20px; }
.scroll-x { overflow-x: auto; }
.sheet-content table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.sheet-content th, .sheet-content td { padding: 6px 5px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.sheet-content th { color: var(--ink-dim); font-weight: 700; font-size: var(--fs-xs); position: sticky; top: 0; background: #1b1109; }
.sheet-content td:first-child, .sheet-content th:first-child { text-align: left; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid rgba(255,255,255,.08); }
.rank-row.res { animation: slidein .4s cubic-bezier(.2,.9,.3,1) backwards; animation-delay: var(--d, 0ms); }
.rank-row.me { background: linear-gradient(90deg, rgba(232,182,74,.18), rgba(232,182,74,.04)); border-radius: 12px; }
@keyframes slidein { from { opacity: 0; transform: translateX(-20px); } }
.rank-row .n { width: 30px; font-weight: 800; color: var(--gold); font-size: var(--fs-lg); }
.rank-row .mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 900; flex: none; }
.mark.ok { background: linear-gradient(#2fa564, #1a6a3d); color: #fff; animation: popin .45s ease-out backwards; animation-delay: calc(var(--d, 0ms) + 250ms); box-shadow: 0 0 10px rgba(126,226,160,.5); }
.mark.no { background: linear-gradient(#a8382c, #6a1c14); color: #fff; }
@keyframes popin { from { transform: scale(0); } 70% { transform: scale(1.3); } }
.rank-row .nm { flex: 1; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .d { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.rank-row .s { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 800; min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.medal { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-family: var(--font-display); font-weight: 900; font-size: 15px; color: #3a2605; box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 4px rgba(0,0,0,.5); }
.medal.m1 { background: linear-gradient(#fbe39a, #c28a22); } .medal.m2 { background: linear-gradient(#f2f4f8, #98a2b3); } .medal.m3 { background: linear-gradient(#f0c09a, #a8642c); }
.leader { text-align: center; color: var(--ink-dim); margin: 14px 0 0; font-size: var(--fs-md); }
.sheet-actions { display: grid; gap: 10px; margin-top: 16px; position: sticky; bottom: -2px; padding-top: 12px; background: linear-gradient(rgba(21,12,5,0), #150c05 28%); }
.banner { text-align: center; font-family: var(--font-display); font-size: 34px; margin: 4px 0 10px; background: linear-gradient(#fff6d2, #f0c250, #b57d1a); -webkit-background-clip: text; background-clip: text; color: transparent; animation: bidpop .7s ease-out; }
.last-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 8px 0; }
.last-card { display: grid; gap: 6px; justify-items: center; font-size: 12px; color: var(--ink-dim); --cw: 58px; --ch: 81px; }
.last-card.w .card { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(232,182,74,.8); }
.last-card.w span { color: var(--gold-hi); font-weight: 800; }
.rules h3 { margin: 14px 0 4px; color: var(--gold); font-size: var(--fs-md); font-family: var(--font-display); }
.rules p, .rules li { font-size: 14px; line-height: 1.5; color: #e8dcc0; margin: 0 0 6px; }
.rules ul { margin: 0; padding-left: 18px; }
.code-big { text-align: center; font-family: var(--font-display); font-size: 48px; letter-spacing: .18em; margin: 4px 0 2px; background: linear-gradient(#fff6d2, #f0c250, #b57d1a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.seat-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid rgba(255,255,255,.08); }
.seat-row .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); flex: none; box-shadow: 0 0 8px var(--good); }
.seat-row .dot.off { background: #777; box-shadow: none; }
.seat-row .nm { flex: 1; font-weight: 700; }
.seat-row .tag { font-size: var(--fs-xs); color: var(--gold); letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.seat-row .avatar { width: 30px; height: 30px; margin: 0; border-width: 2px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; font: inherit; font-size: 22px; letter-spacing: .2em; text-transform: uppercase; text-align: center; color: #fff; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.25); border-radius: 12px; padding: 10px; -webkit-user-select: text; user-select: text; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 14px; }
.mini-row .stepper button { width: 38px; height: 38px; font-size: 18px; }
.mini-row .stepper output { font-size: 20px; min-width: 32px; }
.mini-row .segmented button { padding: 8px 10px; font-size: 13px; }
.err { color: var(--bad); font-size: var(--fs-sm); min-height: 1.2em; text-align: center; margin: 8px 0 0; }

/* =========================================================
   Responsive: small phones, tablets, landscape
   ========================================================= */
@media (max-width: 360px) {
  :root { --cw: 40px; --hw: 50px; }
  .seat { width: 76px; }
  .avatar { width: 42px; height: 42px; }
  .seats.compact .seat { width: 62px; }
  .seats.compact .avatar { width: 32px; height: 32px; }
  .seats.compact .plate .nm, .seats.compact .plate .bt { font-size: 9px; }
  .round-info strong { font-size: var(--fs-md); }
  .trump span { display: none; }
  .chip-btn { padding: 7px 9px; }
  .me-bar .tally small { display: none; }
  .rank-row { flex-wrap: wrap; row-gap: 0; }
  .rank-row .d { order: 9; flex-basis: 100%; padding-left: 38px; margin-top: -4px; }
  .setup-card { padding: 14px; }
}
@media (max-height: 700px) and (orientation: portrait) {
  .seat { width: 80px; }
  .avatar { width: 42px; height: 42px; }
}
@media (min-width: 700px) and (orientation: portrait) {
  :root { --cw: 70px; --hw: 88px; }
  .seat { width: 110px; }
  .avatar { width: 62px; height: 62px; }
  .plate .nm, .plate .bt { font-size: var(--fs-sm); }
  .plate .sc { font-size: var(--fs-xs); }
  .seats.compact .seat { width: 90px; }
  .seats.compact .avatar { width: 48px; height: 48px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  :root { --cw: clamp(36px, 10vh, 54px); --hw: clamp(44px, 12.5vh, 64px); --hand-h: calc(var(--hw) * 1.4 * .72); }
  .play { max-width: 900px; }
  .topbar { padding: 4px 10px; }
  .round-info span { display: none; }
  .table-wrap { padding: 6px 10px 6px; }
  .me-bar { position: absolute; left: 10px; bottom: calc(var(--hw) * 1.3 + 8px); pointer-events: none; border-radius: 12px; border: 1px solid rgba(232,182,74,.3); z-index: 12; max-width: 260px; }
  .me-bar .chip-btn { pointer-events: auto; }
  .hand { position: absolute; left: 0; right: 0; bottom: 0; background: none; z-index: 10; }
  .hand .hc { bottom: -10%; }
  .title { justify-content: flex-start; }
  .fan { --aw: 50px; margin-bottom: 0; }
  .logo { font-size: 32px; }
  .logo small { margin-top: 4px; }
  .river-line { margin: 6px auto 10px; }
  .menu-col { gap: 8px; }
  .primary { padding: 11px 16px; }
  .ghost { padding: 9px 14px; }
  .rank-row { padding: 5px 6px; }
  .banner { font-size: 26px; margin: 0 0 4px; }
  .bid-panel { bottom: auto; top: 50%; transform: translateY(-50%); left: 50%; right: auto; width: min(560px, 92%); margin-left: calc(min(560px, 92%) / -2); animation: none; }
  .seat { width: 84px; }
  .avatar { width: 38px; height: 38px; }
  .seats.compact .seat { width: 66px; }
  .seats.compact .avatar { width: 30px; height: 30px; }
  .plate .sc { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; }
}

/* light effects: no blend modes, glows or heavy shadows (set automatically on slow devices, or from the menu) */
html[data-fx="low"] .spot, html[data-fx="low"] .table > .felt-fx { mix-blend-mode: normal; }
html[data-fx="low"] .spot { opacity: .5 !important; }
html[data-fx="low"] .seat.active .avatar { animation: none; }
html[data-fx="low"] .tcard .card, html[data-fx="low"] .hand .hc .card { box-shadow: 0 3px 5px rgba(0,0,0,.5); }
html[data-fx="low"] .sheet, html[data-fx="low"] .setup-card { backdrop-filter: none; }
html[data-fx="low"] .logo { filter: none; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; max-width: 90%; padding: 10px 16px; border-radius: 14px; background: rgba(10,6,2,.92); border: 1px solid rgba(232,182,74,.6); color: var(--ink); font-size: var(--fs-sm); text-align: center; animation: bub 3.6s ease-out forwards; }

.trump { cursor: pointer; }
.zoom-card { display: grid; justify-items: center; gap: 12px; text-align: center; }
.zoom-card .card { --cw: min(46vw, 190px); --ch: calc(var(--cw) * 1.4); box-shadow: 0 14px 30px rgba(0,0,0,.55); }
.totals td, .totals th { text-align: left; padding: 8px 6px; }
.totals td:last-child, .totals th:last-child { text-align: right; }
.hand .hc.sel { transition-duration: .16s; }
.hand { isolation: isolate; z-index: 9; }

/* teams */
.tm { display: inline-grid; place-items: center; width: 1.3em; height: 1.3em; margin-right: 5px; border-radius: 50%; font: 800 .72em/1 var(--font-ui); font-style: normal; color: #1d1204; vertical-align: 1px; }
.tm.tmA { background: #f0c25a; } .tm.tmB { background: #7fd0e8; }
.team-strip { display: flex; gap: 8px; padding: 6px 12px 0; }
.team-strip .ts { flex: 1; display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 12px; background: rgba(0,0,0,.32); border: 1px solid rgba(255,255,255,.08); font-size: var(--fs-sm); white-space: nowrap; }
.team-strip .ts.mine { border-color: rgba(232,182,74,.55); }
.team-strip .tm { margin: 0; }
.team-strip .ts-sc { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg); }
.team-strip .ts-bid { margin-left: auto; color: var(--ink-dim); font-size: var(--fs-xs); }
.totals .sub { display: block; color: var(--ink-dim); font-size: var(--fs-xs); margin-top: 2px; }
.rank-row.team { background: rgba(232,182,74,.1); }

#turn-timer { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 8px); transform: translateX(-50%); z-index: 40; padding: 4px 12px; border-radius: 999px; background: rgba(18,10,5,.8); color: #f4e6bf; font: 600 13px var(--font-body, system-ui); border: 1px solid rgba(232,182,74,.4); pointer-events: none; }
#turn-timer.me { border-color: #e8b64a; color: #ffe39a; }
#turn-timer.low { background: #8f2a1c; color: #fff; border-color: #ff8a78; animation: tt 1s infinite; }
@keyframes tt { 50% { transform: translateX(-50%) scale(1.08); } }

/* =========================================================
   Swoop-specific
   ========================================================= */
:root {
  --pw: clamp(44px, min(16vw, 8.4vh), 76px);
  --cw: var(--pw);
  --hw: clamp(50px, min(15vw, 9.2vh), 82px);
  --tw: calc(var(--hw) * .74);
  --hand-h: calc(var(--hw) * 1.4 + 34px);
}
.pile-probe, .hand-probe { position: absolute; left: 0; top: 0; height: 1px; visibility: hidden; pointer-events: none; }
.pile-probe { width: var(--pw); }
.hand-probe { width: var(--hw); }
.river-line { margin-top: 10px; }
.logo { font-size: clamp(54px, 18vw, 84px); letter-spacing: -1px; }
.logo small { font-size: .26em; letter-spacing: .04em; margin-top: 10px; }

/* pile */
.center { z-index: 4; }
.pile { position: absolute; left: 50%; top: 49%; width: 0; height: 0; }
.pc { position: absolute; left: calc(var(--pw) / -2); top: calc(var(--pw) * -.7); width: var(--pw); height: calc(var(--pw) * 1.4); }
.pc .card, .flyer .card, .pending-card .card { --cw: var(--pw); --ch: calc(var(--pw) * 1.4); box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 8px 12px rgba(0,0,0,.42), 0 2px 3px rgba(0,0,0,.5); }
.pc.under .card { opacity: .95; }
.flyer { position: absolute; left: 0; top: 0; z-index: 12; width: var(--pw); height: calc(var(--pw) * 1.4); transform-origin: 50% 50%; will-change: transform, opacity; }
.pile-empty { position: absolute; left: calc(var(--pw) * -.9); top: calc(var(--pw) * -.6); width: calc(var(--pw) * 1.8); height: calc(var(--pw) * 1.2); border: 2px dashed rgba(255,244,214,.3); border-radius: 14px; display: grid; place-items: center; color: rgba(255,244,214,.45); font-family: var(--font-display); font-style: italic; font-size: var(--fs-md); }
.pile-info { position: absolute; left: 50%; top: calc(var(--pw) * .82); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; white-space: nowrap; z-index: 40; }
.pile-count { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,244,214,.85); text-shadow: 0 1px 3px #000; }
.pile-run { display: flex; gap: 4px; padding: 3px 6px; border-radius: 99px; background: rgba(0,0,0,.45); }
.pile-run i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.5); }
.pile-run i.on { background: var(--gold-hi); border-color: var(--gold); box-shadow: 0 0 6px rgba(248,220,142,.8); }
.pile-run.hot { animation: hotpulse .9s ease-in-out infinite; }
@keyframes hotpulse { 50% { transform: scale(1.14); background: rgba(160,40,20,.6); } }
.pending-card { position: absolute; left: calc(var(--pw) * .3); top: calc(var(--pw) * -1.65); z-index: 30; transform: scale(1.15) rotate(5deg); }
.pending-card .card { box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(248,220,142,.9), 0 12px 18px rgba(0,0,0,.5); animation: pend 1.2s ease-in-out infinite; }
@keyframes pend { 50% { box-shadow: 0 0 0 3px var(--gold-hi), 0 0 34px rgba(248,220,142,1), 0 12px 18px rgba(0,0,0,.5); } }
.card.wild::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3; box-shadow: inset 0 0 0 calc(var(--cw) * .045) #e8b64a; background: linear-gradient(115deg, transparent 40%, rgba(255,230,150,.35) 50%, transparent 60%); background-size: 250% 100%; animation: sheen 3.4s linear infinite; }
@keyframes sheen { from { background-position: 180% 0; } to { background-position: -80% 0; } }
.card.joker { background: #2a1450; border-color: #f0c250; }
.card .jk { position: absolute; inset: 0; width: 100%; height: 100%; }
.card.joker::before { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: linear-gradient(115deg, transparent 40%, rgba(255,230,150,.3) 50%, transparent 60%); background-size: 250% 100%; animation: sheen 3.4s linear infinite; }
.shock { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 3px solid var(--gold-hi); box-shadow: 0 0 18px rgba(248,220,142,.8); pointer-events: none; z-index: 6; }
.spark { position: absolute; }

.status { top: auto; bottom: 7%; width: 74%; transform: translateX(-50%); font-size: 14px; z-index: 5; }

/* callout */
.callout { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(.5); opacity: 0; pointer-events: none; z-index: 15; white-space: nowrap; text-align: center; }
.callout.swoop, .callout.wild { font-family: var(--font-display); font-weight: 900; font-size: clamp(34px, 11vw, 52px); font-style: italic; letter-spacing: .02em;
  background: linear-gradient(#fff6d2, #f0c250 55%, #b57d1a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 rgba(0,0,0,.55)) drop-shadow(0 0 16px rgba(248,220,142,.7)); }
.callout.wild { background: linear-gradient(#fff, #a6e7ff 50%, #4a90e0); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 3px 0 rgba(0,0,0,.55)) drop-shadow(0 0 16px rgba(120,200,255,.8)); }
.callout.banner { top: 44%; background: linear-gradient(rgba(10,6,2,.86), rgba(10,6,2,.74)); border: 1px solid rgba(232,182,74,.7); border-radius: 18px; padding: 14px 28px; box-shadow: 0 0 0 4px rgba(0,0,0,.3), 0 14px 30px rgba(0,0,0,.6); }
.callout.banner strong { display: block; font-family: var(--font-display); font-size: var(--fs-2xl); color: #fff4d6; }
.callout.banner span { color: var(--gold); font-size: var(--fs-sm); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.callout.show { animation: callout 1.4s cubic-bezier(.2,.9,.3,1.1) forwards; }
@keyframes callout { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-6deg); } 16% { opacity: 1; transform: translate(-50%, -50%) scale(1.14) rotate(2deg); } 28% { transform: translate(-50%, -50%) scale(1) rotate(0); } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -78%) scale(1); } }

/* seats */
.seat { width: 82px; }
.seats.compact .seat { width: 68px; }
.seats.tight .seat { width: 60px; }
.plate .nm { max-width: 100%; }
.seat.low .avatar { box-shadow: 0 0 0 2.5px #ff8f84, 0 0 14px rgba(255,100,80,.7); }
.seat.low .plate .bt b { color: var(--bad); }
.tbl { display: flex; justify-content: center; gap: 3px; margin-top: 4px; height: 28px; }
.sl { position: relative; width: 17px; height: 28px; flex: none; }
.sl.empty { border: 1px dashed rgba(255,255,255,.14); border-radius: 3px; height: 24px; }
.mb { position: absolute; left: 0; top: 4px; width: 17px; height: 24px; border-radius: 3px; border: 1px solid #f4ecd8; background: var(--card-back) center / 100% 100% no-repeat; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.mb.open { top: 2px; box-shadow: 0 0 0 1.5px var(--gold), 0 0 8px rgba(232,182,74,.7); }
.mu { position: absolute; left: 0; top: 0; width: 17px; height: 24px; border-radius: 3px; display: grid; place-items: center; align-content: center; gap: 0; font-style: normal; line-height: 1; border: 1px solid var(--card-line);
  background: linear-gradient(160deg, var(--paper-1), var(--paper-2)); color: var(--c-S); box-shadow: 0 1px 3px rgba(0,0,0,.55); }
.mu[data-suit="H"] { color: var(--c-H); } .mu[data-suit="D"] { color: var(--c-D); } .mu[data-suit="C"] { color: var(--c-C); } .mu[data-suit="S"] { color: var(--c-S); }
.mu b { font: 800 10px var(--font-display); }
.mu .sx { width: 8px; height: 8px; fill: currentColor; }
.mu.wild { box-shadow: 0 0 0 1.5px var(--gold), 0 0 6px rgba(232,182,74,.8); }
.mu.joker { background: #2a1450; color: var(--gold-hi); border-color: var(--gold); }
.seats.compact .sl, .seats.compact .mb, .seats.compact .mu { width: 14px; }
.seats.compact .sl { height: 24px; } .seats.compact .mb, .seats.compact .mu { height: 20px; }
.seats.compact .tbl { height: 24px; gap: 2px; }
.seats.compact .mu b { font-size: 8.5px; } .seats.compact .mu .sx { width: 6px; height: 6px; }
.seats.compact .plate .sc, .seats.compact .backs { display: none; }
.seats.tight .sl, .seats.tight .mb, .seats.tight .mu { width: 12px; }
.seats.tight .mu b { font-size: 7.5px; }
.bubble { z-index: 20; }

/* my table cards */
.mine { display: flex; justify-content: center; gap: calc(var(--tw) * .22); padding: 6px 8px 3px; background: linear-gradient(var(--panel-2), var(--panel)); border-top: 1px solid rgba(232,182,74,.25); min-height: calc(var(--tw) * 1.4 + 22px); z-index: 4; }
.mine .slot { position: relative; width: var(--tw); height: calc(var(--tw) * 1.4 + 11px); }
.mine .slot.empty { border: 1.5px dashed rgba(255,255,255,.12); border-radius: 8px; height: calc(var(--tw) * 1.4); }
.mine .card { --cw: var(--tw); --ch: calc(var(--tw) * 1.4); }
.mine .mystery { position: absolute; left: 0; top: 11px; width: var(--tw); height: calc(var(--tw) * 1.4); border-radius: 7px; }
.mine .mystery.exposed { top: 5px; }
.mine .mystery.ready { cursor: pointer; animation: mready 1.3s ease-in-out infinite; }
.mine .mystery.ready .card { box-shadow: 0 0 0 2.5px var(--gold), 0 0 16px rgba(232,182,74,.8); }
.mine .mystery.chosen { animation: none; transform: translateY(-8px); }
.mine .mystery.chosen .card { box-shadow: 0 0 0 3px #d6a8ff, 0 0 22px rgba(190,140,255,.95); }
@keyframes mready { 50% { transform: translateY(-3px); } }
.mine .upslot { position: absolute; left: 0; top: 0; width: var(--tw); height: calc(var(--tw) * 1.4); }
.mine .card.sel { transform: translateY(-9px); box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(248,220,142,.7), 0 10px 14px rgba(0,0,0,.55); transition: transform .15s; }
.mine .card.hint { animation: hintglow 1s ease-in-out infinite; }
.card.higher::after { content: "\25B2"; position: absolute; left: 4px; bottom: 3px; width: 15px; height: 15px; display: grid; place-items: center; border-radius: 50%; font-size: 8px; line-height: 1; color: #fff; background: #d6402f; box-shadow: 0 1px 2px rgba(0,0,0,.5); z-index: 4; }
.mine .upslot .card { cursor: pointer; }

/* action bar */
.actionbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border-top: 1px solid rgba(232,182,74,.25); z-index: 6; }
.me-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.me-info .avatar { width: 38px; height: 38px; margin: 0; border-width: 2px; flex: none; }
.me-info .who { min-width: 0; line-height: 1.2; }
.me-info .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.me-info .who span { color: var(--ink-dim); font-size: 12px; white-space: nowrap; }
.me-info.active .avatar { box-shadow: 0 0 0 3px var(--gold), 0 0 14px rgba(232,182,74,.7); }
.actionbar .chip-btn { flex: none; }
.act {
  flex: none; min-width: 142px; max-width: 58%; min-height: 46px; padding: 8px 14px; font-weight: 800; font-size: 14px; line-height: 1.15; letter-spacing: .01em; color: #3a2605; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(#fbe39a, #e1a93a 55%, #c28a22); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 4px 0 #8e5f12, 0 8px 14px rgba(0,0,0,.4); transition: transform .08s, box-shadow .08s;
}
.act:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 0 #8e5f12; }
.act:disabled { background: linear-gradient(#4a4338, #35301f); color: #a39a84; box-shadow: 0 3px 0 #1d1a10; cursor: default; }
.act.pickup { background: linear-gradient(#ff9a8a, #d9503f 55%, #a82f22); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 4px 0 #6a1a12, 0 8px 14px rgba(0,0,0,.4); }
.act.swoop { background: linear-gradient(#fff3b8, #f0c250 50%, #d9951a); animation: swooppulse 1s ease-in-out infinite; }
@keyframes swooppulse { 50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 4px 0 #8e5f12, 0 0 22px 4px rgba(248,220,142,.85); } }
.act.mystery { background: linear-gradient(#e0c4ff, #9a64e0 55%, #6b3cb0); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 4px 0 #3a1c6a, 0 8px 14px rgba(0,0,0,.4); }

/* hand */
.hand { --cw: var(--hw); --ch: calc(var(--hw) * 1.4); height: var(--hand-h); background: radial-gradient(ellipse at 50% 120%, #2c1a0b, var(--room-2) 70%); }
.hand .hc { left: 0; bottom: calc(10px + env(safe-area-inset-bottom)); width: var(--hw); transform-origin: 0 100%; transform: translateY(var(--dy, 0px)) scale(var(--k, 1)); transition: transform .18s cubic-bezier(.2,.8,.25,1), filter .2s; }
.hand .hc.drag { transition: none; }
.hand .hc.sel { transform: translateY(calc(var(--hw) * -.3 + var(--dy, 0px))) scale(var(--k, 1)); }
.hand .hc.wait { filter: brightness(.82); }
.hand .hc.higher::after { content: "\25B2"; position: absolute; left: 4px; bottom: 4px; width: 15px; height: 15px; display: grid; place-items: center; border-radius: 50%; font-size: 8px; line-height: 1; color: #fff; background: #d6402f; box-shadow: 0 1px 2px rgba(0,0,0,.5); z-index: 5; pointer-events: none; }
.hand .hc.sel .card { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(248,220,142,.7), 0 10px 18px rgba(0,0,0,.6); }
.hand.empty::after { content: "No cards in hand"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-dim); font-style: italic; }

/* sheets and scores */
.rules h3 span { color: var(--gold); font-family: var(--font-display); }
.rules > h3:first-child { margin-top: 4px; }
.check-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-weight: 600; }
.check-row span { display: grid; gap: 2px; } .check-row small { color: var(--ink-dim); font-size: 12px; font-weight: 400; }
.check-row input { width: 24px; height: 24px; accent-color: var(--gold); flex: none; }
.bar { display: block; height: 4px; margin-top: 5px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #7ee2a0, #e8b64a 70%, #ff8f84); }
.totrow td { border-top: 2px solid var(--gold); font-weight: 800; }
.menu-sheet .sheet-actions { position: static; background: none; }
.rank-row .nm small.bar { max-width: 100%; }
@media (max-width: 360px) { .act { min-width: 120px; font-size: 13px; } .seat { width: 70px; } }
@media (max-height: 700px) and (orientation: portrait) { .mine { padding-top: 3px; } .plate .sc { display: none; } }
@media (orientation: landscape) and (max-height: 520px) {
  :root { --pw: clamp(34px, 11vh, 50px); --hw: clamp(44px, 12.5vh, 64px); --tw: calc(var(--hw) * .8); }
  .table-screen { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto auto; }
  .topbar { grid-column: 1 / 3; }
  .table-wrap { grid-column: 1; grid-row: 2 / 5; }
  .mine { grid-column: 2; grid-row: 2; flex-wrap: wrap; width: calc(var(--tw) * 2.6); min-height: 0; align-content: flex-start; }
  .actionbar { grid-column: 2; grid-row: 3; flex-wrap: wrap; width: calc(var(--tw) * 2.6); }
  .hand { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; pointer-events: none; background: none; height: calc(var(--hw) * 1.1); }
  .hand .hc { pointer-events: auto; bottom: -8%; }
}
.rank-row .d { min-width: 58px; text-align: right; }

@media (max-width: 400px) { .me-info .who span { font-size: 11px; } .me-info .avatar { width: 32px; height: 32px; } .hint-wide { display: none; } }
.mine .upslot { pointer-events: none; }
.mine .upslot .card { pointer-events: auto; }

/* lobby */
.code-big { text-align: center; font-family: var(--font-display); font-size: 48px; letter-spacing: .18em; margin: 4px 0 2px; background: linear-gradient(#fff6d2, #f0c250, #b57d1a); -webkit-background-clip: text; background-clip: text; color: transparent; }
