:root {
        --bg: #f4f1ea;
        --panel: #fffdf8;
        --ink: #1d2420;
        --ink-soft: #4c554f;
        --line: #ddd5c3;
        --accent: #b07d2b;
        --accent-ink: #7c5514;
        --felt: #0d4a2a;
        --felt-deep: #08331c;
        --felt-mid: #146638;
        --card-face: #fffdf7;
        --card-border: #b9b3a4;
        --card-back: #7c2128;
        --card-back-line: rgba(227,179,65,.25);
        --card-back-border: #5d161c;
        --joker-face: #fdf3d0;
        --gold: #e3b341;
        --card-red: #b3272d;
        --card-ink: #1c1c22;
        --danger: #b3272d;
        --shadow: 0 10px 30px rgba(20, 30, 20, .14);
        --cw: clamp(40px, 11vw, 54px);
        --cw-you: clamp(50px, 14.5vw, 74px);
      }
      @media (prefers-color-scheme: dark) {
        :root {
          --bg: #101613;
          --panel: #1a211c;
          --ink: #eef2ec;
          --ink-soft: #a9b4aa;
          --line: #33413a;
          --accent: #e3b341;
          --accent-ink: #e9c46a;
          --shadow: 0 10px 30px rgba(0,0,0,.45);
        }
      }
      * { box-sizing: border-box; }
      html, body { margin: 0; padding: 0; }
      body {
        font-family: "DM Sans", system-ui, sans-serif;
        background: var(--bg);
        color: var(--ink);
        -webkit-tap-highlight-color: transparent;
      }
      button, [role="button"], select, input { min-height: 2.75rem; font: inherit; }
      button { cursor: pointer; }
      h1, h2, h3 { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; margin: 0; }

      .wrap { max-width: 880px; margin: 0 auto; padding: 20px 16px 48px; }
      .view { display: none; }
      .view.active { display: block; }

      /* ---------- Home ---------- */
      .hero { text-align: center; padding: 28px 0 8px; }
      .hero .suits { font-size: 22px; letter-spacing: 10px; color: var(--accent); }
      .hero .suits .r { color: var(--card-red); }
      .hero h1 { font-size: clamp(52px, 13vw, 84px); line-height: 1; margin: 6px 0 4px; }
      .hero p { color: var(--ink-soft); margin: 0 auto; max-width: 46ch; font-size: 17px; }
      .menu { max-width: 430px; margin: 28px auto 0; display: grid; gap: 12px; }
      .menu-btn {
        display: flex; align-items: center; gap: 14px; text-align: left;
        background: var(--panel); color: var(--ink);
        border: 1px solid var(--line); border-radius: 14px;
        padding: 14px 18px; min-height: 64px; box-shadow: var(--shadow);
        transition: transform .08s ease, border-color .15s ease;
      }
      .menu-btn:active { transform: scale(.985); }
      .menu-btn .ic {
        flex: 0 0 42px; width: 42px; height: 42px; border-radius: 10px;
        display: grid; place-items: center; font-size: 21px;
        background: var(--felt); color: #fff;
      }
      .menu-btn.primary { background: var(--felt); border-color: var(--felt-deep); color: #fff; }
      .menu-btn.primary .ic { background: rgba(255,255,255,.16); }
      .menu-btn b { display: block; font-size: 18px; }
      .menu-btn span { display: block; font-size: 13.5px; opacity: .75; margin-top: 1px; }
      .home-note { text-align: center; color: var(--ink-soft); font-size: 13.5px; margin-top: 22px; }

      /* ---------- Panels / forms ---------- */
      .panel {
        background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
        padding: 22px; box-shadow: var(--shadow); max-width: 560px; margin: 18px auto 0;
      }
      .panel h2 { font-size: 30px; margin-bottom: 6px; }
      .panel .lede { color: var(--ink-soft); margin: 0 0 18px; }
      label.f { display: block; font-weight: 700; font-size: 14px; margin: 16px 0 6px; }
      label.f:first-of-type { margin-top: 0; }
      input[type="text"], select {
        width: 100%; padding: 10px 12px; border-radius: 10px;
        border: 1px solid var(--line); background: var(--bg); color: var(--ink);
      }
      input.code { text-transform: uppercase; letter-spacing: 6px; font-weight: 700; font-size: 20px; text-align: center; }
      .btn {
        display: inline-flex; align-items: center; justify-content: center; gap: 8px;
        border-radius: 12px; border: 1px solid var(--line);
        background: var(--panel); color: var(--ink);
        padding: 10px 18px; font-weight: 700; min-height: 48px;
      }
      .btn.primary { background: var(--felt); border-color: var(--felt-deep); color: #fff; }
      .btn.gold { background: var(--gold); border-color: #c1912a; color: #231a02; }
      .btn.ghost { background: transparent; box-shadow: none; }
      .btn:disabled { opacity: .45; cursor: default; }
      .btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
      .btn-row .btn { flex: 1 1 auto; }
      .err { color: var(--danger); font-weight: 600; font-size: 14px; min-height: 20px; margin-top: 8px; }
      .ok { color: var(--accent-ink); font-weight: 600; font-size: 14px; min-height: 20px; margin-top: 8px; }
      .backlink {
        background: none; border: none; color: var(--accent-ink); font-weight: 700;
        padding: 8px 4px; min-height: 44px;
      }
      .room-code {
        font-family: "DM Serif Display", Georgia, serif; font-size: 52px; letter-spacing: 10px;
        text-align: center; padding: 14px 0 4px; color: var(--accent-ink);
      }
      .seat-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
      .seat-list li {
        display: flex; justify-content: space-between; align-items: center;
        border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--bg);
      }
      .seat-list .tag { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }

      /* ---------- Rules ---------- */
      .rules-body { max-width: 640px; margin: 0 auto; }
      .rules-body h2 { font-size: 34px; margin: 10px 0 4px; }
      .rules-section { margin-top: 24px; }
      .rules-section h3 { font-size: 21px; margin-bottom: 6px; color: var(--accent-ink); }
      .rules-section p, .rules-section li { color: var(--ink); line-height: 1.55; font-size: 16px; }
      .rules-section ul { margin: 6px 0; padding-left: 22px; }
      .value-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
      .value-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
      .value-table td:last-child { text-align: right; font-weight: 700; }

      /* Card packs & felt colours — chosen in Settings, applied to this
         player's own screen in practice and multiplayer alike. */
      body[data-pack="midnight"], .pv-pack[data-pack="midnight"] { --card-face: #232d3d; --card-ink: #f4ecd2; --card-red: #ff8a75; --card-border: #4a5a74; --card-back: #101f38; --card-back-line: rgba(180,200,235,.28); --card-back-border: #0a1626; --joker-face: #3a3320; }
      body[data-pack="vintage"], .pv-pack[data-pack="vintage"] { --card-face: #f3e5c0; --card-ink: #3a2a18; --card-red: #9c2b23; --card-border: #b49b62; --card-back: #5a3d22; --card-back-line: rgba(243,229,192,.30); --card-back-border: #3d2812; --joker-face: #ffe9a8; }
      body[data-pack="berry"], .pv-pack[data-pack="berry"] { --card-face: #fdf0f3; --card-ink: #2b1620; --card-red: #c21847; --card-border: #d9a7b5; --card-back: #6d1a3a; --card-back-line: rgba(255,205,220,.28); --card-back-border: #470f26; --joker-face: #ffe3ee; }
      body[data-felt="blue"], .pv-felt[data-felt="blue"] { --felt: #0b3a5c; --felt-deep: #062740; --felt-mid: #12598c; }
      body[data-felt="burgundy"], .pv-felt[data-felt="burgundy"] { --felt: #5c1220; --felt-deep: #3d0b15; --felt-mid: #7e1c2e; }
      body[data-felt="charcoal"], .pv-felt[data-felt="charcoal"] { --felt: #333a37; --felt-deep: #1f2422; --felt-mid: #49534e; }
      body[data-felt="teal"], .pv-felt[data-felt="teal"] { --felt: #0b4f4a; --felt-deep: #06332f; --felt-mid: #12736b; }
      .appearance-preview {
        margin-top: 14px; border-radius: 14px; padding: 14px 12px; text-align: center; color: #fff;
        background: radial-gradient(ellipse at 50% 38%, var(--felt-mid) 0%, var(--felt) 55%, var(--felt-deep) 100%);
        border: 6px solid #5a3d22;
      }
      .appearance-preview .ap-label { font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; opacity: .85; margin-bottom: 10px; }
      .appearance-preview .ap-cards { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
      .appearance-preview .card { width: 46px; height: 65px; }
      .appearance-preview .card .big { font-size: 24px; }
      .appearance-preview .card .corner { font-size: 11px; }
      /* Per-option previews beside each pack / felt select: a sample
         card in that pack, a swatch of that felt. Tap one to choose it. */
      .option-previews { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 2px; }
      .opt-preview {
        display: flex; flex-direction: column; align-items: center; gap: 5px;
        padding: 7px 8px 6px; border: 2px solid var(--line); border-radius: 10px;
        background: var(--panel); color: var(--ink-soft);
        font-size: 11.5px; font-weight: 700; line-height: 1.2; min-height: 0; cursor: pointer;
      }
      .opt-preview.selected { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
      .mini-row { display: flex; gap: 4px; }
      .mini-card {
        position: relative; width: 30px; height: 42px; border-radius: 4px;
        border: 1px solid var(--card-border); background: var(--card-face); color: var(--card-ink);
        display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.25); font-weight: 700;
      }
      .mini-card.red { color: var(--card-red); }
      .mini-card .mini-big { font-size: 17px; line-height: 1; }
      .mini-card .mini-corner { position: absolute; top: 1px; left: 3px; font-size: 9px; line-height: 1; }
      .mini-card.mini-back {
        background: repeating-linear-gradient(45deg, var(--card-back-line) 0 5px, transparent 5px 10px), var(--card-back);
        border-color: var(--card-back-border);
      }
      .felt-swatch {
        width: 52px; height: 36px; border-radius: 7px; border: 3px solid #5a3d22;
        background: radial-gradient(ellipse at 50% 38%, var(--felt-mid) 0%, var(--felt) 55%, var(--felt-deep) 100%);
      }

      /* ---------- Game table ---------- */
      .game-top {
        display: flex; align-items: center; justify-content: space-between; gap: 8px;
        flex-wrap: wrap; margin-bottom: 10px;
      }
      .game-top .round-label { font-weight: 700; }
      .totals { display: flex; gap: 6px; flex-wrap: wrap; }
      .totals .chip {
        font-size: 13px; font-weight: 700; border: 1px solid var(--line);
        background: var(--panel); border-radius: 999px; padding: 5px 11px;
      }
      .totals .chip.leader { border-color: var(--accent); color: var(--accent-ink); }
      .felt {
        background: radial-gradient(ellipse at 50% 38%, var(--felt-mid) 0%, var(--felt) 55%, var(--felt-deep) 100%);
        border: 10px solid #5a3d22;
        border-radius: 26px; padding: 12px 10px 16px; color: #fff;
        perspective: 900px;
        box-shadow: var(--shadow);
      }
      /* Clockwise turn order — play always moves clockwise around the table.
         The strip lists every player in turn order with arrows between them
         and a looping arrow back to the start, highlighting whose turn it is. */
      .turn-order {
        display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
        gap: 4px 5px; margin: 0 auto 10px; padding: 7px 10px; max-width: 100%;
        background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.18);
        border-radius: 999px; font-size: 12.5px; line-height: 1.2;
      }
      .turn-order .to-label {
        display: inline-flex; align-items: center; gap: 5px; font-weight: 800;
        letter-spacing: .04em; text-transform: uppercase; font-size: 11px; opacity: .92;
        margin-right: 2px; white-space: nowrap;
      }
      .turn-order .to-label .cw-arrow { font-size: 17px; line-height: 1; color: var(--gold); }
      .turn-order .to-name {
        padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.10);
        font-weight: 600; white-space: nowrap;
      }
      .turn-order .to-name.active { background: var(--gold); color: #231a02; font-weight: 800; }
      .turn-order .to-name.you-name { box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }
      .turn-order .to-name.you-name.active { box-shadow: none; }
      .turn-order .to-arrow { color: var(--gold); font-weight: 800; font-size: 13px; }
      .turn-order .to-loop { color: var(--gold); font-size: 15px; font-weight: 800; margin-left: 1px; }
      .opponents { display: flex; justify-content: space-around; gap: 6px; flex-wrap: wrap; }
      .player-zone { text-align: center; padding: 6px 5px 3px; border-radius: 12px; position: relative; }
      .player-zone.active { outline: 2px solid var(--gold); background: rgba(255,255,255,.06); animation: turnPulse 1.15s ease-in-out infinite; }
      @keyframes turnPulse {
        0%, 100% { box-shadow: 0 0 0 0 rgba(227,179,65,.65), inset 0 0 0 2px rgba(227,179,65,.9); }
        50% { box-shadow: 0 0 0 12px rgba(227,179,65,0), inset 0 0 0 2px rgba(227,179,65,.35); }
      }
      /* Cambio called: the caller's cards are immune for the rest of the
         round — a shield glow round the whole hand makes that obvious. */
      .player-zone.cambio-immune {
        outline: 3px solid var(--gold);
        background: rgba(227,179,65,.16);
        box-shadow: 0 0 0 4px rgba(179,39,45,.55), 0 0 24px rgba(227,179,65,.7), inset 0 0 0 2px rgba(255,255,255,.35);
      }
      /* Comic-book CAMBIO! burst: slams down onto the caller's cards
         once, then stays stamped there for the rest of the round. */
      @keyframes cambioSlamAnim {
        0% { transform: translate(-50%, -50%) rotate(-24deg) scale(3.4); opacity: 0; }
        55% { transform: translate(-50%, -50%) rotate(-7deg) scale(.9); opacity: 1; }
        75% { transform: translate(-50%, -50%) rotate(-11deg) scale(1.1); opacity: 1; }
        100% { transform: translate(-50%, -50%) rotate(-10deg) scale(1); opacity: 1; }
      }
      .cambio-stamp {
        position: absolute; left: 50%; top: 56%; z-index: 6; pointer-events: none;
        transform: translate(-50%, -50%) rotate(-10deg);
        background: var(--gold); color: #b3272d;
        font-family: "Arial Black", "DM Sans", system-ui, sans-serif;
        font-weight: 900; font-style: italic; letter-spacing: .02em;
        font-size: clamp(19px, 5.2vw, 28px); line-height: 1;
        padding: 16px 20px; text-shadow: 1.5px 1.5px 0 #fff3c4;
        clip-path: polygon(50% 0%, 59% 12%, 72% 4%, 78% 16%, 92% 12%, 93% 26%, 100% 32%, 95% 45%, 100% 58%, 90% 64%, 93% 79%, 80% 80%, 76% 94%, 63% 88%, 52% 100%, 41% 89%, 27% 96%, 23% 82%, 9% 85%, 10% 70%, 0% 62%, 6% 49%, 0% 36%, 11% 30%, 9% 15%, 23% 17%, 28% 4%, 40% 11%);
        filter: drop-shadow(0 5px 7px rgba(0,0,0,.5));
        animation: cambioSlamAnim .6s ease-out both;
      }
      .cambio-stamp.settled { animation: none; }
      .you-zone .cambio-stamp { font-size: clamp(23px, 6vw, 34px); padding: 20px 24px; }
      .immune-badge {
        display: inline-block; margin-top: 7px; padding: 3px 10px; border-radius: 999px;
        background: #b3272d; color: #fff; font-size: 11.5px; font-weight: 800;
        letter-spacing: .05em; text-transform: uppercase; line-height: 1.35;
      }
      .turn-badge {
        display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
        background: var(--gold); color: #231a02; font-size: 11px; font-weight: 800;
        letter-spacing: .07em; text-transform: uppercase; vertical-align: 2px;
        animation: badgeBounce .55s ease-in-out infinite alternate;
      }
      @keyframes badgeBounce { from { transform: translateY(0); } to { transform: translateY(-3px); } }
      .turn-banner {
        display: none; align-items: center; justify-content: center; gap: 10px;
        margin: 0 0 10px; padding: 9px 14px; border-radius: 12px; text-align: center;
        background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
        font-weight: 800; font-size: 16.5px;
      }
      .turn-banner.show { display: flex; }
      .turn-banner .dot {
        flex: 0 0 12px; width: 12px; height: 12px; border-radius: 50%;
        background: var(--accent); animation: badgeBounce .5s ease-in-out infinite alternate;
      }
      .turn-banner.yours { background: var(--gold); border-color: #c1912a; color: #231a02; }
      .turn-banner.yours .dot { background: #231a02; }
      .memory-chip {
        font-size: 12.5px; font-weight: 700; border: 1px dashed var(--line);
        border-radius: 999px; padding: 5px 11px; color: var(--ink-soft); background: var(--panel);
      }
      /* card movement: cards visibly travel across the table */
      /* Pick-ups fly in a long, readable arc from the pile they came
         from, arcing up over the table before settling. */
      @keyframes drawFromDeckAnim {
        0% { transform: translate(-195px, -72px) rotate(-15deg) scale(.76); opacity: .3; }
        55% { transform: translate(-88px, -58px) rotate(-6deg) scale(.94); opacity: 1; }
        100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
      }
      @keyframes drawFromDiscardAnim {
        0% { transform: translate(195px, -72px) rotate(15deg) scale(.76); opacity: .3; }
        55% { transform: translate(88px, -58px) rotate(6deg) scale(.94); opacity: 1; }
        100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
      }
      /* Put-downs sweep across the table from the player's hand area
         and land on the discard pile with a small settle bounce. */
      @keyframes discardLandAnim {
        0% { transform: translate(-125px, 58px) rotate(11deg) scale(.8); opacity: .35; }
        55% { transform: translate(-30px, -16px) rotate(-3deg) scale(1.08); opacity: 1; }
        80% { transform: translate(0, 3px) rotate(1deg) scale(.98); opacity: 1; }
        100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
      }
      @keyframes swapInAnim {
        0% { transform: translateY(-95px) rotate(-5deg) scale(1.18); box-shadow: 0 18px 26px rgba(0,0,0,.5); opacity: .45; }
        60% { transform: translateY(5px) rotate(1deg) scale(1.02); opacity: 1; }
        100% { transform: translateY(0) rotate(0) scale(1); }
      }
      /* Turning a card over to look at it: a 3D flip that bends —
         the card curls as it comes round (skew + rotateX mid-flip,
         lifting with shadow and a light catch), then flattens out. */
      @keyframes flipBendAnim {
        0% { transform: perspective(700px) rotateY(88deg) rotateX(8deg) skewY(5deg) scale(1.03); filter: brightness(.78); box-shadow: -10px 12px 20px rgba(0,0,0,.42); }
        35% { transform: perspective(700px) rotateY(42deg) rotateX(-5deg) skewY(-4deg) scale(1.13); filter: brightness(1.12); box-shadow: 0 18px 26px rgba(0,0,0,.48); }
        65% { transform: perspective(700px) rotateY(-16deg) rotateX(2deg) skewY(2deg) scale(1.06); filter: brightness(1.04); }
        100% { transform: perspective(700px) rotateY(0deg) rotateX(0deg) skewY(0deg) scale(1); filter: brightness(1); }
      }
      .card.anim-flip { animation: flipBendAnim .95s ease-in-out; transform-origin: 18% 50%; }
      /* Power clarity: a card being looked at (Queen / King) is lifted
         and tilted side to side as if being examined, with a gold ring
         — everyone can see WHICH card is being peeked at, while its
         face stays hidden from all but the player using the power. */
      @keyframes fxLookAnim {
        0% { transform: translateY(0) rotate(0deg) scale(1); }
        25% { transform: translateY(-17px) rotate(-7deg) scale(1.08); }
        50% { transform: translateY(-20px) rotate(5deg) scale(1.1); }
        75% { transform: translateY(-16px) rotate(-4deg) scale(1.07); }
        100% { transform: translateY(-18px) rotate(0deg) scale(1.08); }
      }
      .card.fx-look {
        animation: fxLookAnim 2.4s ease-in-out, snapFlashAnim 1.1s ease-out;
        outline: 3px solid var(--gold); outline-offset: 2px; z-index: 3;
      }
      /* Power clarity: the two cards swapped by a Jack / King both
         lift, rock and glow together so the pair that changed places
         is unmistakable. */
      @keyframes fxSwapAnim {
        0% { transform: translateY(0) rotate(0deg) scale(1); }
        30% { transform: translateY(-22px) rotate(-5deg) scale(1.13); }
        55% { transform: translateY(-22px) rotate(5deg) scale(1.13); }
        80% { transform: translateY(-8px) rotate(-2deg) scale(1.05); }
        100% { transform: translateY(0) rotate(0deg) scale(1); }
      }
      .card.fx-swap {
        animation: fxSwapAnim 1.3s ease-in-out, snapFlashAnim 1s ease-out;
        outline: 3px solid var(--gold); outline-offset: 2px; z-index: 3;
      }
      @keyframes snapFlashAnim {
        0% { box-shadow: 0 0 0 0 rgba(227,179,65,.95); }
        100% { box-shadow: 0 0 0 16px rgba(227,179,65,0); }
      }
      @keyframes deckPulse {
        0%, 100% { box-shadow: 0 0 0 0 rgba(227,179,65,.7); }
        50% { box-shadow: 0 0 0 10px rgba(227,179,65,0); }
      }
      .card.anim-draw-deck { animation: drawFromDeckAnim 1.05s ease-out; }
      .card.anim-draw-discard { animation: drawFromDiscardAnim 1.05s ease-out; }
      .card.anim-discard { animation: discardLandAnim 1s ease-out, snapFlashAnim .7s ease-out; }
      .card.anim-swapin { animation: swapInAnim .95s ease-out; }
      /* dealing: cards fly in one-by-one (delay set inline per card) */
      @keyframes dealInAnim {
        0% { transform: translate(95px, -115px) rotate(15deg) scale(.58); opacity: 0; }
        60% { opacity: 1; }
        100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
      }
      .card.anim-deal { animation: dealInAnim .9s ease-out both; }
      /* snapping: the snapped card slams onto the pile with a gold burst */
      @keyframes snapSlamAnim {
        0% { transform: translateY(-95px) scale(1.3) rotate(-11deg); opacity: .45; }
        55% { transform: translateY(3px) scale(.95) rotate(1deg); opacity: 1; }
        100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
      }
      .card.anim-snap { animation: snapSlamAnim .95s ease-out, snapFlashAnim .8s ease-out; }
      /* ---------- Draw to go first ---------- */
      .first-draw {
        background: rgba(0,0,0,.24); border: 1px solid rgba(255,255,255,.20);
        border-radius: 16px; padding: 14px 12px 12px; margin: 0 0 12px; text-align: center;
      }
      .first-draw h3 { font-size: 22px; margin: 0 0 4px; color: #fff; }
      .first-draw p { margin: 4px auto; max-width: 58ch; font-size: 13.5px; line-height: 1.45; opacity: .94; }
      .first-draw .fd-status { font-weight: 800; font-size: 15px; opacity: 1; }
      .fan { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 12px auto 6px; max-width: 560px; }
      .fan .card { width: 38px; height: 54px; border-radius: 6px; }
      .fan .card.taken { opacity: .32; outline: none; cursor: default; }
      .fan .card.mine { outline: 3px solid var(--gold); outline-offset: 1px; opacity: 1; }
      .fd-picks { list-style: none; margin: 10px auto 0; padding: 0; display: grid; gap: 6px; max-width: 480px; text-align: left; }
      .fd-picks li {
        display: flex; justify-content: space-between; align-items: center; gap: 10px;
        background: rgba(255,255,255,.09); border-radius: 9px; padding: 7px 11px; font-size: 14px;
      }
      .fd-picks li.winner { background: var(--gold); color: #231a02; font-weight: 800; }
      .fd-picks .fd-card { font-weight: 700; white-space: nowrap; }
      .pile .card.tappable { animation: deckPulse 1.1s ease-in-out infinite; }
      .hint { color: var(--ink-soft); font-size: 13.5px; line-height: 1.45; margin: 6px 0 0; }
      .player-zone .pname { font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
      .player-zone .pname .thinking { font-weight: 400; font-size: 12px; opacity: .8; }
      .hand { display: grid; grid-template-columns: repeat(2, var(--cw)); gap: 5px; justify-content: center; }
      .hand.you { grid-template-columns: repeat(2, var(--cw-you)); gap: 6px; }
      .hand.wide { grid-template-columns: repeat(3, var(--cw)); }
      .hand.you.wide { grid-template-columns: repeat(3, var(--cw-you)); }
      .card {
        position: relative; width: var(--cw); height: calc(var(--cw) * 1.42);
        border-radius: 7px; border: 1px solid var(--card-border);
        background: var(--card-face); color: var(--card-ink);
        display: grid; place-items: center; user-select: none;
        box-shadow: 0 2px 5px rgba(0,0,0,.35);
        font-weight: 700;
      }
      .hand.you .card { width: var(--cw-you); height: calc(var(--cw-you) * 1.42); border-radius: 9px; }
      .card .big { font-size: calc(var(--cw) * .52); line-height: 1; }
      .hand.you .card .big { font-size: calc(var(--cw-you) * .52); }
      .card .corner { position: absolute; top: 3px; left: 5px; font-size: 12px; line-height: 1.05; text-align: center; }
      .hand.you .card .corner { font-size: 15px; }
      .card.red { color: var(--card-red); }
      .card.joker { color: #6d4c00; background: var(--joker-face); }
      body[data-pack="midnight"] .card.joker { color: #e9c46a; }
      .card.back {
        background:
          repeating-linear-gradient(45deg, var(--card-back-line) 0 6px, transparent 6px 12px),
          var(--card-back);
        border-color: var(--card-back-border); color: transparent;
      }
      .card.empty { background: rgba(255,255,255,.08); border: 1.5px dashed rgba(255,255,255,.35); box-shadow: none; }
      .card.tappable { cursor: pointer; outline: 3px solid var(--gold); outline-offset: 1px; }
      .card .known-chip {
        position: absolute; bottom: 3px; right: 3px; background: var(--gold); color: #231a02;
        font-size: 14px; font-weight: 800; border-radius: 6px; padding: 2px 5px; line-height: 1.25;
        box-shadow: 0 1px 4px rgba(0,0,0,.4); letter-spacing: .01em; pointer-events: none;
      }
      /* Your own cards are bigger, so your reminder is bigger too —
         the number is the bit you need to read at a glance. */
      .hand.you .card .known-chip { font-size: 17.5px; padding: 3px 7px; border-radius: 7px; }
      .piles { display: flex; justify-content: center; align-items: flex-start; gap: 20px; margin: 12px 0 4px; }
      .pile { text-align: center; }
      .pile .plabel { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .85; margin-top: 6px; }
      .pile .card { width: var(--cw); height: calc(var(--cw) * 1.42); }
      .pile .card.tappable { cursor: pointer; }
      .you-zone { margin-top: 6px; }
      .card.empty .empty-label {
        font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
        color: rgba(255,255,255,.55); text-align: center; padding: 0 4px; line-height: 1.3;
      }
      .status {
        min-height: 26px; text-align: center; font-size: 16px; font-weight: 600;
        margin: 10px auto 4px; max-width: 60ch;
      }
      .status.snap { color: var(--gold); }
      .controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; min-height: 48px; }
      .controls .btn { box-shadow: 0 3px 8px rgba(0,0,0,.3); }
      .drawn-spot { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 6px; min-width: 60px; }
      .drawn-spot .dlabel { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .9; }

      /* ---------- Modal ---------- */
      .overlay {
        position: fixed; inset: 0; background: rgba(8, 14, 10, .66);
        display: none; align-items: center; justify-content: center; padding: 16px; z-index: 40;
      }
      .overlay.open { display: flex; }
      .modal {
        background: var(--panel); color: var(--ink); border-radius: 18px; padding: 24px;
        max-width: 520px; width: 100%; max-height: 86vh; overflow: auto; box-shadow: var(--shadow);
      }
      .modal h2 { font-size: 28px; margin-bottom: 4px; }
      .score-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
      .score-table th, .score-table td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 15px; }
      .score-table td.num, .score-table th.num { text-align: right; }
      .score-table tr.winner td { font-weight: 700; color: var(--accent-ink); }
      .mini-cards { font-size: 13px; color: var(--ink-soft); }
      @media (max-width: 520px) {
        :root {
          --cw: clamp(36px, 10.5vw, 46px);
          --cw-you: clamp(46px, 13.5vw, 60px);
        }
        .wrap { padding: 14px 10px 36px; }
        .felt { border-width: 6px; padding: 10px 6px 14px; border-radius: 20px; }
        .opponents { gap: 4px; }
        .player-zone { padding: 5px 3px 2px; }
        .player-zone .pname { font-size: 12.5px; }
        .turn-order { font-size: 11.5px; padding: 6px 7px; gap: 3px 4px; margin-bottom: 8px; }
        .turn-order .to-name { padding: 2px 6px; }
        .turn-order .to-label { font-size: 10px; }
        .piles { gap: 14px; margin: 10px 0 2px; }
        .pile .plabel { font-size: 11px; }
        .status { font-size: 15px; }
        .room-code { font-size: 42px; letter-spacing: 7px; }
      }
      @media (prefers-reduced-motion: reduce) {
        * { transition: none !important; animation: none !important; }
      }
