/* ============================================================
   55 — styled after the DreamHost design system.
   Palette: Prince #A644E5 (purple), Azure #0073EC (blue),
   Turtle #00CAAA, Coral #FF4A48, Tangerine #F59D00, Sunflower #FFDA00.
   Type: Gilroy → Poppins fallback. Bright, bold, mobile-first.
   ============================================================ */
:root {
  --prince: #a644e5;
  --azure: #0073ec;
  --violet: #6e3ce0;
  --midnight: #071c26;
  --oblivion: #111111;
  --turtle: #00caaa;
  --coral: #ff4a48;
  --tangerine: #f59d00;
  --sunflower: #ffda00;
  --off-white: #f4f6f9;
  --smoke: #e0e4e8;
  --cloudy: #afbfc9;
  --galactic: #677983;
  --metal: #434f58;
  --ink: #14121f;
  --white: #ffffff;

  --card-red: #ec2f4b;
  --card-black: #1a1830;

  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 4px 14px rgba(7, 28, 38, 0.16);
  --shadow: 0 12px 30px rgba(7, 28, 38, 0.22);
  --shadow-lg: 0 20px 50px rgba(20, 10, 50, 0.35);

  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 640px at 12% -5%, rgba(166, 68, 229, 0.34), transparent 55%),
    radial-gradient(1000px 620px at 100% 108%, rgba(0, 115, 236, 0.36), transparent 55%),
    linear-gradient(160deg, #0b2334 0%, #071c26 55%, #050f15 100%);
  background-color: #071c26;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; }
.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ---- typography helpers ---- */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
.muted { color: var(--galactic); font-size: 14px; }
.error { color: var(--coral); min-height: 18px; font-size: 14px; font-weight: 600; }
.error:empty { display: none; }

/* ---- buttons: bold, big tap targets, generous spacing ---- */
button, input { font-family: inherit; font-size: 16px; }
button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 13px 22px;
  min-height: 48px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
button:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary {
  background: linear-gradient(135deg, #0073ec, #a644e5);
  color: #fff;
  box-shadow: 0 8px 20px rgba(70, 40, 200, 0.35);
}
.primary:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 10px 26px rgba(70, 40, 200, 0.45); }
.ghost { background: rgba(255, 255, 255, 0.92); color: var(--ink); box-shadow: var(--shadow-sm); }
.ghost:hover:not(:disabled) { background: #fff; }
.danger { background: linear-gradient(135deg, #ff4a48, #f59d00); color: #fff; box-shadow: 0 8px 20px rgba(255, 74, 72, 0.4); }
button.tiny { min-height: 36px; padding: 7px 14px; font-size: 13px; font-weight: 700; }

/* ---- inputs ---- */
input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--smoke);
  border-radius: var(--radius-md);
  background: var(--off-white);
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input:focus { outline: none; border-color: var(--azure); background: #fff; }

/* ---- landing / lobby panels ---- */
.card-panel {
  max-width: 640px;
  margin: 4vh auto;
  background: #fff;
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
}
.logo {
  font-size: clamp(40px, 13vw, 72px);
  line-height: 0.95;
  margin: 6px 0 0;
  text-align: center;
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
  background: linear-gradient(120deg, #a644e5, #0073ec);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tagline { text-align: center; color: var(--galactic); margin-top: 2px; font-weight: 600; }
.field { display: block; margin: 16px 0; }
.field > span { display: block; font-size: 13px; color: var(--metal); margin-bottom: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.field.small { margin: 10px 0; }
/* Avatar picker on the landing page */
.avatar-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-opt {
  width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 12px; font-size: 24px; line-height: 1;
  background: var(--off-white, #f2f4f7); border: 2px solid var(--smoke); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: transform 0.1s, border-color 0.12s, box-shadow 0.12s;
}
.avatar-opt:hover { transform: translateY(-1px); }
.avatar-opt.selected { border-color: var(--azure); box-shadow: 0 0 0 3px rgba(0, 115, 236, 0.22); background: #fff; }
.landing-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.landing-col { display: flex; flex-direction: column; }
.landing-col h3 { color: var(--ink); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--cloudy); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--smoke); }
.divider span { padding: 0; font-size: 12px; text-transform: uppercase; font-weight: 700; }
.small-note { font-size: 13px; margin: 4px 0 14px; }

/* Play now — Quick Play + live open-tables list */
.play-now { margin: 2px 0 18px; }
.play-now-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.play-now-head h3 { color: var(--ink); }
.quickplay {
  flex: none; width: auto; margin: 0;
  background: linear-gradient(135deg, var(--sunflower), var(--tangerine)); color: var(--ink);
  padding: 9px 18px; font-size: 15px; font-weight: 800; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(245, 157, 0, 0.4);
}
.quickplay:hover:not(:disabled) { filter: brightness(1.05); box-shadow: 0 8px 20px rgba(245, 157, 0, 0.5); }
.open-tables-list { display: flex; flex-direction: column; gap: 7px; max-height: 216px; overflow-y: auto; }
.open-table {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--off-white); border: 1px solid var(--smoke); border-radius: var(--radius-sm);
}
.ot-avatars { flex: none; font-size: 17px; letter-spacing: -3px; }
.ot-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.ot-info b { color: var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ot-count { color: var(--galactic); font-size: 11.5px; font-weight: 600; }
.ot-join {
  flex: none; background: var(--azure); color: #fff; font-weight: 800; font-size: 13px;
  border: none; border-radius: 999px; padding: 7px 17px; cursor: pointer;
}
.ot-join:hover { filter: brightness(1.07); }
.ot-join:active { transform: translateY(1px); }
.open-tables-empty { color: var(--galactic); font-size: 13px; margin: 2px 0; padding: 4px 2px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--metal); margin: 2px 0 12px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--azure); }
.code-badge {
  background: var(--sunflower); color: #14121f; font-weight: 800;
  padding: 3px 12px; border-radius: 999px; letter-spacing: 3px; font-family: 'Poppins', monospace;
}
.rules-teaser { margin-top: 18px; }
.rules-teaser summary { cursor: pointer; color: var(--azure); font-weight: 700; }

.seat-list { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.seat-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 2px solid var(--off-white); border-radius: var(--radius-md);
  background: var(--off-white); font-weight: 700;
}
.seat-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--turtle); box-shadow: 0 0 0 4px rgba(0, 202, 170, 0.2); flex: none; }
.seat-dot.off { background: var(--cloudy); box-shadow: none; }
.seat-list li.seat-open { border-style: dashed; border-color: var(--smoke); background: #fff; font-weight: 600; }
.seat-tags { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.seat-host { font-size: 11px; color: #14121f; background: var(--sunflower); padding: 3px 10px; border-radius: 999px; font-weight: 800; }
.seat-bot { font-size: 11px; color: #fff; background: var(--prince); padding: 3px 10px; border-radius: 999px; font-weight: 800; }
.seat-remove { min-height: 26px; padding: 2px 9px; border-radius: 999px; background: var(--smoke); color: var(--metal); font-weight: 800; font-size: 13px; }

/* table-size stepper + bot controls */
.table-size { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 4px; }
.ts-label { font-size: 13px; font-weight: 700; color: var(--metal); text-transform: uppercase; letter-spacing: 0.04em; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper-val { font-weight: 800; font-size: 20px; min-width: 20px; text-align: center; }
.stepper-unit { font-size: 12px; color: var(--galactic); font-weight: 600; }
.stepper-btns { display: inline-flex; gap: 6px; margin-left: 4px; } /* both steppers together, not either side of the value */
.stepper .tiny { min-height: 34px; min-width: 38px; padding: 4px 12px; font-size: 20px; line-height: 1; }
.lobby-bot-controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
.lobby-bot-controls .ghost { flex: 1 1 auto; }

/* ============================================================
   Ad slot (reserved marketing space)
   ============================================================ */
.ad-slot {
  display: flex; align-items: center; gap: 10px;
  margin: 5px 12px; padding: 6px 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, #14121f 0%, #2a1a5c 55%, #0073ec 130%);
  color: #fff; text-decoration: none;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative; overflow: hidden;
  min-height: 46px; flex: none;
}
.ad-slot::after {
  content: ''; position: absolute; right: -30px; top: -40px; width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(166, 68, 229, 0.55), transparent 70%);
  pointer-events: none;
}
.ad-tag {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em;
  background: rgba(255, 255, 255, 0.18); color: #fff; padding: 3px 7px; border-radius: 6px;
  align-self: flex-start; flex: none;
}
.ad-copy { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.ad-title { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-sub { font-size: 11px; color: #d7c9ff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-cta {
  flex: none; font-weight: 800; font-size: 12.5px; white-space: nowrap;
  background: var(--sunflower); color: #14121f; padding: 8px 13px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(255, 218, 0, 0.28);
}
.ad-slot--landing { margin: 16px 0 0; }

/* ---- Adaptive bottom banner ad (in-game): 75px tall, two rows, stands out --- */
.ad-banner {
  flex: none; position: relative; overflow: hidden;
  display: flex; align-items: stretch;
  /* Compact 64px band. The interactive Get VPS button lives on the top row,
     clear of the home indicator, so we only keep a small bottom cushion rather
     than reserving the full safe-area inset (which made the ad tower). */
  height: 64px;
  padding: 4px 13px 8px;
  text-decoration: none; color: #fff;
  background: linear-gradient(100deg, #2a0f4d 0%, #6a1fb0 24%, #0073ec 60%, #00caaa 100%);
  background-size: 220% 100%;
  border-top: 1.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 -6px 22px rgba(120, 40, 220, 0.4);
  animation: adDrift 9s ease-in-out infinite;
}
/* Two stacked rows: [Ad] [DreamHost logo] … [Get VPS] on top; a big headline
   ("Your App Here") with a small tagline below. */
.ad-banner-inner { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; position: relative; }
.ad-top-row { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 5px; }
.ad-bottom-row { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.ad-headline { flex: none; font-size: 19px; font-weight: 900; letter-spacing: -0.03em; color: #fff; white-space: nowrap; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.ad-subhead { flex: 0 1 auto; min-width: 0; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes adDrift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
/* diagonal shine sweep across the whole banner */
.ad-banner-shine {
  position: absolute; top: 0; left: 0; height: 100%; width: 55%; pointer-events: none;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
  transform: skewX(-18deg) translateX(-160%);
  animation: adShine 4.6s ease-in-out infinite;
}
@keyframes adShine { 0% { transform: skewX(-18deg) translateX(-160%); } 58%, 100% { transform: skewX(-18deg) translateX(340%); } }
.ad-banner-tag {
  flex: none; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em;
  background: rgba(255, 255, 255, 0.22); padding: 2px 5px; border-radius: 5px;
}
.dh-logo { flex: none; display: block; height: 20px; width: auto; }
.ad-banner-cta {
  flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  /* margin-left:auto pins the CTA to the right edge, which reads well on a
     phone but strands it ~960px from the headline on a 1280px desktop. Above
     phone widths, centre the row as a group (like .ad-bottom-row) and hold the
     headline-to-CTA distance a 375px phone has: 73px, 8px of which is the
     row's own gap. See the @media rule below. */
  font-weight: 800; font-size: 13px; color: #14121f;
  background: var(--sunflower); padding: 5px 13px; border-radius: 999px;
  box-shadow: 0 3px 12px rgba(255, 218, 0, 0.5);
  animation: adGlow 2.2s ease-in-out infinite;
}
@keyframes adGlow { 0%, 100% { box-shadow: 0 3px 12px rgba(255, 218, 0, 0.45); } 50% { box-shadow: 0 3px 18px rgba(255, 218, 0, 0.9); } }
.ad-banner-arrow { display: inline-block; animation: adArrow 1.4s ease-in-out infinite; }
@keyframes adArrow { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
/* Past the widest phones, stop stretching the ad's top row edge to edge —
   centre it like the row beneath it, keeping the phone's 73px headline-to-CTA
   distance (65px here + the row's 8px gap). */
@media (min-width: 480px) {
  .ad-top-row { justify-content: center; }
  .ad-banner-cta { margin-left: 65px; }
}

@media (prefers-reduced-motion: reduce) {
  .ad-banner, .ad-banner-cta, .ad-banner-arrow { animation: none; }
  .ad-banner-shine { display: none; }
}

/* "Add to home screen" prompt on the landing card */
/* Resume card — an unfinished solo game waiting to be picked back up */
.resume-card {
  margin: 2px 0 16px; padding: 12px;
  background: linear-gradient(135deg, #123a2a, #1b2c52);
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 14px;
}
.resume-head { display: flex; align-items: center; gap: 10px; }
.resume-icon { flex: none; font-size: 22px; line-height: 1; }
.resume-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.resume-text b { font-size: 13px; font-weight: 700; color: #fff; }
.resume-meta { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.72); }
.resume-actions { display: flex; gap: 8px; margin-top: 10px; }
.resume-actions button { flex: 1; min-height: 40px; }

/* A bot is playing this player's seat (they were idle too long) */
.seat-notice {
  margin: 4px 12px 0; padding: 7px 12px; border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9); font-weight: 700; font-size: 12.5px;
}

.install-prompt {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 0 16px; padding: 10px 12px;
  background: linear-gradient(135deg, #0b2a52, #2c1650);
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 14px;
}
.install-icon { flex: none; font-size: 22px; line-height: 1; }
.install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.install-text b { font-size: 13px; font-weight: 700; color: #fff; }
.install-hint { font-size: 11px; font-weight: 500; color: rgba(255, 255, 255, 0.72); }
.install-hint b { font-weight: 700; color: rgba(255, 255, 255, 0.9); }
.ios-share { width: 12px; height: 15px; color: #4aa3ff; vertical-align: -3px; margin: 0 1px; }
.install-btn {
  flex: none; background: var(--sunflower); color: #14121f;
  font-weight: 800; font-size: 13px; border: none; border-radius: 999px;
  padding: 5px 16px; cursor: pointer;
}
.install-btn:active { transform: translateY(1px); }
.install-x {
  flex: none; background: transparent; border: none; color: rgba(255, 255, 255, 0.5);
  font-size: 20px; line-height: 1; padding: 2px 4px; cursor: pointer;
}
.install-x:hover { color: rgba(255, 255, 255, 0.85); }

/* ============================================================
   Game screen — mobile-first vertical stack
   ============================================================ */
#game { display: flex; flex-direction: column; height: 100dvh; min-height: 100dvh; overflow: hidden; }

#topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 14px; padding-top: max(6px, env(safe-area-inset-top));
  color: #fff; flex: none;
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.brand-mark { font-weight: 900; font-size: 16px; letter-spacing: -0.03em; color: #fff; flex: none; white-space: nowrap; }
.round-info { font-weight: 700; font-size: 12.5px; opacity: 0.95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.code-badge { flex: none; }
.invite-btn {
  /* Action gradient, not the code badge's yellow — the room code is the hero
     here, so the button beside it reads as the thing you press instead. */
  flex: none; background: linear-gradient(135deg, #0073ec, #a644e5); color: #fff;
  font-family: inherit;
  font-weight: 800; font-size: 12.5px; border: none; cursor: pointer;
  padding: 3px 15px; border-radius: 999px; box-shadow: 0 2px 8px rgba(70, 40, 200, 0.35);
  min-height: 25px; /* base button sets 48px; keep it >= the 24px tap-target floor */
}
.invite-btn:hover { filter: brightness(1.06); }
.invite-btn:active { transform: translateY(1px); }
#lobbyInviteBtn { margin-left: 10px; vertical-align: middle; }
.topbar-right { display: flex; align-items: center; gap: 5px; flex: none; }
/* Slim top-menu buttons to preserve vertical screen space. */
.topbar-right .ghost { min-height: 28px; padding: 3px 11px; font-size: 12.5px; }
.topbar-right .invite-btn { min-height: 28px; padding: 3px 14px; }

.opponents {
  display: flex; gap: 8px; padding: 2px 12px 6px; overflow-x: auto; flex: none;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.opponents::-webkit-scrollbar { display: none; }
.opp {
  background: rgba(255, 255, 255, 0.95); border-radius: 12px; padding: 6px 10px;
  min-width: 104px; flex: none; border: 2px solid transparent; box-shadow: var(--shadow-sm);
}
.opp.turn { border-color: var(--sunflower); box-shadow: 0 0 0 3px rgba(255, 218, 0, 0.35); }
.opp .opp-name { font-weight: 800; font-size: 12.5px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; line-height: 1.1; }
.opp-av { font-size: 15px; line-height: 1; }
.opp .opp-meta { font-size: 10.5px; color: var(--galactic); margin-top: 2px; font-weight: 600; }
.badge { font-size: 8.5px; padding: 1px 6px; border-radius: 999px; color: #fff; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.badge.laid { background: var(--turtle); }
.badge.stranded { background: var(--prince); }
.badge.out { background: var(--sunflower); color: #14121f; }
/* Unmistakable "it's your turn": the whole chip goes bright yellow and pulses. */
.opp.your-turn {
  background: linear-gradient(135deg, #fff0a6, var(--sunflower));
  border-color: #e0a800;
  animation: yourTurnPulse 1.2s ease-in-out infinite;
}
.opp.your-turn .opp-meta { color: rgba(20, 18, 31, 0.72); }
.badge.yourturn { background: #14121f; color: var(--sunflower); font-size: 9px; }
@keyframes yourTurnPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 218, 0, 0.55), 0 4px 14px rgba(255, 218, 0, 0.35); }
  50%      { box-shadow: 0 0 0 7px rgba(255, 218, 0, 0.85), 0 6px 20px rgba(255, 218, 0, 0.6); }
}
@media (prefers-reduced-motion: reduce) {
  .opp.your-turn { animation: none; box-shadow: 0 0 0 4px rgba(255, 218, 0, 0.75); }
}

/* contextual banner (buy / rummy) */
/* Fixed-height status/action strip: one truncating line of text + right-aligned
   actions. Always visible — idle shows the last play by another player. */
.banner {
  margin: 4px 12px; padding: 6px 12px; border-radius: var(--radius-md);
  height: 50px; flex: none; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; overflow: hidden;
  color: #14121f; font-weight: 700; font-size: 13.5px;
  background: linear-gradient(120deg, var(--sunflower), var(--tangerine));
}
.banner.buy { background: linear-gradient(120deg, var(--sunflower), var(--tangerine)); color: #14121f; }
.banner.bust { background: linear-gradient(120deg, var(--prince), var(--coral)); color: #fff; }
.banner.idle { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.9); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: none; }
.banner.notice { background: linear-gradient(120deg, var(--azure), var(--turtle)); color: #fff; animation: bannerNoticePop 0.25s ease; }
@keyframes bannerNoticePop { from { filter: brightness(1.4); } to { filter: brightness(1); } }
.banner-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.banner-actions { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.banner button { min-height: 36px; padding: 7px 15px; }
.banner-chip { flex: none; font-weight: 800; font-size: 12.5px; white-space: nowrap; opacity: 0.95; }
/* A card drawn inline in the notification bar, instead of spelling it "7♠".
   Sized to sit on the 50px bar's text line without changing its height. */
.banner-card {
  display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  min-width: 26px; height: 30px; padding: 0 4px; margin: 0 2px; vertical-align: middle;
  background: #fff; border-radius: 5px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  font-weight: 900; line-height: 1; font-size: 13px;
}
.banner-card.red { color: var(--card-red); }
.banner-card.black { color: var(--card-black); }
.banner-card.joker { background: linear-gradient(135deg, #a644e5, #0073ec); color: #fff; }
.banner-card.unknown { background: rgba(255, 255, 255, 0.5); color: var(--metal); }
.banner-card .bc-suit { font-size: 12px; }

/* ---------- table chat (private tables only) ---------- */
/* A drawer over the board: the game screen has no spare vertical space, so
   chat borrows the board's while it's open and gives it straight back. */
#chatBtn { position: relative; }
.chat-badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--coral); color: #fff;
  font-size: 10px; font-weight: 900; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px rgba(7, 28, 38, 0.9);
}
.chat-drawer {
  position: fixed; z-index: 40; right: 0; left: auto;
  top: calc(52px + env(safe-area-inset-top, 0px));
  bottom: calc(env(safe-area-inset-bottom, 0px));
  width: min(400px, 100%);
  display: flex; flex-direction: column;
  background: #0f2733; border-left: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: -14px 0 40px rgba(0, 0, 0, 0.5);
  animation: chatIn 0.18s ease-out both;
}
@keyframes chatIn { from { transform: translateX(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.chat-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; color: #fff; font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.chat-close {
  background: none; border: none; box-shadow: none; min-height: 0; padding: 2px 6px;
  color: rgba(255, 255, 255, 0.75); font-size: 24px; line-height: 1;
}
.chat-close:hover { color: #fff; }
.chat-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 9px;
}
.chat-empty { color: rgba(255, 255, 255, 0.45); font-size: 13px; margin: auto; text-align: center; }
.chat-msg { max-width: 88%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-meta {
  display: flex; gap: 7px; align-items: baseline; margin-bottom: 2px;
  font-size: 10.5px; color: rgba(255, 255, 255, 0.55);
}
.chat-msg.mine .chat-meta { justify-content: flex-end; }
.chat-who { font-weight: 800; color: rgba(255, 255, 255, 0.85); }
.chat-text {
  background: rgba(255, 255, 255, 0.1); color: #fff;
  padding: 7px 11px; border-radius: 13px; font-size: 13.5px; font-weight: 600;
  line-height: 1.35; word-break: break-word; overflow-wrap: anywhere; text-align: left;
}
.chat-msg.mine .chat-text { background: linear-gradient(135deg, #0073ec, #a644e5); }
.chat-form { flex: none; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(255, 255, 255, 0.12); }
.chat-form input {
  flex: 1 1 auto; min-width: 0; padding: 10px 13px; font-size: 16px; /* 16px stops iOS zooming on focus */
  border-radius: var(--radius-md); border: 2px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08); color: #fff;
}
.chat-form input::placeholder { color: rgba(255, 255, 255, 0.45); }
.chat-form input:focus { outline: none; border-color: var(--azure); background: rgba(255, 255, 255, 0.14); }
.chat-form button { flex: none; min-height: 42px; padding: 9px 17px; font-size: 14px; }
.chat-error { color: var(--coral); font-size: 12px; font-weight: 700; margin: 0 12px 8px; min-height: 0; }
.chat-error:empty { display: none; }

/* Lobby chat: inline in the card, so the seat list stays in view while you
   talk — that's the whole point of it during the wait. */
.lobby-chat { margin-top: 20px; border-top: 1px solid var(--smoke); padding-top: 14px; }
.lobby-chat-title { font-size: 14px; color: var(--metal); margin-bottom: 8px; }
.lobby-chat-log {
  max-height: 200px; min-height: 64px;
  background: var(--off-white); border: 1px solid var(--smoke);
  border-radius: var(--radius-md); padding: 10px;
}
/* The drawer is dark over the board; in the light lobby card it needs the
   opposite treatment, so re-tint just the pieces that assume a dark ground. */
.lobby-chat-log .chat-empty { color: var(--galactic); }
.lobby-chat-log .chat-meta { color: var(--galactic); }
.lobby-chat-log .chat-who { color: var(--metal); }
.lobby-chat-log .chat-text { background: #fff; color: var(--ink); border: 1px solid var(--smoke); }
.lobby-chat-log .chat-msg.mine .chat-text { background: linear-gradient(135deg, #0073ec, #a644e5); color: #fff; border-color: transparent; }
.lobby-chat-form { border-top: none; padding: 10px 0 0; }
.lobby-chat-form input {
  border: 2px solid var(--smoke); background: var(--off-white); color: var(--ink);
}
.lobby-chat-form input::placeholder { color: var(--galactic); }
.lobby-chat-form input:focus { border-color: var(--azure); background: #fff; }
.lobby-chat .chat-error { margin: 6px 0 0; }

/* THE BOARD — everyone's laid-down melds fill this scrollable region */
.board { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 12px; }
.melds { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-content: flex-start; min-height: 100%; }

/* FEATURED PILES — while the table has no Sets/Runs, the piles move up here,
   grow large and centered, and become the main thing you tap. */
/* `safe center` keeps content centered when it fits but falls back to the top
   (never clipping the round pill) when it doesn't; scroll reaches the rest. */
.board.featured { display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: min(20px, 2.4vh); overflow-y: auto; }
.board.featured #melds { display: none; }
/* Pile size scales with viewport height so the round pill + instructive text
   below the piles are ALWAYS visible, even on short screens. */
.piles.featured { gap: min(30px, 7vw); }
/* --feat-pile-w is set per-render from the board's real free height (app.js). */
.piles.featured .pile-card { width: var(--feat-pile-w, 96px); height: calc(var(--feat-pile-w, 96px) * 1.4); border-radius: 15px; font-size: calc(var(--feat-pile-w, 96px) * 0.34); box-shadow: var(--shadow-lg); }
.piles.featured .pile .pcard { width: var(--feat-pile-w, 96px); font-size: calc(var(--feat-pile-w, 96px) * 0.28); }
.piles.featured .pile-label { font-size: 14px; margin-top: 9px; }
.piles.featured .pile.clickable .pile-card { outline: 5px solid var(--sunflower); animation: pilePulse 1.6s ease-in-out infinite; }
@keyframes pilePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 218, 0, 0.0), var(--shadow-lg); }
  50%      { box-shadow: 0 0 0 10px rgba(255, 218, 0, 0.28), var(--shadow-lg); }
}
.table-hint { color: rgba(255, 255, 255, 0.92); font-weight: 700; font-size: 15px; text-align: center; max-width: 300px; line-height: 1.4; margin: 0; }

/* Always-visible reminder of what this Round needs — sticks to the top of the
   table so friends never have to ask "what are we going for?" */
.round-goal {
  align-self: center; margin: 0 auto 8px; position: sticky; top: 0; z-index: 3;
  display: inline-flex; align-items: center; gap: 9px;
  background: linear-gradient(120deg, var(--prince), var(--azure));
  color: #fff; padding: 5px 15px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28); box-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.round-goal { cursor: pointer; }
.round-goal .rg-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.9; font-weight: 800; }
.round-goal .rg-value { font-size: 14px; font-weight: 800; }
/* Marks the pill as tappable — it reopens the round instructions. */
.round-goal .rg-help {
  font-size: 10px; font-weight: 900; line-height: 1; width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

/* ---------- round intro carousel ---------- */
.intro-body { max-width: 420px; text-align: center; position: relative; }
.intro-skip {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  background: none; border: none; box-shadow: none; min-height: 0;
  padding: 4px 6px; font-size: 12.5px; font-weight: 700; color: var(--galactic);
}
.intro-skip:hover { color: var(--ink); }
.intro-slide { min-height: 292px; display: flex; flex-direction: column; justify-content: center; }
.intro-slide.slide-in { animation: introIn 0.22s ease-out both; }
@keyframes introIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.intro-kicker {
  font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--violet); margin-bottom: 6px;
}
.intro-title { font-size: 23px; margin: 0 0 8px; line-height: 1.15; }
.intro-blurb { margin: 0 auto 14px; color: var(--metal); font-size: 14.5px; max-width: 34ch; }
.intro-note {
  margin: 14px auto 0; font-size: 12.5px; color: var(--galactic); max-width: 36ch;
  background: var(--off-white); border-radius: var(--radius-md); padding: 9px 12px;
}

/* Example cards, scaled down from the real ones so a Run of 4 fits on mobile. */
.intro-cards { display: flex; gap: 7px; justify-content: center; flex-wrap: nowrap; }
.intro-cards .pcard {
  width: 60px; height: 84px; flex: none; cursor: default; transform: none;
  box-shadow: var(--shadow-sm);
}
.intro-cards .pcard .rank { font-size: 21px; }
.intro-cards .pcard .suit { font-size: 20px; }
.intro-cards .pcard .joker-label { font-size: 8px; }
/* A Run example is 4 cards wide, which clips on a 320px phone — shrink it
   there rather than letting the fourth card fall off the edge. */
@media (max-width: 359px) {
  .intro-cards { gap: 5px; }
  .intro-cards .pcard { width: 50px; height: 70px; }
  .intro-cards .pcard .rank { font-size: 17px; }
  .intro-cards .pcard .suit { font-size: 16px; }
  .intro-facedown { width: 50px; height: 70px; font-size: 16px; }
}

/* Buy / Bust demo visuals. */
.intro-demo { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.intro-cards.mini .pcard { width: 44px; height: 62px; }
.intro-cards.mini .pcard .rank { font-size: 15px; }
.intro-cards.mini .pcard .suit { font-size: 14px; }
.intro-cards.bad .pcard { outline: 2px solid var(--coral); outline-offset: 2px; }
.intro-plus { font-size: 19px; font-weight: 900; color: var(--galactic); align-self: center; }
.intro-facedown {
  width: 60px; height: 84px; flex: none; border-radius: 10px;
  background: linear-gradient(135deg, #a644e5, #0073ec); color: #fff;
  border: 2px solid #fff; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.intro-caps {
  display: flex; gap: 26px; justify-content: center; margin-top: 2px;
  font-size: 10.5px; font-weight: 700; color: var(--galactic); text-align: center;
}
.intro-caps.one { gap: 0; }
/* The "= 2 more cards" total under the Buy demo — the cost of a Buy. */
.intro-cost { margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--coral); }
.intro-caps .bust-word { color: var(--coral); font-weight: 800; }
.intro-arrow { font-size: 17px; font-weight: 900; color: var(--cloudy); line-height: 1; margin: 1px 0; }

/* The round's contract, as one chip per required group. */
.intro-contract { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }
.intro-chip {
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  padding: 12px 15px; border-radius: var(--radius-md); color: #fff; min-width: 88px;
}
.intro-chip.chip-set { background: linear-gradient(135deg, #0073ec, #6e3ce0); }
.intro-chip.chip-run { background: linear-gradient(135deg, #a644e5, #ff4a48); }
.intro-chip .ic-kind { font-weight: 900; font-size: 15px; letter-spacing: -0.01em; }
.intro-chip .ic-sub { font-size: 10.5px; opacity: 0.92; font-weight: 700; }

.intro-steps { display: grid; gap: 9px; text-align: left; margin: 0 auto; max-width: 32ch; }
.intro-step { display: flex; gap: 10px; align-items: flex-start; }
.intro-step .is-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, #0073ec, #a644e5); color: #fff;
  font-weight: 900; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.intro-step .is-text { font-size: 13.5px; color: var(--metal); line-height: 1.35; }

.intro-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.intro-foot.solo { justify-content: flex-end; } /* no dots to balance against */
.intro-dots { display: flex; gap: 6px; }
.intro-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--smoke); transition: background 0.15s ease; }
.intro-dot.on { background: var(--violet); }
.intro-nav { display: flex; gap: 8px; }
.intro-nav button { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.board.featured .round-goal { position: static; }
.melds .empty-note { color: rgba(255, 255, 255, 0.5); margin: auto; font-weight: 600; text-align: center; width: 100%; padding: 8px; font-size: 13px; }

/* ---------- opening deal animation ---------- */
#dealOverlay {
  position: fixed; inset: 0; z-index: 200; padding: 20px; overflow: hidden;
  background: radial-gradient(circle at 50% 32%, #10314a 0%, var(--midnight) 68%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}
#dealOverlay.fadeout { opacity: 0; transition: opacity 0.32s ease; }
.deal-title { color: #fff; font-weight: 900; font-size: 19px; letter-spacing: -0.02em; text-align: center; }
.deal-subtitle { color: rgba(255, 255, 255, 0.85); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.deal-dealer-chip { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: var(--sunflower); color: #14121f; font-size: 10px; font-weight: 900; }

/* Round table: deck in the middle, players (avatars) around the rim. */
.deal-table { position: relative; width: min(82vw, 60vh, 340px); aspect-ratio: 1; margin: 2px auto; border-radius: 50%;
  background: radial-gradient(circle at 50% 46%, rgba(0, 115, 236, 0.18), rgba(0, 0, 0, 0) 68%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06), inset 0 0 40px rgba(0, 0, 0, 0.3); }
.deal-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px; }
.deal-deck, .deal-discard { width: 58px; height: 82px; border-radius: 10px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); }
.deal-deck { background: linear-gradient(150deg, var(--violet), var(--azure)); color: #fff; }
.deal-deck .deck-wordmark { font-size: 15px; }
.deal-deck.kick { animation: dealKick 0.18s ease; }
@keyframes dealKick { 0% { transform: scale(1); } 45% { transform: scale(1.07) rotate(-2deg); } 100% { transform: scale(1); } }
.deal-discard { background: #fff; overflow: hidden; }
.deal-discard.empty { background: rgba(255, 255, 255, 0.06); border: 2px dashed rgba(255, 255, 255, 0.22); color: rgba(255, 255, 255, 0.4); font-weight: 900; }
.deal-discard .pcard { width: 50px; box-shadow: none; }

.deal-seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; width: 78px; }
.deal-avatar { position: relative; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04));
  border: 2px solid rgba(255, 255, 255, 0.28); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  transition: border-color 0.15s, box-shadow 0.15s; }
.deal-seat.active .deal-avatar { border-color: var(--sunflower); box-shadow: 0 0 0 4px rgba(255, 218, 0, 0.35), 0 3px 10px rgba(0, 0, 0, 0.4); }
.deal-avatar.pop { animation: avatarPop 0.3s ease; }
@keyframes avatarPop { 0% { transform: scale(1); } 45% { transform: scale(1.17); } 100% { transform: scale(1); } }
.deal-dealer-badge { position: absolute; right: -3px; bottom: -3px; width: 19px; height: 19px; border-radius: 50%; background: var(--sunflower); color: #14121f; font-size: 11px; font-weight: 900; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); }
.deal-seat-name { color: #fff; font-weight: 800; font-size: 11px; white-space: nowrap; max-width: 86px; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.deal-seat-count { color: var(--sunflower); font-weight: 800; font-size: 11px; }
.deal-skip { color: rgba(255, 255, 255, 0.45); font-size: 12px; font-weight: 700; }
.deal-fly {
  position: fixed; width: 30px; height: 42px; border-radius: 5px; z-index: 201;
  background: linear-gradient(150deg, var(--violet), var(--azure)); border: 1.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); will-change: transform, opacity;
  transition: transform 0.3s cubic-bezier(0.45, 0, 0.3, 1), opacity 0.24s ease;
}
@media (prefers-reduced-motion: reduce) { .deal-fly { transition-duration: 0.12s; } .deal-deck.kick, .deal-avatar.pop { animation: none; } }
.meld {
  background: rgba(255, 255, 255, 0.1); border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md); padding: 6px 8px; color: #fff;
}
.meld.mine { border-color: rgba(255, 218, 0, 0.5); background: rgba(255, 218, 0, 0.09); }
/* a selected card can be added here */
.meld.can-add { outline: 3px solid var(--turtle); box-shadow: 0 0 0 4px rgba(0, 202, 170, 0.28); cursor: pointer; }
/* a selected card cannot be added here — de-emphasise */
.meld.no-add { opacity: 0.45; }
/* dragging a card over an addable Set/Run */
.meld.drag-hover { outline: 4px solid var(--turtle); transform: scale(1.05); box-shadow: 0 0 0 6px rgba(0, 202, 170, 0.35); }
.meld { transition: transform 0.1s ease, opacity 0.1s ease; }
.meld-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; margin-bottom: 4px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.add-cue { text-transform: none; letter-spacing: 0; background: var(--turtle); color: #04231d; font-weight: 800; padding: 1px 7px; border-radius: 999px; font-size: 10px; }
.meld-cards { display: flex; gap: 3px; }

/* COMPACT DECK — piles + contextual actions in one row, near the thumb */
.deck { display: flex; align-items: center; gap: 12px; padding: 6px 12px; flex: none; }
.piles { display: flex; gap: 12px; flex: none; }
.pile { text-align: center; }
.pile-card {
  width: 50px; height: 70px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 900; background: #fff; box-shadow: var(--shadow-sm); user-select: none;
}
.pile-card.back { background: linear-gradient(135deg, #a644e5, #0073ec); color: #fff; border: 2px solid #fff; letter-spacing: 0; }
/* Card-back wordmark — the same Poppins treatment as the LAID OUT topbar mark. */
.deck-wordmark { font-family: 'Poppins', sans-serif; font-weight: 900; line-height: 0.9; font-size: 0.62em; letter-spacing: -0.03em; display: block; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.pile-card.empty { background: rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.7); border: 2px dashed rgba(255, 255, 255, 0.6); }
.pile.discard .pile-card:not(.empty) { background: transparent; box-shadow: none; width: auto; height: auto; }
.pile .pcard { width: 50px; font-size: 14px; }
.pile-label { color: rgba(255, 255, 255, 0.85); font-size: 10px; margin-top: 3px; font-weight: 700; }
.pile-count { color: rgba(255, 255, 255, 0.5); font-weight: 600; }
.pile.clickable .pile-card { outline: 3px solid var(--sunflower); cursor: pointer; }
.pile.discard.drop-armed .pile-card { outline: 2px dashed rgba(255, 255, 255, 0.8); }
.pile.discard.drop-hover .pile-card { outline: 4px solid var(--turtle); transform: scale(1.08); box-shadow: 0 0 0 5px rgba(0, 202, 170, 0.3); }
.pile.discard { transition: transform 0.1s ease; }

/* ---- playing cards (size-relative to font-size) ---- */
.pcard {
  width: clamp(46px, 12.6vw, 58px); aspect-ratio: 5 / 7;
  font-size: clamp(13px, 3.7vw, 17px);
  background: #fff; border-radius: 0.5em; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.04em;
  box-shadow: 0 3px 8px rgba(20, 10, 50, 0.28); user-select: none; flex: none;
  border: 1px solid var(--smoke);
}
.pcard .rank { font-size: 2em; font-weight: 900; line-height: 0.85; letter-spacing: -0.04em; }
.pcard .suit { font-size: 1.75em; line-height: 0.85; }
.pcard.red { color: var(--card-red); }
.pcard.black { color: var(--card-black); }
.pcard.joker { background: linear-gradient(140deg, #ffe27a, #a644e5); color: #3a1160; border-color: transparent; }
.pcard.joker .rank { font-size: 2.5em; }
.pcard .joker-label { font-size: 0.72em; font-weight: 800; letter-spacing: 0.06em; }

.hand .pcard { cursor: grab; transition: transform 0.09s ease, box-shadow 0.12s ease; touch-action: none; }
.hand .pcard:active { cursor: grabbing; }
.hand .pcard.selected { outline: 4px solid var(--azure); transform: translateY(-12px); box-shadow: 0 12px 22px rgba(0, 115, 236, 0.4); }

/* Freshly-arrived cards (drawn, Bought, received in a Bust) glow, then settle. */
@keyframes newCardGlow {
  0%   { box-shadow: 0 0 16px 5px rgba(255, 218, 0, 0.95), 0 0 0 2px rgba(255, 218, 0, 0.85); }
  55%  { box-shadow: 0 0 12px 3px rgba(255, 218, 0, 0.6), 0 0 0 2px rgba(255, 218, 0, 0.5); }
  100% { box-shadow: 0 3px 8px rgba(20, 10, 50, 0.28); }
}
.hand .pcard.new-card { animation: newCardGlow 2.4s ease-out forwards; }
@media (prefers-reduced-motion: reduce) {
  .hand .pcard.new-card { animation: none; box-shadow: 0 0 0 2px rgba(255, 218, 0, 0.85); }
}
.hand .pcard.dragging { opacity: 0.6; outline: 4px dashed var(--sunflower); transform: translateY(-6px) scale(1.04); z-index: 5; }
.meld-cards .pcard { width: clamp(40px, 10.5vw, 48px); font-size: clamp(11px, 3vw, 14px); cursor: pointer; }

/* action bar — compact buttons, fills the deck row beside the piles */
.action-bar {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center;
  flex: 1 1 auto; min-width: 0;
}
.action-bar button { min-height: 42px; padding: 9px 14px; font-size: 14px; border-radius: 12px; flex: 0 1 auto; }
.action-bar .hint-text { color: rgba(255, 255, 255, 0.9); font-size: 13px; font-weight: 600; text-align: center; width: 100%; }

/* hand */
.hand-area {
  background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px);
  /* No safe-area inset here — the ad banner below owns the bottom edge, so this
     stays a slim fixed pad and the table above gets the reclaimed height. */
  padding: 10px 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.2); flex: none;
}
.hand-header { color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; font-weight: 700; flex-wrap: wrap; }
.hand-header .drag-note { color: rgba(255, 255, 255, 0.75); font-size: 11px; font-weight: 500; }
.hand-header .hint { color: var(--sunflower); font-weight: 700; }
.hand-header-right { display: flex; align-items: center; gap: 6px; }
.sort-label { color: rgba(255, 255, 255, 0.85); font-size: 12px; font-weight: 700; }
#sortControls { display: inline-flex; align-items: center; gap: 6px; }
.hand { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

/* log feed — slim on mobile */
/* one-line ticker: only the latest message shows; tap to open the full feed */
.log-feed {
  overflow: hidden; padding: 4px 14px calc(4px + env(safe-area-inset-bottom));
  font-size: 11px; color: rgba(255, 255, 255, 0.75); background: rgba(7, 28, 38, 0.4); flex: none;
  white-space: nowrap; text-overflow: ellipsis; cursor: pointer; position: relative;
}
.log-feed::after { content: '↑ Activity'; float: right; color: rgba(255, 255, 255, 0.5); font-weight: 700; padding-left: 10px; }
.log-feed div { display: none; overflow: hidden; text-overflow: ellipsis; }
.log-feed div:last-child { display: block; margin-right: 68px; }

.activity-list { max-height: 62vh; overflow-y: auto; margin-top: 6px; border: 1px solid var(--smoke); border-radius: var(--radius-md); }
.activity-row { padding: 8px 12px; font-size: 13.5px; color: var(--metal); border-bottom: 1px solid var(--off-white); }
.activity-row:last-child { border-bottom: none; }
/* Per-round activity inside the Scores window */
.score-activity-title { color: var(--ink); font-size: 15px; margin: 18px 0 4px; }
#scoreActivity { max-height: 34vh; }
.activity-round-head { position: sticky; top: 0; background: var(--midnight); color: #fff; font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 12px; }

/* ============================================================
   Modals
   ============================================================ */
.modal {
  position: fixed; inset: 0; background: rgba(20, 10, 50, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 14px;
}
.modal-body {
  background: #fff; border-radius: 24px; padding: 22px; max-width: 640px; width: 100%;
  max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-body h3 { color: var(--ink); font-size: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
/* Invite / share modal */
.invite-code-box { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--midnight); border-radius: var(--radius-md); padding: 16px; margin: 16px 0; }
.invite-code-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.6); font-weight: 700; }
.invite-code { font-size: 32px; font-weight: 900; letter-spacing: 8px; color: var(--sunflower); font-family: 'Poppins', monospace; }
.invite-actions { justify-content: center; margin-top: 4px; }
.invite-status { text-align: center; color: var(--turtle); font-weight: 700; font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.builder-groups { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; min-height: 20px; }
.builder-group { border: 2.5px solid var(--turtle); border-radius: var(--radius-md); padding: 8px; }
.builder-group .bg-head { font-size: 11px; color: var(--galactic); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; text-transform: uppercase; }
/* Small round close button on a committed Set/Run (no tall button padding). */
.bg-remove {
  flex: none; width: 20px; height: 20px; min-height: 0; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; line-height: 1;
  background: var(--smoke); color: var(--metal);
}
.bg-remove:hover { background: var(--coral); color: #fff; }
.builder-group .bg-cards { display: flex; gap: 3px; margin-top: 4px; }
.builder-current { border: 2.5px dashed var(--azure); border-radius: var(--radius-md); padding: 10px; margin: 12px 0; }
.builder-current-label { font-size: 12px; color: var(--galactic); font-weight: 700; }
.builder-current-cards { display: flex; gap: 5px; min-height: 62px; margin: 8px 0; flex-wrap: wrap; }
.builder-current-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.builder-hand { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.builder-hand .pcard.used { opacity: 0.3; pointer-events: none; }
.builder-hand .pcard, .builder-current-cards .pcard, .builder-group .pcard { cursor: pointer; }

.score-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.score-table th, .score-table td { border: 1px solid var(--smoke); padding: 8px; text-align: center; font-size: 14px; }
.score-table th { background: var(--off-white); font-weight: 800; }
.score-table td.name { text-align: left; font-weight: 700; }
.winner-row { background: #fff7d6; }
.tag-check { color: var(--turtle); font-weight: 800; }

.rules-body h4 { margin: 14px 0 4px; color: var(--ink); }
.rules-body ul { margin: 4px 0; padding-left: 20px; }
.rules-body li { font-size: 14px; margin: 3px 0; }
.rules-body p { font-size: 14px; }

/* ============================================================
   Toast
   ============================================================ */
#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #14121f; color: #fff; padding: 12px 18px; border-radius: 999px; z-index: 100;
  max-width: 90%; text-align: center; font-weight: 600; box-shadow: var(--shadow-lg);
  transition: opacity 0.25s ease;
}

/* ============================================================
   Larger screens — center the game in a phone-like column
   ============================================================ */
@media (min-width: 720px) {
  #game { max-width: 560px; margin: 0 auto; height: 100dvh; box-shadow: 0 0 80px rgba(0, 0, 0, 0.3); }
  .ad-title { font-size: 15px; }
  .pcard { font-size: 16px; width: 56px; }
}
@media (max-width: 380px) {
  .ad-cta { padding: 8px 11px; font-size: 12px; }
  .action-bar .primary, .action-bar .danger, .action-bar .ghost { flex-basis: 100%; }
}
