    /* ═══════════════════════════ TOKENS ═══════════════════════════ */
    :root {
      /* Dynamic card size – scales with viewport so everything always fits */
      --cw: clamp(34px, 6.5vmin, 70px);
      --ch: calc(var(--cw) * 1.42);
      --cr: clamp(7px, 1vmin, 13px);
      --sw: calc(var(--cw) * 1.18);   /* deck/pile stack width  */
      --sh: calc(var(--ch) * 1.18);   /* deck/pile stack height */

      --green-dark:   #094b09;
      --green-mid:    #0f7010;
      --green-light:  #1a9118;
      --header-bg:    #0e1a0e;
      --card-bg:      #fffdf8;
      --card-border:  #ccc;
      --card-red:     #cc1f1f;
      --card-black:   #111;
      --shadow-card:  0 2px 5px rgba(0,0,0,.14), 0 7px 18px rgba(0,0,0,.18);
      --radius-btn:   8px;
      --transition:   .14s ease;
    }

    /* ── Height-responsive scale-down ── */
    @media (max-height: 740px) {
      :root { --cw: clamp(26px, 5.4vmin, 56px); }
      .topbar { height: clamp(40px, 6vmin, 56px) !important; }
    }
    @media (max-height: 580px) {
      :root { --cw: clamp(20px, 4.2vmin, 44px); }
      .topbar { height: clamp(34px, 5vmin, 44px) !important; }
    }
    /* Touch devices: larger minimum so cards and buttons are comfortably tappable */
    @media (hover: none) and (pointer: coarse) {
      :root { --cw: clamp(44px, 6.5vmin, 70px); }
    }
    @media (hover: none) and (pointer: coarse) and (max-height: 740px) {
      :root { --cw: clamp(36px, 5.4vmin, 56px); }
    }
    @media (hover: none) and (pointer: coarse) and (max-height: 580px) {
      :root { --cw: clamp(26px, 4.2vmin, 44px); }
    }

    /* ═══════════════════════════ RESET ════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html, body { height: 100%; font-family: system-ui, Arial, sans-serif; background: #1a1a1a; overflow: hidden; }
    body { display: flex; justify-content: center; }

    /* ═══════════════════════════ APP SHELL ════════════════════════ */
    .app {
      width: min(100vw, 1200px);
      height: 100svh;
      display: flex;
      flex-direction: column;
      background: var(--green-mid);
      box-shadow: 0 0 80px rgba(0,0,0,.6);
      overflow: hidden;
    }

    /* ─── Header ─── */
    .topbar {
      background: var(--header-bg);
      height: clamp(48px, 7vmin, 70px);
      flex-shrink: 0;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 12px rgba(0,0,0,.5);
    }
    .title {
      color: #fff;
      font-size: clamp(24px, 5vmin, 52px);
      font-weight: 900;
      letter-spacing: 4px;
      text-transform: uppercase;
      transform: rotate(-1.5deg);
      text-shadow: 0 2px 0 #444, 0 4px 8px rgba(0,0,0,.35);
      user-select: none;
    }
    .hamburger {
      position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
      width: clamp(40px, 7vmin, 54px); height: clamp(40px, 7vmin, 54px);
      border: none; border-radius: 8px;
      background: rgba(255,255,255,.08); color: rgba(255,255,255,.85);
      font-size: clamp(22px, 4vmin, 30px);
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: background var(--transition);
    }
    .hamburger:hover { background: rgba(255,255,255,.16); }

    /* ═══════════════════════════ LOBBY ════════════════════════════ */
    .lobby {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      overflow-y: auto;
      padding: clamp(12px, 3vw, 32px);
      gap: clamp(16px, 3vmin, 28px);
      background:
        radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.06) 0, transparent 55%),
        linear-gradient(180deg, var(--green-light) 0%, var(--green-mid) 40%, var(--green-dark) 100%);
    }
    .lobby-logo {
      font-size: clamp(32px, 8vmin, 72px);
      font-weight: 900; color: #fff; text-transform: uppercase;
      letter-spacing: 4px; transform: rotate(-1.5deg);
      text-shadow: 0 3px 0 #333, 0 6px 18px rgba(0,0,0,.4);
      margin-top: auto;
    }
    .lobby-card { margin-bottom: auto; }
    .lobby-card {
      background: rgba(0,0,0,.28);
      border: 1px solid rgba(255,255,255,.14);
      border-radius: 18px;
      padding: clamp(16px, 3.5vw, 32px);
      width: min(98vw, 680px);
      display: flex; flex-direction: column;
      gap: clamp(14px, 3vmin, 26px);
    }
    .lobby-section-title {
      color: rgba(255,255,255,.7);
      font-size: 13px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 1.5px;
      margin-bottom: -2px;
      margin-top: 4px;
    }
    .lobby-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
    .lobby-label {
      color: rgba(255,255,255,.9); font-size: 14px; font-weight: 700;
      text-shadow: 0 1px 2px rgba(0,0,0,.3); flex: 1; min-width: 0;
    }
    .lobby-input {
      flex: 1; min-width: 100px;
      padding: 9px 13px; border-radius: 8px;
      border: 2px solid rgba(255,255,255,.25);
      background: rgba(255,255,255,.1); color: #fff;
      font-size: 15px; font-weight: 600; outline: none;
    }
    .lobby-input::placeholder { color: rgba(255,255,255,.4); }
    .lobby-input:focus { border-color: rgba(255,215,0,.7); background: rgba(255,255,255,.16); }

    /* Avatar picker in lobby */
    .av-picker { display: flex; gap: 6px; flex-wrap: wrap; }
    .av-opt {
      border: 3px solid transparent; border-radius: 50%;
      cursor: pointer; transition: border-color .14s, transform .14s;
      padding: 2px;
    }
    .av-opt:hover { border-color: rgba(255,255,255,.5); transform: scale(1.05); }
    .av-opt.active { border-color: #ffd700; }
    .av-opt .avatar { width: 40px; height: 40px; pointer-events: none; }

    /* Bot count selector */
    .lobby-bot-count { display: flex; gap: 5px; }
    .lbc-btn {
      width: 40px; height: 40px;
      border: 2px solid rgba(255,255,255,.25); border-radius: 8px;
      background: rgba(0,0,0,.2); color: rgba(255,255,255,.8);
      font-size: 15px; font-weight: 700; cursor: pointer;
      transition: background var(--transition), border-color var(--transition), color var(--transition);
    }
    .lbc-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
    .lbc-btn.active { background: rgba(255,215,0,.25); border-color: #ffd700; color: #ffd700; }

    /* Per-bot config rows */
    .lobby-bots { display: flex; flex-direction: column; gap: 10px; }
    .lobby-bot-row {
      background: rgba(255,255,255,.07); border-radius: 10px;
      padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    }
    .lobby-bot-row[hidden] { display: none; }

    .lobby-divider { height: 1px; background: rgba(255,255,255,.13); margin: 2px 0; }

    .lobby-start {
      align-self: center; min-width: 200px; height: 54px;
      font-size: 18px; font-weight: 800; letter-spacing: 1px;
      background: linear-gradient(180deg, #3daa3d, #267a26);
      color: #fff; border: none; border-radius: 10px; cursor: pointer;
      box-shadow: 0 4px 0 rgba(0,0,0,.25);
      transition: transform .14s, box-shadow .14s;
    }
    .lobby-start:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0,0,0,.2); }
    .lobby-start:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,.2); }

    /* ═══════════════════════════ TABLE (GRID) ══════════════════════ */
    .table {
      flex: 1;
      min-height: 0;
      display: grid;
      padding: clamp(6px, 1.5vmin, 18px);
      gap: clamp(5px, 1.2vmin, 14px);
      background:
        radial-gradient(ellipse at 50% 0%,   rgba(255,255,255,.07) 0, transparent 55%),
        radial-gradient(ellipse at 50% 100%, rgba(0,0,0,.12) 0, transparent 55%),
        linear-gradient(180deg, var(--green-light) 0%, var(--green-mid) 30%, var(--green-dark) 100%);
      position: relative; overflow: hidden;
    }
    .table::before {
      content: '';
      position: absolute; inset: 0;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Ccircle cx='2' cy='2' r='.6' fill='rgba(255,255,255,.04)'/%3E%3C/svg%3E");
      background-size: 4px 4px; pointer-events: none;
    }

    /* ── 1 bot: bot at top-center, player at bottom ── */
    .table.bots-1 {
      grid-template-columns: 1fr;
      grid-template-areas:
        "sB"
        "center"
        "msg"
        "player";
      grid-template-rows: minmax(0, auto) minmax(0, 1fr) auto minmax(0, 2fr);
      align-items: center;
    }
    .table.bots-1 #slotA, .table.bots-1 #slotC, .table.bots-1 #slotD { display: none; }
    .table.bots-1 #slotB { grid-area: sB; }

    /* ── 2 bots: left and right of center on wide, top-two on narrow ── */
    .table.bots-2 {
      grid-template-columns: 1fr auto 1fr;
      grid-template-areas:
        "sA  center  sC"
        "msg msg     msg"
        "player player player";
      grid-template-rows: minmax(0, 1fr) auto minmax(0, 2fr);
      align-items: center;
    }
    .table.bots-2 #slotB, .table.bots-2 #slotD { display: none; }
    .table.bots-2 #slotA { grid-area: sA; justify-self: end; }
    .table.bots-2 #slotC { grid-area: sC; justify-self: start; }

    /* ── 3 bots: top-left, top-center, top-right ── */
    .table.bots-3 {
      grid-template-columns: 1fr 1fr 1fr;
      grid-template-areas:
        "sA     sB     sC"
        "center center center"
        "msg    msg    msg"
        "player player player";
      grid-template-rows: minmax(0, auto) minmax(0, 1fr) auto minmax(0, 2fr);
      align-items: center;
    }
    .table.bots-3 #slotA { grid-area: sA; }
    .table.bots-3 #slotB { grid-area: sB; }
    .table.bots-3 #slotC { grid-area: sC; }
    .table.bots-3 #slotD { display: none; }

    /* ── 4 bots: all four across the top ── */
    .table.bots-4 {
      grid-template-columns: 1fr 1fr 1fr 1fr;
      grid-template-areas:
        "sA     sB     sC     sD"
        "center center center center"
        "msg    msg    msg    msg"
        "player player player player";
      grid-template-rows: minmax(0, auto) minmax(0, 1fr) auto minmax(0, 2fr);
      align-items: center;
    }
    .table.bots-4 #slotA { grid-area: sA; }
    .table.bots-4 #slotB { grid-area: sB; }
    .table.bots-4 #slotC { grid-area: sC; }
    .table.bots-4 #slotD { grid-area: sD; }

    /* Shared grid areas */
    .center-area { grid-area: center; justify-self: center; align-self: center; }
    .message-bar { grid-area: msg; align-self: center; }
    .bottom-area { grid-area: player; align-self: start; }

    /* ── On narrow screens, bots-2 stacks top-two ── */
    @media (max-width: 540px) {
      .table.bots-2 {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
          "sA  sC"
          "center center"
          "msg msg"
          "player player";
        grid-template-rows: minmax(0, auto) minmax(0, 1fr) auto minmax(0, 2fr);
      }
      .table.bots-2 #slotA { justify-self: center; }
      .table.bots-2 #slotC { justify-self: center; }
      .table.bots-4 {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
          "sA sB"
          "sC sD"
          "center center"
          "msg msg"
          "player player";
        grid-template-rows: minmax(0, auto) minmax(0, auto) minmax(0, 1fr) auto minmax(0, 2fr);
      }
    }

    /* ═══════════════════════════ BOT SLOTS ═════════════════════════ */
    .bot-slot {
      /* Bot cards never need to be tapped → keep them compact regardless of touch mode */
      --cw: clamp(26px, 4.5vmin, 52px);
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: clamp(3px, 0.8vmin, 8px);
      padding: clamp(4px, 1vmin, 10px);
      overflow: visible;
      min-height: 0;
    }
    .bot-slot.active-bot { filter: drop-shadow(0 0 14px rgba(255,230,80,.7)); }
    .bot-slot .faceup-row { gap: clamp(2px, 0.6vw, 8px); }

    /* ── Stacked face-up / face-down pile group ── */
    .card-pile-group {
      display: inline-flex;
      flex-direction: column;
      align-items: center;
    }
    .card-pile-group .faceup-row  { position: relative; z-index: 2; }
    .card-pile-group .facedown-peek {
      display: flex;
      gap: clamp(3px, 0.8vw, 10px);
      margin-top: calc(var(--ch) * -0.78);
      position: relative;
      z-index: 1;
    }
    .bot-slot .card-pile-group .facedown-peek { gap: clamp(2px, 0.6vw, 8px); }
    /* When face-up row is empty (faceDown phase), remove the negative overlap */
    .card-pile-group.no-faceup .facedown-peek { margin-top: 0; }
    /* When face-down row is empty, hide it completely so it can't overlap controls */
    .facedown-peek:empty { display: none; }
    .facedown-peek.active { filter: drop-shadow(0 0 14px rgba(255,230,80,.5)); cursor: pointer; }
    /* Played face-down slot: invisible but holds position */
    .back-card.fd-played {
      background: rgba(255,255,255,0.07);
      border: 2px dashed rgba(255,255,255,0.22);
      box-shadow: none;
      pointer-events: none;
    }

    /* ═══════════════════════════ AVATAR ═══════════════════════════ */
    .avatar-block { display: flex; flex-direction: column; align-items: center; gap: 3px; }
    .avatar {
      width: calc(var(--cw) * 1.06); height: calc(var(--cw) * 1.06);
      border-radius: 50%;
      border: 3px solid rgba(255,255,255,.2);
      box-shadow: 0 4px 12px rgba(0,0,0,.25);
      flex-shrink: 0; overflow: hidden;
      display: flex; align-items: center; justify-content: center;
      font-size: calc(var(--cw) * 0.66);
      line-height: 1; user-select: none;
    }
    .av-opt .avatar { width: 40px; height: 40px; font-size: 24px; }
    .avatar.you   { background: radial-gradient(circle at 35% 35%, #fff8e1, #ffe082); }
    .avatar.bot_1 { background: radial-gradient(circle at 35% 35%, #fbe9e7, #ffccbc); }
    .avatar.bot_2 { background: radial-gradient(circle at 35% 35%, #e8f5e9, #c8e6c9); }
    .avatar.bot_3 { background: radial-gradient(circle at 35% 35%, #fce4ec, #f8bbd0); }
    .avatar.bot_4 { background: radial-gradient(circle at 35% 35%, #ede7f6, #d1c4e9); }

    .player-name { font-size: clamp(12px, 2.2vmin, 20px); color: #fff; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.3); }
    .player-meta { font-size: clamp(10px, 1.8vmin, 15px); color: rgba(255,255,255,.75); }
    .status-pill { background: rgba(0,0,0,.25); color: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.18); padding: 4px 10px; border-radius: 999px; font-size: clamp(10px, 1.8vmin, 14px); font-weight: 600; }

    .small-stack { min-height: calc(var(--ch) * 0.5); display: flex; justify-content: center; align-items: center; }
    .small-stack .back-card:nth-child(2) { margin-left: calc(var(--cw) * -0.3); }
    .small-stack .back-card:nth-child(3) { margin-left: calc(var(--cw) * -0.3); }

    /* ═══════════════════════════ CENTER ════════════════════════════ */
    .middle-stacks {
      display: flex;
      gap: clamp(16px, 4vmin, 48px);
      align-items: center;
    }
    .stack-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
    .stack-label {
      color: rgba(255,255,255,.8); font-size: clamp(9px, 1.5vmin, 13px);
      font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.3);
      text-align: center; white-space: nowrap;
    }

    .deck-stack, .pile-stack {
      width: var(--sw); height: var(--sh);
      position: relative; border-radius: var(--cr);
      cursor: pointer;
    }
    .deck-stack .layer, .pile-stack .layer {
      position: absolute; inset: 0;
      border-radius: var(--cr); border: 2px solid rgba(0,0,0,.1);
      background: #efefef; box-shadow: 0 4px 10px rgba(0,0,0,.2);
    }
    .deck-stack .layer:nth-child(1), .pile-stack .layer:nth-child(1) { transform: translate(-6px, 6px); }
    .deck-stack .layer:nth-child(2), .pile-stack .layer:nth-child(2) { transform: translate(-3px, 3px); }
    .deck-stack .top-card, .pile-stack .top-card { position: absolute; inset: 0; z-index: 2; }

    /* Below-card when invisible 5 is on top */
    .pile-stack .pile-below {
      position: absolute; top: 0; left: 0; z-index: 1;
      transform: translate(-50px, 10px) rotate(-12deg);
      transform-origin: top right; opacity: .9;
    }
    .pile-stack .top-card.over-five { transform: rotate(4deg); }

    .pile-stack.pile-burn-anim { animation: pileBurn .42s ease-out both; }
    .pile-stack.pile-take-anim { animation: pileShake .38s ease both; }

    /* ═══════════════════════════ MESSAGE ══════════════════════════ */
    .message-bar {
      background: #e8e040; border: 2px solid #c8c030; color: #3a3a08;
      border-radius: 10px; padding: clamp(7px, 1.5vmin, 13px) clamp(10px, 2vmin, 18px);
      font-size: clamp(11px, 2vmin, 18px); font-weight: 600; text-align: center;
      box-shadow: 0 3px 0 rgba(0,0,0,.12); flex-shrink: 0;
    }

    /* ═══════════════════════════ CARDS ════════════════════════════ */
    .card, .back-card {
      width: var(--cw); height: var(--ch);
      border-radius: var(--cr);
      border: max(1.5px, calc(var(--cw) * 0.018)) solid var(--card-border);
      box-shadow: var(--shadow-card); position: relative;
      overflow: hidden; user-select: none; background: var(--card-bg);
    }
    .card::after {
      content: ''; position: absolute; inset: 0;
      background: linear-gradient(145deg, rgba(255,255,255,.5) 0%, transparent 55%);
      pointer-events: none;
    }
    .card.red   { color: var(--card-red); }
    .card.black { color: var(--card-black); }
    .card .corner { position: absolute; left: 6px; top: 4px; font-weight: 900; line-height: .9; text-align: center; }
    .card .corner.bot { left: auto; right: 6px; bottom: 4px; top: auto; transform: rotate(180deg); }
    .card .rank { font-size: calc(var(--cw) * 0.3); display: block; }
    .card .suit { font-size: calc(var(--cw) * 0.22); display: block; margin-top: -1px; }
    .card .center {
      position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
      font-size: calc(var(--cw) * 0.54); font-weight: 800;
    }
    .card .wild-tag {
      position: absolute; right: 4px; top: 4px;
      background: rgba(255,210,0,.96); color: #553d00;
      border-radius: 999px; padding: 1px 5px;
      font-size: calc(var(--cw) * 0.12); font-weight: 800;
      box-shadow: 0 1px 2px rgba(0,0,0,.12); z-index: 3;
    }
    .card.joker { background: linear-gradient(170deg, #fff9ea, #fff1cc); color: #7a4400; }
    .card.joker .center { font-size: calc(var(--cw) * 0.44); flex-direction: column; gap: 1px; }
    .card.joker .center span:first-child { font-size: calc(var(--cw) * 0.5); }
    .card .center .tiny { font-size: calc(var(--cw) * 0.14); letter-spacing: 1.5px; font-weight: 700; }

    /* ──── Shithead card style ──── */
    .card.sh {
      background: linear-gradient(160deg, #f2fbf2, #dff0df);
      color: #0c3d0c;
      border-color: #6aaa6a;
    }
    .card.sh::after { display: none; }
    .card.sh.joker { background: linear-gradient(160deg, #fff9ea, #fff1cc); color: #7a4400; border-color: #e8c060; }
    .card .sh-corner {
      position: absolute; left: 5px; top: 4px;
      font-size: calc(var(--cw) * 0.26); font-weight: 900; line-height: 1;
    }
    .card .sh-corner.sh-bot {
      left: auto; right: 5px; bottom: 4px; top: auto;
      transform: rotate(180deg);
    }
    .card .sh-center {
      position: absolute; inset: 0;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: 0;
    }
    .card .sh-rank { font-size: calc(var(--cw) * 0.44); font-weight: 900; line-height: 1; }
    .card .sh-fx   { font-size: calc(var(--cw) * 0.28); line-height: 1.1; margin-top: 1px; }
    .back-card {
      background: repeating-linear-gradient(45deg, rgba(255,255,255,.7) 0, rgba(255,255,255,.7) 1px, transparent 1px, transparent 8px),
                  repeating-linear-gradient(-45deg, rgba(255,255,255,.7) 0, rgba(255,255,255,.7) 1px, transparent 1px, transparent 8px),
                  #c01818;
      border-color: #d4d4d4;
    }
    .back-card::before { content: ''; position: absolute; inset: calc(var(--cw)*0.06); border: 2px solid rgba(255,255,255,.8); border-radius: calc(var(--cr)*0.6); }

    /* ─── Card slot states ─── */
    .card-slot { position: relative; transition: transform .15s ease, filter .15s ease, margin-left .2s ease; }
    .card-slot.selectable { cursor: pointer; }
    .card-slot.selectable:hover { transform: translateY(calc(var(--ch) * -0.07)); }
    .card-slot.selected { transform: translateY(calc(var(--ch) * -0.16)) scale(1.05); z-index: 5; filter: drop-shadow(0 0 8px rgba(255,215,0,.8)); }
    .card-slot.selected .card, .card-slot.selected .back-card { border-color: #ffd700; box-shadow: 0 0 0 2.5px #ffd700, var(--shadow-card); }
    .card-slot.disabled { filter: grayscale(.35) opacity(.55); }
    .card-slot.ghost.empty { opacity: .2; pointer-events: none; }

    /* Card arrival animation */
    .pile-arrival { animation: cardArrival .78s cubic-bezier(.2, 0, .15, 1) both; }

    /* ═══════════════════════════ BOTTOM AREA ══════════════════════ */
    .bottom-area {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: clamp(4px, 0.8vmin, 10px);
      padding-top: clamp(4px, 1vmin, 12px);
      padding-bottom: max(6px, env(safe-area-inset-bottom));
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
    }

    /* faceup row */
    .faceup-row { display: flex; justify-content: center; gap: clamp(3px, 0.8vw, 10px); }

    .hand-row {
      min-height: calc(var(--ch) * 1.2);
      display: flex; align-items: center;
      gap: 4px;
      position: relative;
    }
    .hand-scroll-wrap {
      flex: 1; min-width: 0;
      overflow: hidden;
      padding-top: calc(var(--ch) * 0.22);
      display: flex; align-items: flex-end;
    }
    .hand-scroll-btn {
      flex-shrink: 0;
      width: clamp(28px, 5vmin, 42px);
      align-self: stretch;
      background: rgba(0,0,0,.22);
      border: 1.5px solid rgba(255,255,255,.22);
      border-radius: 8px;
      color: rgba(255,255,255,.9);
      font-size: clamp(18px, 4vmin, 28px);
      font-weight: 900; line-height: 1;
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: background var(--transition);
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
    }
    .hand-scroll-btn:hover  { background: rgba(255,255,255,.18); }
    .hand-scroll-btn:active { background: rgba(255,255,255,.30); }
    /* On touch devices: overlay buttons on the edges so cards use full width */
    @media (hover: none) and (pointer: coarse) {
      .hand-scroll-btn {
        position: absolute; top: 0; bottom: 0; z-index: 5;
        width: 44px; border-radius: 0; border: none; align-self: unset;
        flex-shrink: unset;
      }
      #handScrollLeft  { left: 0;  background: linear-gradient(90deg,  rgba(0,0,0,.42) 0%, transparent 100%); }
      #handScrollRight { right: 0; background: linear-gradient(270deg, rgba(0,0,0,.42) 0%, transparent 100%); }
      #handScrollLeft:active  { background: linear-gradient(90deg,  rgba(0,0,0,.60) 0%, transparent 100%); }
      #handScrollRight:active { background: linear-gradient(270deg, rgba(0,0,0,.60) 0%, transparent 100%); }
    }
    .overlap-row {
      display: flex; align-items: flex-end; justify-content: flex-start;
      flex-wrap: nowrap; overflow: visible;
      flex-shrink: 0; margin: 0 auto;
      transition: transform .18s ease;
    }
    /* Normal overlap */
    .overlap-row .card-slot + .card-slot,
    .overlap-row .back-card + .back-card { margin-left: clamp(-20px, -2vw, -4px); }
    /* Desktop hover: only lift the individual hovered card, no row-wide shift */
    @media (hover: hover) and (pointer: fine) {
      .card-slot.selectable:hover { transform: translateY(calc(var(--ch) * -0.11)); z-index: 4; }
    }
    /* Touch: fan out the whole row so cards are easier to tap */
    @media (hover: none) and (pointer: coarse) {
      .overlap-row .card-slot + .card-slot,
      .overlap-row .back-card + .back-card { margin-left: clamp(-12px, -1.2vw, -2px); }
      .overlap-row:hover .card-slot + .card-slot,
      .overlap-row:hover .back-card + .back-card { margin-left: clamp(-6px, -0.6vw, 6px); }
    }

    /* player face-down + faceup + avatar row */
    .player-bottom-row {
      display: flex; align-items: flex-end;
      justify-content: center;
      gap: clamp(8px, 2vw, 22px);
      flex-wrap: wrap;
    }
    .player-board { display: flex; flex-direction: column; align-items: center; gap: 6px; }
    .player-faceup.active { filter: drop-shadow(0 0 14px rgba(255,230,80,.5)); }
    .player-avatar-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }

    /* ─── Controls ─── */
    .controls {
      display: flex; align-items: center; justify-content: center;
      gap: clamp(5px, 1.2vw, 12px); flex-wrap: wrap;
    }
    .btn {
      height: clamp(38px, 6vmin, 56px);
      min-width: clamp(72px, 9vw, 120px);
      border-radius: var(--radius-btn); border: none;
      font-size: clamp(11px, 1.8vmin, 16px); font-weight: 700; cursor: pointer;
      box-shadow: 0 3px 0 rgba(0,0,0,.22);
      transition: transform var(--transition), box-shadow var(--transition);
      letter-spacing: .3px; white-space: nowrap;
    }
    .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(0,0,0,.2); }
    .btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,.2); }
    .btn:disabled { cursor: default; opacity: .5; filter: grayscale(.3); }
    .btn.primary { background: linear-gradient(180deg, #3daa3d, #267a26); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
    .btn.secondary { background: linear-gradient(180deg, #f6f6f6, #e0e0e0); color: #333; border: 1.5px solid rgba(0,0,0,.14); }
    .btn.take { min-width: clamp(100px, 12vw, 148px); }

    /* ═══════════════════════════ DRAWER ═══════════════════════════ */
    /* ═══════════════════════════ LOBBY RULES ══════════════════════ */
    .toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
    .toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
    .toggle-slider { position: absolute; inset: 0; background: rgba(255,255,255,.2); border-radius: 24px; cursor: pointer; transition: background .2s; }
    .toggle-slider::before { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
    .toggle-switch input:checked + .toggle-slider { background: #3daa3d; }
    .toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
    .lobby-select { padding: 6px 8px; border-radius: 8px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; font-size: 13px; font-weight: 600; outline: none; cursor: pointer; flex-shrink: 0; width: 220px; text-align: right; }
    .lobby-select:focus { border-color: rgba(255,215,0,.7); }
    .lobby-select option { background: #1a3a1a; color: #fff; }

    .overlay { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    .overlay.open { opacity: 1; pointer-events: auto; }
    .drawer { position: fixed; inset: 0; z-index: 31; pointer-events: none; }
    .drawer-panel {
      position: absolute; top: 0; left: 0;
      width: min(92vw, 380px); height: 100%;
      background: #fff; box-shadow: 8px 0 30px rgba(0,0,0,.3);
      transform: translateX(-104%); transition: transform .22s ease;
      padding: 22px 18px 32px; overflow-y: auto;
    }
    .drawer.open { pointer-events: auto; }
    .drawer.open .drawer-panel { transform: none; }
    .drawer h2 { font-size: 26px; color: #8d1515; margin-bottom: 12px; }
    .drawer h3 { font-size: 16px; margin: 16px 0 6px; color: #1a1a1a; }
    .drawer p, .drawer li { font-size: 14px; line-height: 1.5; color: #333; }
    .drawer ul { padding-left: 18px; }
    .drawer li { margin-bottom: 4px; }
    .close-drawer { position: absolute; right: 12px; top: 10px; width: 36px; height: 36px; border: none; border-radius: 50%; background: #eee; font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

    /* ═══════════════════════════ JOKER MODAL ══════════════════════ */
    .joker-modal { position: fixed; inset: 0; z-index: 32; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
    .joker-modal.open { opacity: 1; pointer-events: auto; }
    .joker-box { width: min(94vw, 600px); background: #fff; border-radius: 18px; padding: 22px 20px 24px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
    .joker-box h3 { font-size: 24px; margin-bottom: 6px; }
    .joker-box p  { color: #666; font-size: 14px; margin-bottom: 16px; }
    .joker-options { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
    .joker-choice { border: none; background: transparent; cursor: pointer; padding: 0; }

    /* ═══════════════════════════ PILE MODAL ════════════════════════ */
    .pile-modal { position: fixed; inset: 0; z-index: 42; background: rgba(0,0,0,.56); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
    .pile-modal.open { opacity: 1; pointer-events: auto; }
    .pile-modal-box { background: #fff; border-radius: 16px; padding: 22px 22px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.35); max-width: min(96vw, 700px); display: flex; flex-direction: column; align-items: center; gap: 16px; }
    .pile-modal-title { font-size: 20px; font-weight: 800; color: #1a1a1a; }
    .pile-modal-cards { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

    /* ═══════════════════════════ ANIMATIONS ════════════════════════ */
    @keyframes cardArrival {
      0%   { transform: translate(-170px, 30px) scale(.38) rotate(-42deg); opacity: 0; filter: blur(3px); }
      12%  { opacity: 1; filter: blur(1px); }
      22%  { filter: blur(0); }
      54%  { transform: translate(-22px, -72px) scale(1.13) rotate(9deg); }
      73%  { transform: translate(7px,  12px) scale(.95) rotate(-3deg); }
      87%  { transform: translate(-2px, -4px) scale(1.02) rotate(.7deg); }
      100% { transform: none; opacity: 1; filter: none; }
    }
    @keyframes pileBurn {
      0%   { filter: none; transform: none; }
      20%  { filter: brightness(1.9) saturate(2.5); transform: scale(1.04); box-shadow: 0 0 0 6px rgba(255,100,0,.85), 0 0 40px rgba(255,60,0,.7); }
      65%  { filter: brightness(.6); transform: scale(.96); box-shadow: 0 0 0 2px rgba(255,40,0,.3); }
      100% { filter: none; transform: scale(.88); opacity: 0; }
    }
    @keyframes pileShake {
      0%, 100% { transform: none; }
      18%  { transform: translateX(-9px) rotate(-2.5deg); }
      36%  { transform: translateX(9px) rotate(2.5deg); }
      54%  { transform: translateX(-5px); }
      72%  { transform: translateX(5px); }
    }
    /* ══════════════════════ BLIND CARD REVEAL ══════════════════ */
    .reveal-modal {
      position: fixed; inset: 0; z-index: 65;
      background: rgba(0,0,0,.82);
      display: flex; align-items: center; justify-content: center;
      opacity: 0; pointer-events: none; transition: opacity .15s ease;
    }
    .reveal-modal.open { opacity: 1; pointer-events: auto; }
    .reveal-scene {
      --cw: 160px; --ch: calc(160px * 1.42); --cr: 10px;
      perspective: 900px;
    }
    .reveal-card {
      width: var(--cw); height: var(--ch);
      position: relative; transform-style: preserve-3d;
    }
    .reveal-card.flipping { animation: cardFlipReveal 2s ease forwards; }
    .reveal-back, .reveal-face {
      position: absolute; inset: 0; backface-visibility: hidden;
      border-radius: var(--cr); overflow: hidden;
    }
    .reveal-back {
      background:
        repeating-linear-gradient(45deg, rgba(255,255,255,.65) 0, rgba(255,255,255,.65) 1px, transparent 1px, transparent 8px),
        repeating-linear-gradient(-45deg, rgba(255,255,255,.65) 0, rgba(255,255,255,.65) 1px, transparent 1px, transparent 8px),
        #c01818;
      border: 3px solid #d4d4d4;
    }
    .reveal-back::before {
      content: ''; position: absolute; inset: 8%;
      border: 2px solid rgba(255,255,255,.75); border-radius: 6px;
    }
    .reveal-face {
      transform: rotateY(180deg);
      display: flex; align-items: center; justify-content: center;
    }
    .reveal-face .card-slot { width: var(--cw); height: var(--ch); flex-shrink: 0; }
    .reveal-face .card-slot > .card,
    .reveal-face .card-slot > .back-card { width: 100%; height: 100%; border-radius: var(--cr); }
    .reveal-face .corner { font-size: calc(var(--cw) * 0.14); }
    .reveal-face .center  { font-size: calc(var(--cw) * 0.32); }
    .reveal-face .center .tiny { font-size: calc(var(--cw) * 0.14); }
    .reveal-label {
      position: absolute; bottom: calc(var(--ch) + 16px);
      left: 50%; transform: translateX(-50%);
      color: #fff; font-size: clamp(14px, 3vmin, 20px); font-weight: 800;
      text-shadow: 0 2px 8px rgba(0,0,0,.6); white-space: nowrap;
    }
    @keyframes cardFlipReveal {
      0%   { transform: rotateY(0deg) scale(.45); }
      18%  { transform: rotateY(0deg) scale(1.06); }
      28%  { transform: rotateY(0deg) scale(1); }
      52%  { transform: rotateY(180deg) scale(1); }
      88%  { transform: rotateY(180deg) scale(1); }
      100% { transform: rotateY(180deg) scale(.35); }
    }

    /* ═══════════════════════════ DICE MODAL ════════════════════ */
    .dice-modal {
      position: fixed; inset: 0; z-index: 50;
      background: rgba(0,0,0,.62);
      display: flex; align-items: center; justify-content: center;
      opacity: 0; pointer-events: none; transition: opacity .2s ease;
    }
    .dice-modal.open { opacity: 1; pointer-events: auto; }
    .dice-box {
      background: var(--card-bg); border-radius: 22px;
      padding: clamp(20px,4vw,36px) clamp(24px,5vw,48px);
      text-align: center; box-shadow: 0 24px 64px rgba(0,0,0,.45);
      min-width: 260px; max-width: min(90vw, 420px);
      display: flex; flex-direction: column; align-items: center; gap: 16px;
    }
    .dice-heading { font-size: clamp(18px,4vmin,26px); font-weight: 900; color: #1a1a1a; }
    .dice-rows { display: flex; flex-direction: column; gap: 10px; width: 100%; }
    .dice-row { display: flex; align-items: center; gap: 12px; justify-content: center; }
    .dice-player-name { font-size: 14px; font-weight: 700; color: #222; min-width: 64px; text-align: left; }
    .dice-roll-val { font-size: 13px; font-weight: 600; color: #888; min-width: 24px; }
    .dice-face { font-size: clamp(32px,6vmin,48px); min-width: 48px; text-align: center; line-height: 1; }
    .dice-face.rolling { animation: diceShake .12s ease-in-out infinite alternate; }
    .dice-starter { font-size: clamp(15px,3vmin,20px); font-weight: 800; color: #267a26; }
    @keyframes dealIn {
      0%   { transform: translateY(-55px) rotate(-12deg) scale(.55); opacity: 0; }
      55%  { transform: translateY(4px) rotate(2deg) scale(1.04); opacity: 1; }
      75%  { transform: translateY(-2px) rotate(-.5deg) scale(.99); }
      100% { transform: none; opacity: 1; }
    }
    @keyframes bubblePop {
      0%   { transform: translateX(-50%) scale(0) translateY(6px); opacity: 0; }
      12%  { transform: translateX(-50%) scale(1.12) translateY(0); opacity: 1; }
      22%  { transform: translateX(-50%) scale(1); }
      78%  { transform: translateX(-50%) scale(1); opacity: 1; }
      100% { transform: translateX(-50%) scale(.85) translateY(-4px); opacity: 0; }
    }
    .speech-bubble {
      position: fixed;
      z-index: 60;
      background: #fff;
      color: #1a1a1a;
      font-size: clamp(11px, 2.2vmin, 14px);
      font-weight: 800;
      padding: 5px 11px;
      border-radius: 14px;
      white-space: nowrap;
      pointer-events: none;
      box-shadow: 0 3px 14px rgba(0,0,0,.28);
      transform: translateX(-50%);
      transform-origin: bottom center;
      animation: bubblePop 2.6s cubic-bezier(.2,.8,.4,1) forwards;
    }
    .speech-bubble::after {
      content: '';
      position: absolute;
      bottom: -7px; left: 50%;
      transform: translateX(-50%);
      border: 5px solid transparent;
      border-top-color: #fff;
      border-bottom: none;
    }
    @keyframes diceShake {
      from { transform: rotate(-10deg) scale(.93); }
      to   { transform: rotate(10deg)  scale(1.07); }
    }

    /* ═══════════════════════════ END-GAME MODAL ════════════════ */
    .endgame-modal {
      position: fixed; inset: 0; z-index: 55;
      background: rgba(0,0,0,.68);
      display: flex; align-items: center; justify-content: center;
      opacity: 0; pointer-events: none; transition: opacity .25s ease;
      overflow-y: auto; padding: 16px;
    }
    .endgame-modal.open { opacity: 1; pointer-events: auto; }
    .endgame-box {
      background: var(--card-bg); border-radius: 22px;
      padding: clamp(18px,4vw,30px) clamp(20px,5vw,38px);
      width: min(96vw, 560px); box-shadow: 0 24px 64px rgba(0,0,0,.5);
      display: flex; flex-direction: column; gap: 16px; align-items: center;
    }
    .endgame-title { font-size: clamp(20px,4vmin,30px); font-weight: 900; text-align: center; }
    .endgame-standings { width: 100%; display: flex; flex-direction: column; gap: 8px; }
    .podium-row {
      display: flex; align-items: center; gap: 10px;
      background: #f6f6f6; border-radius: 12px; padding: 9px 14px;
    }
    .podium-place { font-size: 20px; min-width: 34px; text-align: center; }
    .podium-name  { font-size: 15px; font-weight: 700; flex: 1; }
    .podium-row.place-1    { background: #fff9df; border: 2px solid #ffd700; }
    .podium-row.place-last { background: #fff0f0; border: 2px solid #ffb0b0; }

    /* Stats table */
    .stats-section { width: 100%; }
    .stats-section-title {
      font-size: 12px; font-weight: 800; text-transform: uppercase;
      letter-spacing: 1px; color: #888; margin-bottom: 8px;
    }
    .stats-mode-header { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #666; margin: 12px 0 4px; padding: 4px 0; border-bottom: 2px solid #ddd; }
    .stats-mode-header:first-child { margin-top: 0; }
    .stats-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
    .stats-table th {
      background: #efefef; padding: 5px 10px; text-align: center;
      font-weight: 700; border-bottom: 2px solid #ddd;
    }
    .stats-table th:first-child { text-align: left; }
    .stats-table td { padding: 5px 10px; text-align: center; border-bottom: 1px solid #eee; }
    .stats-table td:first-child { text-align: left; font-weight: 600; display: flex; align-items: center; gap: 4px; }
    .stats-table tr:last-child td { border-bottom: none; }

    /* Lobby scoreboard – override table colors for dark green background */
    #lobbyStatsSection .stats-table th {
      background: rgba(255,255,255,.15); color: #fff; border-bottom-color: rgba(255,255,255,.2);
    }
    #lobbyStatsSection .stats-table td {
      color: #fff; border-bottom-color: rgba(255,255,255,.1);
    }
    #lobbyStatsSection .stats-mode-header { color: rgba(255,255,255,.55); border-bottom-color: rgba(255,255,255,.2); }

    /* Collapsible toggle button for lobby scoreboard */
    .lobby-stats-toggle {
      width: 100%; display: flex; align-items: center; justify-content: space-between;
      background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
      border-radius: 8px; padding: 9px 14px; cursor: pointer; color: #fff;
      font-size: 13px; font-weight: 700; transition: background .14s;
    }
    .lobby-stats-toggle:hover { background: rgba(255,255,255,.14); }
    .lobby-stats-chevron { font-size: 11px; color: rgba(255,255,255,.55); }

    /* ═══════════════════════════ ONLINE LOBBY ═════════════════════════ */
    .lobby-mode-tabs {
      display: flex; gap: 4px;
      background: rgba(0,0,0,.3); border-radius: 10px; padding: 4px;
    }
    .lmt-btn {
      flex: 1; height: 44px; border: none; border-radius: 7px;
      background: transparent; color: rgba(255,255,255,.55);
      font-size: 15px; font-weight: 700; cursor: pointer;
      transition: background .14s, color .14s;
    }
    .lmt-btn.active { background: rgba(255,255,255,.18); color: #fff; }
    .lmt-btn:hover:not(.active) { background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); }

    .online-sub-tabs { display: flex; gap: 6px; }
    .ost-btn {
      flex: 1; height: 40px;
      border: 2px solid rgba(255,255,255,.18); border-radius: 8px;
      background: rgba(0,0,0,.18); color: rgba(255,255,255,.6);
      font-size: 14px; font-weight: 700; cursor: pointer;
      transition: background .14s, border-color .14s, color .14s;
    }
    .ost-btn.active { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.5); color: #fff; }
    .ost-btn:hover:not(.active) { background: rgba(255,255,255,.09); color: rgba(255,255,255,.85); }

    /* Access-code display */
    .access-code-block {
      display: flex; flex-direction: column; align-items: center; gap: 8px;
      background: rgba(0,0,0,.32); border-radius: 14px; padding: 20px 24px;
      border: 1px solid rgba(255,215,0,.35);
    }
    .ac-label {
      font-size: 11px; font-weight: 800; text-transform: uppercase;
      letter-spacing: 2px; color: rgba(255,255,255,.5);
    }
    .ac-value {
      font-size: clamp(26px, 7vw, 46px); font-weight: 900; letter-spacing: 8px;
      color: #ffd700; text-shadow: 0 2px 14px rgba(255,215,0,.4);
      font-family: 'Courier New', monospace; user-select: all;
    }
    .ac-copy {
      background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22);
      color: rgba(255,255,255,.75); border-radius: 6px; padding: 5px 16px;
      font-size: 13px; font-weight: 600; cursor: pointer;
      transition: background .14s;
    }
    .ac-copy:hover { background: rgba(255,255,255,.2); }

    /* Waiting list */
    .waiting-list {
      background: rgba(0,0,0,.2); border-radius: 12px; padding: 12px 14px;
      display: flex; flex-direction: column; gap: 7px; min-height: 56px;
    }
    .wl-title {
      font-size: 11px; font-weight: 800; text-transform: uppercase;
      letter-spacing: 1.2px; color: rgba(255,255,255,.45); margin-bottom: 2px;
    }
    .wl-player {
      display: flex; align-items: center; gap: 10px;
      background: rgba(255,255,255,.08); border-radius: 8px; padding: 7px 11px;
    }
    .wl-player .avatar { width: 30px; height: 30px; font-size: 17px; flex-shrink: 0; }
    .wl-player-name { font-size: 14px; font-weight: 700; color: #fff; flex: 1; }
    .wl-player-role  { font-size: 11px; color: #ffd700; font-weight: 800; }
    .wl-player-status { font-size: 11px; color: rgba(255,255,255,.4); }
    .wl-kick-btn {
      margin-left: auto; flex-shrink: 0;
      background: rgba(220,60,60,.18); border: 1px solid rgba(220,60,60,.4);
      color: rgba(255,140,140,.9); border-radius: 6px;
      padding: 3px 10px; font-size: 11px; font-weight: 700;
      cursor: pointer; transition: background .14s;
    }
    .wl-kick-btn:hover { background: rgba(220,60,60,.38); }

    /* Join code input */
    .join-code-input {
      width: 100%; text-transform: uppercase; letter-spacing: 6px;
      font-size: clamp(22px, 6vw, 30px); font-weight: 900;
      text-align: center; font-family: 'Courier New', monospace;
    }
    .join-error {
      min-height: 18px; color: #ff7070; font-size: 13px;
      font-weight: 700; text-align: center;
    }

    .online-actions-row {
      display: flex; flex-direction: column; gap: 8px; align-items: center;
    }
    .lobby-quit {
      background: rgba(220,60,60,.16); border: 1px solid rgba(220,60,60,.32);
      color: rgba(255,140,140,.9); border-radius: 8px;
      padding: 9px 22px; font-size: 14px; font-weight: 700;
      cursor: pointer; transition: background .14s; min-width: 160px;
    }
    .lobby-quit:hover { background: rgba(220,60,60,.3); }
    .lobby-secondary {
      background: rgba(255,200,50,.12); border: 1px solid rgba(255,200,50,.3);
      color: rgba(255,220,100,.9); border-radius: 8px;
      padding: 9px 22px; font-size: 14px; font-weight: 700;
      cursor: pointer; transition: background .14s; min-width: 160px;
    }
    .lobby-secondary:hover   { background: rgba(255,200,50,.22); }
    .lobby-secondary:disabled { opacity: .4; cursor: not-allowed; }
    .lobby-start:disabled {
      opacity: .45; cursor: not-allowed;
      transform: none !important; box-shadow: 0 4px 0 rgba(0,0,0,.25) !important;
    }

    /* ════════════════════ READY BADGE (setup phase) ════════════════ */
    .ready-badge {
      font-size: 11px; font-weight: 800; padding: 2px 8px;
      border-radius: 999px; white-space: nowrap; margin-top: 2px;
      text-align: center;
    }
    .ready-badge.ready    { background: rgba(61,170,61,.25); color: #7ee87e; border: 1px solid rgba(61,170,61,.45); }
    .ready-badge.not-ready { background: rgba(220,60,60,.2);  color: #ff9898; border: 1px solid rgba(220,60,60,.35); }

/* ════════════════════ REACTION BUTTON ════════════════════ */
.reaction-trigger {
  background: rgba(255,200,50,.15); border: 1px solid rgba(255,200,50,.3);
  color: #ffd966; font-size: 18px; padding: 6px 10px;
  border-radius: 10px; cursor: pointer; transition: background .14s;
  min-width: unset;
}
.reaction-trigger:hover { background: rgba(255,200,50,.28); }

/* ════════════════════ REACTION PANEL ════════════════════ */
.reaction-panel {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(420px, 100vw); background: #1e2433;
  border: 1px solid rgba(255,255,255,.12); border-bottom: none;
  border-radius: 18px 18px 0 0; padding: 14px 16px 20px;
  z-index: 300; box-shadow: 0 -8px 32px rgba(0,0,0,.5);
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateX(-50%) translateY(100%); } to { transform: translateX(-50%) translateY(0); } }
.reaction-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,.6);
  margin-bottom: 10px; letter-spacing: .05em; text-transform: uppercase;
}
.reaction-close {
  background: none; border: none; color: rgba(255,255,255,.5);
  font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.reaction-target-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.reaction-target-btn {
  padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 700;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.7); cursor: pointer; transition: background .12s;
}
.reaction-target-btn.active {
  background: rgba(100,160,255,.25); border-color: rgba(100,160,255,.5);
  color: #9eceff;
}
.reaction-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
}
.reaction-item {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: 9px 6px; font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,.85); cursor: pointer; text-align: center;
  transition: background .12s; line-height: 1.4;
}
.reaction-item:hover { background: rgba(255,255,255,.14); }
.reaction-item:active { transform: scale(.95); }

/* ════════════════════ REACTION TOASTS ════════════════════ */
.reaction-toasts {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; z-index: 400; width: min(340px, 90vw);
}
.reaction-toast {
  background: rgba(20,25,40,.92); border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px; padding: 10px 16px; font-size: 14px;
  color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.4);
  animation: toastIn .25s ease, toastOut .3s ease 3.7s forwards;
  backdrop-filter: blur(8px);
}
.reaction-toast strong { color: #9eceff; }
@keyframes toastIn  { from { opacity:0; transform: translateY(-12px); } to { opacity:1; transform: translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform: translateY(-8px); } }

/* ════════════════════ DISBANDED OVERLAY ════════════════════ */
.disbanded-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; backdrop-filter: blur(4px);
}
.disbanded-overlay[hidden] { display: none; }
.disbanded-box {
  background: #1e2433; border: 1px solid rgba(255,255,255,.15);
  border-radius: 18px; padding: 32px 28px; text-align: center;
  max-width: 320px; box-shadow: 0 16px 48px rgba(0,0,0,.6);
  animation: popIn .2s ease;
}
@keyframes popIn { from { transform: scale(.88); opacity:0; } to { transform: scale(1); opacity:1; } }
.disbanded-icon { font-size: 40px; margin-bottom: 12px; }
.disbanded-msg  { font-size: 16px; font-weight: 600; color: rgba(255,255,255,.9); line-height: 1.5; margin-bottom: 20px; }
