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

    :root {
      /* ── Ocean-extracted palette (from card art PDFs) ─────────── */
      --bg:        #0D2A52;   /* deep ocean blue — mid-water zone      */
      --table:     #0B2448;   /* darker for depth behind cards          */
      --felt:      #173C72;   /* ocean hub surface                      */
      --panel:     #1A4280;   /* panels — bright ocean mid-tone         */
      --border:    #3A78CC;   /* cornflower / Arctic Ocean card border  */
      --text:      #DAEEFF;   /* near-white with a sky-blue tint        */
      --muted:     #76B0D8;   /* muted ocean blue for secondary text    */
      --gold:      #F0C840;   /* card star gold                         */
      --gold2:     #D4A820;   /* deeper gold                            */
      --cyan:      #22D8F8;   /* electric cyan — card title color       */
      --teal:      #18C8A8;   /* seafoam teal                           */
      --green:     #42C878;   /* kelp / ocean green                     */
      --red:       #e84057;
      --purple:    #a855f7;
      --sand:      #D0A84E;   /* sandy seafloor accent                  */
      --coral:     #F09880;   /* coral orange-pink accent               */
      /* ── Coral reef in-game palette (matches game-bg.png) ─────── */
      --cr-cream:      #fef5e6;
      --cr-cream-mid:  #f5e8d0;
      --cr-aqua:       #bcdde6;
      --cr-teal:       #5fb3d6;
      --cr-teal-deep:  #2c5a8a;
      --cr-navy:       #1a2d5a;
      --cr-coral:      #f4a574;
      --cr-coral-deep: #e8956b;
      --cr-gold:       #e8b34a;
      --cr-gold-deep:  #c89320;
      --card-w:    98px;
      --card-h:    138px;
      --mini-w:    84px;
      --mini-h:    118px;
      --radius:    10px;
      --glow-c:    rgba(34,216,248,.45);
      --glow-teal: rgba(24,200,168,.5);
      --glow-gold: rgba(240,200,64,.5);
      /* Shared card-back art (sandpiper + "Currents and Critters") — used for the
         deck pile, face-down hands, draw-flip backs and any hidden card, everywhere. */
      --cc-card-back: url("/multiplayer/client/card-back.png?v=1");
    }

    html, body {
      height: 100%;
      background: var(--bg);
      color: var(--text);
      font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
      font-size: 14px;
      overflow: hidden;
    }

    /* ── LOBBY ──────────────────────────────────────────────────── */
    #pv-lobby {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100vh;
      gap: 22px;
      padding: 24px;
      /* Ocean scene: sky-aqua → mid-water → deep ocean blue */
      background:
        radial-gradient(ellipse at 50% -5%, rgba(168,224,248,.28) 0%, transparent 50%),
        radial-gradient(ellipse at 15% 80%, rgba(24,200,168,.15) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 60%, rgba(34,216,248,.10) 0%, transparent 45%),
        linear-gradient(180deg,
          #1A5090 0%,
          #133C78 30%,
          #0F2E60 60%,
          #0B2448 100%
        );
    }
    #pv-lobby h1 {
      font-family: "Cinzel", serif;
      font-size: 2.2rem;
      font-weight: 900;
      color: var(--gold);
      letter-spacing: 3px;
      text-shadow: 0 0 40px rgba(240,200,64,.6), 0 0 80px rgba(34,216,248,.25), 0 2px 0 rgba(0,0,0,.5);
    }
    #pv-lobby .subtitle {
      color: var(--cyan);
      font-size: 13px;
      font-family: "Nunito", inherit;
      font-weight: 700;
      letter-spacing: .4px;
      text-align: center;
      max-width: 380px;
      margin-top: -14px;
    }
    .pv-lobby-box {
      background: linear-gradient(160deg, rgba(22,56,110,.88) 0%, rgba(16,44,92,.92) 100%);
      border: 1px solid rgba(58,120,204,.35);
      border-radius: 14px;
      padding: 20px 24px;
      width: 100%;
      max-width: 420px;
      display: flex;
      flex-direction: column;
      gap: 11px;
      box-shadow: 0 8px 32px rgba(0,0,0,.3), inset 0 1px 0 rgba(34,216,248,.12);
      backdrop-filter: blur(4px);
    }
    .pv-lobby-box h2 {
      font-family: "Cinzel", serif;
      font-size: 1rem;
      font-weight: 700;
      color: var(--gold);
      text-transform: uppercase;
      letter-spacing: 1.8px;
      text-shadow: 0 0 10px rgba(240,200,64,.35);
    }
    .pv-input {
      background: #122E6A;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      font-family: inherit;
      font-size: 14px;
      padding: 9px 12px;
      outline: none;
      width: 100%;
      transition: border-color .2s;
    }
    .pv-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(61,214,245,.12); }
    .pv-input::placeholder { color: var(--muted); }
    .pv-row { display: flex; gap: 8px; }
    .pv-row .pv-input { flex: 1; }

    .pv-btn {
      background: linear-gradient(135deg, var(--cr-teal), var(--cr-teal-deep));
      border: none; border-radius: 10px;
      color: #fff; cursor: pointer;
      font-family: "Nunito", inherit;
      font-size: 13px; font-weight: 800;
      padding: 10px 18px;
      transition: transform .15s, box-shadow .15s, filter .15s;
      white-space: nowrap;
      letter-spacing: .3px;
      text-shadow: 0 1px 2px rgba(0,0,0,.25);
    }
    .pv-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(95,179,214,.55); }
    .pv-btn:active:not(:disabled) { transform: translateY(0); }
    .pv-btn:disabled { filter: brightness(.45); cursor: default; }
    .pv-btn.gold { background: linear-gradient(135deg, #c8971a, #a97c14); }
    .pv-btn.gold:hover:not(:disabled) { box-shadow: 0 4px 18px rgba(200,150,26,.6); }
    /* Coral is still available but End Turn now uses its own softer class */
    .pv-btn.coral { background: linear-gradient(135deg, #ef5a5a, #d83838); }
    .pv-btn.coral:hover:not(:disabled) { box-shadow: 0 4px 18px rgba(216,56,56,.55); }
    /* End Turn — calm ocean teal, not scary red */
    .pv-btn.end-turn { background: linear-gradient(135deg, #5fb3d6, #3a8fb5); }
    .pv-btn.end-turn:hover:not(:disabled) { box-shadow: 0 4px 18px rgba(95,179,214,.6); }
    .pv-btn.end-turn.suggest {
      box-shadow: 0 0 0 3px rgba(95,179,214,.5), 0 4px 16px rgba(95,179,214,.4);
      animation: end-turn-pulse 2s ease-in-out infinite;
    }
    @keyframes end-turn-pulse {
      0%, 100% { box-shadow: 0 0 0 2px rgba(95,179,214,.35), 0 2px 10px rgba(95,179,214,.25); }
      50%       { box-shadow: 0 0 0 5px rgba(95,179,214,.6),  0 4px 20px rgba(95,179,214,.55); }
    }
    #end-turn-hint {
      display: none; font-size: 10.5px; font-weight: 800;
      color: #3a8fb5; white-space: nowrap; letter-spacing: .2px;
    }
    .pv-btn.danger { background: linear-gradient(135deg, #b03040, #8e1828); }
    #pv-undo-btn {
      background: linear-gradient(135deg, #9b89c7, #7d6aae);
      color: #fff;
      border: 1px solid rgba(180,165,220,.45);
      font-size: 13px;
      padding: 7px 14px;
      white-space: nowrap;
      flex-shrink: 0;
      border-radius: 10px;
    }
    #pv-undo-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }
    #pv-undo-btn:hover:not(:disabled) {
      background: linear-gradient(135deg, #ad9bd6, #8e7bbe);
      transform: translateY(-1px);
      box-shadow: 0 4px 14px rgba(125,106,174,.5);
    }
    /* Surf's Up!! and Full Screen — match Undo Turn's compact action-row sizing */
    .pv-btn-surf, .pv-btn-fullscreen {
      font-size: 13px;
      padding: 7px 14px;
      white-space: nowrap;
      flex-shrink: 0;
      border-radius: 10px;
      color: #fff;
    }
    .pv-btn-surf {
      background: linear-gradient(135deg, #3ea8d8, #1f7fb4);
      border: 1px solid rgba(140,210,240,.45);
    }
    .pv-btn-surf:hover:not(:disabled) {
      background: linear-gradient(135deg, #4fb8e4, #2a8fc4);
      transform: translateY(-1px);
      box-shadow: 0 4px 14px rgba(31,127,180,.55);
    }
    .pv-btn-surf.is-away {
      background: linear-gradient(135deg, #d8a13e, #b47f1f);
      border-color: rgba(240,210,140,.55);
      animation: surf-pulse 2.2s ease-in-out infinite;
    }
    .pv-btn-surf.is-away:hover:not(:disabled) {
      background: linear-gradient(135deg, #e4b04f, #c4902a);
      box-shadow: 0 4px 14px rgba(180,127,31,.55);
    }
    @keyframes surf-pulse {
      0%,100% { box-shadow: 0 0 8px rgba(216,161,62,.45); }
      50%      { box-shadow: 0 0 22px rgba(216,161,62,.85); }
    }
    .pv-btn-fullscreen {
      background: linear-gradient(135deg, #5a7ea8, #3e608c);
      border: 1px solid rgba(150,180,220,.45);
    }
    .pv-btn-fullscreen:hover:not(:disabled) {
      background: linear-gradient(135deg, #6c91be, #527aa6);
      transform: translateY(-1px);
      box-shadow: 0 4px 14px rgba(62,96,140,.55);
    }

    /* Away badge on seat avatars + Draw-2 affordance */
    .pv-seat-away-badge {
      position: absolute;
      top: -4px; left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, #d8a13e, #b47f1f);
      color: #fff;
      font-family: "Nunito", sans-serif;
      font-weight: 800;
      font-size: 9px;
      letter-spacing: .5px;
      padding: 2px 6px;
      border-radius: 8px;
      box-shadow: 0 2px 6px rgba(180,127,31,.55);
      pointer-events: none;
      z-index: 5;
      text-transform: uppercase;
      white-space: nowrap;
    }
    .pv-seat-draw2-btn {
      position: absolute;
      bottom: 18px; left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, #ef5a5a, #d83838);
      color: #fff;
      border: 1px solid rgba(255,200,200,.55);
      font-family: "Nunito", sans-serif;
      font-weight: 800;
      font-size: 10px;
      letter-spacing: .3px;
      padding: 4px 8px;
      border-radius: 8px;
      cursor: pointer;
      box-shadow: 0 3px 10px rgba(216,56,56,.55);
      z-index: 6;
      animation: draw2-pulse 1.6s ease-in-out infinite;
      white-space: nowrap;
    }
    .pv-seat-draw2-btn:hover {
      background: linear-gradient(135deg, #f96d6d, #e44545);
      transform: translateX(-50%) translateY(-1px);
      box-shadow: 0 5px 14px rgba(216,56,56,.75);
    }
    @keyframes draw2-pulse {
      0%,100% { box-shadow: 0 0 8px rgba(216,56,56,.5); }
      50%      { box-shadow: 0 0 22px rgba(216,56,56,.9); }
    }
    .pv-seat { position: relative; }

    /* AFK-vote "Are you still here?" challenge — deep-ocean panel, on-theme */
    #pv-afk-modal {
      display: none;
      position: fixed;
      inset: 0;
      background: radial-gradient(circle at 50% 40%, rgba(13,42,82,.78), rgba(6,16,30,.92));
      z-index: 9100;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(5px);
    }
    #pv-afk-modal.open { display: flex; animation: afkFadeIn .25s ease both; }
    @keyframes afkFadeIn { from { opacity: 0; } to { opacity: 1; } }
    #pv-afk-box {
      position: relative;
      background: linear-gradient(165deg, #1A4280 0%, #123265 45%, #0B2448 100%);
      border: 2px solid var(--border);
      border-radius: 18px;
      padding: 28px 36px 30px;
      color: var(--text);
      text-align: center;
      box-shadow: 0 18px 70px rgba(0,0,0,.6), 0 0 30px var(--glow-c), inset 0 1px 0 rgba(255,255,255,.08);
      max-width: 460px; width: 94%;
      animation: afkPop .32s cubic-bezier(.22,.68,0,1.2) both;
    }
    @keyframes afkPop { from { transform: translateY(14px) scale(.94); } to { transform: none; } }
    #pv-afk-box .pv-afk-icon { font-size: 32px; line-height: 1; margin-bottom: 4px; }
    #pv-afk-box h2 {
      font-family: "Cinzel", serif;
      font-size: 28px;
      margin: 0 0 8px 0;
      color: var(--gold);
      text-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 16px rgba(240,200,64,.35);
    }
    #pv-afk-box .pv-afk-sub {
      font-family: "Nunito", sans-serif;
      font-size: 15px;
      color: #b8d0ee;
      margin: 0 0 18px 0;
      line-height: 1.45;
    }
    /* Draining countdown ring — conic gradient depletes as time runs out. */
    #pv-afk-ring {
      --pct: 100%;
      --ring: var(--teal);
      position: relative;
      width: 132px; height: 132px;
      margin: 4px auto 14px;
      border-radius: 50%;
      background:
        conic-gradient(var(--ring) var(--pct), rgba(255,255,255,.08) var(--pct) 100%);
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 0 22px -4px var(--ring), inset 0 0 18px rgba(0,0,0,.45);
      transition: background .25s linear, box-shadow .35s linear;
    }
    #pv-afk-ring::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: 50%;
      box-shadow: inset 0 0 0 2px rgba(255,255,255,.06);
      pointer-events: none;
    }
    #pv-afk-ring-inner {
      width: 104px; height: 104px;
      border-radius: 50%;
      background: radial-gradient(circle at 50% 38%, #0f2c52, #081a30);
      display: flex; align-items: center; justify-content: center;
      box-shadow: inset 0 2px 10px rgba(0,0,0,.6);
    }
    #pv-afk-countdown {
      font-family: "Cinzel", serif;
      font-size: 52px;
      font-weight: 900;
      line-height: 1;
      color: var(--ring, var(--teal));
      text-shadow: 0 2px 10px rgba(0,0,0,.5);
      transition: color .25s linear, transform .15s ease;
    }
    #pv-afk-ring.urgent #pv-afk-countdown { animation: afkPulse .7s ease-in-out infinite; }
    @keyframes afkPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }
    #pv-afk-box .pv-afk-seconds {
      font-family: "Nunito", sans-serif;
      font-size: 14px; font-weight: 700;
      color: var(--muted);
      margin: 0 0 14px 0;
      letter-spacing: .3px;
    }
    #pv-afk-box .pv-afk-seconds #pv-afk-seconds-num { color: var(--text); font-size: 16px; }
    #pv-afk-box .pv-afk-warn {
      font-family: "Nunito", sans-serif;
      font-size: 13px; line-height: 1.5;
      color: #f5c260;
      background: rgba(240,200,64,.1);
      border: 1px solid rgba(240,200,64,.25);
      border-radius: 8px;
      padding: 10px 14px;
      margin: 0 0 14px 0;
    }
    #pv-afk-box .pv-afk-warn strong { color: #f5c260; font-weight: 900; }
    #pv-afk-box .pv-afk-foot {
      font-family: "Nunito", sans-serif;
      font-size: 14px; font-weight: 700;
      color: var(--text);
      background: rgba(61,214,245,.08);
      border: 1px solid rgba(61,214,245,.2);
      border-radius: 8px;
      padding: 10px 14px;
    }
    #pv-afk-box .pv-afk-foot b { color: var(--cyan); font-size: 15px; }
    /* Welcome-back toast */
    #pv-welcome-back-toast {
      display: none;
      position: fixed;
      top: 80px;
      left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, #3ea8d8, #1f7fb4);
      color: #fff;
      font-family: "Nunito", sans-serif;
      font-weight: 800;
      font-size: 14px;
      padding: 12px 22px;
      border-radius: 12px;
      box-shadow: 0 6px 22px rgba(0,0,0,.45), 0 0 16px rgba(95,179,214,.5);
      z-index: 8500;
      max-width: 420px;
      text-align: center;
      border: 1px solid rgba(150,210,240,.45);
    }
    #pv-welcome-back-toast.visible { display: block; }
    .pv-btn.sm { font-size: 12px; padding: 6px 11px; }
    .pv-btn.full { width: 100%; }
    .pv-btn.pulse-glow {
      animation: btn-pulse 1.8s ease-in-out infinite;
      box-shadow: 0 0 12px rgba(240,80,80,.45);
    }
    @keyframes btn-pulse {
      0%,100% { box-shadow: 0 0 8px rgba(240,80,80,.4); }
      50%      { box-shadow: 0 0 22px rgba(240,80,80,.75); }
    }

    #pv-lobby-status, #pv-home-status { text-align: center; color: var(--muted); font-size: 13px; min-height: 18px; }

    /* ── Ocean bubble atmosphere ─────────────────────── */
    #pv-lobby::before {
      content: "";
      position: fixed;
      inset: 0;
      background:
        radial-gradient(2px 2px at 18% 28%, rgba(168,224,248,.55) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 62% 12%, rgba(34,216,248,.45) 0%, transparent 100%),
        radial-gradient(2px 2px at 42% 65%, rgba(24,200,168,.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 78% 48%, rgba(34,216,248,.35) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 8%  78%, rgba(24,200,168,.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 55% 90%, rgba(168,224,248,.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 32% 50%, rgba(34,216,248,.3) 0%, transparent 100%);
      pointer-events: none;
      z-index: 0;
      animation: depth-drift 12s ease-in-out infinite alternate;
    }
    #pv-lobby > * { position: relative; z-index: 1; }
    @keyframes depth-drift {
      from { opacity: 0.6; transform: translateY(0); }
      to   { opacity: 1; transform: translateY(-6px); }
    }

    /* ── Drag and drop ────────────────────────────────── */
    .pv-hand-card.dragging { opacity: 0.4; cursor: grabbing; }
    .pv-hand-card { cursor: grab; }
    .pv-hand-card.hand-drag-over::before { content: ''; position: absolute; left: -4px; top: 0; bottom: 0; width: 3px; background: var(--cyan); border-radius: 2px; box-shadow: 0 0 8px var(--glow-c); z-index: 99; }
    .pv-board-card.movable { cursor: grab; }
    .pv-board-card.movable:hover { border-color: var(--gold) !important; box-shadow: 0 0 12px var(--glow-gold), 0 4px 16px rgba(0,0,0,.6) !important; }
    .pv-board-card.movable.dragging { opacity: 0.4; cursor: grabbing; }
    .pv-ocean-hub.move-target { outline: 2px dashed rgba(61,214,245,.55); border-radius: 8px; }
    .pv-ocean-hub.move-drag-over { outline: 2px solid var(--cyan) !important; border-radius: 8px; box-shadow: 0 0 20px var(--glow-c); background: rgba(48,200,240,.06); }
    .pv-lane-slot.drag-over { background: rgba(61,214,245,.25); border-color: var(--cyan) !important; box-shadow: 0 0 12px var(--cyan); transform: scale(1.12); }
    #pv-pool-area.drag-over { outline: 2px dashed var(--gold); border-radius: 8px; background: rgba(245,200,66,.1); }
    #pv-pool-area.drag-over::after { content: "Drop to discard to pool"; display:block; text-align:center; font-size:11px; color:var(--gold); margin-top:4px; }
    #pv-pool-area.can-drop { outline: 1px dashed var(--muted); border-radius: 8px; }
    #pv-hand-zone.pool-drag-over { outline: 2px dashed var(--cyan); background: rgba(48,200,240,.1); border-radius: 8px; transition: background .15s; }
    #tut-hand-zone.pool-drag-over { outline: 2px dashed var(--cyan); background: rgba(48,200,240,.1); border-radius: 6px; }

    /* ── ACTION DROPDOWN PREVIEW ─────────────────────────────────── */
    .pv-ocean-hub.action-preview-target {
      outline: 3px solid var(--cyan) !important;
      border-radius: 8px;
      box-shadow: 0 0 22px rgba(61,214,245,.55);
      background: rgba(48,200,240,.06);
      animation: preview-hub-pulse 1.1s ease-in-out infinite;
    }
    #pv-ocean-drop-zone.action-preview-target {
      border-color: var(--cyan) !important;
      box-shadow: 0 0 18px rgba(61,214,245,.5) !important;
      background: rgba(48,200,240,.1) !important;
    }
    .pv-lane-slot.action-preview-slot {
      border-color: var(--cyan) !important;
      background: rgba(48,200,240,.18);
      position: relative;
    }
    .action-preview-ghost-img {
      position: absolute; inset: 0;
      width: 100%; height: 100%;
      object-fit: cover; border-radius: 6px;
      opacity: 0.5;
      filter: saturate(0.55) brightness(1.1);
      pointer-events: none; z-index: 1;
    }
    @keyframes preview-hub-pulse {
      0%, 100% { box-shadow: 0 0 12px rgba(61,214,245,.35); }
      50%       { box-shadow: 0 0 26px rgba(61,214,245,.7); }
    }

    /* ── MOVE CONFIRMATION MODAL ─────────────────────────────────── */
    #move-confirm-modal {
      display: none; position: fixed; inset: 0; z-index: 9200;
      background: rgba(26,45,90,.45);
      backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
      align-items: center; justify-content: center;
    }
    #move-confirm-modal.open { display: flex; animation: dwm-fade-in .18s ease; }
    #move-confirm-box {
      background: linear-gradient(160deg, var(--cr-cream) 0%, #f5e0c8 70%, #efd0b0 100%);
      border: 2px solid rgba(232,179,74,.65); border-radius: 20px;
      box-shadow: 0 14px 50px rgba(26,45,90,.35), inset 0 1px 0 rgba(255,255,255,.6);
      padding: 24px 28px 22px; width: 92%; max-width: 420px;
      text-align: center; font-family: "Nunito", sans-serif;
      animation: dwm-box-in .22s cubic-bezier(.2,.9,.3,1.2);
    }
    #move-confirm-icon { font-size: 36px; margin-bottom: 4px; line-height: 1; }
    #move-confirm-title {
      font-family: "Cinzel", serif; color: var(--cr-navy);
      font-size: 1.3rem; font-weight: 700; letter-spacing: 1.2px; margin: 0 0 8px;
    }
    #move-confirm-msg {
      color: var(--cr-navy); font-size: 13.5px; line-height: 1.55;
      margin: 0 0 18px; opacity: .88;
    }
    #move-confirm-buttons { display: flex; gap: 10px; justify-content: center; }
    #move-confirm-cancel, #move-confirm-ok {
      border: none; border-radius: 11px; padding: 11px 18px;
      font-family: "Nunito", sans-serif; font-size: 13px; font-weight: 800;
      cursor: pointer; transition: transform .12s, box-shadow .15s, filter .15s;
      letter-spacing: .3px; flex: 1;
    }
    #move-confirm-cancel {
      background: rgba(255,255,255,.78); border: 1.5px solid rgba(95,179,214,.55);
      color: var(--cr-navy);
    }
    #move-confirm-cancel:hover { background: #fff; border-color: var(--cr-teal); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(95,179,214,.35); }
    #move-confirm-ok {
      background: linear-gradient(135deg, #3dd8a8, #2ab88a); color: #fff;
      text-shadow: 0 1px 0 rgba(0,0,0,.2); border: 1.5px solid rgba(61,214,168,.5);
    }
    #move-confirm-ok:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(61,214,168,.5); filter: brightness(1.06); }

    /* ── END TURN CONFIRMATION MODAL ────────────────────────────── */
    #end-turn-modal {
      display: none; position: fixed; inset: 0; z-index: 9200;
      background: rgba(8,22,58,.38);
      backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
      align-items: center; justify-content: center;
    }
    #end-turn-modal.open { display: flex; animation: dwm-fade-in .18s ease; }
    #end-turn-box {
      background: linear-gradient(160deg, #e4f5fb 0%, #cae9f7 65%, #b0dbf1 100%);
      border: 2px solid rgba(95,179,214,.6); border-radius: 20px;
      box-shadow: 0 14px 50px rgba(8,22,58,.28), inset 0 1px 0 rgba(255,255,255,.75);
      padding: 24px 28px 22px; width: 92%; max-width: 400px;
      text-align: center; font-family: "Nunito", sans-serif;
      animation: dwm-box-in .22s cubic-bezier(.2,.9,.3,1.2);
    }
    #end-turn-icon { font-size: 38px; margin-bottom: 4px; line-height: 1; }
    #end-turn-title {
      font-family: "Cinzel", serif; color: var(--cr-navy);
      font-size: 1.3rem; font-weight: 700; letter-spacing: 1.2px; margin: 0 0 8px;
    }
    #end-turn-msg {
      color: var(--cr-navy); font-size: 13.5px; line-height: 1.55;
      margin: 0 0 18px; opacity: .88;
    }
    #end-turn-buttons { display: flex; gap: 10px; justify-content: center; }
    #end-turn-cancel, #end-turn-confirm {
      border: none; border-radius: 11px; padding: 11px 18px;
      font-family: "Nunito", sans-serif; font-size: 13px; font-weight: 800;
      cursor: pointer; transition: transform .12s, box-shadow .15s, filter .15s;
      letter-spacing: .3px; flex: 1;
    }
    #end-turn-cancel {
      background: rgba(255,255,255,.82); border: 1.5px solid rgba(95,179,214,.5);
      color: var(--cr-navy);
    }
    #end-turn-cancel:hover { background: #fff; border-color: var(--cr-teal); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(95,179,214,.35); }
    #end-turn-confirm {
      background: linear-gradient(135deg, #5fb3d6, #3a8fb5); color: #fff;
      text-shadow: 0 1px 0 rgba(0,0,0,.18); border: 1.5px solid rgba(95,179,214,.5);
    }
    #end-turn-confirm:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(95,179,214,.55); filter: brightness(1.06); }

    /* ── HELP / STRATEGY GUIDE ───────────────────────────────────── */
    /* ══════════════════════════════════════════════════════════════
       Strategy Guide modal — warm coral-reef palette
       ══════════════════════════════════════════════════════════════ */
    #pv-help-modal {
      display: none; position: fixed; inset: 0; z-index: 9300;
      background: rgba(10,20,44,.62);
      backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
      align-items: stretch; justify-content: center;
    }
    #pv-help-modal.open { display: flex; animation: dwm-fade-in .18s ease; }
    /* #pv-game > * { position:relative; z-index:1 } (defined later in source)
       has equal specificity and would otherwise clobber the line above,
       dropping the modal back into the in-flow column behind the game HUD.
       This higher-specificity rule (two IDs) keeps it a true fixed overlay
       so the full-screen panel covers the top bar, menu, turn banner and
       guide bar instead of stacking under them. */
    #pv-game > #pv-help-modal { position: fixed; z-index: 9300; }
    /* Full-screen panel: fills the entire viewport so the three Strategy
       sections have the whole page to spread out in. */
    #pv-help-box {
      background: linear-gradient(168deg, #162848 0%, #0f1f3d 45%, #0b1830 100%);
      border: none;
      border-radius: 0;
      box-shadow: inset 0 1px 0 rgba(255,220,180,.08);
      width: 100%; max-width: none;
      max-height: 100vh; height: 100vh;
      display: flex; flex-direction: column; overflow: hidden;
      font-family: "Nunito", sans-serif; color: #f5ede0;
      animation: dwm-sheet-in .26s cubic-bezier(.2,.9,.3,1.05);
    }
    @keyframes dwm-sheet-in { from { transform: translateY(2%); opacity:.4; } to { transform: translateY(0); opacity:1; } }
    #pv-help-header {
      flex: 0 0 auto;
      display: flex; align-items: center; gap: 10px;
      padding: 16px 20px 12px;
      border-bottom: 1px solid rgba(244,165,116,.22);
      background: linear-gradient(90deg, rgba(244,165,116,.07) 0%, transparent 60%);
    }
    #pv-help-title {
      flex: 1; text-align: center; margin: 0;
      font-family: "Luckiest Guy", "Cinzel", serif; font-size: 30px; font-weight: 400;
      color: var(--cr-gold, #e8b34a); letter-spacing: 1.5px;
      text-shadow: 0 2px 10px rgba(232,179,74,.4);
    }
    #pv-help-back, #pv-help-close {
      background: rgba(244,165,116,.1); border: 1.5px solid rgba(244,165,116,.35);
      color: #f5d8bc; border-radius: 10px; cursor: pointer;
      font-family: "Nunito", sans-serif; font-weight: 800; font-size: 13px;
      padding: 7px 12px; transition: background .15s, border-color .15s, transform .12s;
      flex-shrink: 0;
    }
    #pv-help-back:hover, #pv-help-close:hover { background: rgba(244,165,116,.25); border-color: var(--cr-coral, #f4a574); transform: translateY(-1px); }
    #pv-help-back { visibility: hidden; }
    #pv-help-modal.detail #pv-help-back { visibility: visible; }
    #pv-help-intro {
      flex: 0 0 auto;
      padding: 12px 22px 8px; margin: 0; font-size: 16px; line-height: 1.5;
      color: #d8c8aa; text-align: center; font-weight: 600;
    }
    #pv-help-modal.detail #pv-help-intro { display: none; }
    #hs-active-row { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: center; }
    #hs-active-row .hs-active-label { font-weight: 800; color: #c8a882; font-size: 12px; }
    .hs-active-pill { font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 20px; border: 1.5px solid; background: rgba(255,255,255,.05); }
    #hs-clear-active { font-size: 11px; font-weight: 800; color: #f8b0a0; background: rgba(232,110,80,.14); border: 1px solid rgba(232,110,80,.4); border-radius: 16px; padding: 3px 10px; cursor: pointer; }
    #hs-clear-active:hover { background: rgba(232,110,80,.26); }
    /* Randomize bar — sits on the right above the strategy rail. Pick how many
       strategies (1-4) and it activates that many at random for you. */
    #pv-help-rand {
      flex: 0 0 auto;
      display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
      padding: 4px 22px 6px;
    }
    #pv-help-modal.detail #pv-help-rand { display: none; }
    #pv-help-rand .phr-label { font-size: 12px; font-weight: 800; color: #c8a882; }
    #pv-help-rand .phr-label-tail { color: #c8a882; }
    .phr-count { display: inline-flex; gap: 3px; background: rgba(255,255,255,.05); border: 1px solid rgba(244,165,116,.3); border-radius: 12px; padding: 3px; }
    .phr-n {
      min-width: 26px; height: 24px; padding: 0 6px; cursor: pointer;
      background: transparent; border: none; border-radius: 9px;
      font-family: "Nunito", sans-serif; font-size: 13px; font-weight: 900; color: #d8c8aa;
      transition: background .12s, color .12s;
    }
    .phr-n:hover { color: #fef0e0; background: rgba(244,165,116,.16); }
    .phr-n.active { background: var(--cr-coral, #f4a574); color: #1a1208; }
    #phr-go {
      cursor: pointer; font-family: "Nunito", sans-serif; font-size: 13px; font-weight: 900; letter-spacing: .3px;
      color: #1a1208; background: linear-gradient(180deg, #f6c178 0%, #e8a052 100%);
      border: 1px solid rgba(244,165,116,.6); border-radius: 12px; padding: 6px 14px;
      box-shadow: 0 2px 10px rgba(232,160,82,.35); transition: transform .12s, box-shadow .12s, filter .12s;
    }
    #phr-go:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 4px 16px rgba(232,160,82,.5); }
    #phr-go:active { transform: translateY(0); }
    @media (max-width: 560px) {
      #pv-help-rand { padding: 2px 14px 6px; justify-content: center; }
    }
    /* Vertical dashboard: section 1 (core rail) on top, then a 2-column row
       with section 2 (selected) and section 3 (suggested combos). */
    #pv-help-list {
      flex: 1 1 auto; min-height: 0;
      overflow-x: hidden; overflow-y: auto;
      padding: 8px 22px 20px;
      display: flex; flex-direction: column; gap: 16px;
    }
    #pv-help-list::-webkit-scrollbar { width: 10px; }
    #pv-help-list::-webkit-scrollbar-thumb { background: rgba(244,165,116,.4); border-radius: 8px; }
    #pv-help-list::-webkit-scrollbar-track { background: rgba(255,255,255,.05); border-radius: 8px; }
    #pv-help-modal.detail #pv-help-list { display: none; }
    /* Section markers act as tall dividers between groups in the horizontal rail. */
    .hs-section-head {
      flex: 0 0 auto; align-self: stretch; width: 132px;
      display: flex; flex-direction: column; justify-content: center; gap: 6px;
      margin: 0; padding: 0 16px 0 4px;
      border-right: 2px solid rgba(232,179,74,.28);
      font-family: "Luckiest Guy", "Cinzel", serif; font-size: 20px; font-weight: 400;
      color: var(--cr-gold, #e8b34a); line-height: 1.1; letter-spacing: .5px;
    }
    .hs-section-head span { font-family: "Nunito", sans-serif; font-size: 12px; font-weight: 700; color: #b0986e; line-height: 1.3; }
    #pv-help-detail { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: none; padding: 10px 28px 24px; }
    #pv-help-modal.detail #pv-help-detail { display: block; }
    @media (max-width: 560px) {
      #pv-help-box { height: 100vh; max-height: 100vh; }
      .hs2-card, .hs2-combo { width: 70vw; max-width: 240px; }
    }

    .help-strat-card {
      flex: 0 0 auto; width: 208px; min-height: 0; max-height: 100%; scroll-snap-align: start;
      background: linear-gradient(155deg, rgba(244,165,116,.1) 0%, rgba(15,31,61,.6) 100%);
      border: 1.5px solid rgba(244,165,116,.25);
      border-radius: 14px; padding: 12px 13px; cursor: pointer;
      transition: transform .14s, border-color .14s, box-shadow .14s, background .14s;
      display: flex; flex-direction: column; gap: 6px; box-sizing: border-box;
    }
    .help-strat-card:hover {
      transform: translateY(-2px); border-color: var(--cr-coral, #f4a574);
      box-shadow: 0 6px 24px rgba(244,165,116,.28);
      background: linear-gradient(155deg, rgba(244,165,116,.2) 0%, rgba(15,31,61,.7) 100%);
    }
    .help-strat-card.active {
      border-color: var(--strat-c, #f4a574);
      box-shadow: 0 0 0 1.5px var(--strat-c, #f4a574), 0 6px 22px rgba(244,165,116,.22);
      background: linear-gradient(155deg, color-mix(in srgb, var(--strat-c, #f4a574) 20%, transparent), rgba(15,31,61,.55));
    }
    .help-strat-card .hsc-top { display: flex; align-items: center; gap: 8px; }
    .help-strat-card .hsc-name { font-family: "Luckiest Guy", "Cinzel", serif; font-weight: 400; font-size: 17px; color: #fef0e0; flex: 1; letter-spacing: .4px; line-height: 1.1; }
    .help-tier {
      font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
      padding: 3px 8px; border-radius: 20px; flex-shrink: 0;
    }
    .help-tier.Core        { background: rgba(94,201,137,.2);  color: #8fe8b0; border: 1px solid rgba(94,201,137,.5); }
    .help-tier.Combo       { background: rgba(232,179,74,.18); color: #f0c860; border: 1px solid rgba(232,179,74,.5); }
    .help-tier.Beginner    { background: rgba(94,201,137,.2);  color: #8fe8b0; border: 1px solid rgba(94,201,137,.5); }
    .help-tier.Intermediate{ background: rgba(244,165,116,.2); color: #f4c090; border: 1px solid rgba(244,165,116,.5); }
    .help-tier.Advanced    { background: rgba(232,179,74,.2);  color: #f0c860; border: 1px solid rgba(232,179,74,.5); }
    .help-tier.Expert      { background: rgba(232,110,80,.2);  color: #f8a090; border: 1px solid rgba(232,110,80,.5); }
    .help-tier.Hybrid      { background: rgba(192,132,252,.2); color: #d4b0fc; border: 1px solid rgba(192,132,252,.5); }
    .help-tier.Custom      { background: rgba(244,165,116,.18); color: #f4c090; border: 1px solid rgba(244,165,116,.5); }
    .help-strat-card .hsc-blurb { font-size: 12.5px; line-height: 1.42; color: #d2bc9a; font-weight: 600; flex: 1 1 auto; overflow-y: auto; }
    .help-strat-card .hsc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
    .help-strat-card .hsc-go { font-size: 11px; font-weight: 800; color: var(--cr-coral, #f4a574); }
    .hsc-toggle {
      font-size: 11px; font-weight: 800; cursor: pointer; flex-shrink: 0;
      border-radius: 16px; padding: 5px 12px;
      background: rgba(244,165,116,.1); border: 1.5px solid rgba(244,165,116,.4); color: #f5d8bc;
      transition: background .14s, border-color .14s, transform .12s;
    }
    .hsc-toggle:hover { background: rgba(244,165,116,.22); border-color: var(--cr-coral, #f4a574); transform: translateY(-1px); }
    .hsc-toggle.on { background: rgba(94,201,137,.22); border-color: #5ec989; color: #aef0c8; }

    #pv-help-detail .hd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
    #pv-help-detail .hd-name { font-family: "Luckiest Guy", "Cinzel", serif; font-size: 24px; font-weight: 400; color: #fef0e0; letter-spacing: .4px; }
    #pv-help-detail .hd-blurb { font-size: 15px; line-height: 1.55; color: #d2bc9a; margin: 0 0 14px; font-weight: 600; }
    #hd-activate {
      width: 100%; padding: 12px 16px; border-radius: 12px; cursor: pointer;
      font-family: "Nunito", sans-serif; font-size: 15px; font-weight: 900; letter-spacing: .3px;
      background: linear-gradient(135deg, var(--cr-coral, #f4a574), var(--cr-coral-deep, #e8956b)); color: #2a0e00;
      border: 1.5px solid rgba(244,165,116,.6); text-shadow: 0 1px 0 rgba(255,255,255,.2);
      transition: transform .12s, box-shadow .15s, filter .15s;
    }
    #hd-activate:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(244,165,116,.45); filter: brightness(1.06); }
    #hd-activate.on { background: linear-gradient(135deg, #5ec989, #3da868); color: #031a0c; border-color: rgba(94,201,137,.6); }
    .hd-activate-hint { font-size: 11.5px; color: #a89070; text-align: center; margin: 7px 0 4px; line-height: 1.4; }
    #pv-help-detail .hd-section-title {
      font-family: "Luckiest Guy", "Cinzel", serif; font-size: 18px; font-weight: 400; color: var(--cr-gold, #e8b34a); letter-spacing: .4px;
      margin: 18px 0 8px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    }
    .hd-count-note { font-family: "Nunito", sans-serif; font-size: 11px; font-weight: 700; color: #a89070; }
    #pv-help-detail ol.hd-steps { margin: 0; padding-left: 22px; }
    #pv-help-detail ol.hd-steps li { font-size: 15px; line-height: 1.55; color: #f5ede0; margin-bottom: 8px; font-weight: 600; }
    #pv-help-detail ul.hd-tips { margin: 0; padding-left: 26px; list-style: none; }
    #pv-help-detail ul.hd-tips li { font-size: 14px; line-height: 1.6; color: #d2bc9a; margin-bottom: 12px; position: relative; padding-left: 6px; font-weight: 600; overflow-wrap: break-word; word-break: break-word; }
    #pv-help-detail ul.hd-tips li::before { content: "💡"; position: absolute; left: -24px; top: 0; line-height: 1.6; font-size: 13px; }
    .hd-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; margin-top: 4px; }
    .hd-card-tile {
      background: rgba(244,165,116,.06); border: 1px solid rgba(244,165,116,.2);
      border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 5px;
      cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s;
    }
    .hd-card-tile:hover { transform: translateY(-2px); border-color: var(--cr-coral, #f4a574); box-shadow: 0 4px 14px rgba(244,165,116,.25); }
    .hd-card-img { width: 100%; aspect-ratio: 1 / 1; border-radius: 7px; overflow: hidden; background: #0c1c34; position: relative; }
    .hd-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .hd-card-count {
      position: absolute; bottom: 3px; right: 3px;
      background: rgba(15,24,44,.92); color: #f5d060; border: 1px solid rgba(245,200,64,.5);
      font-size: 11px; font-weight: 900; padding: 1px 6px; border-radius: 10px;
    }
    .hd-card-name { font-size: 10.5px; font-weight: 800; color: #fef0e0; line-height: 1.2; text-align: center; }
    .hd-card-text { font-size: 9.5px; line-height: 1.3; color: #b09878; text-align: center; }
    .hd-card-tile.no-img { cursor: default; }
    .hd-card-tile.no-img:hover { transform: none; border-color: rgba(244,165,116,.2); box-shadow: none; }
    .hd-card-noimg {
      width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
      font-family: "Cinzel", serif; font-weight: 700; font-size: 20px; letter-spacing: 1px;
      color: var(--cr-coral, #f4a574); background: linear-gradient(160deg, rgba(244,165,116,.16), rgba(12,28,52,.6));
    }

    /* ══ Strategies v2 — numbered-section dashboard ══════════════════ */
    .hs2-sec { min-width: 0; }
    .hs2-sec-head {
      display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
      font-family: "Luckiest Guy", "Cinzel", serif; font-weight: 400; font-size: 19px;
      color: var(--cr-gold, #e8b34a); letter-spacing: .6px; margin: 0 0 10px;
    }
    .hs2-num {
      display: inline-flex; align-items: center; justify-content: center;
      width: 25px; height: 25px; border-radius: 50%; flex-shrink: 0;
      background: linear-gradient(180deg, #f6c178, #e8a052); color: #1a1208;
      font-family: "Nunito", sans-serif; font-weight: 900; font-size: 14px;
      box-shadow: 0 2px 8px rgba(232,160,82,.4);
    }
    .hs2-sec-sub { font-family: "Nunito", sans-serif; font-size: 12px; font-weight: 700; color: #9fb6cc; letter-spacing: 0; }
    .hs2-clear, #hs2-show-more {
      margin-left: auto; font-family: "Nunito", sans-serif; font-size: 12px; font-weight: 800; cursor: pointer;
      color: #f5d8bc; background: rgba(244,165,116,.1); border: 1.5px solid rgba(244,165,116,.4);
      border-radius: 14px; padding: 4px 12px; letter-spacing: 0; transition: background .14s, border-color .14s, transform .12s;
    }
    .hs2-clear:hover, #hs2-show-more:hover { background: rgba(244,165,116,.22); border-color: var(--cr-coral, #f4a574); transform: translateY(-1px); }
    .hs2-clear { color: #f8b0a0; background: rgba(232,110,80,.14); border-color: rgba(232,110,80,.4); }
    .hs2-clear:hover { background: rgba(232,110,80,.26); border-color: #e86e50; }

    /* Section 1: horizontal rail of full core cards */
    .hs2-core-rail {
      display: flex; flex-direction: row; flex-wrap: nowrap; gap: 13px;
      overflow-x: auto; overflow-y: hidden; padding: 2px 2px 12px;
      scroll-snap-type: x proximity;
    }
    .hs2-core-rail::-webkit-scrollbar { height: 9px; }
    .hs2-core-rail::-webkit-scrollbar-thumb { background: rgba(244,165,116,.4); border-radius: 8px; }
    .hs2-core-rail::-webkit-scrollbar-track { background: rgba(255,255,255,.05); border-radius: 8px; }

    .hs2-card {
      position: relative; flex: 0 0 auto; width: 190px; box-sizing: border-box;
      scroll-snap-align: start; cursor: pointer;
      background: linear-gradient(165deg, rgba(18,34,62,.94), rgba(9,20,40,.97));
      border: 1.5px solid rgba(95,150,200,.28); border-radius: 15px; overflow: hidden;
      display: flex; flex-direction: column;
      transition: transform .14s, border-color .14s, box-shadow .14s;
    }
    .hs2-card:hover {
      transform: translateY(-3px); border-color: var(--strat-c, #f4a574);
      box-shadow: 0 8px 26px rgba(0,0,0,.45), 0 0 16px color-mix(in srgb, var(--strat-c, #f4a574) 35%, transparent);
    }
    .hs2-card.active {
      border-color: #5ec989;
      box-shadow: 0 0 0 2px #5ec989, 0 8px 26px rgba(0,0,0,.5);
    }
    .hs2-card-art, .hs2-mini-art, .hs2-combo-art {
      position: relative; width: 100%; overflow: hidden;
      background: radial-gradient(120% 100% at 50% 18%, rgba(36,60,96,.7), rgba(9,20,40,.96));
    }
    .hs2-card-art { height: 96px; }
    /* Avatar-gallery portraits sit on a transparent canvas — contain + center
       so the whole critter shows, framed by the dark tank backdrop. */
    .hs2-card-art img, .hs2-mini-art img, .hs2-combo-art img, .hs2-reco-art img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; padding: 4px; box-sizing: border-box; filter: drop-shadow(0 2px 5px rgba(0,0,0,.45)); }
    .hs2-card-art::after, .hs2-combo-art::after {
      content: ""; position: absolute; inset: 0; pointer-events: none;
      background: linear-gradient(180deg, transparent 62%, rgba(9,20,40,.55));
    }
    .hs2-card-tag { position: absolute; top: 7px; right: 7px; z-index: 2; }
    .hs2-card-body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
    .hs2-card-name { font-family: "Luckiest Guy", "Cinzel", serif; font-weight: 400; font-size: 16px; color: #fef0e0; letter-spacing: .4px; line-height: 1.12; }
    .hs2-card-blurb { font-size: 11.5px; line-height: 1.4; color: #c2d2e2; font-weight: 600; flex: 1; }
    .hs2-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
    .hs2-card-view, .hs2-combo-view { font-size: 10.5px; font-weight: 800; color: var(--cr-coral, #f4a574); cursor: pointer; flex-shrink: 0; }
    .hs2-combo-view { color: #f0c860; }
    .hs2-card-view:hover, .hs2-combo-view:hover { text-decoration: underline; }
    .hs2-check {
      position: absolute; top: 7px; left: 7px; z-index: 3; width: 23px; height: 23px; border-radius: 50%;
      background: #5ec989; color: #06200f; display: flex; align-items: center; justify-content: center;
      font-weight: 900; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.45);
    }

    /* Top of the list: the standout "best strategy for your hand" recommendation. */
    .hs2-reco { margin-bottom: 6px; }
    .hs2-reco-card {
      position: relative; display: flex; gap: 14px; align-items: stretch; cursor: pointer;
      background: linear-gradient(135deg, rgba(60,46,12,.92), rgba(28,40,66,.96));
      border: 2px solid var(--cr-gold, #e8b34a); border-radius: 16px; overflow: hidden;
      padding: 12px 14px; box-shadow: 0 0 0 1px rgba(232,179,74,.25), 0 8px 28px rgba(0,0,0,.45), 0 0 22px rgba(232,179,74,.28);
      transition: transform .14s, box-shadow .14s, border-color .14s;
    }
    .hs2-reco-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(232,179,74,.4), 0 10px 32px rgba(0,0,0,.5), 0 0 28px rgba(232,179,74,.45); }
    .hs2-reco-card.empty { cursor: default; }
    .hs2-reco-card.empty:hover { transform: none; }
    .hs2-reco-art { flex: 0 0 92px; width: 92px; height: 92px; border-radius: 12px; }
    .hs2-reco-card.empty .hs2-reco-art { display: none; }
    .hs2-reco-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; justify-content: center; }
    .hs2-reco-kicker {
      font-family: "Nunito", sans-serif; font-weight: 900; font-size: 12px; letter-spacing: .3px;
      color: var(--cr-gold, #f2c869); text-transform: uppercase;
    }
    .hs2-reco-name { font-family: "Luckiest Guy", "Cinzel", serif; font-weight: 400; font-size: 22px; color: #fff4e2; letter-spacing: .5px; line-height: 1.1; }
    .hs2-reco-why { font-size: 12.5px; line-height: 1.4; color: #d8e4f0; font-weight: 600; }
    .hs2-reco-why strong { color: #ffe39a; }
    .hs2-reco-foot { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
    .hs2-reco-view { font-size: 11.5px; font-weight: 800; color: var(--cr-gold, #f2c869); cursor: pointer; flex-shrink: 0; }
    .hs2-reco-view:hover { text-decoration: underline; }

    /* Bottom row: section 2 (selected) | section 3 (combos). Grows to fill the
       remaining page height so the panels reach the bottom of the screen. */
    .hs2-bottom { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.55fr); gap: 16px; align-items: stretch; flex: 1 1 auto; min-height: 240px; }
    @media (max-width: 820px) { .hs2-bottom { grid-template-columns: 1fr; flex: 0 0 auto; } }
    .hs2-panel { background: rgba(8,18,36,.5); border: 1px solid rgba(95,150,200,.18); border-radius: 16px; padding: 13px 14px; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
    .hs2-panel .hs2-sec-head { flex: 0 0 auto; }
    .hs2-selected-row, .hs2-combos-row { display: flex; flex-wrap: wrap; gap: 11px; }

    /* Section 2: selected mini-cards */
    .hs2-mini {
      position: relative; width: 120px; box-sizing: border-box;
      background: linear-gradient(165deg, rgba(18,34,62,.94), rgba(9,20,40,.97));
      border: 1.5px solid var(--strat-c, #5ec989); border-radius: 13px; overflow: hidden;
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--strat-c, #5ec989) 28%, transparent);
    }
    .hs2-mini-art { height: 62px; }
    .hs2-mini-body { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
    .hs2-mini-name { font-family: "Luckiest Guy", "Cinzel", serif; font-weight: 400; font-size: 12.5px; color: #fef0e0; line-height: 1.12; }
    .hs2-mini-x {
      position: absolute; top: 5px; right: 5px; z-index: 3; width: 21px; height: 21px; border-radius: 50%;
      background: rgba(232,110,80,.94); color: #fff; border: none; cursor: pointer;
      font-weight: 900; font-size: 11px; line-height: 1; display: flex; align-items: center; justify-content: center;
      box-shadow: 0 2px 6px rgba(0,0,0,.45); transition: transform .12s, background .12s;
    }
    .hs2-mini-x:hover { transform: scale(1.14); background: #e86e50; }
    .hs2-mini.avail { cursor: pointer; border-color: rgba(244,165,116,.32); box-shadow: none; opacity: .9; transition: opacity .14s, transform .12s, border-color .14s; }
    .hs2-mini.avail:hover { opacity: 1; transform: translateY(-2px); border-color: var(--cr-coral, #f4a574); }

    /* Section 2: add-another + create-your-own slots */
    .hs2-slot {
      width: 120px; min-height: 122px; box-sizing: border-box; cursor: pointer;
      border: 1.5px dashed rgba(244,165,116,.45); border-radius: 13px;
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; text-align: center;
      background: rgba(244,165,116,.05); color: #f5c8a0; padding: 10px 8px;
      transition: background .14s, border-color .14s, transform .12s;
    }
    .hs2-slot:hover { background: rgba(244,165,116,.15); border-color: var(--cr-coral, #f4a574); transform: translateY(-2px); }
    .hs2-slot.create { border-color: rgba(105,211,230,.5); color: #aee4ef; background: rgba(105,211,230,.06); }
    .hs2-slot.create:hover { background: rgba(105,211,230,.16); border-color: #69d3e6; }
    .hs2-slot-ico { font-size: 22px; line-height: 1; }
    .hs2-slot-title { font-family: "Luckiest Guy", "Nunito", sans-serif; font-weight: 400; font-size: 13px; line-height: 1.18; }
    .hs2-slot-sub { font-family: "Nunito", sans-serif; font-size: 10px; font-weight: 700; color: #b0986e; line-height: 1.3; }
    .hs2-empty { font-size: 13px; font-weight: 700; color: #9fb6cc; padding: 18px 8px; line-height: 1.5; flex: 1; min-width: 180px; }

    /* Section 3: combo suggestion cards */
    .hs2-combo {
      position: relative; flex: 0 0 auto; width: 190px; box-sizing: border-box; cursor: pointer;
      background: linear-gradient(165deg, rgba(42,33,16,.82), rgba(13,23,43,.96));
      border: 1.5px solid rgba(232,179,74,.42); border-radius: 14px; overflow: hidden;
      display: flex; flex-direction: column; transition: transform .14s, border-color .14s, box-shadow .14s;
    }
    .hs2-combo:hover { transform: translateY(-3px); border-color: #f0c860; box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 14px rgba(232,179,74,.3); }
    .hs2-combo.active { border-color: #5ec989; box-shadow: 0 0 0 2px #5ec989, 0 8px 24px rgba(0,0,0,.5); }
    .hs2-combo-art { height: 76px; }
    .hs2-combo-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
    .hs2-combo-pairtag {
      display: inline-block; align-self: flex-start; font-size: 9px; font-weight: 800; letter-spacing: .2px;
      color: #d6c4a2; background: rgba(232,179,74,.12); border: 1px solid rgba(232,179,74,.3);
      border-radius: 10px; padding: 1px 7px;
    }
    .hs2-combo-name { font-family: "Luckiest Guy", "Cinzel", serif; font-weight: 400; font-size: 14px; color: #fef0e0; line-height: 1.12; }
    .hs2-combo-why { font-size: 11px; line-height: 1.4; color: #d6c4a2; font-weight: 600; flex: 1; }
    .hs2-combo-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }

    .hs-create-btn {
      flex: 0 0 auto; align-self: stretch; width: 200px; margin: 0;
      padding: 12px 16px; border-radius: 14px; cursor: pointer;
      font-family: "Luckiest Guy", "Nunito", sans-serif; font-size: 17px; font-weight: 400; letter-spacing: .4px; line-height: 1.2;
      background: rgba(244,165,116,.08); border: 1.5px dashed rgba(244,165,116,.45); color: #f5c8a0;
      transition: background .14s, border-color .14s, transform .12s;
    }
    .hs-create-btn:hover { background: rgba(244,165,116,.18); border-color: var(--cr-coral, #f4a574); transform: translateY(-1px); }
    .hd-custom-tools { display: flex; gap: 10px; margin-top: 22px; }
    .hd-edit-btn, .hd-delete-btn {
      flex: 1; padding: 10px 14px; border-radius: 11px; cursor: pointer;
      font-family: "Nunito", sans-serif; font-size: 13px; font-weight: 800;
      transition: background .14s, border-color .14s, transform .12s;
    }
    .hd-edit-btn { background: rgba(244,165,116,.1); border: 1.5px solid rgba(244,165,116,.4); color: #f5d8bc; }
    .hd-edit-btn:hover { background: rgba(244,165,116,.22); border-color: var(--cr-coral, #f4a574); transform: translateY(-1px); }
    .hd-delete-btn { background: rgba(232,110,80,.1); border: 1.5px solid rgba(232,110,80,.4); color: #f8b0a0; }
    .hd-delete-btn:hover { background: rgba(232,110,80,.22); border-color: #e86e50; transform: translateY(-1px); }
    .cc-form { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
    .cc-flabel { font-family: "Cinzel", serif; font-size: 13px; font-weight: 700; color: var(--cr-gold, #e8b34a); margin-top: 10px; }
    .cc-fhint { font-family: "Nunito", sans-serif; font-size: 11px; font-weight: 700; color: #a89070; }
    .cc-input, .cc-textarea {
      width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px;
      background: rgba(10,20,40,.65); border: 1.5px solid rgba(244,165,116,.3); color: #f5ede0;
      font-family: "Nunito", sans-serif; font-size: 14px; line-height: 1.45;
      transition: border-color .14s, box-shadow .14s;
    }
    .cc-textarea { resize: vertical; min-height: 64px; }
    .cc-input:focus, .cc-textarea:focus { outline: none; border-color: var(--cr-coral, #f4a574); box-shadow: 0 0 0 2px rgba(244,165,116,.22); }
    .cc-input-err { border-color: #e86e50 !important; box-shadow: 0 0 0 2px rgba(232,110,80,.3) !important; }
    .cc-input::placeholder, .cc-textarea::placeholder { color: #7a6248; }
    .cc-form-actions { display: flex; gap: 10px; margin-top: 16px; }
    .cc-save-btn {
      flex: 2; padding: 12px 16px; border-radius: 12px; cursor: pointer;
      font-family: "Nunito", sans-serif; font-size: 15px; font-weight: 900; letter-spacing: .3px;
      background: linear-gradient(135deg, var(--cr-coral, #f4a574), var(--cr-coral-deep, #e8956b)); color: #2a0e00;
      border: 1.5px solid rgba(244,165,116,.6); text-shadow: 0 1px 0 rgba(255,255,255,.18);
      transition: transform .12s, box-shadow .15s, filter .15s;
    }
    .cc-save-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(244,165,116,.45); filter: brightness(1.06); }
    .cc-cancel-btn {
      flex: 1; padding: 12px 16px; border-radius: 12px; cursor: pointer;
      font-family: "Nunito", sans-serif; font-size: 14px; font-weight: 800;
      background: rgba(255,255,255,.06); border: 1.5px solid rgba(244,165,116,.3); color: #c8b49a;
      transition: background .14s, border-color .14s, transform .12s;
    }
    .cc-cancel-btn:hover { background: rgba(244,165,116,.14); border-color: var(--cr-coral, #f4a574); transform: translateY(-1px); }
    .cc-form code { background: rgba(244,165,116,.16); color: #f5c8a0; padding: 1px 5px; border-radius: 5px; font-size: 12px; }

    /* ── Strategy highlight on hand + pool cards (active strategies) ── */
    .pv-pool-card.strat-hl { outline: 2.5px solid var(--strat-c, #b388ff); outline-offset: 1px; filter: drop-shadow(0 0 6px var(--strat-c, #b388ff)); }
    .pv-hand-card.strat-hl { filter: drop-shadow(0 0 7px var(--strat-c, #b388ff)); }
    .pv-hand-card.strat-hl .pv-card-inner { outline: 2.5px solid var(--strat-c, #b388ff); outline-offset: 1px; }
    .strat-tags {
      position: absolute; top: 2px; left: 2px; z-index: 8;
      display: flex; flex-wrap: wrap; gap: 2px; max-width: calc(100% - 4px);
      pointer-events: none;
    }
    /* Hand cards fan out with a -28px overlap and no z-index ordering, so a
       badge sitting in either the left 28px (overlapped BY this card onto the
       previous one) or the right 28px (overlapped BY the next card onto this
       one) reads as belonging to the wrong card. 30px is inside every card's
       exclusively-visible strip regardless of its position in the fan. */
    .pv-hand-card .strat-tags { left: 30px; max-width: calc(100% - 32px); }
    .strat-tag {
      font-size: 8px; font-weight: 900; color: #07101f; line-height: 1.25;
      padding: 1px 4px; border-radius: 6px; white-space: nowrap;
      box-shadow: 0 1px 3px rgba(0,0,0,.55); letter-spacing: .2px;
    }
    .strat-tag-more { background: #fff; }
    /* Strategy highlight on board cards + ocean bases (mine, opponents, the
       full-screen focus view, and the hover peek). Outline is drawn outside the
       box so overflow:hidden never clips it. */
    .pv-board-card.strat-hl { outline: 3px solid var(--strat-c, #b388ff); outline-offset: 1px; box-shadow: 0 0 11px 1px var(--strat-c, #b388ff); z-index: 6; }
    .pv-ocean-face.strat-hl { outline: 3px solid var(--strat-c, #b388ff); outline-offset: 1px; box-shadow: 0 0 0 2px #004180, 0 0 16px 2px var(--strat-c, #b388ff); }


    /* ── Family-colour legend (top of the Strategies panel) ──────────── */
    .hs-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 9px 0 2px; }
    .hs-legend-cap { font-size: 11px; font-weight: 800; color: #9fc0e0; margin-right: 2px; }
    .hs-legend-chip {
      font-size: 11px; font-weight: 800; color: #e8eef6;
      padding: 2px 8px 2px 6px; border-radius: 999px;
      background: rgba(255,255,255,.05); border: 1px solid var(--lc, #b388ff);
    }
    .hs-legend-chip::before {
      content: ""; display: inline-block; width: 8px; height: 8px;
      border-radius: 50%; background: var(--lc, #b388ff); margin-right: 5px;
      vertical-align: middle; box-shadow: 0 0 5px var(--lc, #b388ff);
    }

    /* ── SEAT PICKER ─────────────────────────────────────────────── */
    #pv-seat-picker { display: none; flex-direction: column; gap: 10px; }
    .seat-grid { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
    .seat-btn {
      width: 140px; height: 140px;
      border-radius: 16px;
      border: 2.5px solid #a8c8ee;
      background: #fff;
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 8px; cursor: pointer;
      transition: border-color .18s, background .18s, transform .15s, box-shadow .15s;
      font-family: "Nunito", inherit;
      box-shadow: 0 2px 12px rgba(30,80,160,.10);
    }
    .seat-btn .seat-num {
      font-family: "Cinzel", serif;
      font-size: 44px; font-weight: 900;
      color: #1a2d5a; line-height: 1;
    }
    .seat-btn .seat-label { font-size: 12px; font-weight: 800; color: #1a2d5a; text-transform: uppercase; letter-spacing: 1px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .seat-btn:hover:not(.taken) { border-color: #3a7ad8; background: #f0f6ff; transform: translateY(-3px); box-shadow: 0 8px 24px rgba(58,122,216,.22); }
    .seat-btn.selected { border-color: #3a7ad8; border-width: 3px; background: #e8f1fc; box-shadow: 0 0 0 4px rgba(58,122,216,.20), 0 8px 24px rgba(58,122,216,.20); }
    .seat-btn.selected .seat-num { color: #1e58b8; }
    .seat-btn.selected .seat-label { color: #1e58b8; }
    .seat-btn.taken { cursor: not-allowed; opacity: .5; border-color: #ccd8e8; background: #f4f7fb; }
    .seat-btn.taken .seat-num { color: #8a9aaa; }
    .seat-btn.taken .seat-label { color: #8a9aaa; }

    /* ── GAME ROOT ──────────────────────────────────────────────── */
    #pv-game {
      display: none;
      flex-direction: column;
      height: 100vh;
      /* overflow: hidden removed — it was clipping the absolutely-positioned
         menu dropdown. html/body already has overflow:hidden to block scroll. */
      background: #050d1a;
      position: relative;
    }
    /* Moving water background — gently drifts the game-bg.png for a "moving water" feel */
    #pv-game::before {
      content: "";
      position: absolute;
      inset: -2.5%;
      background: url("/game-bg.png") center/cover no-repeat;
      animation: pv-water-drift 26s ease-in-out infinite alternate;
      z-index: 0;
      pointer-events: none;
      will-change: transform;
    }
    /* Subtle shimmer overlay — extra "water" cue layered on top of the bg */
    #pv-game::after {
      content: "";
      position: absolute;
      inset: 0;
      background:
        linear-gradient(120deg, transparent 35%, rgba(120, 200, 230, 0.06) 50%, transparent 65%);
      background-size: 220% 220%;
      animation: pv-water-shimmer 18s linear infinite;
      z-index: 0;
      pointer-events: none;
      will-change: background-position;
    }
    /* All immediate children of #pv-game must render above the bg layers */
    #pv-game > * { position: relative; z-index: 1; }
    @keyframes pv-water-drift {
      0%   { transform: translate(-0.9%, -0.6%) scale(1.015); }
      50%  { transform: translate(0.5%, -0.4%) scale(1.02);  }
      100% { transform: translate(0.9%, 0.6%)  scale(1.015); }
    }
    @keyframes pv-water-shimmer {
      0%   { background-position: 0% 0%; }
      100% { background-position: 220% 220%; }
    }
    @media (prefers-reduced-motion: reduce) {
      #pv-game::before, #pv-game::after { animation: none; }
    }

    /* ── NOTICE BAR ─────────────────────────────────────────────── */
    #pv-notice {
      background: linear-gradient(90deg, rgba(254,245,230,.92) 0%, rgba(220,238,245,.94) 50%, rgba(254,245,230,.92) 100%);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border-bottom: 1px solid rgba(95,179,214,.45);
      font-size: 12px;
      color: var(--cr-navy);
      padding: 5px 14px;
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
      /* Stacking context so the menu dropdown renders above the game table */
      position: relative;
      z-index: 100;
    }
    .room-badge {
      background: linear-gradient(135deg, var(--cr-teal), var(--cr-teal-deep));
      border-radius: 6px;
      padding: 2px 8px;
      font-weight: 800;
      color: #fff;
      font-size: 11px;
      letter-spacing: 1.5px;
      text-shadow: 0 1px 2px rgba(0,0,0,.25);
    }
    #pv-my-name-badge { color: var(--cr-navy); font-weight: 800; }
    #pv-my-score-badge {
      background: linear-gradient(135deg, var(--cr-coral), var(--cr-coral-deep));
      border: 1px solid rgba(232,179,74,.65);
      border-radius: 8px;
      padding: 2px 10px;
      font-weight: 900;
      color: var(--cr-navy);
      font-size: 13px;
      font-family: "Cinzel", serif;
      letter-spacing: 1px;
      min-width: 48px;
      text-align: center;
      cursor: pointer;
      transition: border-color .15s, box-shadow .15s, transform .12s;
      text-shadow: 0 1px 0 rgba(255,255,255,.45);
    }
    #pv-my-score-badge:hover {
      border-color: var(--cr-gold);
      box-shadow: 0 0 10px rgba(232,179,74,.4);
      transform: translateY(-1px);
    }
    #pv-status-text { flex: 1; text-align: center; color: var(--cr-navy); font-weight: 800; font-size: 12px; letter-spacing: .3px; }
    #pv-notice .notice-btns { display: flex; gap: 6px; }

    /* ── TURN BANNER ────────────────────────────────────────────── */
    #pv-turn-banner {
      text-align: center;
      font-family: "Cinzel", serif;
      font-size: 13px;
      font-weight: 900;
      padding: 8px 20px;
      letter-spacing: 2px;
      flex-shrink: 0;
      transition: background .4s, color .4s, box-shadow .4s;
    }
    #pv-turn-banner.my-turn {
      background: linear-gradient(90deg, rgba(244,165,116,0) 0%, rgba(244,165,116,.55) 30%, rgba(232,179,74,.6) 50%, rgba(244,165,116,.55) 70%, rgba(244,165,116,0) 100%);
      color: var(--cr-navy);
      animation: banner-glow 2s ease-in-out infinite;
      text-shadow: 0 0 18px rgba(255,255,255,.85), 0 1px 0 rgba(255,255,255,.9);
    }
    @keyframes banner-glow {
      0%,100% { box-shadow: inset 0 -2px 22px rgba(232,179,74,.18); }
      50%      { box-shadow: inset 0 -2px 32px rgba(232,179,74,.4); }
    }
    #pv-turn-banner.their-turn {
      opacity: 0;
      pointer-events: none;
    }
    #pv-turn-banner.endgame {
      background: linear-gradient(90deg, rgba(40,10,10,0) 0%, rgba(80,10,10,.7) 30%, rgba(80,10,10,.7) 70%, rgba(40,10,10,0) 100%);
      color: var(--red);
      animation: banner-red 1.5s ease-in-out infinite;
    }
    @keyframes banner-red {
      0%,100% { text-shadow: 0 0 10px rgba(232,64,87,.4); }
      50%      { text-shadow: 0 0 25px rgba(232,64,87,.8); }
    }

    /* ── TABLE ──────────────────────────────────────────────────── */
    /* The board lives in #pv-table-inner so the in-game Board Size control
       can zoom ONLY the board (oceans, pool, deck, opponents) without ever
       pushing or clipping the hand, action bar, or End/Undo buttons. The
       outer #pv-table is the scroll container that catches overflow when the
       board is zoomed in past the available space. */
    #pv-table {
      flex: 1;
      overflow: hidden;
      position: relative;
      min-height: 0;
    }
    #pv-table.pv-table-zoomed { overflow: auto; }
    #pv-table-inner {
      display: grid;
      grid-template-rows: auto auto 1fr;
      gap: 5px;
      padding: 5px 10px;
      min-height: 100%;
      box-sizing: border-box;
      zoom: var(--board-zoom, 1);
    }

    /* ── OPPONENTS ──────────────────────────────────────────────── */
    #pv-opponents { display: none !important; }
    /* 1 opponent — centred */
    #pv-opponents.opp-1 { grid-template-columns: 1fr; justify-items: center; }
    /* 2 opponents — left + across */
    #pv-opponents.opp-2 { grid-template-areas: "left across"; grid-template-columns: 1fr 2fr; }
    /* 3 opponents — left + across + right */
    #pv-opponents.opp-3 { grid-template-areas: "left across right"; grid-template-columns: 1fr 2fr 1fr; }
    .opp-pos-across { grid-area: across; }
    .opp-pos-left   { grid-area: left; }
    .opp-pos-right  { grid-area: right; }
    .opp-pos-label {
      font-size: 9px; color: var(--muted); text-transform: uppercase;
      letter-spacing: 1px; text-align: center; margin-bottom: 3px; font-weight: 700;
    }

    .pv-opp-card {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 7px 11px;
      min-width: 170px;
      max-width: 300px;
      flex: 1;
      transition: border-color .3s, box-shadow .3s;
    }
    .pv-opp-card.active-turn {
      border-color: var(--gold2);
      box-shadow: 0 0 14px rgba(245,200,66,.2);
    }
    .pv-opp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
    .pv-opp-name { font-weight: 800; font-size: 13px; }
    .pv-opp-score {
      background: #143268;
      border-radius: 6px; padding: 2px 8px;
      font-size: 12px; font-weight: 800;
      color: var(--gold); font-family: "Cinzel", serif;
    }
    .pv-opp-stats { display: flex; gap: 10px; font-size: 11px; color: var(--muted); margin-bottom: 5px; }

    /* face-down hand cards strip */
    .pv-opp-hand {
      display: flex;
      align-items: center;
      margin-bottom: 5px;
      height: 30px;
      position: relative;
    }
    .pv-fd-card {
      width: 21px;
      height: 30px;
      background: var(--cc-card-back) center/cover no-repeat,
                  linear-gradient(135deg, #2A5AA0, #1A3D78);
      border: 1px solid #3A72C0;
      border-radius: 4px;
      position: absolute;
      overflow: hidden;
      box-shadow: 1px 1px 4px rgba(0,0,0,.4);
      transition: transform .15s;
    }

    .pv-opp-mini-board { display: flex; gap: 4px; flex-wrap: wrap; }
    .pv-mini-ocean {
      background: var(--felt);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 2px 5px;
      font-size: 10px; color: var(--muted);
      display: flex; gap: 3px; align-items: center;
    }
    .pv-mini-ocean img { width: 26px; height: 36px; object-fit: cover; border-radius: 3px; opacity: .85; }
    .pv-mini-count {
      background: var(--border); border-radius: 4px;
      padding: 1px 4px; font-size: 10px; color: var(--text);
    }

    /* ── CENTER STRIP ───────────────────────────────────────────── */
    #pv-center-strip {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 14px;
      padding: 3px 0;
    }
    .pv-section-label {
      font-size: 9px;
      color: var(--cr-navy);
      text-transform: uppercase;
      letter-spacing: 1.5px;
      text-align: center;
      margin-bottom: 3px;
      font-weight: 800;
      text-shadow: 0 1px 0 rgba(255,255,255,.5);
    }

    /* Deck pile */
    .pv-deck-pile {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      cursor: pointer;
      position: relative;
    }
    .pv-deck-stack {
      position: relative;
      width: 76px;
      height: 106px;
    }
    .pv-deck-face {
      position: absolute;
      inset: 0;
      /* Card-back art fills the pile; the gradient is only a load fallback.
         The count is NEVER printed on the card — it lives in the label below
         and the hover tooltip (#pv-deck-tip). */
      background: var(--cc-card-back) center/cover no-repeat,
                  linear-gradient(135deg, var(--cr-teal), var(--cr-teal-deep));
      border: 2px solid var(--cr-gold);
      border-radius: 10px;
      overflow: hidden;
      box-shadow: 3px 3px 0 rgba(26,45,90,.55), 5px 5px 0 rgba(26,45,90,.4);
      transition: border-color .2s, box-shadow .2s;
    }
    .pv-deck-pile:hover .pv-deck-face { border-color: var(--cr-coral); box-shadow: 3px 3px 0 rgba(26,45,90,.55), 5px 5px 0 rgba(26,45,90,.4), 0 0 18px rgba(244,165,116,.55); }
    .pv-deck-count { font-size: 11px; color: var(--cr-navy); font-weight: 800; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
    /* Hover popup over the deck: how many cards are left. Lives above the pile,
       never on the card art. */
    .pv-deck-tip {
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%) translateY(2px);
      margin-bottom: 7px;
      background: var(--cr-navy);
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      white-space: nowrap;
      padding: 5px 11px;
      border-radius: 9px;
      border: 1.5px solid var(--cr-gold);
      box-shadow: 0 5px 16px rgba(0,0,0,.45);
      opacity: 0;
      pointer-events: none;
      transition: opacity .15s ease, transform .15s ease;
      z-index: 60;
    }
    .pv-deck-tip::after {
      content: "";
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      border: 5px solid transparent;
      border-top-color: var(--cr-gold);
    }
    .pv-deck-pile:hover .pv-deck-tip { opacity: 1; transform: translateX(-50%) translateY(-2px); }

    /* Pool */
    #pv-pool-area { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
    #pv-pool-wrap {
      display: grid;
      grid-template-columns: repeat(5, 90px);
      gap: 8px;
    }
    .pv-pool-card {
      width: 90px; height: 126px;
      border-radius: 7px; overflow: hidden;
      border: 2px solid var(--border);
      cursor: pointer;
      transition: transform .18s, border-color .15s, box-shadow .15s;
      position: relative; flex-shrink: 0;
    }
    .pv-pool-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .pv-pool-card:hover {
      transform: translateY(-8px) scale(1.12);
      border-color: var(--cyan);
      box-shadow: 0 6px 18px var(--glow-c);
      z-index: 20;
    }
    .pv-pool-card.selected {
      border-color: var(--gold);
      box-shadow: 0 0 10px var(--glow-gold);
      transform: translateY(-5px) scale(1.08);
    }
    @keyframes flipCardIn {
      from { transform: rotateY(90deg) scale(.8); opacity: 0; }
      to   { transform: rotateY(0deg)  scale(1);  opacity: 1; }
    }
    .pv-pool-card.flip-in { animation: flipCardIn .32s ease-out; }

    /* ── POOL EXPAND BUTTON ─────────────────────────────────────── */
    #pv-pool-expand-btn {
      background: rgba(232,179,74,.18);
      border: 1px solid rgba(232,179,74,.55);
      border-radius: 5px;
      color: var(--cr-navy);
      cursor: pointer;
      padding: 3px 10px;
      font-size: 11px;
      line-height: 1.5;
      letter-spacing: .5px;
      text-transform: uppercase;
      font-weight: 800;
      transition: color .15s, border-color .15s, background .15s;
      vertical-align: middle;
      margin-left: 6px;
    }
    #pv-pool-expand-btn:hover { color: var(--cr-navy); border-color: var(--cr-gold); background: rgba(232,179,74,.35); }

    /* ── POOL OVERVIEW MODAL ────────────────────────────────────── */
    #pv-pool-modal {
      display: none;
      position: fixed; inset: 0;
      background: rgba(0,12,30,.88);
      z-index: 1500;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(4px);
    }
    #pv-pool-modal.open { display: flex; }
    #pv-pm-box {
      background: var(--felt);
      border: 1px solid var(--border);
      border-radius: 16px;
      box-shadow: 0 20px 60px rgba(0,0,0,.7);
      width: min(96vw, 800px);
      max-height: 82vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    #pv-pm-hdr {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 18px 12px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    #pv-pm-title {
      font-family: "Cinzel", serif;
      font-size: 1rem;
      font-weight: 700;
      color: var(--cyan);
      letter-spacing: .5px;
    }
    #pv-pm-close {
      width: 30px; height: 30px;
      background: rgba(255,255,255,.07);
      border: 1px solid var(--border);
      border-radius: 50%;
      color: var(--muted);
      font-size: 16px;
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: color .15s, border-color .15s;
    }
    #pv-pm-close:hover { color: var(--red); border-color: var(--red); }
    #pv-pm-body {
      overflow-y: auto;
      padding: 16px 16px 20px;
    }
    #pv-pm-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 18px;
    }
    .pv-pm-card {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      cursor: pointer;
    }
    .pv-pm-card-img {
      width: 100%; aspect-ratio: 48 / 68;
      border-radius: 10px;
      overflow: hidden;
      border: 2px solid var(--border);
      transition: transform .18s, border-color .15s, box-shadow .15s;
    }
    .pv-pm-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .pv-pm-card:hover .pv-pm-card-img {
      transform: translateY(-8px) scale(1.05);
      border-color: var(--cyan);
      box-shadow: 0 10px 28px var(--glow-c);
    }
    .pv-pm-card.selected .pv-pm-card-img {
      border-color: var(--gold);
      box-shadow: 0 0 18px var(--glow-gold);
      transform: translateY(-5px) scale(1.04);
    }
    .pv-pm-card-name {
      font-size: .8rem;
      color: var(--muted);
      text-align: center;
      width: 100%;
      line-height: 1.3;
    }
    #pv-pm-hint {
      font-size: .8rem;
      color: var(--cyan);
      text-align: center;
      padding: 10px 0 2px;
    }
    #pv-pm-empty {
      font-size: .88rem;
      color: var(--muted);
      text-align: center;
      padding: 36px 0;
    }

    /* ── CARD ANIMATIONS ────────────────────────────────────────── */
    @keyframes dealIn {
      0%   { transform: translateY(-55px) translateX(-10px) scale(.55) rotate(-6deg); opacity: 0; }
      65%  { transform: translateY(5px)   translateX(0)     scale(1.06) rotate(.5deg); opacity: 1; }
      100% { transform: translateY(0)     translateX(0)     scale(1)    rotate(0deg); opacity: 1; }
    }
    .pv-hand-card.deal-in {
      animation: handSurfaceIn .46s cubic-bezier(.22,.68,0,1.15) both;
    }
    @keyframes handSurfaceIn {
      0%   { opacity: 0; transform: scale(.55) translateY(10px); filter: blur(2px); }
      55%  { opacity: 1; transform: scale(1.08) translateY(-2px); filter: blur(0); }
      100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
    }

    /* ── END-GAME CINEMATIC ─────────────────────────────────────── */
    #endgame-cinematic {
      position: fixed; inset: 0; z-index: 9999;
      display: none; flex-direction: column; align-items: center; justify-content: center;
      background: rgba(0,0,0,.78); pointer-events: none;
    }
    #endgame-cinematic.active { display: flex; pointer-events: none; }
    #endgame-cinematic.active .eg-dismiss { pointer-events: auto; }
    @keyframes egCardDrop {
      0%   { transform: translateY(-160px) scale(.5) rotate(-8deg); opacity: 0; }
      55%  { transform: translateY(12px)   scale(1.08) rotate(1deg); opacity: 1; }
      75%  { transform: translateY(-6px)   scale(1.04) rotate(-.5deg); }
      100% { transform: translateY(0)      scale(1)    rotate(0deg); opacity: 1; }
    }
    @keyframes egTitlePop {
      0%   { transform: scale(.6); opacity: 0; }
      70%  { transform: scale(1.12); opacity: 1; }
      100% { transform: scale(1); opacity: 1; }
    }
    @keyframes egShake {
      0%,100% { transform: translateX(0); }
      20%     { transform: translateX(-6px); }
      40%     { transform: translateX(6px); }
      60%     { transform: translateX(-4px); }
      80%     { transform: translateX(4px); }
    }
    #endgame-cinematic .eg-title {
      font-family: "Cinzel", serif; font-size: clamp(1.8rem, 5vw, 2.8rem);
      color: #f87171; text-shadow: 0 0 24px #f87171, 0 0 48px #f8717166;
      letter-spacing: .12em; margin-bottom: 18px;
      animation: egTitlePop .5s .05s cubic-bezier(.22,.68,0,1.3) both, egShake .35s .5s ease-in-out;
    }
    #endgame-cinematic .eg-card-wrap {
      width: clamp(120px, 22vw, 180px);
      aspect-ratio: 2/3;
      border-radius: 10px;
      overflow: hidden;
      box-shadow: 0 0 40px #f87171aa, 0 0 80px #f8717155;
      animation: egCardDrop .55s .1s cubic-bezier(.22,.68,0,1.25) both;
      margin-bottom: 18px;
    }
    #endgame-cinematic .eg-card-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
    #endgame-cinematic .eg-sub {
      font-size: .95rem; color: #e0e0e0; opacity: 0;
      animation: egTitlePop .4s .55s ease-out forwards;
      text-align: center; max-width: 280px; line-height: 1.4;
    }
    #endgame-cinematic .eg-dismiss {
      margin-top: 22px; padding: 9px 28px;
      background: rgba(248,113,113,.15); border: 1.5px solid #f87171;
      color: #f87171; border-radius: 8px; cursor: pointer;
      font-size: .9rem; letter-spacing: .06em;
      opacity: 0; animation: egTitlePop .4s .9s ease-out forwards;
      transition: background .18s;
    }
    #endgame-cinematic .eg-dismiss:hover { background: rgba(248,113,113,.28); }
    @keyframes placeIn {
      0%   { transform: scale(.3) rotate(-4deg); opacity: 0; }
      65%  { transform: scale(1.1) rotate(.5deg); opacity: 1; }
      100% { transform: scale(1)   rotate(0deg); opacity: 1; }
    }
    .pv-board-card.place-in { animation: placeIn .3s cubic-bezier(.22,.68,0,1.2) both; }
    .pv-draw-btns { display: flex; gap: 5px; }

    /* ── MY BOARD ───────────────────────────────────────────────── */
    #pv-my-board {
      flex: 1;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-content: flex-start;
      justify-content: center;
      overflow-y: auto;
      padding: 4px 0;
    }

    .pv-ocean-hub {
      background: var(--felt);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 6px;
      display: grid;
      grid-template-areas:
        ".    up    ."
        "left ocean right"
        ".    down  .";
      /* Side (left/right) lanes use minmax(half-card, auto) — NOT a fixed
         half-card width — so that stacking cards sideways (Yellowfin Tuna,
         Lobster, …) GROWS the column instead of overflowing it. This keeps the
         hub border wrapped around the whole stack and makes the hub's layout
         box grow, so neighbouring oceans reflow out of the way instead of being
         overlapped by the spilling cards. The minmax floor matches the old
         fixed width, so empty/single-card oceans are unchanged; up/down already
         grow via the auto rows below. */
      grid-template-columns: minmax(calc(var(--mini-w) / 2), auto) auto minmax(calc(var(--mini-w) / 2), auto);
      grid-template-rows: auto auto auto;
      align-items: center;
      gap: 0;
      transition: border-color .2s, box-shadow .2s;
    }
    .pv-ocean-hub:hover { border-color: #2a5070; }

    .pv-ocean-center { grid-area: ocean; display: flex; align-items: center; justify-content: center; align-self: center; }
    /* gap:0 so stacked cards touch and connect flush (see stacking rules below) */
    .pv-lane-up    { grid-area: up;    display: flex; flex-direction: column-reverse; align-items: center; gap: 0; align-self: end; }
    .pv-lane-down  { grid-area: down;  display: flex; flex-direction: column; align-items: center; gap: 0; align-self: start; }
    .pv-lane-left  { grid-area: left;  display: flex; flex-direction: row-reverse; align-items: center; gap: 0; align-self: center; }
    .pv-lane-right { grid-area: right; display: flex; flex-direction: row; align-items: center; gap: 0; align-self: center; }

    .pv-board-card {
      width: var(--mini-w);
      height: var(--mini-h);
      border-radius: 7px; overflow: hidden;
      border: 1.5px solid var(--border);
      position: relative; flex-shrink: 0;
      transition: transform .15s, border-color .15s, box-shadow .15s;
      cursor: pointer;
    }
    .pv-board-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .pv-board-card:hover {
      transform: scale(1.05);
      border-color: var(--cyan);
      z-index: 20;
      box-shadow: 0 4px 16px rgba(0,0,0,.6);
    }

    /* ── Half-card clip: each card slides under the ocean face ── */
    /* Up: show top half of card (bottom tucks under ocean) */
    .pv-lane-up .pv-board-card,
    .pv-lane-up .pv-lane-slot {
      height: calc(var(--mini-h) / 2);
      border-bottom: none;
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
    }
    /* Down: show bottom half (top tucks under ocean) */
    .pv-lane-down .pv-board-card,
    .pv-lane-down .pv-lane-slot {
      height: calc(var(--mini-h) / 2);
      border-top: none;
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }
    /* Left: show left half (right edge tucks under ocean) */
    .pv-lane-left .pv-board-card,
    .pv-lane-left .pv-lane-slot {
      width: calc(var(--mini-w) / 2);
      border-right: none;
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }
    /* Right: show right half (left edge tucks under ocean) */
    .pv-lane-right .pv-board-card,
    .pv-lane-right .pv-lane-slot {
      width: calc(var(--mini-w) / 2);
      border-left: none;
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
    }
    /* Direction-based hover: translate away from ocean instead of scaling in */
    .pv-lane-up    .pv-board-card:hover { transform: translateY(-4px) scale(1.05); transform-origin: center bottom; }
    .pv-lane-down  .pv-board-card:hover { transform: translateY(4px)  scale(1.05); transform-origin: center top; }
    .pv-lane-left  .pv-board-card:hover { transform: translateX(-4px) scale(1.05); transform-origin: right center; }
    .pv-lane-right .pv-board-card:hover { transform: translateX(4px)  scale(1.05); transform-origin: left center; }

    /* Stacked cards (Yellowfin Tuna, Lobster, etc.) sit FLUSH against each
       other — every card's visible half connects seamlessly to the next so the
       whole stack reads as one smooth, even column with every animal fully
       shown, instead of clumping into thin overlapping slivers. The inner edge
       still tucks under the ocean via the half-card clip above. */
    .pv-lane-up    .pv-board-card,
    .pv-lane-down  .pv-board-card,
    .pv-lane-left  .pv-board-card,
    .pv-lane-right .pv-board-card { position: relative; margin: 0; }
    /* Drop the border + rounded corner on the edge that meets the next card in
       the stack, so only the outermost card keeps a finished edge. */
    .pv-lane-down  .pv-board-card:not(:last-child) { border-bottom: none; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    .pv-lane-up    .pv-board-card:not(:last-child) { border-top:    none; border-top-left-radius: 0;    border-top-right-radius: 0; }
    .pv-lane-right .pv-board-card:not(:last-child) { border-right:  none; border-top-right-radius: 0;   border-bottom-right-radius: 0; }
    .pv-lane-left  .pv-board-card:not(:last-child) { border-left:   none; border-top-left-radius: 0;    border-bottom-left-radius: 0; }
    /* Newer cards layer on top of older ones so the stack reads correctly. */
    .pv-lane-up    .pv-board-card:nth-child(n+2),
    .pv-lane-down  .pv-board-card:nth-child(n+2),
    .pv-lane-left  .pv-board-card:nth-child(n+2),
    .pv-lane-right .pv-board-card:nth-child(n+2) { z-index: 1; }
    .pv-lane-up    .pv-board-card:nth-child(n+4),
    .pv-lane-down  .pv-board-card:nth-child(n+4),
    .pv-lane-left  .pv-board-card:nth-child(n+4),
    .pv-lane-right .pv-board-card:nth-child(n+4) { z-index: 2; }
    .pv-lane-up    .pv-board-card:nth-child(n+6),
    .pv-lane-down  .pv-board-card:nth-child(n+6),
    .pv-lane-left  .pv-board-card:nth-child(n+6),
    .pv-lane-right .pv-board-card:nth-child(n+6) { z-index: 3; }

    /* Ocean face sits on top of adjacent lane cards (z-index) */
    .pv-ocean-center { position: relative; z-index: 2; }
    /* species glow on board hover — applied via JS data-species.
       Colours match the canonical FAMILY_COLORS map (one colour per family). */
    .pv-board-card[data-species="Mammal"]:hover      { border-color: #f25fa6; box-shadow: 0 4px 14px rgba(242,95,166,.4); }
    .pv-board-card[data-species="Game Fish"]:hover   { border-color: #9aa6b2; box-shadow: 0 4px 14px rgba(154,166,178,.45); }
    .pv-board-card[data-species="Crustacean"]:hover  { border-color: #ef4444; box-shadow: 0 4px 14px rgba(239,68,68,.4); }
    .pv-board-card[data-species="Invertebrate"]:hover{ border-color: #a855f7; box-shadow: 0 4px 14px rgba(168,85,247,.4); }
    .pv-board-card[data-species="Crosscurrent"]:hover{ border-color: #22c55e; box-shadow: 0 4px 14px rgba(34,197,94,.4); }
    .pv-board-card[data-species="Coral"]:hover       { border-color: #facc15; box-shadow: 0 4px 14px rgba(250,204,21,.4); }
    .pv-board-card[data-species="Baitfish"]:hover    { border-color: #a86a34; box-shadow: 0 4px 14px rgba(168,106,52,.45); }
    .pv-board-card[data-species="Cephalopod"]:hover  { border-color: #fb8c2a; box-shadow: 0 4px 14px rgba(251,140,42,.4); }
    .pv-board-card[data-species="Bird"]:hover        { border-color: #3b82f6; box-shadow: 0 4px 14px rgba(59,130,246,.4); }
    .pv-board-card[data-species="Ocean"]:hover       { border-color: #14c7d4; box-shadow: 0 4px 14px rgba(20,199,212,.4); }

    .pv-ocean-face {
      width: 100px; height: 140px;
      border-radius: 9px; overflow: hidden;
      border: none;
      /* thin dark-blue ring matches the separator line on card images */
      box-shadow: 0 0 0 2px #004180, 0 6px 22px rgba(0,0,0,.65);
      cursor: pointer;
      transition: box-shadow .2s;
      position: relative; z-index: 1;
    }
    .pv-ocean-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .pv-ocean-face:hover { box-shadow: 0 0 0 2px #004180, 0 6px 22px rgba(0,0,0,.65), 0 0 18px rgba(61,214,245,.4); }

    .pv-lane-slot {
      width: var(--mini-w); height: var(--mini-h);
      border: 1.5px dashed var(--border);
      border-radius: 7px;
      display: flex; align-items: center; justify-content: center;
      font-size: 20px; color: var(--border);
      flex-shrink: 0; cursor: default;
      transition: border-color .15s, background .15s;
    }
    .pv-lane-slot.playable {
      border-color: var(--green); color: var(--green); cursor: pointer;
      animation: slot-pulse 1.5s ease-in-out infinite;
    }
    .pv-lane-slot.playable:hover { background: rgba(31,187,138,.12); border-color: #3ee8a8; }
    @keyframes slot-pulse {
      0%,100% { box-shadow: none; }
      50%      { box-shadow: 0 0 10px rgba(31,187,138,.45); }
    }

    /* ── Stackable slot (Yellowfin / Lobster stacking on existing cards) ──
       The "+ stack here" slot sits flush at the end of the stack with a
       distinct dashed-green appearance so it reads as the next card in line. */
    .pv-lane-up    .pv-lane-slot.stack-slot { margin-bottom: 0 !important; margin-top: 3px; }
    .pv-lane-down  .pv-lane-slot.stack-slot { margin-top:    0 !important; margin-bottom: 3px; }
    .pv-lane-left  .pv-lane-slot.stack-slot { margin-right:  0 !important; margin-left:  3px; }
    .pv-lane-right .pv-lane-slot.stack-slot { margin-left:   0 !important; margin-right: 3px; }
    .pv-lane-slot.stack-slot {
      border-style: dashed;
      border-color: #3dd8a8;
      color: #3dd8a8;
      font-size: 16px;
      font-weight: 900;
      background: rgba(31,187,138,.07);
    }
    .pv-lane-slot.stack-slot:hover {
      background: rgba(31,187,138,.18);
      border-color: #3ee8a8;
      transform: scale(1.08);
    }

    /* ── ACTION BAR ─────────────────────────────────────────────── */
    #pv-action-bar {
      background: linear-gradient(180deg, rgba(254,245,230,.92) 0%, rgba(245,232,208,.95) 100%);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-top: 1.5px solid rgba(232,179,74,.55);
      border-radius: 12px 12px 0 0;
      padding: 9px 13px;
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
      flex-wrap: wrap;
    }
    #pv-action-bar select {
      background: rgba(255,255,255,.88);
      border: 1.5px solid rgba(95,179,214,.55);
      border-radius: 7px;
      color: var(--cr-navy);
      font-family: "Nunito", inherit;
      font-size: 13px; font-weight: 700;
      padding: 7px 10px;
      outline: none; flex: 1; min-width: 160px; cursor: pointer;
      transition: border-color .15s, box-shadow .15s;
    }
    #pv-action-bar select:focus { border-color: var(--cr-teal); box-shadow: 0 0 0 3px rgba(95,179,214,.25); }
    #pv-action-bar select option { background: #fff; color: var(--cr-navy); }
    .pv-action-divider { width: 1px; height: 30px; background: rgba(95,179,214,.4); flex-shrink: 0; }
    .pv-star-wrap {
      display: flex; align-items: center; gap: 6px;
      font-size: 12px; font-weight: 800; color: var(--cr-navy); cursor: pointer;
    }
    .pv-star-wrap input[type=checkbox] { accent-color: var(--cr-gold); width: 14px; height: 14px; }
    .pv-star-wrap:has(input:checked) { color: #8a5200; }

    #pv-payment-info { display: none !important; }
    .clear-pay { display: none !important; }

    /* ── Payment mode bar ──────────────────────────────────────── */
    #pv-payment-mode-bar {
      display: none;
      align-items: center;
      gap: 8px;
      background: rgba(220,50,50,.12);
      border: 1px solid rgba(220,50,50,.4);
      border-radius: 10px;
      padding: 6px 12px;
      flex: 1;
    }
    #pv-payment-mode-text {
      flex: 1;
      font-size: 12px;
      font-weight: 700;
      color: #f07070;
    }
    #pv-payment-confirm-btn {
      background: linear-gradient(135deg, #1fbb8a, #148060);
      color: #fff;
      border: none;
      border-radius: 8px;
      padding: 5px 14px;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      white-space: nowrap;
    }
    #pv-payment-confirm-btn:disabled {
      opacity: 0.45;
      cursor: default;
    }
    #pv-payment-cancel-btn {
      background: rgba(200,60,60,.18);
      color: #f07070;
      border: 1px solid rgba(220,60,60,.4);
      border-radius: 8px;
      padding: 5px 12px;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      white-space: nowrap;
    }
    /* ── "Use as Payment" button on hand cards during payment mode ── */
    .pv-pay-discard-btn {
      position: absolute;
      top: -14px;
      left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, #0ea5a0, #0d8a86);
      color: #fff;
      border: none;
      border-radius: 20px;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: .2px;
      padding: 4px 12px;
      cursor: pointer;
      opacity: 0;
      transition: opacity .15s, background .15s, transform .12s;
      white-space: nowrap;
      z-index: 30;
      pointer-events: none;
      box-shadow: 0 2px 8px rgba(13,138,134,.5);
    }
    /* Always visible in payment mode */
    #pv-hand.payment-active .pv-pay-discard-btn { opacity: 1; pointer-events: auto; }
    .pv-hand-card:hover .pv-pay-discard-btn { opacity: 1; pointer-events: auto; }
    .pv-hand-card.pay-selected .pv-pay-discard-btn {
      background: linear-gradient(135deg, #16a34a, #15803d);
      box-shadow: 0 2px 8px rgba(22,163,74,.5);
      opacity: 1;
      pointer-events: auto;
    }
    .pv-pay-discard-btn:hover { transform: translateX(-50%) scale(1.08); }

    /* ── HAND ZONE ──────────────────────────────────────────────── */
    #pv-hand-zone {
      background: linear-gradient(0deg, rgba(6,18,48,.99) 0%, rgba(10,30,68,.55) 100%);
      flex-shrink: 0;
      padding: 6px 8px 12px;
      display: grid;
      grid-template-columns: max-content 1fr max-content;
      align-items: end;
      min-height: 168px;
      position: relative;
      overflow: visible;
    }
    #pv-hand {
      display: flex;
      align-items: flex-end;
      justify-content: center;
      position: relative;
      overflow: visible;
      z-index: 3;
      min-width: 0;
    }

    /* ── PLAYER SEATS (coral-reef reference design) ────────────── */
    /* Pill panels flanking the hand — left column and right column of the grid */
    .pv-seat-cluster {
      position: relative;
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      gap: 3px;
      z-index: 20;
      background: linear-gradient(180deg, rgba(255,255,255,.95) 0%, rgba(232,244,253,.92) 100%);
      border: 1px solid rgba(180,210,235,.65);
      border-radius: 20px;
      padding: 10px 10px;
      box-shadow: 0 8px 22px rgba(8,30,55,.4), inset 0 1px 0 rgba(255,255,255,.7);
    }
    #pv-seats-left  { margin-right: 6px; }
    #pv-seats-right { margin-left:  6px; }
    .pv-seat {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
      cursor: pointer;
      padding: 8px 5px 8px;
      border-radius: 14px;
      transition: background .15s, transform .15s;
      width: 90px;
      position: relative;
    }
    .pv-seat:hover:not(.pv-seat-empty) {
      background: rgba(180,215,240,.35);
      transform: translateY(-2px);
    }
    .pv-seat-avatar-wrap {
      position: relative; /* required so cc-avbg is contained within the circle */
      width: 48px; height: 48px;
      border-radius: 50%;
      border: 2px solid #ffffff;
      overflow: hidden;
      flex-shrink: 0;
      background: #f5fbff;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 2px 8px rgba(8,30,55,.18);
    }
    .pv-seat-avatar-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
    /* Exclusive background layer rendered behind any avatar. */
    .cc-avbg {
      position: absolute; inset: 0; z-index: 0;
      background-size: cover; background-position: center;
      border-radius: inherit; pointer-events: none;
      /* Hard-clip to a circle so the background never bleeds outside the
         avatar wrap — belt-and-suspenders on top of overflow:hidden so
         GPU compositing transitions can't cause escape. */
      clip-path: circle(50% at 50% 50%);
    }
    .cc-has-bg > img { position: relative; z-index: 1; }
    /* When a background is present, the wrap's own fill shouldn't show through. */
    .cc-has-bg { background: transparent !important; }
    .pv-seat.active-turn .pv-seat-avatar-wrap {
      border: 3px solid #f05050;
      box-shadow: 0 0 12px rgba(240,80,80,.7), 0 0 22px rgba(240,80,80,.35);
      animation: seat-glow 1.8s ease-in-out infinite;
    }
    @keyframes seat-glow {
      0%,100% {
        box-shadow: 0 0 10px rgba(240,80,80,.6), 0 0 18px rgba(240,80,80,.3);
        transform: translateY(0);
      }
      50% {
        box-shadow: 0 0 20px rgba(240,80,80,.95), 0 0 34px rgba(240,80,80,.55);
        transform: translateY(-5px);
      }
    }
    .pv-seat-name {
      font-size: 12px; font-weight: 800;
      color: #1a4d6e;
      max-width: 90px; text-align: center;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      letter-spacing: .2px;
    }
    .pv-seat.active-turn .pv-seat-name { color: #c93030; }
    /* P# seat label chip (P1, P2, …) — used for AFK reporting */
    .pv-seat-plabel {
      display: inline-block;
      font-size: 9px; font-weight: 900;
      line-height: 1;
      color: #0b2448;
      background: linear-gradient(135deg, #5fb3d6, #2c5a8a);
      border-radius: 5px;
      padding: 2px 4px;
      margin-right: 4px;
      vertical-align: middle;
      letter-spacing: .3px;
      box-shadow: 0 1px 2px rgba(0,0,0,.25);
    }
    .pv-seat-score {
      font-size: 11px; font-weight: 800;
      color: #d4922a;
      display: inline-flex; align-items: center; gap: 3px;
      white-space: nowrap;
    }
    .pv-seat-score::before { content: "⭐"; font-size: 10px; }
    .pv-seat.active-turn .pv-seat-score {
      color: #fff;
      background: linear-gradient(135deg, #f06868, #d83838);
      padding: 2px 8px;
      border-radius: 10px;
      box-shadow: 0 2px 4px rgba(208,56,56,.35);
    }
    .pv-seat.active-turn .pv-seat-score::before { color: #ffe8a0; }
    .pv-seat-me-badge {
      font-size: 8px; font-weight: 800; color: #fff;
      letter-spacing: .4px;
      background: linear-gradient(135deg, #f06868, #d83838);
      padding: 2px 6px;
      border-radius: 8px;
      position: absolute;
      top: -6px;
      left: 50%;
      transform: translateX(-50%);
      white-space: nowrap;
      box-shadow: 0 2px 4px rgba(208,56,56,.3);
    }
    /* Own seat: avatar is clickable to open gallery when it's not your turn */
    .pv-seat.pv-seat-me-avatar-clickable { cursor: pointer; }
    .pv-seat.pv-seat-me-avatar-clickable .pv-seat-avatar-wrap {
      border-color: #27d0f5;
      box-shadow: 0 0 0 2px rgba(39,208,245,.45), 0 2px 8px rgba(8,30,55,.18);
      transition: box-shadow .2s, border-color .2s;
    }
    .pv-seat.pv-seat-me-avatar-clickable:hover .pv-seat-avatar-wrap {
      box-shadow: 0 0 0 3px rgba(39,208,245,.7), 0 4px 16px rgba(39,208,245,.3);
    }
    .pv-seat-empty { cursor: default; opacity: 0.6; }
    .pv-seat-empty .pv-seat-avatar-wrap {
      background: rgba(220,232,242,.7);
      border: 2px dashed rgba(120,150,180,.55);
      font-size: 22px; color: rgba(120,150,180,.7);
      box-shadow: none;
    }
    .pv-seat-empty .pv-seat-name { color: rgba(100,140,175,.7); }
    .pv-seat-score-empty { opacity: 0; pointer-events: none; }
    .pv-seat-score-empty::before { content: ""; }

    .pv-hand-card {
      width: var(--card-w);
      height: var(--card-h);
      position: relative;
      cursor: pointer;
      flex-shrink: 0;
      border-radius: var(--radius);
      overflow: visible;
      margin-left: -28px;
      will-change: transform;
      /* transition is set by JS per-card */
    }
    .pv-hand-card:first-child { margin-left: 0; }

    .pv-card-inner {
      width: 100%; height: 100%;
      border-radius: var(--radius);
      overflow: hidden;
      border: 2px solid var(--border);
      background: var(--panel);
      box-shadow: 0 6px 16px rgba(0,0,0,.55);
      transition: border-color .2s, box-shadow .2s;
      position: relative;
    }
    .pv-card-inner img { width: 100%; height: 100%; object-fit: cover; display: block; }
    /* directional info chip — shown on hover based on mouse quadrant */
    .pv-card-chip {
      display: none;
      position: absolute;
      left: 4px; right: 4px;
      background: rgba(8,18,32,.88);
      border: 1px solid rgba(48,200,240,.35);
      border-radius: 5px;
      font-size: 10px; line-height: 1.3;
      color: var(--fg);
      padding: 3px 5px;
      z-index: 6;
      pointer-events: none;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .pv-card-chip.chip-top    { top: 4px; }
    .pv-card-chip.chip-bottom { bottom: 4px; }
    .pv-card-chip.chip-left   { top: 50%; transform: translateY(-50%); }
    .pv-card-chip.chip-right  { top: 50%; transform: translateY(-50%); }
    .pv-hand-card.hovered .pv-card-chip { display: block; }

    /* shimmer sweep */
    .pv-card-inner::before {
      content: "";
      position: absolute;
      top: 0; left: -80%;
      width: 60%; height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
      transform: skewX(-15deg);
      animation: shimmer 4s ease-in-out infinite;
      pointer-events: none;
      z-index: 3;
    }
    @keyframes shimmer { 0% { left: -80%; } 100% { left: 160%; } }

    .pv-hand-card.hovered .pv-card-inner { border-color: var(--cyan); box-shadow: 0 0 22px var(--glow-c), 0 10px 28px rgba(0,0,0,.7); }
    .pv-hand-card.selected .pv-card-inner { border-color: var(--gold); box-shadow: 0 0 22px var(--glow-gold), 0 10px 28px rgba(0,0,0,.7); }
    .pv-hand-card.pay-selected .pv-card-inner { border-color: var(--green); box-shadow: 0 0 16px rgba(31,187,138,.55); }
    /* Star ability — matching-symbol cards glow gold during payment */
    .pv-hand-card.star-sym-match .pv-card-inner { border-color: var(--gold); box-shadow: 0 0 14px rgba(240,200,64,.55), 0 0 28px rgba(240,200,64,.25); }
    .pv-hand-card.star-sym-match.pay-selected .pv-card-inner { border-color: var(--gold); box-shadow: 0 0 20px rgba(240,200,64,.75), 0 0 36px rgba(240,200,64,.35); }
    .pv-hand-card.discard-selected .pv-card-inner { border-color: var(--red); box-shadow: 0 0 16px rgba(232,64,87,.55); }

/* symbol pip — top-right */
    .pv-sym-pip {
      position: absolute; top: 4px; right: 4px;
      font-size: 11px;
      background: rgba(0,0,0,.72);
      border: 1px solid rgba(48,200,240,.3);
      border-radius: 5px; padding: 1px 5px;
      color: var(--cyan); z-index: 4;
      font-weight: 700;
    }

    /* Hearthstone-style tooltip — appears above hovered card */
    .pv-tooltip {
      display: none;
      position: absolute;
      bottom: calc(100% + 12px);
      left: 50%; transform: translateX(-50%);
      background: rgba(14,38,88,.96);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 10px 12px;
      width: 210px;
      font-size: 11px; line-height: 1.5;
      color: var(--text);
      z-index: 1000;
      pointer-events: none;
      box-shadow: 0 6px 30px rgba(0,0,0,.7);
    }
    .pv-hand-card.hovered .pv-tooltip { display: block; }
    .tt-name { font-weight: 800; font-size: 12.5px; margin-bottom: 2px; color: var(--cyan); }
    .tt-species { color: var(--muted); font-size: 10.5px; margin-bottom: 5px; }
    .tt-text { color: var(--text); font-size: 11px; }
    .tt-star { color: var(--gold); margin-top: 4px; font-size: 10.5px; }
    .tt-arrow {
      position: absolute; bottom: -7px; left: 50%;
      transform: translateX(-50%);
      width: 0; height: 0;
      border-left: 7px solid transparent;
      border-right: 7px solid transparent;
      border-top: 7px solid var(--border);
    }
    .tt-arrow::after {
      content: "";
      position: absolute; top: -8px; left: -6px;
      width: 0; height: 0;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      border-top: 6px solid rgba(8,18,40,.96);
    }

    .pv-hand-overflow {
      display: flex; align-items: center; justify-content: center;
      width: 46px; height: var(--card-h);
      background: rgba(255,255,255,.04);
      border: 1px dashed var(--border);
      border-radius: var(--radius);
      font-size: 13px; font-weight: 700; color: var(--muted);
      margin-left: 8px;
    }

    /* ── DISCARD BANNER ─────────────────────────────────────────── */
    #pv-discard-banner {
      display: none;
      background: linear-gradient(90deg, rgba(60,40,8,0) 0%, rgba(80,55,10,.92) 20%, rgba(80,55,10,.92) 80%, rgba(60,40,8,0) 100%);
      border-top: 1.5px solid rgba(240,200,64,.65);
      border-bottom: 1.5px solid rgba(240,200,64,.65);
      padding: 10px 14px;
      font-family: "Baloo 2", "Nunito", sans-serif;
      font-size: 14px; font-weight: 700;
      color: #f0c840;
      text-shadow: 0 1px 8px rgba(240,200,64,.45);
      letter-spacing: .2px;
      text-align: center;
      flex-shrink: 0;
    }
    #pv-discard-banner.visible { display: block; }

    /* ── LOG TAIL ───────────────────────────────────────────────── */
    #pv-log { display: none !important; }
    .log-entry { border-bottom: 1px solid #1E4080; padding: 2px 0; }
    .log-entry:last-child { border: none; }

    /* ── CARD ZOOM MODAL ────────────────────────────────────────── */
    #pv-zoom-modal {
      display: none;
      position: fixed; inset: 0;
      background: rgba(0,0,0,.82);
      /* Top-most overlay: above the in-game UI AND the History game-detail
         modal (9800) so tapping a card to zoom works from both. */
      z-index: 9990;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(6px);
    }
    #pv-zoom-modal.open { display: flex; }
    #pv-zoom-inner {
      position: relative;
      max-width: 90vw; max-height: 88vh;
      display: flex; flex-direction: column; align-items: center; gap: 14px;
    }
    #pv-zoom-img {
      max-width: min(380px, 90vw);
      max-height: 70vh;
      border-radius: 14px;
      border: 3px solid var(--cyan);
      box-shadow: 0 0 60px rgba(61,214,245,.35), 0 20px 60px rgba(0,0,0,.8);
      display: block;
    }
    #pv-zoom-info {
      text-align: center;
      background: rgba(18,46,100,.92);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 10px 18px;
      max-width: 380px;
    }
    #pv-zoom-info .zm-name { font-family: "Cinzel", serif; font-size: 16px; font-weight: 900; color: var(--cyan); margin-bottom: 4px; }
    #pv-zoom-info .zm-species { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
    #pv-zoom-info .zm-text { font-size: 12px; line-height: 1.6; color: var(--text); }
    #pv-zoom-info .zm-star { color: var(--gold); margin-top: 4px; font-size: 12px; }
    #pv-zoom-close {
      position: absolute; top: -14px; right: -14px;
      width: 32px; height: 32px;
      background: var(--felt); border: 1px solid var(--border);
      border-radius: 50%; color: var(--muted);
      font-size: 18px; cursor: pointer; display: flex;
      align-items: center; justify-content: center;
      transition: color .15s, border-color .15s;
    }
    #pv-zoom-close:hover { color: var(--red); border-color: var(--red); }
    .pv-zoom-nav {
      position: fixed; top: 50%; transform: translateY(-50%);
      width: 48px; height: 64px;
      background: rgba(18,46,100,.88); border: 1px solid var(--border);
      border-radius: 10px; color: var(--cyan);
      font-size: 28px; cursor: pointer; display: flex;
      align-items: center; justify-content: center;
      transition: background .15s, color .15s, opacity .15s;
      z-index: 2001; user-select: none;
    }
    .pv-zoom-nav:hover { background: rgba(30,68,140,.95); color: #fff; }
    .pv-zoom-nav:disabled { opacity: 0.25; cursor: default; pointer-events: none; }
    #pv-zoom-prev { left: 14px; }
    #pv-zoom-next { right: 14px; }
    #pv-zoom-counter {
      font-size: 11px; color: var(--muted); text-align: center;
      margin-top: -6px; letter-spacing: .5px;
    }

    /* ── TOASTS ─────────────────────────────────────────────────── */
    #pv-toasts {
      position: fixed; top: 18px; right: 18px;
      display: flex; flex-direction: column; gap: 8px;
      z-index: 3000; pointer-events: none;
    }
    .pv-toast {
      background: rgba(16,40,88,.95);
      border-left: 3px solid var(--cyan);
      border-radius: 8px;
      padding: 9px 14px;
      font-size: 13px; font-weight: 700;
      color: var(--text);
      box-shadow: 0 4px 20px rgba(0,0,0,.5);
      transform: translateX(120%);
      transition: transform .3s cubic-bezier(.2,1,.4,1), opacity .3s;
      opacity: 0;
      pointer-events: none;
      max-width: 280px;
    }
    .pv-toast.show { transform: translateX(0); opacity: 1; }
    .pv-toast.toast-ok    { border-left-color: var(--green); }
    .pv-toast.toast-warn  { border-left-color: var(--gold); }
    .pv-toast.toast-err   { border-left-color: var(--red); }

    /* ── WAITING ROOM OVERLAY ──────────────────────────────────── */
    #pv-waiting-room {
      display: none;
      position: fixed; inset: 0;
      background: linear-gradient(180deg, #4a7bb8 0%, #2c5384 100%);
      z-index: 900;
      align-items: center; justify-content: center;
      padding: 20px;
      overflow-y: auto;
    }
    #pv-waiting-room.open { display: flex; }
    .wr-box {
      background: linear-gradient(180deg, #e3edfb 0%, #d8e4f7 100%);
      border: 3px solid #2c4d80;
      border-radius: 24px;
      box-shadow: 0 12px 40px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.6);
      padding: 36px 40px 32px;
      max-width: 460px; width: 100%;
      display: flex; flex-direction: column;
      align-items: center; gap: 22px;
      text-align: center;
    }
    .wr-box h2 {
      font-family: "Cinzel", "Cormorant Garamond", serif;
      font-size: 2rem; font-weight: 900;
      color: #1a3a72;
      letter-spacing: 1px;
      margin: 0;
      text-transform: uppercase;
    }
    .wr-subtitle {
      font-size: 17px;
      color: #2c4d80;
      font-weight: 500;
      margin: -6px 0 0;
    }
    .wr-code {
      font-family: "Cinzel", "Cormorant Garamond", serif;
      font-size: 3.5rem; font-weight: 900;
      letter-spacing: 14px;
      color: #1a3a72;
      background: linear-gradient(180deg, #f4f8ff 0%, #e8eff9 100%);
      border: none;
      border-radius: 18px;
      padding: 22px 28px 22px 42px;
      cursor: pointer;
      width: 100%;
      box-sizing: border-box;
      box-shadow: 0 4px 12px rgba(26,58,114,.12), inset 0 1px 0 rgba(255,255,255,.8);
      transition: transform .15s;
      user-select: all;
    }
    .wr-code:hover { transform: translateY(-1px); }
    #wr-copy-btn {
      background: linear-gradient(180deg, #ffffff 0%, #f2f6fc 100%);
      border: none;
      border-radius: 14px;
      padding: 14px 28px;
      font-size: 17px;
      font-weight: 700;
      color: #1a3a72;
      cursor: pointer;
      box-shadow: 0 3px 10px rgba(26,58,114,.12), inset 0 1px 0 rgba(255,255,255,.8);
      transition: transform .15s, box-shadow .15s;
      display: inline-flex; align-items: center; gap: 10px;
    }
    #wr-copy-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(26,58,114,.18); }
    #wr-copy-btn .wr-copy-icon { font-size: 18px; }
    .wr-quick-setup {
      width: 100%;
      padding: 18px;
      border: 1px solid rgba(26,58,114,.14);
      border-radius: 18px;
      background: linear-gradient(180deg, rgba(255,255,255,.82), rgba(238,246,255,.76));
      box-shadow: 0 3px 10px rgba(26,58,114,.08), inset 0 1px 0 rgba(255,255,255,.85);
      box-sizing: border-box;
    }
    .wr-quick-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 12px;
      color: #1a3a72;
      font-size: 13px;
      font-weight: 900;
      letter-spacing: 1.4px;
      text-transform: uppercase;
    }
    .wr-quick-total {
      color: #5f80aa;
      font-size: 10px;
      letter-spacing: .7px;
      white-space: nowrap;
    }
    .wr-human-options {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
    }
    .wr-human-option {
      min-width: 0;
      padding: 10px 6px 9px;
      border: 1.5px solid #b6cae3;
      border-radius: 13px;
      background: rgba(255,255,255,.72);
      color: #52749e;
      cursor: pointer;
      font-family: "Nunito", sans-serif;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0;
      transition: transform .12s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
    }
    .wr-human-option strong {
      font-family: "Cinzel", serif;
      font-size: 20px;
      line-height: 1.05;
      color: #1f5794;
    }
    .wr-human-option span { font-size: 11px; font-weight: 900; }
    .wr-human-option small { margin-top: 2px; font-size: 9px; font-weight: 800; color: #7994b5; }
    .wr-human-option:hover:not(:disabled) {
      transform: translateY(-1px);
      border-color: #4c91d4;
      box-shadow: 0 4px 10px rgba(31,87,148,.14);
    }
    .wr-human-option.active {
      border-color: #2877c8;
      background: linear-gradient(180deg, #eaf6ff, #d9edff);
      box-shadow: 0 0 0 2px rgba(40,119,200,.12), 0 4px 10px rgba(31,87,148,.12);
    }
    .wr-human-option.active strong,
    .wr-human-option.active span { color: #175da8; }
    .wr-human-option:disabled {
      cursor: default;
      opacity: .5;
      transform: none;
      box-shadow: none;
    }
    .wr-human-option.active:disabled { opacity: .86; }
    .wr-quick-note {
      margin-top: 10px;
      color: #6482a8;
      font-size: 11px;
      font-weight: 700;
      line-height: 1.35;
    }
    .wr-players {
      width: 100%;
      background: linear-gradient(180deg, #f4f8ff 0%, #e8eff9 100%);
      border: none;
      border-radius: 18px;
      padding: 22px 26px;
      text-align: left;
      box-shadow: 0 3px 10px rgba(26,58,114,.10), inset 0 1px 0 rgba(255,255,255,.7);
      box-sizing: border-box;
    }
    .wr-players-title {
      font-weight: 800;
      color: #1a3a72;
      font-size: 14px;
      text-transform: uppercase;
      letter-spacing: 2px;
      margin-bottom: 16px;
    }
    .wr-player-row {
      display: flex; align-items: center; gap: 14px;
      padding: 12px 0;
      border-bottom: 1px solid rgba(26,58,114,.10);
      font-size: 18px;
      font-weight: 700;
      color: #1a3a72;
    }
    .wr-player-row:last-child { border: none; padding-bottom: 4px; }
    .wr-player-row:first-of-type { padding-top: 4px; }
    .wr-seat-dot {
      width: 14px; height: 14px; border-radius: 50%;
      flex-shrink: 0;
    }
    .wr-seat-dot.filled {
      background: radial-gradient(circle at 30% 30%, #5aa2e8 0%, #2868c4 100%);
      box-shadow: 0 1px 3px rgba(40,104,196,.4);
    }
    .wr-seat-dot.empty {
      background: #c4d4ec;
      border: 2px solid #94b3d6;
      box-sizing: border-box;
    }
    .wr-player-name { font-weight: 700; color: #1a3a72; }
    .wr-player-empty { color: #6a87b0; font-weight: 600; }
    /* AI difficulty picker — three small pills (Easy/Medium/Hard) next to each bot */
    .wr-ai-name { flex: 1; min-width: 0; }
    .wr-diff-box {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 3px; border-radius: 10px;
      background: rgba(255,255,255,.55);
      border: 1px solid rgba(26,58,114,.18);
      margin-left: auto; flex-shrink: 0;
    }
    .wr-diff-pill {
      font-family: "Baloo 2", "Nunito", sans-serif;
      font-size: 11px; font-weight: 700;
      letter-spacing: .3px;
      padding: 5px 10px;
      border-radius: 7px;
      border: 1.5px solid transparent;
      background: transparent;
      cursor: pointer;
      color: #6a87b0;
      transition: transform .08s ease, background .12s ease, color .12s ease, border-color .12s ease;
      user-select: none;
    }
    .wr-diff-pill:hover:not(:disabled) { transform: translateY(-1px); }
    .wr-diff-pill:disabled { cursor: default; opacity: .55; }
    .wr-diff-pill.wr-diff-easy.active {
      background: #2e9e4f; color: #fff; border-color: #1f7a3a;
      box-shadow: 0 2px 6px rgba(46,158,79,.4);
    }
    .wr-diff-pill.wr-diff-medium.active {
      background: #e8b73a; color: #5a3a00; border-color: #b88a18;
      box-shadow: 0 2px 6px rgba(232,183,58,.5);
    }
    .wr-diff-pill.wr-diff-hard.active {
      background: #cc3636; color: #fff; border-color: #8a1f1f;
      box-shadow: 0 2px 6px rgba(204,54,54,.5);
    }
    .wr-diff-pill.wr-diff-easy:hover:not(:disabled):not(.active)   { color: #2e9e4f; border-color: rgba(46,158,79,.45); }
    .wr-diff-pill.wr-diff-medium:hover:not(:disabled):not(.active) { color: #b88a18; border-color: rgba(184,138,24,.45); }
    .wr-diff-pill.wr-diff-hard:hover:not(:disabled):not(.active)   { color: #cc3636; border-color: rgba(204,54,54,.45); }
    #wr-chat-btn {
      position: relative;
      width: 100%;
      min-height: 48px;
      border: 1.5px solid #5da3d7;
      border-radius: 14px;
      background: linear-gradient(180deg, #f8fcff 0%, #e4f3ff 100%);
      color: #1c5d9c;
      box-shadow: 0 3px 10px rgba(26,88,148,.12), inset 0 1px 0 rgba(255,255,255,.9);
      font-family: "Nunito", sans-serif;
      font-size: 14px;
      font-weight: 900;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
    }
    #wr-chat-btn:hover {
      transform: translateY(-1px);
      background: #fafdff;
      box-shadow: 0 5px 14px rgba(26,88,148,.18);
    }
    .wr-chat-icon { font-size: 18px; line-height: 1; }
    .wr-chat-badge {
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      border-radius: 9px;
      background: #e84057;
      color: #fff;
      font-size: 10px;
      line-height: 18px;
      text-align: center;
      box-shadow: 0 0 0 2px #edf7ff;
      display: none;
    }
    .wr-caption {
      font-size: 15px;
      color: #2c4d80;
      font-weight: 500;
      margin: -4px 0 0;
    }
    #wr-start-btn {
      width: 100%;
      padding: 0;
      border: none;
      border-radius: 18px;
      cursor: pointer;
      /* Yellow gradient sampled to match the right edge of the coral images */
      background: linear-gradient(180deg, #ffdf8a 0%, #fdc55b 100%);
      box-shadow: 0 4px 14px rgba(245,192,101,.4), inset 0 1px 0 rgba(255,255,255,.5);
      transition: transform .15s, box-shadow .15s;
      overflow: hidden;
      position: relative;
      aspect-ratio: 920 / 175;
    }
    #wr-start-btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(245,192,101,.5); }
    #wr-start-btn:disabled { cursor: default; }
    .wr-btn-coral {
      position: absolute;
      top: 0; bottom: 0; left: 0;
      width: 28%;
      background-size: auto 100%;
      background-position: left center;
      background-repeat: no-repeat;
    }
    #wr-start-btn.coral-red    .wr-btn-coral { background-image: url("/multiplayer/client/lobby-coral-red.png?v=6"); }
    #wr-start-btn.coral-orange .wr-btn-coral { background-image: url("/multiplayer/client/lobby-coral-orange.png?v=6"); }
    #wr-start-btn.coral-yellow .wr-btn-coral { background-image: url("/multiplayer/client/lobby-coral-yellow.png?v=6"); }
    .wr-btn-text {
      font-family: "Cinzel", "Cormorant Garamond", serif;
      font-size: 22px;
      font-weight: 700;
      color: #1a3a72;
      letter-spacing: .3px;
      position: absolute;
      top: 0; bottom: 0; right: 0;
      left: 28%;
      display: flex; align-items: center; justify-content: center;
      padding: 0 16px;
      text-align: center;
    }
    .wr-btn-text.with-play::before {
      content: "▶";
      display: inline-block;
      margin-right: 12px;
      font-size: 18px;
    }
    @media (max-width: 520px) {
      .wr-box { padding: 28px 22px 24px; gap: 18px; }
      .wr-box h2 { font-size: 1.6rem; }
      .wr-code { font-size: 2.6rem; letter-spacing: 10px; padding: 18px 20px 18px 30px; }
      .wr-subtitle { font-size: 15px; }
      .wr-players { padding: 18px 20px; }
      .wr-player-row { font-size: 16px; }
      .wr-player-row.wr-ai-row { flex-wrap: wrap; }
      .wr-diff-box { width: 100%; margin-left: 28px; justify-content: stretch; }
      .wr-diff-pill { flex: 1; }
      .wr-quick-setup { padding: 14px; }
      .wr-human-option { padding-inline: 3px; }
      .wr-btn-text { font-size: 17px; }
    }

    /* ── GUIDE BAR ──────────────────────────────────────────────── */
    #pv-guide-bar {
      display: none;
      background: linear-gradient(90deg, rgba(254,245,230,0) 0%, rgba(254,245,230,.88) 10%, rgba(220,238,245,.9) 50%, rgba(254,245,230,.88) 90%, rgba(254,245,230,0) 100%);
      backdrop-filter: blur(8px);
      padding: 7px 20px;
      font-size: 12px; font-weight: 700;
      color: var(--cr-navy);
      text-align: center;
      flex-shrink: 0;
      letter-spacing: .3px;
    }
    #pv-guide-bar.visible { display: block; }
    #pv-guide-bar .guide-step { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
    .gs { background: rgba(95,179,214,.2); border: 1px solid rgba(95,179,214,.45); border-radius: 20px; padding: 3px 12px; white-space: nowrap; color: var(--cr-navy); }
    .gs.done  { background: rgba(31,187,138,.18); border-color: rgba(31,187,138,.45); color: #1f7e58; }
    .gs.active { background: rgba(232,179,74,.28); border-color: rgba(232,179,74,.65); color: #8a5200; font-weight: 800; }

    /* ── DRAW-PHASE HINT BANNER ────────────────────────────────── */
    #pv-pool-pick-hint {
      display: none;
      background: linear-gradient(90deg, rgba(60,40,8,0) 0%, rgba(80,55,10,.92) 20%, rgba(80,55,10,.92) 80%, rgba(60,40,8,0) 100%);
      border-top: 1.5px solid rgba(240,200,64,.65);
      border-bottom: 1.5px solid rgba(240,200,64,.65);
      padding: 10px 14px;
      font-family: "Baloo 2", "Nunito", sans-serif;
      font-size: 14px; font-weight: 700;
      color: #f0c840;
      text-shadow: 0 1px 8px rgba(240,200,64,.45);
      letter-spacing: .2px;
      text-align: center;
      flex-shrink: 0;
    }
    #pv-pool-pick-hint.visible { display: block; }

    /* ── QUICK DRAW BUTTON ──────────────────────────────────────── */
    #pv-help-btn {
      display: flex;
      flex-direction: column; align-items: center; gap: 2px;
      background: linear-gradient(180deg, var(--cr-cream) 0%, var(--cr-cream-mid) 100%);
      border: 1.5px solid rgba(232,179,74,.6);
      border-radius: 16px;
      padding: 8px 18px;
      cursor: pointer;
      font-family: "Nunito", inherit;
      transition: transform .15s, box-shadow .15s, border-color .15s;
      flex-shrink: 0;
    }
    #pv-help-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(232,179,74,.4); border-color: var(--cr-gold); }
    #pv-help-btn .help-label { font-size: 13px; font-weight: 800; color: var(--cr-navy); }
    #pv-help-btn .help-sub   { font-size: 10px; color: rgba(26,45,90,.65); }

    /* ── IN-GAME CHALLENGE PANEL (lower-left, above action bar) ──── */
    #ig-challenge-panel {
      position: fixed;
      left: 12px;
      bottom: 302px;
      z-index: 50;
      width: 226px;
      background: linear-gradient(160deg, rgba(10,26,60,.97) 0%, rgba(6,16,42,.98) 100%);
      border: 1.5px solid rgba(95,179,214,.38);
      border-radius: 14px;
      box-shadow: 0 6px 28px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04);
      overflow: hidden;
      transition: width .2s ease, border-radius .2s ease;
      display: none;
      pointer-events: auto;
      font-family: "Nunito", sans-serif;
    }
    #ig-challenge-panel.igcp-minimized {
      width: auto;
      border-radius: 22px;
    }
    #igcp-header {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 10px 7px;
      cursor: pointer;
      user-select: none;
      border-bottom: 1px solid rgba(95,179,214,.15);
      transition: background .15s;
    }
    #ig-challenge-panel.igcp-minimized #igcp-header { border-bottom: none; padding: 7px 12px; }
    #igcp-header:hover { background: rgba(95,179,214,.07); }
    #igcp-minimize-btn {
      order: -1;
      background: none;
      border: 1px solid rgba(95,179,214,.32);
      border-radius: 6px;
      cursor: pointer;
      color: #7aafcc;
      font-size: 13px;
      line-height: 1;
      padding: 1px 5px 2px;
      flex-shrink: 0;
      transition: background .15s, color .15s;
    }
    #igcp-minimize-btn:hover { background: rgba(95,179,214,.18); color: #c0e0f0; }
    #igcp-calendar-icon { flex-shrink: 0; width: 17px; height: 17px; opacity: .82; }
    #igcp-title {
      font-size: 12px;
      font-weight: 800;
      color: #d4eaf8;
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      letter-spacing: .1px;
    }
    #igcp-pill {
      font-size: 9px;
      font-weight: 800;
      letter-spacing: .5px;
      text-transform: uppercase;
      background: rgba(38,128,200,.26);
      color: #6db8e0;
      border: 1px solid rgba(38,128,200,.36);
      border-radius: 10px;
      padding: 1px 6px;
      flex-shrink: 0;
    }
    #igcp-pill.weekly { background: rgba(232,179,74,.2); color: #f0c860; border-color: rgba(232,179,74,.36); }
    #igcp-cards {
      padding: 7px 7px 3px;
      display: flex;
      flex-direction: column;
      gap: 5px;
      max-height: 270px;
      overflow-y: auto;
      overflow-x: hidden;
    }
    #igcp-cards::-webkit-scrollbar { width: 4px; }
    #igcp-cards::-webkit-scrollbar-thumb { background: rgba(95,179,214,.28); border-radius: 4px; }
    .igcp-row {
      background: rgba(255,255,255,.04);
      border: 1px solid rgba(95,179,214,.16);
      border-radius: 9px;
      padding: 6px 8px 5px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      transition: border-color .2s;
    }
    .igcp-row.igcp-done { border-color: rgba(94,201,137,.28); background: rgba(94,201,137,.05); opacity: .72; }
    .igcp-row-top { display: flex; align-items: flex-start; gap: 6px; }
    .igcp-row-icon { font-size: 15px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
    .igcp-row-info { flex: 1; min-width: 0; }
    .igcp-row-name {
      font-size: 11px; font-weight: 800; color: #e0eff9;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
    }
    .igcp-row-desc {
      font-size: 9.5px; color: #7ba5c0; line-height: 1.35; overflow: hidden;
      display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 1px;
    }
    .igcp-row-xp { font-size: 9.5px; font-weight: 800; color: #f0c860; flex-shrink: 0; margin-top: 2px; white-space: nowrap; }
    .igcp-row-bar-wrap { display: flex; align-items: center; gap: 5px; }
    .igcp-row-bar { flex: 1; height: 4px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
    .igcp-row-fill {
      height: 100%;
      background: linear-gradient(90deg, #2680c8 0%, #5fb3d6 100%);
      border-radius: 3px;
      transition: width .35s ease;
    }
    .igcp-row.igcp-done .igcp-row-fill { background: linear-gradient(90deg, #3aaa70 0%, #5ec989 100%); }
    .igcp-row-prog { font-size: 9px; color: #6a9ab8; font-weight: 700; white-space: nowrap; }
    .igcp-row.igcp-done .igcp-row-prog { color: #5ec989; }
    #igcp-footer {
      padding: 4px 8px 7px;
      font-size: 9px;
      color: rgba(106,154,184,.55);
      text-align: center;
      cursor: pointer;
      transition: color .15s;
    }
    #igcp-footer:hover { color: rgba(95,179,214,.75); }
    #ig-challenge-panel.igcp-minimized #igcp-cards,
    #ig-challenge-panel.igcp-minimized #igcp-footer { display: none; }

    /* ── IN-GAME BOARD SIZE CONTROL (lower-right, above Undo/End Turn) ── */
    #bs-ctrl {
      position: fixed;
      right: 12px;
      bottom: 302px;
      z-index: 50;
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      padding: 7px 7px 8px;
      background: linear-gradient(160deg, rgba(10,26,60,.97) 0%, rgba(6,16,42,.98) 100%);
      border: 1.5px solid rgba(95,179,214,.38);
      border-radius: 14px;
      box-shadow: 0 6px 28px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04);
      font-family: "Nunito", sans-serif;
      user-select: none;
    }
    #bs-label {
      font-size: 9px;
      font-weight: 800;
      letter-spacing: .4px;
      text-transform: uppercase;
      color: #7aafcc;
      text-align: center;
      line-height: 1.1;
      margin-bottom: 1px;
    }
    .bs-btn {
      width: 38px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(95,179,214,.14);
      border: 1.5px solid rgba(95,179,214,.4);
      border-radius: 9px;
      color: #d4eaf8;
      font-size: 22px;
      font-weight: 800;
      line-height: 1;
      cursor: pointer;
      transition: background .14s, border-color .14s, transform .08s;
    }
    .bs-btn:hover { background: rgba(95,179,214,.28); border-color: #5fb3d6; }
    .bs-btn:active { transform: scale(.92); }
    .bs-btn:disabled { opacity: .35; cursor: default; }
    .bs-btn:disabled:hover { background: rgba(95,179,214,.14); border-color: rgba(95,179,214,.4); }
    #bs-readout {
      font-size: 11px;
      font-weight: 800;
      color: #9fd0ec;
      min-width: 38px;
      text-align: center;
      padding: 1px 0;
    }

    /* ── DRAW NOTIFICATION ──────────────────────────────────────── */
    /* ── DRAW NOTIFICATION PILL ───────────────────────────────────── */
    #draw-notif {
      position: fixed;
      top: 80px; right: 18px;
      display: flex; align-items: center; gap: 12px;
      background: linear-gradient(135deg, rgba(26,45,90,.97) 0%, rgba(44,90,138,.95) 100%);
      backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(95,179,214,.48);
      border-radius: 18px;
      padding: 10px 18px 10px 10px;
      pointer-events: none; z-index: 820;
      max-width: 320px; min-width: 180px;
      box-shadow: 0 6px 32px rgba(0,0,0,.48), 0 0 0 1px rgba(95,179,214,.12) inset, 0 1px 0 rgba(188,221,230,.08) inset;
      opacity: 0; transform: translateX(32px);
      transition: opacity .32s cubic-bezier(.22,.68,0,1.2), transform .32s cubic-bezier(.22,.68,0,1.2);
    }
    #draw-notif.visible {
      opacity: 1; transform: translateX(0);
    }
    #draw-notif.hiding {
      opacity: 0; transform: translateX(24px);
      transition: opacity .4s ease, transform .4s ease;
    }
    /* warm coral-water shimmer accent */
    #draw-notif::before {
      content: "";
      position: absolute; inset: 0; border-radius: 18px;
      background: linear-gradient(120deg, rgba(95,179,214,.09) 0%, rgba(95,179,214,0) 65%);
      pointer-events: none;
    }
    .dn-avatar-wrap {
      position: relative; /* required so cc-avbg is contained within the circle */
      flex-shrink: 0;
      width: 34px; height: 34px; border-radius: 50%;
      overflow: hidden;
      border: 2px solid rgba(95,179,214,.65);
      box-shadow: 0 0 10px rgba(95,179,214,.28), 0 2px 8px rgba(0,0,0,.38);
      background: rgba(26,45,90,.85);
      display: flex; align-items: center; justify-content: center;
    }
    .dn-avatar-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
    .dn-avatar-letter {
      font-family: "Cinzel", serif; font-size: 18px; font-weight: 700;
      color: var(--cr-teal); text-shadow: 0 0 8px rgba(95,179,214,.55);
    }
    .dn-body {
      display: flex; flex-direction: column; gap: 2px; min-width: 0;
    }
    .dn-label {
      font-family: "Cinzel", serif;
      font-size: 9px; font-weight: 600; letter-spacing: 1.4px;
      color: rgba(188,221,230,.6); text-transform: uppercase;
    }
    .dn-name {
      font-family: "Baloo 2", "Nunito", sans-serif;
      font-size: 14px; font-weight: 800;
      color: var(--cr-gold); text-shadow: 0 0 10px rgba(232,179,74,.3);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .dn-action {
      font-family: "Baloo 2", "Nunito", sans-serif;
      font-size: 12px; font-weight: 600; color: var(--cr-aqua);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .dn-cards { color: var(--cr-teal); font-weight: 700; }
    @media (max-width: 520px) {
      #draw-notif { top: 64px; right: 10px; max-width: calc(100vw - 20px); }
    }

    /* ── DRAW-OVER-10 WARNING MODAL (coral reef theme) ──────────── */
    #draw-warn-modal {
      display: none; position: fixed; inset: 0; z-index: 9200;
      background: rgba(26,45,90,.45);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      align-items: center; justify-content: center;
    }
    #draw-warn-modal.open { display: flex; animation: dwm-fade-in .18s ease; }
    @keyframes dwm-fade-in { from { opacity: 0; } to { opacity: 1; } }
    #draw-warn-box {
      background: linear-gradient(160deg, var(--cr-cream) 0%, #f5e0c8 70%, #efd0b0 100%);
      border: 2px solid rgba(232,179,74,.65);
      border-radius: 20px;
      box-shadow: 0 14px 50px rgba(26,45,90,.35), inset 0 1px 0 rgba(255,255,255,.6);
      padding: 24px 28px 22px;
      width: 92%; max-width: 400px;
      text-align: center;
      font-family: "Nunito", sans-serif;
      animation: dwm-box-in .22s cubic-bezier(.2,.9,.3,1.2);
    }
    @keyframes dwm-box-in {
      from { opacity:0; transform: translateY(10px) scale(.96); }
      to   { opacity:1; transform: translateY(0) scale(1); }
    }
    #draw-warn-icon {
      font-size: 38px;
      filter: drop-shadow(0 2px 4px rgba(232,179,74,.5));
      margin-bottom: 4px;
    }
    #draw-warn-title {
      font-family: "Cinzel", serif;
      color: var(--cr-navy);
      font-size: 1.3rem;
      font-weight: 700;
      letter-spacing: 1.2px;
      margin: 0 0 8px;
    }
    #draw-warn-msg {
      color: var(--cr-navy);
      font-size: 13.5px;
      line-height: 1.55;
      margin: 0 0 18px;
      opacity: .88;
    }
    #draw-warn-buttons {
      display: flex; gap: 10px; justify-content: center;
    }
    #draw-warn-cancel,
    #draw-warn-confirm {
      border: none; border-radius: 11px;
      padding: 11px 18px;
      font-family: "Nunito", sans-serif;
      font-size: 13px; font-weight: 800;
      cursor: pointer;
      transition: transform .12s, box-shadow .15s, filter .15s;
      letter-spacing: .3px;
      flex: 1;
    }
    #draw-warn-cancel {
      background: rgba(255,255,255,.78);
      border: 1.5px solid rgba(95,179,214,.55);
      color: var(--cr-navy);
    }
    #draw-warn-cancel:hover {
      background: #fff;
      border-color: var(--cr-teal);
      transform: translateY(-1px);
      box-shadow: 0 4px 14px rgba(95,179,214,.35);
    }
    #draw-warn-confirm {
      background: linear-gradient(135deg, var(--cr-coral), var(--cr-coral-deep));
      color: var(--cr-navy);
      text-shadow: 0 1px 0 rgba(255,255,255,.45);
      border: 1.5px solid rgba(232,179,74,.5);
    }
    #draw-warn-confirm:hover {
      transform: translateY(-1px);
      box-shadow: 0 5px 16px rgba(244,165,116,.55);
      filter: brightness(1.06);
    }

    /* ── STAR-SKIP CONFIRMATION MODAL ──────────────────────────── */
    #star-skip-modal {
      display: none; position: fixed; inset: 0; z-index: 9200;
      background: rgba(26,45,90,.45);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      align-items: center; justify-content: center;
    }
    #star-skip-modal.open { display: flex; animation: dwm-fade-in .18s ease; }
    #star-skip-box {
      background: linear-gradient(160deg, var(--cr-cream) 0%, #f5e0c8 70%, #efd0b0 100%);
      border: 2px solid rgba(232,179,74,.65);
      border-radius: 20px;
      box-shadow: 0 14px 50px rgba(26,45,90,.35), inset 0 1px 0 rgba(255,255,255,.6);
      padding: 24px 28px 22px;
      width: 92%; max-width: 400px;
      text-align: center;
      font-family: "Nunito", sans-serif;
      animation: dwm-box-in .22s cubic-bezier(.2,.9,.3,1.2);
    }
    #star-skip-icon {
      font-size: 38px;
      color: var(--cr-gold, #e8b34a);
      filter: drop-shadow(0 2px 4px rgba(232,179,74,.5));
      margin-bottom: 4px;
      line-height: 1;
    }
    #star-skip-title {
      font-family: "Cinzel", serif;
      color: var(--cr-navy);
      font-size: 1.3rem;
      font-weight: 700;
      letter-spacing: 1.2px;
      margin: 0 0 8px;
    }
    #star-skip-msg {
      color: var(--cr-navy);
      font-size: 13.5px;
      line-height: 1.55;
      margin: 0 0 18px;
      opacity: .88;
    }
    #star-skip-buttons {
      display: flex; gap: 10px; justify-content: center;
    }
    #star-skip-back,
    #star-skip-confirm {
      border: none; border-radius: 11px;
      padding: 11px 18px;
      font-family: "Nunito", sans-serif;
      font-size: 13px; font-weight: 800;
      cursor: pointer;
      transition: transform .12s, box-shadow .15s, filter .15s;
      letter-spacing: .3px;
      flex: 1;
    }
    #star-skip-back {
      background: rgba(255,255,255,.78);
      border: 1.5px solid rgba(95,179,214,.55);
      color: var(--cr-navy);
    }
    #star-skip-back:hover {
      background: #fff;
      border-color: var(--cr-teal);
      transform: translateY(-1px);
      box-shadow: 0 4px 14px rgba(95,179,214,.35);
    }
    #star-skip-confirm {
      background: linear-gradient(135deg, var(--cr-teal, #5fb3d6), #3a8fb5);
      color: #fff;
      text-shadow: 0 1px 0 rgba(0,0,0,.2);
      border: 1.5px solid rgba(95,179,214,.5);
    }
    #star-skip-confirm:hover {
      transform: translateY(-1px);
      box-shadow: 0 5px 16px rgba(95,179,214,.5);
      filter: brightness(1.06);
    }

    /* ── TUTORIAL MODE ──────────────────────────────────────────── */
    #pv-tutorial {
      position: fixed; inset: 0; z-index: 9500;
      background: linear-gradient(180deg, #142E62 0%, #0E2450 60%, #0B2248 100%);
      display: none; flex-direction: column;
    }
    #pv-tutorial.active { display: flex; }
    #tut-topbar {
      display: flex; align-items: center; gap: 10px; padding: 8px 14px;
      background: rgba(16,44,100,.97); border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    #tut-step-badge {
      font-size: 10px; color: var(--cyan); font-weight: 700;
      background: rgba(48,200,240,.1); border: 1px solid rgba(48,200,240,.28);
      border-radius: 20px; padding: 3px 10px; white-space: nowrap;
    }
    #tut-topbar-title {
      flex: 1; font-family: "Cinzel", serif; font-size: 12px;
      color: var(--gold); font-weight: 700; white-space: nowrap; overflow: hidden;
    }
    #tut-x-btn {
      background: none; border: none; color: var(--muted); cursor: pointer;
      font-size: 17px; width: 30px; height: 30px;
      display: flex; align-items: center; justify-content: center;
      border-radius: 50%; transition: background .15s, color .15s; flex-shrink: 0;
    }
    #tut-x-btn:hover { background: rgba(232,64,87,.2); color: var(--red); }
    #tut-table {
      flex: 1; display: flex; flex-direction: column; gap: 6px;
      padding: 8px; overflow: hidden; min-height: 0;
    }
    #tut-opp-row {
      display: flex; gap: 8px; flex-shrink: 0; align-items: flex-start;
    }
    .tut-player-panel {
      background: rgba(22,58,118,.7); border: 1px solid var(--border);
      border-radius: 10px; padding: 7px 10px;
      display: flex; flex-direction: column; gap: 4px;
      flex: 1; min-width: 0;
    }
    .tut-player-panel.active-turn { border-color: var(--cyan); }
    .tut-pname {
      font-size: 11px; font-weight: 700; color: var(--cyan);
      display: flex; justify-content: space-between; align-items: center;
    }
    .tut-pname-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tut-pscore { color: var(--gold); font-size: 10px; flex-shrink: 0; margin-left: 4px; }
    .tut-phand-count { font-size: 9px; color: var(--muted); }
    .tut-mini-board {
      display: flex; flex-direction: column; align-items: center; gap: 0px; min-height: 44px;
    }
    .tut-mini-hub { display: flex; flex-direction: column; align-items: center; position: relative; }
    .tut-mini-board-row { display: flex; align-items: center; position: relative; z-index: 2; }
    .tut-mini-slot-up   { margin-bottom: -7px; z-index: 1; position: relative; display: flex; justify-content: center; }
    .tut-mini-slot-down { margin-top:    -7px; z-index: 1; position: relative; display: flex; justify-content: center; }
    .tut-mini-slot-left  { margin-right: -5px; z-index: 1; position: relative; }
    .tut-mini-slot-right { margin-left:  -5px; z-index: 1; position: relative; }
    .tut-mini-ocean {
      width: 28px; height: 40px; border-radius: 4px; overflow: hidden;
      border: 1.5px solid var(--teal); flex-shrink: 0; position: relative; z-index: 4;
    }
    .tut-mini-ocean img { width: 100%; height: 100%; object-fit: cover; }
    .tut-mini-animal {
      width: 20px; height: 28px; border-radius: 3px; overflow: hidden;
      border: 1px solid rgba(48,200,240,.5); flex-shrink: 0;
    }
    .tut-mini-animal img { width: 100%; height: 100%; object-fit: cover; }
    .tut-mini-slot-empty {
      width: 20px; height: 28px; border-radius: 3px;
      border: 1px dashed rgba(255,255,255,.15); flex-shrink: 0;
    }
    #tut-center-strip {
      display: flex; align-items: center; justify-content: center;
      gap: 16px; flex-shrink: 0;
    }
    .tut-section-lbl { font-size: 9px; color: var(--muted); font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: .5px; }
    #tut-pool-area { display: flex; flex-direction: column; align-items: center; gap: 4px; }
    #tut-pool-wrap { display: flex; gap: 4px; align-items: center; }
    .tut-pool-card {
      width: 42px; height: 58px; border-radius: 5px; overflow: hidden;
      border: 1.5px solid var(--border); cursor: grab;
      transition: transform .15s, border-color .15s, opacity .15s;
    }
    .tut-pool-card:hover { transform: translateY(-6px); border-color: var(--cyan); }
    .tut-pool-card.dragging { opacity: .45; cursor: grabbing; }
    .tut-pool-card.tut-pool-drawable { border-color: var(--cyan); animation: tut-card-pulse 1.3s ease-in-out infinite; cursor: pointer; }
    .tut-pool-card.tut-pool-drawable:hover { transform: translateY(-10px) scale(1.06); }
    .tut-pool-card img { width: 100%; height: 100%; object-fit: cover; }
    #tut-deck-pile {
      display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
      position: relative;
    }
    .tut-deck-face {
      width: 42px; height: 58px;
      background: var(--cc-card-back) center/cover no-repeat,
                  linear-gradient(135deg, #1C3E80, #2A5AA8);
      border: 2px solid #3A72C0; border-radius: 7px;
      overflow: hidden;
      box-shadow: 3px 3px 0 #0d1830;
      transition: border-color .2s;
    }
    #tut-deck-pile:hover .tut-deck-face { border-color: var(--cyan); }
    .tut-deck-count { font-size: 9px; color: var(--muted); font-weight: 700; }
    /* Tutorial deck hover popup — cards left, above the pile, never on the art. */
    .tut-deck-tip {
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%) translateY(2px);
      margin-bottom: 6px;
      background: #0d1830;
      color: #eaf8ff;
      font-size: 10px;
      font-weight: 800;
      white-space: nowrap;
      padding: 4px 9px;
      border-radius: 7px;
      border: 1px solid var(--cyan);
      box-shadow: 0 4px 12px rgba(0,0,0,.5);
      opacity: 0;
      pointer-events: none;
      transition: opacity .15s ease, transform .15s ease;
      z-index: 60;
    }
    #tut-deck-pile:hover .tut-deck-tip { opacity: 1; transform: translateX(-50%) translateY(-2px); }
    #tut-my-board-area {
      display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0;
    }
    #tut-my-board-wrap {
      display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
      min-height: 72px; padding: 4px;
    }
    .tut-ocean-hub { display: flex; flex-direction: column; align-items: center; position: relative; }
    .tut-ocean-hub.tut-board-clickable { border-radius: 10px; outline: 2px solid var(--gold); outline-offset: 4px; box-shadow: 0 0 18px rgba(240,184,64,.5); animation: tut-card-pulse-gold 1.3s ease-in-out infinite; }
    /* Animals are behind the ocean — ocean row sits on top (z-index 3), animals behind (z-index 1) */
    .tut-slot-up   { margin-bottom: -28px; z-index: 1; position: relative; display: flex; gap: 2px; justify-content: center; }
    .tut-slot-down { margin-top:    -28px; z-index: 1; position: relative; display: flex; gap: 2px; justify-content: center; }
    .tut-slot-row  { display: flex; align-items: center; position: relative; z-index: 3; }
    .tut-slot-left  { margin-right: -20px; z-index: 1; position: relative; }
    .tut-slot-right { margin-left:  -20px; z-index: 1; position: relative; }
    .tut-ocean-card {
      width: 56px; height: 78px; border-radius: 7px; overflow: hidden;
      border: 2px solid var(--teal);
    }
    .tut-ocean-card img { width: 100%; height: 100%; object-fit: cover; }
    .tut-attached-card {
      width: 42px; height: 58px; border-radius: 4px; overflow: hidden;
      border: 1.5px solid var(--cyan); box-shadow: 0 0 6px rgba(48,200,240,.3);
    }
    .tut-attached-card img { width: 100%; height: 100%; object-fit: cover; }
    .tut-empty-slot {
      width: 42px; height: 58px; border-radius: 4px;
      border: 1.5px dashed rgba(48,200,240,.2);
      display: flex; align-items: center; justify-content: center;
      color: rgba(255,255,255,.2); font-size: 8px; text-align: center; line-height: 1.2;
    }
    .tut-empty-board-msg {
      color: var(--muted); font-size: 10px; text-align: center; padding: 10px;
    }
    #tut-hand-zone {
      flex-shrink: 0; padding: 4px 8px 6px;
      background: rgba(12,34,80,.85); border-top: 1px solid var(--border);
      position: relative; z-index: 9590;
    }
    #tut-hand-row {
      display: flex; gap: 5px; justify-content: center; flex-wrap: nowrap;
      overflow-x: auto; padding: 6px 0;
    }
    .tut-hand-card {
      width: 56px; height: 78px; border-radius: 7px; overflow: hidden;
      border: 2px solid var(--border); cursor: pointer;
      transition: transform .18s, border-color .15s, box-shadow .15s;
      flex-shrink: 0; position: relative;
    }
    .tut-hand-card:hover { transform: translateY(-14px) scale(1.1); border-color: var(--cyan); box-shadow: 0 8px 22px var(--glow-c); z-index: 30; }
    .tut-hand-card.tut-selectable { border-color: var(--cyan); box-shadow: 0 0 14px var(--glow-c); animation: tut-card-pulse 1.3s ease-in-out infinite; }
    .tut-hand-card.tut-discard-selectable { border-color: var(--red); box-shadow: 0 0 10px rgba(232,64,87,.3); animation: tut-card-pulse-red 1.3s ease-in-out infinite; }
    .tut-hand-card.tut-discard-selected { border-color: var(--red); opacity: .55; }
    .tut-hand-card.tut-pay-selectable { border-color: var(--teal); box-shadow: 0 0 10px rgba(13,148,136,.4); animation: tut-card-pulse-teal 1.3s ease-in-out infinite; }
    .tut-hand-card.tut-card-selected { border-color: var(--gold) !important; box-shadow: 0 0 18px var(--glow-gold) !important; transform: translateY(-10px) scale(1.08); }
    .tut-hand-card img { width: 100%; height: 100%; object-fit: cover; }
    .tut-card-label {
      position: absolute; bottom: 0; left: 0; right: 0;
      background: rgba(0,0,0,.8); font-size: 7px; color: #ddf;
      text-align: center; padding: 2px; font-weight: 700; line-height: 1.1;
    }
    .tut-star-badge {
      position: absolute; top: 2px; right: 2px; color: var(--gold);
      font-size: 10px; font-weight: 900; text-shadow: 0 0 4px rgba(240,184,64,.8);
    }
    .tut-card-tip {
      display: none; position: absolute; bottom: calc(100% + 10px); left: 50%;
      transform: translateX(-50%); width: 176px;
      background: rgba(14,40,96,.98); border: 1px solid rgba(58,120,204,.45);
      border-radius: 9px; padding: 9px 11px; z-index: 9700;
      font-size: 11px; line-height: 1.5; pointer-events: none;
      box-shadow: 0 8px 24px rgba(0,0,0,.8);
    }
    .tut-hand-card:hover .tut-card-tip { display: block; }
    .tut-card-tip .tip-name { font-weight: 800; color: var(--gold); font-size: 12px; margin-bottom: 2px; }
    .tut-card-tip .tip-meta { color: var(--muted); font-size: 10px; margin-bottom: 5px; }
    .tut-card-tip .tip-body { color: var(--text); font-size: 11px; }
    .tut-card-tip .tip-star { color: var(--gold); font-size: 10.5px; margin-top: 4px; font-style: italic; }
    .tut-card-tip .tip-hint { margin-top: 5px; font-size: 9px; color: var(--muted); border-top: 1px solid rgba(255,255,255,.08); padding-top: 4px; }
    /* ── Staging area (paid card waiting to be dragged) ── */
    #tut-staging-row {
      display: flex; justify-content: center; padding: 4px 0 0;
    }
    #tut-staging-row:empty { display: none; }
    .tut-staging-wrap {
      display: flex; align-items: center; gap: 10px; padding: 7px 14px;
      background: rgba(48,200,240,.08); border: 1.5px dashed var(--cyan);
      border-radius: 10px;
    }
    .tut-staging-label {
      font-size: 9px; color: var(--cyan); font-weight: 800; text-transform: uppercase;
      letter-spacing: .5px; white-space: nowrap;
    }
    .tut-staged-card {
      width: 52px; height: 72px; border-radius: 6px; overflow: hidden;
      border: 2.5px solid var(--cyan); cursor: grab; position: relative; flex-shrink: 0;
      box-shadow: 0 0 14px rgba(48,200,240,.55); animation: tut-card-pulse 1.3s ease-in-out infinite;
    }
    .tut-staged-card img { width: 100%; height: 100%; object-fit: cover; }
    .tut-staged-card-lbl {
      position: absolute; bottom: 0; left: 0; right: 0; text-align: center;
      font-size: 6px; font-weight: 700; color: #fff; background: rgba(0,0,0,.75); padding: 2px;
    }
    /* ── Board drop zone (shown when drag_ocean step) ── */
    /* Large, easy-to-hit target for the first ocean — matches the roomy drop
       zone used in real games so dragging the first ocean is never fiddly. */
    .tut-board-droptarget {
      min-width: 150px; min-height: 150px; border-radius: 12px;
      border: 2.5px dashed var(--cyan); background: rgba(48,200,240,.1);
      display: flex; align-items: center; justify-content: center;
      color: var(--cyan); font-size: 13px; font-weight: 800; text-align: center;
      animation: tut-card-pulse-teal 1s ease-in-out infinite; cursor: copy;
      position: relative; z-index: 9600; padding: 18px;
    }
    /* ── Ocean slot drop target (drag_animal step) ── */
    .tut-empty-slot.tut-ocean-droptarget {
      border: 2px dashed #ffd700 !important;
      color: #ffd700 !important;
      background: rgba(255,215,0,.08);
      animation: tut-card-pulse-gold 1s ease-in-out infinite;
      font-size: 14px !important;
    }
    @keyframes tut-card-pulse-gold {
      0%,100% { box-shadow: 0 0 8px rgba(255,215,0,.4); }
      50%      { box-shadow: 0 0 20px rgba(255,215,0,.8); }
    }
    /* ── Draggable card (drag-from-hand step) ── */
    .tut-hand-card.tut-drag-ready {
      border-color: var(--gold) !important; cursor: grab;
      box-shadow: 0 0 14px rgba(240,184,64,.55) !important;
      animation: tut-card-pulse-gold 1.3s ease-in-out infinite;
    }
    /* ── Selected-and-locked card (already selected, now paying) ── */
    .tut-hand-card.tut-selected-locked {
      border-color: var(--gold) !important; box-shadow: 0 0 16px rgba(240,184,64,.75) !important;
      animation: tut-card-pulse-gold 1.3s ease-in-out infinite; cursor: default;
    }
    #tut-panel {
      flex-shrink: 0; position: relative; z-index: 9590;
      background: linear-gradient(0deg, rgba(12,34,82,.99) 0%, rgba(20,52,112,.98) 100%);
      border-top: 1px solid rgba(58,120,204,.35);
      padding: 10px 16px 10px;
      display: flex; flex-direction: column; gap: 7px;
    }
    #tut-panel-title {
      font-family: "Cinzel", serif; font-size: 11px; color: var(--cyan);
      font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
    }
    #tut-panel-text { font-size: 12.5px; color: var(--text); line-height: 1.55; }
    #tut-panel-text strong { color: var(--gold); }
    #tut-panel-text em { color: var(--cyan); font-style: normal; }
    #tut-panel-text p { margin: 0 0 5px; }
    #tut-panel-text p:last-child { margin: 0; }
    #tut-action-hint {
      font-size: 11px; color: var(--cyan); font-weight: 700;
      background: rgba(48,200,240,.08); border: 1px solid rgba(48,200,240,.22);
      border-radius: 7px; padding: 6px 10px;
      animation: tut-hint-blink 2s ease-in-out infinite;
    }
    #tut-nav { display: flex; gap: 8px; justify-content: flex-end; }
    #tut-back-btn, #tut-next-btn {
      background: rgba(22,56,118,.85); border: 1px solid var(--border);
      color: var(--text); border-radius: 8px; padding: 7px 15px;
      font-size: 12px; font-weight: 700; cursor: pointer;
      transition: background .15s, border-color .15s;
    }
    #tut-back-btn:hover { border-color: var(--muted); }
    #tut-next-btn { background: linear-gradient(135deg,#0d6cb0,#0a5490); border-color: #2a80c0; color: #fff; }
    #tut-next-btn:hover { background: linear-gradient(135deg,#1278c8,#0d60a0); }
    #tut-next-btn:disabled, #tut-back-btn:disabled { opacity:.35; cursor:not-allowed; }
    #tut-finish-btns { display: flex; gap: 8px; justify-content: center; }
    .tut-finish-btn {
      flex: 1; padding: 9px; border-radius: 8px; font-size: 12px; font-weight: 700;
      cursor: pointer; border: none; transition: opacity .15s;
    }
    .tut-finish-btn:hover { opacity: .85; }
    #tut-main-menu-btn { background: linear-gradient(135deg,#0d6cb0,#0a5490); color: #fff; }
    #tut-restart-btn { background: rgba(22,56,118,.85); border: 1px solid var(--border); color: var(--text); }
    #tut-spotlight-overlay {
      position: fixed; inset: 0; z-index: 9570; pointer-events: none;
      transition: opacity .3s;
    }
    #tut-spotlight-overlay.dim { background: rgba(0,0,0,.68); pointer-events: all; }
    .tut-highlight {
      position: relative; z-index: 9580 !important;
      outline: 2.5px solid var(--cyan) !important; outline-offset: 3px !important;
      border-radius: 8px !important;
      box-shadow: 0 0 0 5px rgba(48,200,240,.15), 0 0 28px rgba(48,200,240,.45) !important;
      animation: tut-glow 1.4s ease-in-out infinite !important;
    }
    #tut-exit-confirm {
      position: fixed; inset: 0; z-index: 9700; background: rgba(0,0,0,.85);
      backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center;
    }
    #tut-exit-confirm.open { display: flex; }
    .tut-confirm-box {
      background: linear-gradient(160deg,rgba(22,58,118,.99) 0%,rgba(14,40,88,1) 100%);
      border: 1px solid rgba(58,120,204,.35); border-radius: 14px;
      padding: 28px 30px; max-width: 340px; width: 90%; text-align: center;
      box-shadow: 0 12px 48px rgba(0,0,0,.7);
    }
    .tut-confirm-box p { font-family:"Cinzel",serif; font-size:14px; color:var(--gold); margin-bottom:18px; font-weight:700; }
    .tut-confirm-btns { display: flex; gap: 10px; justify-content: center; }
    #tut-exit-no-btn {
      background: rgba(22,56,118,.85); border: 1px solid var(--border); color: var(--text);
      border-radius: 8px; padding: 10px 20px; font-size: 12px; font-weight: 700; cursor: pointer;
    }
    #tut-exit-yes-btn {
      background: linear-gradient(135deg,#c0283c,#9a1f2e); border: none; color: #fff;
      border-radius: 8px; padding: 10px 20px; font-size: 12px; font-weight: 700; cursor: pointer;
    }
    #tut-zoom {
      position: fixed; inset: 0; z-index: 9800; background: rgba(0,0,0,.86);
      backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center;
    }
    #tut-zoom.open { display: flex; }
    #tut-zoom-inner {
      position: relative; display: flex; flex-direction: column;
      align-items: center; gap: 10px; padding: 24px;
    }
    #tut-zoom-img {
      width: 140px; height: 196px; object-fit: cover; border-radius: 10px;
      border: 2px solid var(--cyan); box-shadow: 0 0 40px rgba(48,200,240,.4);
    }
    #tut-zoom-name { font-family:"Cinzel",serif; font-size:13px; color:var(--gold); font-weight:700; }
    #tut-zoom-close {
      position: absolute; top: 8px; right: 8px;
      background: rgba(20,50,108,.9); border: 1px solid var(--border);
      color: var(--muted); border-radius: 50%; width: 26px; height: 26px;
      cursor: pointer; font-size: 12px; display: flex; align-items:center; justify-content:center;
    }
    #tut-zoom-hint {
      font-size: 11px; color: var(--cyan); font-weight: 700;
      background: rgba(48,200,240,.1); border: 1px solid rgba(48,200,240,.25);
      border-radius: 7px; padding: 7px 14px; text-align: center;
    }
    #tut-flash-msg {
      position: fixed; top: 52px; left: 50%; transform: translateX(-50%);
      z-index: 9900; background: rgba(48,200,240,.14);
      border: 1px solid rgba(48,200,240,.42); border-radius: 8px;
      padding: 7px 18px; font-size: 12px; font-weight: 700; color: var(--cyan);
      white-space: nowrap; opacity: 0; transition: opacity .3s; pointer-events: none;
    }
    #tut-flash-msg.visible { opacity: 1; }
    .tut-bot-flash { animation: tut-bot-anim .7s ease-in-out 2; }
    #tut-tips-list { padding: 0; margin: 4px 0 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
    #tut-tips-list li { font-size: 11.5px; color: var(--text); padding-left: 2px; }
    #tut-tips-list li::before { content: "◆ "; color: var(--cyan); font-size: 8px; vertical-align: middle; }
    @keyframes tut-glow {
      0%,100% { box-shadow: 0 0 0 5px rgba(48,200,240,.15),0 0 22px rgba(48,200,240,.4); }
      50%      { box-shadow: 0 0 0 5px rgba(48,200,240,.3), 0 0 38px rgba(48,200,240,.7); }
    }
    @keyframes tut-card-pulse {
      0%,100% { box-shadow: 0 0 10px rgba(48,200,240,.3); }
      50%      { box-shadow: 0 0 22px rgba(48,200,240,.7); }
    }
    @keyframes tut-card-pulse-red {
      0%,100% { box-shadow: 0 0 8px rgba(232,64,87,.3); }
      50%      { box-shadow: 0 0 20px rgba(232,64,87,.65); }
    }
    @keyframes tut-card-pulse-teal {
      0%,100% { box-shadow: 0 0 8px rgba(13,148,136,.3); }
      50%      { box-shadow: 0 0 22px rgba(13,148,136,.7); }
    }
    @keyframes tut-hint-blink {
      0%,100% { opacity: 1; } 50% { opacity: .65; }
    }
    @keyframes tut-bot-anim {
      0%,100% { border-color: var(--border); }
      50%      { border-color: var(--gold); box-shadow: 0 0 14px var(--glow-gold); }
    }
    @keyframes tut-fade-in {
      from { opacity: 0; transform: translateY(5px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .tut-fade-in { animation: tut-fade-in .22s ease-out; }

    /* ══ CARD MOVEMENT ANIMATIONS ══════════════════════════════════
       Hook reveal (deck draw), pool→player fly, ripple reveal (pool entry).
       The overlay sits above everything; cloned cards animate within it. */
    #pv-anim-layer {
      position: fixed; inset: 0; pointer-events: none; z-index: 9700;
      overflow: hidden;
    }
    .pv-anim-card {
      position: absolute; width: 90px; height: 126px;
      border-radius: 10px;
      border: 2px solid rgba(95,179,214,.85);
      box-shadow: 0 12px 28px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.08) inset;
      overflow: hidden;
      transform-style: preserve-3d;
      will-change: transform, opacity;
      background: linear-gradient(135deg, #2A5AA0, #1A3D78);
    }
    .pv-anim-card .pv-anim-face,
    .pv-anim-card .pv-anim-back {
      position: absolute; inset: 0; backface-visibility: hidden;
      -webkit-backface-visibility: hidden;
      border-radius: 8px; overflow: hidden;
    }
    .pv-anim-card .pv-anim-face img {
      width: 100%; height: 100%; object-fit: cover; display: block;
    }
    .pv-anim-card .pv-anim-back {
      background: var(--cc-card-back) center/cover no-repeat,
                  linear-gradient(135deg, #2A5AA0, #1A3D78);
      transform: rotateY(180deg);
    }
    .pv-anim-card.face-down .pv-anim-face { transform: rotateY(180deg); }
    .pv-anim-card.face-down .pv-anim-back { transform: rotateY(0deg); }

    /* Pool ripple reveal: circular pulse + card surfacing */
    .pv-pool-card.surfacing { animation: pool-surface .42s cubic-bezier(.22,.68,0,1.2) both; }
    @keyframes pool-surface {
      0%   { opacity: 0; transform: scale(.55) translateY(8px); filter: blur(2px); }
      55%  { opacity: 1; transform: scale(1.08) translateY(-2px); filter: blur(0); }
      100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
    }
    .pv-ripple {
      position: absolute; pointer-events: none;
      border-radius: 50%;
      border: 2px solid rgba(95,179,214,.7);
      background: radial-gradient(circle, rgba(188,221,230,.35) 0%, rgba(95,179,214,.15) 50%, rgba(95,179,214,0) 80%);
      animation: pool-ripple .55s ease-out forwards;
    }
    @keyframes pool-ripple {
      0%   { transform: scale(.2); opacity: .9; }
      100% { transform: scale(2.6); opacity: 0; }
    }
    /* Landing bounce for cards arriving at a destination */
    @keyframes anim-land {
      0%   { transform: scale(1.05); }
      60%  { transform: scale(.96); }
      100% { transform: scale(1); }
    }
    /* Hook arc visual aid — subtle trailing glow */
    .pv-anim-card.hook-trail::before {
      content: ""; position: absolute; inset: -4px;
      border-radius: 14px;
      box-shadow: 0 0 24px rgba(95,179,214,.45);
      opacity: 0; animation: hook-trail .42s ease-out forwards;
    }
    @keyframes hook-trail {
      0%   { opacity: 0; }
      40%  { opacity: .6; }
      100% { opacity: 0; }
    }

    /* ── SCORE BREAKDOWN MODAL ─────────────────────────────────── */
    #pv-score-modal {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,.82);
      z-index: 2500; align-items: center; justify-content: center;
      backdrop-filter: blur(6px);
    }
    #pv-score-modal.open { display: flex; }
    .pv-modal-box {
      background: linear-gradient(160deg, rgba(22,58,118,.98) 0%, rgba(14,40,88,.99) 100%);
      border: 1px solid rgba(58,120,204,.28);
      border-radius: 16px;
      box-shadow: 0 0 60px rgba(34,216,248,.10), 0 20px 60px rgba(0,0,0,.6);
      padding: 24px;
      max-width: 640px; width: 95%; max-height: 85vh;
      overflow-y: auto; position: relative;
    }
    .pv-modal-box h2 {
      font-family: "Cinzel", serif; font-size: 1.1rem; font-weight: 900;
      color: var(--gold); letter-spacing: 1.5px; margin-bottom: 16px;
    }
    .pv-modal-close {
      position: absolute; top: 14px; right: 14px;
      width: 30px; height: 30px; background: var(--panel);
      border: 1px solid var(--border); border-radius: 50%;
      color: var(--muted); font-size: 16px; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: color .15s, border-color .15s;
    }
    .pv-modal-close:hover { color: var(--red); border-color: var(--red); }

    /* Leaderboard summary */
    .sb-leaderboard { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
    .sb-rank-pill {
      display: flex; align-items: center; gap: 6px;
      border: 1px solid rgba(58,120,204,.28); border-radius: 8px;
      padding: 4px 10px; background: rgba(22,56,110,.7); font-size: 12px;
    }
    .sb-rank-badge {
      width: 22px; height: 22px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 11px; font-weight: 900; flex-shrink: 0;
    }
    .sb-rank-1 { background: #c8971a; color: #2a1800; }
    .sb-rank-2 { background: #808080; color: #fff; }
    .sb-rank-3 { background: #7a4010; color: #fff; }
    .sb-rank-n { background: var(--border); color: var(--muted); }
    .sb-you { background: var(--teal); color: #fff; border-radius: 5px; font-size: 9px; padding: 1px 5px; font-weight: 800; }

    .sb-player-block {
      border: 1px solid var(--border); border-radius: 10px;
      padding: 10px; margin-bottom: 8px; background: rgba(22,50,100,.5);
    }
    .sb-player-head {
      display: flex; align-items: center; gap: 8px;
      font-weight: 800; margin-bottom: 8px;
    }
    .sb-total-pill {
      margin-left: auto; background: var(--gold); color: #1a0a00;
      border-radius: 10px; padding: 2px 9px; font-size: 12px; font-weight: 900;
      font-family: "Cinzel", serif;
    }
    .sb-card-row {
      border-top: 1px solid rgba(48,200,240,.1); padding-top: 6px; margin-top: 6px;
      font-size: 11px; color: var(--muted);
    }
    .sb-card-name { font-weight: 700; color: var(--text); font-size: 11.5px; }
    .sb-card-pts { color: var(--green); font-weight: 800; }
    .sb-card-components { margin-top: 2px; line-height: 1.5; }

    /* ── TUTORIAL MODAL ─────────────────────────────────────────── */
    .tut-step {
      border-left: 3px solid var(--cyan); padding-left: 12px;
      margin-bottom: 14px;
    }
    .tut-step h3 {
      font-size: 14px; font-weight: 800; color: var(--cyan); margin-bottom: 4px;
    }
    .tut-step p { font-size: 12.5px; color: var(--text); line-height: 1.6; }

    /* ── MISC ───────────────────────────────────────────────────── */
    .pv-tag {
      display: inline-block; background: var(--border);
      border-radius: 5px; padding: 2px 7px;
      font-size: 11px; color: var(--muted);
    }
    .hidden { display: none !important; }
    ::-webkit-scrollbar { width: 5px; height: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

    /* ── NOTICE BAR DROPDOWN MENU ───────────────────────────────── */
    .pv-menu-wrap { position: relative; }
    #pv-menu-btn {
      background: linear-gradient(135deg, var(--cr-teal), var(--cr-teal-deep));
      border: 1px solid rgba(232,179,74,.55);
      color: #fff; padding: 4px 11px; border-radius: 7px;
      cursor: pointer; font-size: 12px; font-weight: 800;
      text-shadow: 0 1px 2px rgba(0,0,0,.3);
      transition: filter .15s, box-shadow .15s;
    }
    #pv-menu-btn:hover { filter: brightness(1.08); box-shadow: 0 2px 10px rgba(95,179,214,.45); }
    #pv-menu-drop {
      display: none; position: absolute; top: calc(100% + 5px); right: 0;
      min-width: 230px; background: #1A3E80;
      border: 1px solid rgba(58,120,204,.35); border-radius: 10px;
      box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 9000;
      padding: 8px 0; flex-direction: column;
    }
    #pv-menu-drop.open { display: flex; }
    .pv-menu-item {
      display: block; width: 100%; text-align: left;
      background: none; border: none; color: var(--text);
      padding: 8px 16px; cursor: pointer; font-size: 13px;
      text-decoration: none;
    }
    .pv-menu-item:hover { background: rgba(48,200,240,.08); }
    .pv-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
    .pv-menu-label {
      padding: 4px 14px 2px; font-size: 10px;
      color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
    }
    #pv-menu-scores-list {
      padding: 4px 16px 6px; font-size: 12px;
      color: var(--muted); line-height: 1.8;
    }
    .pv-menu-room { padding: 2px 16px 6px; font-size: 11px; color: #5a8ab8; font-family: monospace; }
    .pv-menu-hand-row {
      display: flex; align-items: center; gap: 6px;
      padding: 3px 14px; font-size: 12px; cursor: pointer;
      transition: background .1s;
    }
    .pv-menu-hand-row:hover { background: rgba(48,200,240,.08); }
    .pv-menu-hand-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .pv-menu-hand-dot.active { background: var(--gold); box-shadow: 0 0 5px rgba(240,200,64,.7); }
    .pv-menu-hand-dot.mine { background: var(--cyan); }
    .pv-menu-hand-dot.other { background: var(--border); }
    .pv-menu-hand-name { flex: 1; color: var(--text); font-weight: 600; }
    .pv-menu-hand-name.active { color: var(--gold); font-weight: 800; }
    .pv-menu-hand-score { color: var(--muted); font-size: 11px; }
    .pv-menu-hand-edit { font-size: 10px; color: var(--muted); opacity: .6; }
    .pv-menu-hand-rename {
      display: flex; align-items: center; gap: 4px; padding: 4px 14px;
    }
    .pv-menu-hand-rename input {
      flex: 1; background: #122E6A; border: 1px solid var(--border);
      border-radius: 6px; padding: 4px 8px; color: var(--text); font-size: 12px;
      outline: none;
    }
    .pv-menu-hand-rename input:focus { border-color: var(--cyan); }
    .pv-menu-hand-rename button {
      background: none; border: 1px solid var(--border); border-radius: 6px;
      padding: 4px 8px; color: var(--muted); font-size: 11px; cursor: pointer;
    }
    .pv-menu-hand-rename button:hover { border-color: var(--cyan); color: var(--cyan); }

    /* AI Speed control in menu */
    #pv-menu-ai-speed-section { padding: 6px 12px 8px; }
    .ai-speed-label {
      font-size: 11px; font-weight: 700; color: var(--muted);
      text-transform: uppercase; letter-spacing: .6px;
      margin-bottom: 6px;
    }
    .ai-speed-bar {
      display: flex; gap: 0; width: 100%;
      border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden;
    }
    .ai-speed-btn {
      flex: 1; padding: 6px 0; background: transparent;
      color: var(--muted); font-size: 12px; font-weight: 700;
      border: none; border-right: 1px solid var(--border); cursor: pointer;
      transition: background .15s, color .15s;
      font-family: "Nunito", sans-serif;
    }
    .ai-speed-btn:last-child { border-right: none; }
    .ai-speed-btn:hover:not(.active) { background: rgba(48,200,240,.09); color: var(--text); }
    .ai-speed-btn.active {
      background: linear-gradient(135deg, #1f7fb4, #155f8a);
      color: #fff; cursor: default;
    }

    /* ── BOARD FOCUS OVERLAY ────────────────────────────────────── */
    #pv-board-focus {
      display: none; position: fixed; inset: 0; z-index: 9500;
      background: linear-gradient(160deg, rgba(26,45,90,.97) 0%, rgba(20,56,100,.97) 60%, rgba(44,90,138,.96) 100%);
      backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
      flex-direction: column;
      align-items: center; padding: 20px 16px; overflow-y: auto;
    }
    #pv-board-focus.open { display: flex; }
    #pv-board-focus-label {
      font-size: 1.2rem; color: var(--cr-gold); font-weight: 900;
      font-family: "Cinzel", serif; margin-bottom: 14px;
      text-shadow: 0 0 18px rgba(232,179,74,.5);
      letter-spacing: 1.5px;
    }
    #pv-board-focus-content {
      display: flex; flex-wrap: wrap; gap: 10px;
      justify-content: center; padding-bottom: 24px;
      max-width: 960px; width: 100%;
    }
    #pv-board-focus-close {
      position: fixed; top: 14px; right: 16px;
      background: rgba(44,90,138,.85); border: 1px solid rgba(95,179,214,.5);
      color: var(--cr-cream); font-size: 1.2rem; width: 32px; height: 32px;
      border-radius: 50%; cursor: pointer; z-index: 9501;
      transition: background .15s, border-color .15s;
    }
    #pv-board-focus-close:hover { background: rgba(44,90,138,1); border-color: var(--cr-teal); }

    /* ── FULL OPPONENT BOARDS (inline, toggled) ─────────────────── */
    .pv-opp-full-wrap {
      background: var(--panel); border: 1px solid var(--border);
      border-radius: 10px; padding: 6px; cursor: pointer;
      transition: border-color .2s; overflow: hidden;
    }
    .pv-opp-full-wrap:hover { border-color: var(--cyan); }
    .pv-opp-full-wrap.active-turn {
      border-color: var(--gold2);
      box-shadow: 0 0 14px rgba(245,200,66,.2);
      animation: opp-turn-bob 1.8s ease-in-out infinite;
    }
    @keyframes opp-turn-bob {
      0%,100% {
        box-shadow: 0 0 10px rgba(245,200,66,.15);
        transform: translateY(0);
      }
      50% {
        box-shadow: 0 0 22px rgba(245,200,66,.4);
        transform: translateY(-4px);
      }
    }
    .pv-opp-full-label {
      font-size: 10px; color: var(--muted); text-align: center;
      margin-bottom: 3px; font-weight: 700; pointer-events: none;
    }
    .pv-opp-full-label .opp-score { color: var(--gold); margin-left: 4px; }
    .pv-ro-board { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; padding: 2px; }
    .pv-ro-board .pv-lane-slot { cursor: default; }
    .pv-ro-board .pv-lane-slot:hover { transform: none; background: none; border-color: var(--border); }

    /* Equal columns when showing full boards */
    #pv-opponents.full-mode.opp-2 { grid-template-columns: 1fr 1fr; }
    #pv-opponents.full-mode.opp-3 { grid-template-columns: 1fr 1fr 1fr; }
    #pv-opponents.full-mode { overflow-y: auto; max-height: 42vh; }

    /* Read-only board in the focus overlay — adaptive sizing based on how
       many oceans are on the board. Bigger when there are few, smaller as
       more oceans need to fit on screen. Set --focus-scale from JS. */
    #pv-board-focus-content {
      --focus-scale: 1;
      --mini-w: calc(84px * var(--focus-scale));
      --mini-h: calc(118px * var(--focus-scale));
    }
    #pv-board-focus-content .pv-ro-board { gap: calc(8px * var(--focus-scale)); }
    #pv-board-focus-content .pv-ocean-face {
      width: calc(100px * var(--focus-scale));
      height: calc(140px * var(--focus-scale));
    }

    /* ── BOARD HOVER PREVIEW (smaller, floating tooltip) ─────────── */
    #pv-board-hover {
      display: none;
      position: fixed;
      z-index: 9450;
      background: linear-gradient(135deg, rgba(26,45,90,.97) 0%, rgba(44,90,138,.97) 100%);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: 1.5px solid rgba(95,179,214,.6);
      border-radius: 12px;
      padding: 10px 12px 8px;
      box-shadow: 0 8px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(188,221,230,.1) inset, 0 1px 0 rgba(255,255,255,.06) inset;
      max-width: 540px;
      max-height: 72vh;
      overflow-y: auto;
      pointer-events: none;
      opacity: 0;
      transform: translateY(4px);
      transition: opacity .14s ease, transform .14s ease;
    }
    #pv-board-hover.visible { display: block; opacity: 1; transform: translateY(0); }
    #pv-board-hover .pv-bh-title {
      font-family: "Cinzel", serif;
      font-size: 12px;
      letter-spacing: .8px;
      color: var(--cr-gold);
      font-weight: 700;
      text-align: center;
      margin-bottom: 6px;
      text-shadow: 0 0 10px rgba(232,179,74,.4);
    }
    #pv-board-hover .pv-bh-hint {
      font-family: "Baloo 2", "Nunito", sans-serif;
      font-size: 9.5px;
      color: rgba(188,221,230,.7);
      text-align: center;
      margin-top: 4px;
      letter-spacing: .3px;
    }
    /* Hover preview uses smaller cards regardless of board size — it's a tooltip. */
    #pv-board-hover {
      --mini-w: 50px;
      --mini-h: 70px;
    }
    #pv-board-hover .pv-ro-board { gap: 4px; }
    #pv-board-hover .pv-ocean-face { width: 60px; height: 84px; }
    #pv-board-hover .pv-board-card { cursor: default; }
    #pv-board-hover .pv-board-card:hover { transform: none; }

    /* ── FLOATING GAME LOG ──────────────────────────────────────── */
    #pv-log-float {
      display: none; position: fixed; bottom: 14px; right: 14px;
      width: 300px; max-height: 48vh;
      background: #1A3E80; border: 1px solid rgba(58,120,204,.3);
      border-radius: 10px; z-index: 8000; flex-direction: column; overflow: hidden;
    }
    #pv-log-float.open { display: flex; }
    #pv-log-float-hdr {
      display: flex; align-items: center; justify-content: space-between;
      padding: 7px 12px; border-bottom: 1px solid var(--border);
      font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer;
    }
    #pv-log-float-body {
      overflow-y: auto; flex: 1; padding: 6px 12px;
    }
    #pv-log-float-body .log-entry { font-size: 11px; color: var(--muted); line-height: 1.6; }

    /* ── 4+ OPPONENT MINI LAYOUT ────────────────────────────────── */
    #pv-opponents.opp-many {
      display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
    }
    .pv-opp-mini {
      width: 150px; background: var(--panel); border: 1px solid var(--border);
      border-radius: 8px; padding: 6px 8px; cursor: pointer;
    }
    .pv-opp-mini:hover { border-color: var(--cyan); }
    .pv-opp-mini .pv-opp-name { font-size: 11px; }
    .pv-opp-mini .pv-opp-score { font-size: 10px; padding: 1px 6px; }
    .pv-opp-card { cursor: pointer; }
    .pv-opp-card:hover { border-color: var(--cyan); }

    @media (max-width: 640px) {
      #pv-log-float { width: calc(100vw - 20px); right: 10px; }
    }

    /* ── CHAT ───────────────────────────────────────────────────── */
    /* Chat button — lives inside #bs-ctrl, directly below the minus button,
       styled to match the board-size cluster art. */
    #bs-chat-sep {
      width: 30px; height: 1px; margin: 3px 0 1px;
      background: rgba(95,179,214,.32);
    }
    #pv-chat-btn {
      position: relative;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: 1px; width: 44px; padding: 5px 0 4px;
      background: rgba(95,179,214,.14);
      border: 1.5px solid rgba(95,179,214,.4);
      border-radius: 10px;
      color: #d4eaf8; cursor: pointer;
      transition: background .14s, border-color .14s, transform .08s;
      font-family: "Nunito", sans-serif;
    }
    #pv-chat-btn:hover { background: rgba(95,179,214,.28); border-color: #5fb3d6; }
    #pv-chat-btn:active { transform: scale(.94); }
    #pv-chat-btn .pvc-btn-ico { font-size: 17px; line-height: 1; }
    #pv-chat-btn .pvc-btn-lbl {
      font-size: 8.5px; font-weight: 800; letter-spacing: .3px;
      text-transform: uppercase; color: #7aafcc; line-height: 1;
    }
    #pv-chat-btn .chat-badge {
      position: absolute; top: -6px; right: -6px;
      background: var(--red); color: #fff; font-size: 9px; font-weight: 800;
      min-width: 16px; height: 16px; line-height: 16px; text-align: center;
      border-radius: 8px; padding: 0 4px; display: none;
      box-shadow: 0 0 0 2px rgba(6,16,42,.95);
    }
    #pv-chat-panel {
      position: fixed; bottom: 70px; right: 16px; z-index: 1850;
      width: 330px; height: 460px; max-height: calc(100vh - 90px); max-width: calc(100vw - 24px);
      background: linear-gradient(160deg, rgba(22,58,118,.98) 0%, rgba(12,34,76,.99) 100%);
      border: 1.5px solid rgba(95,179,214,.42); border-radius: 14px;
      box-shadow: 0 14px 50px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04);
      display: none; flex-direction: column; overflow: hidden;
    }
    #pv-chat-panel.open { display: flex; }
    #pv-chat-panel.dragging { transition: none; user-select: none; }
    #pv-chat-hdr {
      display: flex; align-items: center; gap: 8px;
      padding: 9px 10px 9px 12px; border-bottom: 1px solid rgba(95,179,214,.18);
      font-size: 13px; font-weight: 800; color: var(--cyan);
      cursor: grab; flex-shrink: 0; touch-action: none;
      background: linear-gradient(180deg, rgba(30,72,140,.55), rgba(20,52,108,.25));
    }
    #pv-chat-hdr:active { cursor: grabbing; }
    #pv-chat-title {
      flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      font-family: "Cinzel", serif; font-size: 13.5px; font-weight: 900; color: #bfe6fb;
    }
    #pv-chat-title.editable { cursor: pointer; }
    #pv-chat-title.editable:hover { text-decoration: underline dotted rgba(191,230,251,.6); }
    .pvc-title-edit {
      width: 100%; box-sizing: border-box; background: rgba(22,56,110,.95);
      border: 1px solid var(--cyan); color: #fff; border-radius: 6px; padding: 3px 7px;
      font-family: "Cinzel", serif; font-size: 13px; font-weight: 800;
    }
    .pvc-title-edit:focus { outline: none; }
    .pvc-hdr-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
    .pvc-hbtn {
      position: relative;
      background: none; border: none; color: #8fb8d8; cursor: pointer;
      font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 7px;
    }
    .pvc-hbtn:hover { color: #fff; background: rgba(95,179,214,.18); }
    #pv-chat-close:hover { color: var(--red); }
    #pv-chat-back { font-size: 20px; font-weight: 800; }
    .pvc-back-dot {
      position: absolute; top: 2px; right: 2px; width: 8px; height: 8px;
      border-radius: 50%; background: var(--red); display: none;
      box-shadow: 0 0 0 2px rgba(16,42,84,.95);
    }
    .pvc-back-dot.show { display: block; }
    /* View switching — only the active view is shown */
    .pvc-view { flex: 1; min-height: 0; display: none; flex-direction: column; }
    .pvc-view.active { display: flex; }
    #pv-chat-messages {
      flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
      min-height: 60px;
    }
    .chat-msg { font-size: 11px; line-height: 1.5; display: flex; align-items: flex-start; gap: 7px; }
    .chat-msg .cm-avatar {
      position: relative; /* contain the .cc-avbg layer inside the 26px circle */
      width: 26px; height: 26px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: linear-gradient(145deg, #2f8be3 0%, #226ec4 100%);
      border: 1.5px solid rgba(95,179,214,.5); margin-top: 1px;
    }
    .chat-msg .cm-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .chat-msg .cm-main { min-width: 0; flex: 1; }
    .chat-msg .cm-sender { font-weight: 700; color: var(--gold); }
    .chat-msg .cm-target { font-size: 10px; color: var(--muted); margin-left: 4px; }
    .chat-msg .cm-text   { color: #e0e8f0; word-break: break-word; }
    #pv-chat-input-row {
      display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid rgba(48,200,240,.15);
      flex-direction: column;
    }
    #pv-chat-target-row { display: flex; align-items: center; gap: 6px; }
    #pv-chat-target-row label { font-size: 10px; color: var(--muted); flex-shrink: 0; }
    #pv-chat-to { font-size: 11px; background: rgba(22,56,110,.8); border: 1px solid var(--border); color: #dde; border-radius: 5px; padding: 3px 6px; flex: 1; }
    #pv-chat-msg-row { display: flex; gap: 6px; }
    #pv-chat-text { flex: 1; font-size: 11px; background: rgba(22,56,110,.8); border: 1px solid var(--border); color: #dde; border-radius: 5px; padding: 5px 8px; resize: none; }
    #pv-chat-send { background: var(--cyan); color: #0A2448; font-size: 11px; font-weight: 700; border: none; border-radius: 5px; padding: 5px 10px; cursor: pointer; align-self: stretch; }
    #pv-chat-send:hover { opacity: .85; }

    /* ── CHAT LIST VIEW (Current Game Chat + DMs + groups) ───────── */
    #pv-chat-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
    .pvc-row {
      display: flex; align-items: center; gap: 10px; padding: 9px 10px;
      border-radius: 11px; cursor: pointer; transition: background .14s; position: relative;
    }
    .pvc-row:hover { background: rgba(95,179,214,.14); }
    .pvc-row.current { background: rgba(232,179,74,.12); border: 1px solid rgba(232,179,74,.34); margin-bottom: 4px; }
    .pvc-row.current:hover { background: rgba(232,179,74,.2); }
    .pvc-av {
      width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; overflow: hidden; position: relative;
      background: linear-gradient(145deg,#2f8be3,#1f66bc); display: flex; align-items: center; justify-content: center;
      border: 1.5px solid rgba(95,179,214,.4);
    }
    .pvc-av img { width: 100%; height: 100%; object-fit: cover; }
    .pvc-av-letter { color: #fff; font-weight: 900; font-size: 16px; font-family: "Cinzel", serif; }
    .pvc-row-body { flex: 1; min-width: 0; }
    .pvc-row-top { display: flex; align-items: baseline; gap: 6px; }
    .pvc-row-name { font-size: 12.5px; font-weight: 800; color: #dcecfb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
    .pvc-row-time { font-size: 9.5px; color: #7fa6cc; flex-shrink: 0; }
    .pvc-row-prev { font-size: 11px; color: #93b4d4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
    .pvc-row-unread {
      min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--red);
      color: #fff; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center; flex-shrink: 0;
    }
    .pvc-list-empty { text-align: center; color: #8fb0d0; font-size: 12px; padding: 28px 18px; line-height: 1.6; }
    .pvc-list-sub { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: #6f9bc4; padding: 8px 10px 4px; }

    /* ── CONVERSATION VIEW (DM / group) ──────────────────────────── */
    #pv-chat-conv-msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
    .pvc-bubble { max-width: 80%; padding: 6px 10px; border-radius: 13px; font-size: 12px; line-height: 1.4; word-break: break-word; position: relative; }
    .pvc-bubble.mine { align-self: flex-end; background: linear-gradient(135deg,#2e90e0,#1a6ad0); color: #fff; border-bottom-right-radius: 4px; }
    .pvc-bubble.theirs { align-self: flex-start; background: rgba(255,255,255,.1); color: #e6f0fa; border: 1px solid rgba(95,179,214,.28); border-bottom-left-radius: 4px; }
    .pvc-bubble-sender { display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; color: var(--gold); margin-bottom: 2px; }
    .pvc-bubble-av { width: 16px; height: 16px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: linear-gradient(145deg,#2f8be3,#1f66bc); display: flex; align-items: center; justify-content: center; }
    .pvc-bubble-av img { width: 100%; height: 100%; object-fit: cover; }
    .pvc-bubble-av-lt { color: #fff; font-weight: 900; font-size: 8.5px; }
    .pvc-bubble-time { font-size: 9px; opacity: .65; margin-top: 2px; display: block; text-align: right; }
    .pvc-conv-empty { text-align: center; color: #8fb0d0; font-size: 12px; padding: 24px; }
    .pvc-sys { align-self: center; max-width: 88%; text-align: center; font-size: 10.5px; color: #8fb0d0; margin: 4px 0; line-height: 1.4; }
    #pv-chat-conv-input { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid rgba(95,179,214,.18); flex-shrink: 0; }
    #pv-chat-conv-text {
      flex: 1; min-width: 0; font-size: 12px; background: rgba(22,56,110,.8); border: 1px solid var(--border);
      color: #dde; border-radius: 8px; padding: 7px 10px; resize: none; max-height: 80px; font-family: inherit;
    }
    #pv-chat-conv-send { background: var(--cyan); color: #0A2448; font-size: 12px; font-weight: 800; border: none; border-radius: 8px; padding: 0 14px; cursor: pointer; flex-shrink: 0; }
    #pv-chat-conv-send:hover { opacity: .85; }
    .pvc-guest-note { padding: 12px; text-align: center; font-size: 11.5px; color: #f0c674; background: rgba(232,179,74,.1); }

    /* ── SEARCH-TO-MESSAGE BAR (iMessage-style recipient picker) ──── */
    /* (#pv-chat-view-list lays out via .pvc-view: flex column, shown only when .active) */
    #pv-chat-compose { display: flex; flex-direction: column; flex-shrink: 0; padding: 9px 9px 5px; border-bottom: 1px solid rgba(95,179,214,.14); }
    .pvc-compose-recip {
      display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
      background: rgba(22,56,110,.8); border: 1px solid var(--border); border-radius: 9px;
      padding: 6px 8px; min-height: 36px; flex-shrink: 0;
    }
    .pvc-chip {
      display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 2px;
      background: linear-gradient(135deg,#2e90e0,#1a6ad0); color: #fff; border-radius: 20px;
      font-size: 11px; font-weight: 800; max-width: 100%;
    }
    .pvc-chip-av { width: 20px; height: 20px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; }
    .pvc-chip-av img { width: 100%; height: 100%; object-fit: cover; }
    .pvc-chip-av-lt { font-size: 10px; color: #fff; font-weight: 900; }
    .pvc-chip-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
    .pvc-chip-x { background: none; border: none; color: rgba(255,255,255,.85); cursor: pointer;
      font-size: 14px; line-height: 1; padding: 0 2px; }
    .pvc-chip-x:hover { color: #fff; }
    .pvc-compose-input {
      flex: 1; min-width: 90px; background: none; border: none; outline: none;
      color: #e6f0fa; font-size: 12px; font-family: inherit; padding: 3px 2px;
    }
    .pvc-compose-input::placeholder { color: #7fa6cc; }
    .pvc-compose-sugg {
      display: none; flex-direction: column; margin-top: 4px; max-height: 200px; overflow-y: auto;
      background: rgba(10,30,70,.92); border: 1px solid rgba(95,179,214,.3); border-radius: 9px;
    }
    .pvc-compose-sugg.show { display: flex; }
    .pvc-sugg-row { display: flex; align-items: center; gap: 9px; padding: 7px 9px; cursor: pointer; border-radius: 8px; }
    .pvc-sugg-row:hover, .pvc-sugg-row.active { background: rgba(95,179,214,.18); }
    .pvc-sugg-av { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: linear-gradient(145deg,#2f8be3,#1f66bc); display: flex; align-items: center; justify-content: center; }
    .pvc-sugg-av img { width: 100%; height: 100%; object-fit: cover; }
    .pvc-sugg-av-lt { color: #fff; font-weight: 900; font-size: 13px; font-family: "Cinzel", serif; }
    .pvc-sugg-nm { font-size: 12.5px; font-weight: 700; color: #dcecfb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pvc-compose-name {
      margin-top: 8px; width: 100%; box-sizing: border-box; background: rgba(22,56,110,.8);
      border: 1px solid var(--border); color: #e6f0fa; border-radius: 9px; padding: 8px 10px;
      font-size: 12px; font-family: inherit;
    }
    .pvc-compose-name:focus, .pvc-compose-input:focus { outline: none; }
    .pvc-compose-go {
      margin-top: 8px; width: 100%; background: linear-gradient(135deg,#2e90e0,#1a6ad0); color: #fff;
      border: none; border-radius: 9px; padding: 9px; font-size: 12.5px; font-weight: 800; cursor: pointer;
    }
    .pvc-compose-go:hover { filter: brightness(1.08); }
    .pvc-compose-go:disabled { opacity: .45; cursor: default; filter: none; }
    .pvc-compose-hint { font-size: 10.5px; color: #7fa6cc; text-align: center; padding: 10px 6px; line-height: 1.5; }

    /* ── GROUP CREATE / SETTINGS MODAL ───────────────────────────── */
    #pv-grp-modal {
      display: none; position: fixed; inset: 0; z-index: 9900;
      background: rgba(6,16,42,.62); backdrop-filter: blur(4px);
      align-items: center; justify-content: center; padding: 20px;
    }
    #pv-grp-modal.open { display: flex; }
    #pv-grp-box {
      width: 100%; max-width: 360px; max-height: 88vh; overflow-y: auto;
      background: linear-gradient(160deg, rgba(24,60,122,.99) 0%, rgba(14,38,84,.99) 100%);
      border: 1.5px solid rgba(95,179,214,.45); border-radius: 16px;
      box-shadow: 0 18px 60px rgba(0,0,0,.6); padding: 18px 18px 16px;
    }
    #pv-grp-title { font-family: "Cinzel", serif; font-size: 16px; font-weight: 900; color: #bfe6fb; margin-bottom: 12px; }
    .pvg-label { display: block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: #7fa6cc; margin: 10px 0 4px; }
    #pv-grp-name, #pv-grp-members {
      width: 100%; box-sizing: border-box; font-size: 13px; font-family: inherit;
      background: rgba(10,30,70,.85); border: 1px solid var(--border); color: #e6f0fa;
      border-radius: 9px; padding: 9px 11px; resize: none;
    }
    #pv-grp-name:focus, #pv-grp-members:focus { outline: none; border-color: var(--cyan); }
    #pv-grp-roster { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
    .pvg-member { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #cfe2f5; padding: 4px 2px; }
    .pvg-member .pvg-mdot { width: 7px; height: 7px; border-radius: 50%; background: #5fb3d6; flex-shrink: 0; }
    .pvg-member .pvg-mav {
      width: 26px; height: 26px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: linear-gradient(145deg,#2f8be3,#1f66bc); display: flex; align-items: center; justify-content: center;
      border: 1px solid rgba(95,179,214,.4);
    }
    .pvg-member .pvg-mav img { width: 100%; height: 100%; object-fit: cover; }
    .pvg-member .pvg-mav-lt { color: #fff; font-weight: 900; font-size: 11px; font-family: "Cinzel", serif; }
    .pvg-msg { font-size: 11.5px; line-height: 1.4; margin-top: 10px; min-height: 14px; }
    .pvg-msg.err { color: #ff9aa6; }
    .pvg-msg.ok  { color: #8be0a0; }
    #pv-grp-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
    .pvg-btn {
      font-size: 12.5px; font-weight: 800; border-radius: 9px; padding: 8px 14px; cursor: pointer;
      border: 1px solid rgba(95,179,214,.4); background: rgba(95,179,214,.12); color: #d4eaf8;
    }
    .pvg-btn:hover { background: rgba(95,179,214,.24); }
    .pvg-btn.primary { background: linear-gradient(135deg,#2e90e0,#1a6ad0); border-color: transparent; color: #fff; }
    .pvg-btn.primary:hover { filter: brightness(1.08); }
    .pvg-btn.danger { background: rgba(232,64,79,.16); border-color: rgba(232,64,79,.5); color: #ffb3bb; margin-right: auto; }
    .pvg-btn.danger:hover { background: rgba(232,64,79,.3); }
    .pvg-btn:disabled { opacity: .5; cursor: default; }

    @media (max-width: 640px) {
      #pv-chat-panel { width: calc(100vw - 20px); right: 10px; bottom: 64px; height: 70vh; }
    }

    /* ── GAME SUMMARY FULL SCREEN ──────────────────────────────── */
    #pv-endgame-overlay {
      display: none; position: fixed; inset: 0; z-index: 9850;
      /* Clean flat/gradient light background — no underwater scene art. */
      background: linear-gradient(170deg, #dff0fb 0%, #cfe6f8 45%, #bfdcf3 100%);
      overflow-y: auto;
    }
    #pv-endgame-overlay::before {
      content: ''; position: fixed; inset: 0; z-index: 0;
      background:
        radial-gradient(ellipse at 18% 0%, rgba(255,255,255,.55) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 8%, rgba(255,255,255,.35) 0%, transparent 50%);
      pointer-events: none;
    }
    #pv-endgame-overlay.open { display: flex; flex-direction: column; }
    #gs-wrap {
      flex: 1; min-height: 100vh; padding: 14px 16px 28px;
      display: flex; flex-direction: column; gap: 14px;
      font-family: "Nunito", sans-serif;
      width: 100%;
      position: relative; z-index: 1;
    }
    /* ── Header ── */
    #gs-header { text-align: center; padding-top: 6px; }
    #gs-game-title {
      font-family: "Cinzel", serif; font-size: clamp(1.9rem,5vw,3.4rem);
      color: #1a2d5a; text-shadow: 0 2px 12px rgba(255,255,255,.7), 0 1px 0 rgba(255,255,255,.9);
      letter-spacing: 3px; margin: 4px 0 12px;
      transition: color .4s, text-shadow .4s;
    }
    #gs-meta-bar {
      display: flex; justify-content: center; gap: 0;
      background: rgba(255,255,255,.78); border: 1.5px solid rgba(100,160,220,.35);
      border-radius: 18px; overflow: hidden; flex-wrap: wrap;
      max-width: 680px; margin: 0 auto;
      box-shadow: 0 6px 30px rgba(30,60,140,.14), inset 0 1px 0 rgba(255,255,255,.9);
      backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    }
    .gs-meta-item {
      padding: 12px 22px; border-right: 1px solid rgba(100,160,220,.22);
      text-align: center; min-width: 88px;
    }
    .gs-meta-item:last-child { border-right: none; }
    .gs-meta-label { font-size: 9px; font-weight: 800; text-transform: uppercase; color: #5a80a8; letter-spacing: .9px; }
    .gs-meta-val { font-size: 18px; font-weight: 900; color: #1a2d5a; margin-top: 3px; }
    .gs-meta-val.gs-big { font-size: 22px; }
    .gs-meta-val.gs-cyan { color: #1888c0; }
    .gs-meta-val.gs-gold { color: #b86800; }
    /* ── Body ── */
    #gs-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; flex: 1; }
    @media (max-width: 800px) { #gs-body { grid-template-columns: 1fr; } }
    /* ── Shared panel style ── */
    .gs-panel {
      background: rgba(255,255,255,.80);
      backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(100,160,220,.3);
      border-radius: 20px;
      box-shadow: 0 8px 32px rgba(30,60,140,.12), inset 0 1px 0 rgba(255,255,255,.95);
    }
    /* ── Left: standings ── */
    #gs-left { display: flex; flex-direction: column; gap: 12px; }
    #gs-standings {
      background: rgba(255,255,255,.80);
      backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(100,160,220,.3);
      border-radius: 20px; overflow: hidden; flex: 1;
      box-shadow: 0 8px 32px rgba(30,60,140,.12);
    }
    #gs-standings-title {
      font-family: "Cinzel", serif; font-size: .85rem; font-weight: 800;
      color: #1a2d5a; text-align: center; padding: 11px 16px 9px;
      letter-spacing: 2.5px; background: rgba(180,220,255,.45);
      border-bottom: 1px solid rgba(100,160,220,.25); text-transform: uppercase;
    }
    .gs-st-row {
      display: grid; grid-template-columns: 54px 62px 1fr auto;
      align-items: center; gap: 0; padding: 0 16px 0 0;
      border-bottom: 1px solid rgba(100,160,220,.18); position: relative;
      overflow: hidden; min-height: 72px;
    }
    .gs-st-row:last-child { border-bottom: none; }
    .gs-st-bg {
      position: absolute; inset: 0;
      background-size: cover; background-position: center;
      opacity: .18; z-index: 0;
    }
    .gs-st-rank {
      position: relative; z-index: 1;
      display: flex; align-items: center; justify-content: center;
      font-size: 22px; font-weight: 900; font-family: "Cinzel",serif;
      min-width: 54px; color: #3a5888;
    }
    .gs-st-rank-1 { font-size: 26px; }
    .gs-st-rank-2 { font-size: 24px; }
    .gs-st-rank-3 { font-size: 24px; }
    .gs-st-av { position: relative; z-index: 1; padding: 10px 6px; }
    .gs-st-av img {
      width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
      border: 2.5px solid rgba(80,150,220,.45); display: block;
      box-shadow: 0 3px 12px rgba(30,60,140,.2);
    }
    .gs-st-info { position: relative; z-index: 1; padding: 8px 10px; min-width: 0; }
    .gs-st-name { font-size: 17px; font-weight: 900; color: #1a2d5a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .gs-st-env { font-size: 10px; font-weight: 700; color: #5a80a8; text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }
    .gs-st-score { position: relative; z-index: 1; font-size: 20px; font-weight: 900; color: #1a2d5a; white-space: nowrap; letter-spacing: .5px; }
    .gs-st-row.gs-st-me { background: rgba(56,160,220,.09); }
    .gs-st-row.gs-st-me .gs-st-name { color: #0e6aaa; }
    .gs-st-row.gs-st-me .gs-st-score { color: #0e6aaa; }
    .gs-st-row.gs-st-me .gs-st-av img { border-color: rgba(14,106,170,.55); box-shadow: 0 0 12px rgba(14,106,170,.2); }
    /* ── Special feats ── */
    #gs-feats {
      background: rgba(255,255,255,.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(100,160,220,.3); border-radius: 18px; padding: 13px 16px;
      box-shadow: 0 6px 24px rgba(30,60,140,.1);
    }
    #gs-feats-title {
      font-family: "Cinzel",serif; font-size: .74rem; font-weight: 800;
      color: #3a5888; text-align: center; letter-spacing: 2px; margin-bottom: 11px; text-transform: uppercase;
    }
    #gs-feats-row { display: flex; gap: 10px; }
    .gs-feat-card {
      flex: 1; background: rgba(180,220,255,.35); border: 1px solid rgba(100,160,220,.25);
      border-radius: 14px; padding: 11px 12px; text-align: center;
    }
    .gs-feat-label { font-size: 9px; font-weight: 800; color: #5a80a8; text-transform: uppercase; letter-spacing: .6px; }
    .gs-feat-val { font-size: 14px; font-weight: 900; color: #1a2d5a; margin-top: 5px; }
    /* ── Challenges Completed ── */
    #gs-challenges-done {
      background: rgba(255,255,255,.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(80,180,120,.35); border-radius: 18px; padding: 13px 16px;
      box-shadow: 0 6px 24px rgba(30,60,140,.1); margin-top: 4px;
    }
    #gs-challenges-title {
      font-family: "Cinzel",serif; font-size: .74rem; font-weight: 800;
      color: #1a6b3a; text-align: center; letter-spacing: 2px; margin-bottom: 10px; text-transform: uppercase;
    }
    #gs-challenges-list { display: flex; flex-direction: column; gap: 7px; }
    .gs-ch-row {
      display: flex; align-items: center; gap: 10px;
      background: rgba(60,180,100,.12); border: 1px solid rgba(60,180,100,.25);
      border-radius: 12px; padding: 8px 12px;
    }
    .gs-ch-icon { font-size: 20px; flex-shrink: 0; }
    .gs-ch-info { flex: 1; min-width: 0; }
    .gs-ch-type { font-size: 9px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
    .gs-ch-type.daily  { color: #1a7abf; }
    .gs-ch-type.weekly { color: #8a40b8; }
    .gs-ch-name { font-size: 13px; font-weight: 800; color: #1a3a20; margin-top: 1px; }
    .gs-ch-xp { font-size: 12px; font-weight: 900; color: #d4910a; white-space: nowrap; flex-shrink: 0; }
    /* ── Strategy confirm panel ── */
    #gs-strat-confirm {
      background: rgba(255,255,255,.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(100,160,220,.3); border-radius: 18px; padding: 14px 16px;
      box-shadow: 0 6px 24px rgba(30,60,140,.1);
    }
    #gs-strat-title {
      font-family: "Cinzel",serif; font-size: .74rem; font-weight: 800;
      color: #1a2d5a; text-align: center; letter-spacing: 2px; margin-bottom: 5px; text-transform: uppercase;
    }
    #gs-strat-hint {
      font-size: 11px; font-weight: 700; color: #5a7090; text-align: center; margin-bottom: 10px;
    }
    #gs-strat-list {
      display: flex; flex-direction: column; gap: 5px;
      max-height: 220px; overflow-y: auto;
      scrollbar-width: thin; scrollbar-color: rgba(100,160,220,.5) rgba(220,235,255,.3);
      padding-right: 3px; margin-bottom: 8px;
    }
    #gs-strat-list::-webkit-scrollbar { width: 6px; }
    #gs-strat-list::-webkit-scrollbar-thumb { background: rgba(100,160,220,.5); border-radius: 4px; }
    .gs-strat-row {
      display: flex; align-items: center; gap: 10px;
      background: rgba(220,235,255,.45); border: 1px solid rgba(100,160,220,.25);
      border-radius: 10px; padding: 8px 12px; cursor: pointer;
      transition: background .12s, border-color .12s;
      user-select: none;
    }
    .gs-strat-row:hover { background: rgba(180,215,255,.65); border-color: rgba(80,140,220,.4); }
    .gs-strat-row.selected {
      background: rgba(30,100,220,.12); border-color: rgba(30,100,220,.55);
      box-shadow: 0 0 0 1.5px rgba(30,100,220,.25);
    }
    .gs-strat-row input[type="checkbox"] { accent-color: #1c64d0; width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
    .gs-strat-row-text { flex: 1; min-width: 0; }
    .gs-strat-row-name { font-size: 13px; font-weight: 800; color: #1a2d5a; }
    .gs-strat-row-tier { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; opacity: .65; }
    .gs-strat-row-swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid rgba(0,0,0,.15); }
    #gs-strat-none-row {
      margin-top: 4px; padding-top: 8px;
      border-top: 1px solid rgba(100,160,220,.2);
    }
    .gs-strat-none-label {
      display: flex; align-items: center; gap: 8px; cursor: pointer;
      font-size: 12px; font-weight: 700; color: #5a7090;
    }
    .gs-strat-none-label input[type="checkbox"] { accent-color: #8aabb8; width: 14px; height: 14px; cursor: pointer; }
    /* ── Right column ── */
    #gs-right { display: flex; flex-direction: column; gap: 12px; }
    /* ── XP row ── */
    #gs-xp-row { display: flex; gap: 12px; align-items: stretch; }
    #gs-xp-section {
      flex: 1; background: rgba(255,255,255,.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(100,160,220,.3); border-radius: 18px; padding: 16px 18px;
      box-shadow: 0 6px 24px rgba(30,60,140,.1);
    }
    #gs-xp-header {
      font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.4px;
      color: #5a80a8; margin-bottom: 14px; text-align: center;
    }
    #gs-xp-bar-row { display: flex; align-items: center; gap: 14px; }
    #gs-level-badge {
      background: linear-gradient(148deg, #3a7ad0, #1e58b0);
      border: 2px solid rgba(255,255,255,.5); border-radius: 16px;
      padding: 9px 14px; text-align: center; flex-shrink: 0;
      box-shadow: 0 4px 16px rgba(30,80,180,.3);
    }
    #gs-level-badge .gs-lbl { font-size: 8px; font-weight: 800; color: rgba(255,255,255,.8); text-transform: uppercase; letter-spacing: .9px; }
    #gs-level-badge .gs-num { font-size: 34px; font-weight: 900; color: #fff; line-height: 1.05; }
    #gs-xp-bar-wrap { flex: 1; }
    #gs-xp-bar-track {
      height: 24px; background: rgba(30,80,180,.12); border-radius: 999px;
      border: 1px solid rgba(100,160,220,.4); overflow: hidden; position: relative;
      box-shadow: inset 0 2px 6px rgba(30,60,140,.15);
    }
    #gs-xp-bar-fill {
      height: 100%; border-radius: 999px;
      background: linear-gradient(90deg, #2878d8, #38a8f0, #56c8ff);
      box-shadow: 0 0 10px rgba(56,168,240,.5);
      width: 0%;
    }
    #gs-xp-bar-markers { display: flex; justify-content: space-between; margin-top: 5px; }
    .gs-xp-mk { font-size: 9px; color: #8aaac8; font-weight: 700; }
    #gs-xp-gain-badge {
      background: linear-gradient(148deg, #e8980a, #c87000);
      border: 2px solid rgba(255,255,255,.5); border-radius: 16px;
      padding: 9px 14px; text-align: center; flex-shrink: 0;
      box-shadow: 0 4px 16px rgba(180,100,0,.25);
    }
    #gs-xp-gain-badge .gs-xp-num { font-size: 34px; font-weight: 900; color: #fff; display: block; line-height: 1.05; }
    #gs-xp-gain-badge .gs-xp-label { font-size: 8px; font-weight: 800; color: rgba(255,255,255,.85); text-transform: uppercase; letter-spacing: .9px; display: block; margin-top: 1px; }
    /* ── Placement table ── */
    #gs-placement-table {
      background: rgba(255,255,255,.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(100,160,220,.3); border-radius: 18px; padding: 14px 16px; min-width: 162px;
      box-shadow: 0 6px 24px rgba(30,60,140,.1);
    }
    .gs-pt-title { font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .9px; color: #5a80a8; margin-bottom: 9px; text-align: center; }
    .gs-pt-row {
      display: flex; justify-content: space-between; gap: 8px;
      padding: 6px 0; border-bottom: 1px solid rgba(100,160,220,.2);
      font-size: 12px; font-weight: 700;
    }
    .gs-pt-row:last-child { border-bottom: none; }
    .gs-pt-rank { color: #3a6090; }
    .gs-pt-xp { color: #1878c0; }
    .gs-pt-row.gs-pt-me { background: rgba(56,160,220,.08); border-radius: 6px; padding: 6px 4px; }
    .gs-pt-row.gs-pt-me .gs-pt-rank, .gs-pt-row.gs-pt-me .gs-pt-xp { color: #b86800; font-weight: 900; font-size: 13px; }
    /* ── Match Stats ── */
    #gs-match-stats {
      background: rgba(255,255,255,.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(100,160,220,.3); border-radius: 18px; padding: 14px 16px; flex: 1;
      box-shadow: 0 6px 24px rgba(30,60,140,.1);
    }
    #gs-stats-title {
      font-family: "Cinzel",serif; font-size: 10px; font-weight: 800; color: #1a2d5a;
      margin-bottom: 12px; letter-spacing: 2px; text-transform: uppercase; text-align: center;
    }
    #gs-stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
    @media (max-width: 600px) { #gs-stats-grid { grid-template-columns: repeat(2,1fr); } }
    .gs-stat-card {
      background: rgba(180,220,255,.35); border: 1px solid rgba(100,160,220,.28);
      border-radius: 15px; padding: 12px 13px; text-align: left; overflow: hidden; position: relative;
      min-height: 100px;
    }
    .gs-sc-num {
      font-family: "Cinzel",serif; font-size: 30px; font-weight: 900;
      color: #1a2d5a; line-height: 1.1;
    }
    .gs-sc-unit { font-size: 11px; font-weight: 700; color: #1878c0; margin-top: 1px; }
    .gs-sc-label { font-size: 10px; font-weight: 800; color: #4a6888; margin-top: 5px; line-height: 1.35; }
    .gs-sc-player { font-size: 11px; font-weight: 800; color: #3a6090; margin-top: 3px; }
    .gs-sc-name { font-size: 15px; font-weight: 900; color: #1a2d5a; }
    .gs-sc-pts { font-size: 12px; font-weight: 700; color: #1878c0; }
    .gs-sc-xp {
      position: absolute; bottom: 8px; right: 8px;
      background: rgba(30,120,200,.18); border: 1px solid rgba(30,120,200,.3);
      border-radius: 999px; padding: 2px 8px; font-size: 9px; font-weight: 800; color: #1868b0;
    }
    /* ── Rewards Earned ── */
    #gs-rewards {
      background: rgba(255,255,255,.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1.5px solid rgba(100,160,220,.3); border-radius: 18px; padding: 13px 16px;
      box-shadow: 0 6px 24px rgba(30,60,140,.1);
    }
    #gs-rewards-title {
      font-family: "Cinzel",serif; font-size: .74rem; font-weight: 800;
      color: #b86800; text-align: center; letter-spacing: 2px; margin-bottom: 10px; text-transform: uppercase;
    }
    #gs-rewards-list {
      display: flex; flex-direction: column; gap: 7px;
      max-height: 188px; overflow-y: auto; padding-right: 4px;
      scrollbar-width: thin; scrollbar-color: rgba(232,152,10,.5) rgba(255,238,210,.4);
    }
    #gs-rewards-list::-webkit-scrollbar { width: 7px; }
    #gs-rewards-list::-webkit-scrollbar-track { background: rgba(255,238,210,.4); border-radius: 4px; }
    #gs-rewards-list::-webkit-scrollbar-thumb { background: rgba(232,152,10,.5); border-radius: 4px; }
    #gs-rewards-empty { font-size: 12px; color: #8a98aa; text-align: center; padding: 10px 0; }
    .gs-rw-row {
      display: flex; align-items: center; gap: 10px;
      background: rgba(255,236,205,.5); border: 1px solid rgba(232,170,70,.3);
      border-radius: 12px; padding: 8px 12px;
    }
    .gs-rw-icon { font-size: 19px; flex-shrink: 0; }
    .gs-rw-info { flex: 1; min-width: 0; }
    .gs-rw-name { font-size: 13px; font-weight: 800; color: #5a3a0a; }
    .gs-rw-desc { font-size: 10px; font-weight: 700; color: #9a7a3a; margin-top: 1px; }
    .gs-rw-xp { font-size: 13px; font-weight: 900; color: #c87800; white-space: nowrap; flex-shrink: 0; }
    .gs-rw-xp.gs-rw-status { color: #2a8a4a; font-size: 16px; }

    /* ── Strategy search ── */
    #gs-strat-search {
      width: 100%; padding: 9px 12px; margin-bottom: 9px;
      border: 1.5px solid rgba(100,160,220,.35); border-radius: 11px;
      background: rgba(255,255,255,.7); font-family: "Nunito",sans-serif;
      font-size: 13px; font-weight: 700; color: #1a2d5a; outline: none;
      transition: border-color .12s, box-shadow .12s;
    }
    #gs-strat-search::placeholder { color: #8aa6c4; font-weight: 600; }
    #gs-strat-search:focus { border-color: rgba(40,120,216,.6); box-shadow: 0 0 0 3px rgba(40,120,216,.14); }
    .gs-strat-row.gs-strat-hidden { display: none; }
    #gs-strat-no-match { font-size: 12px; color: #8a98aa; text-align: center; padding: 8px 0; display: none; }

    /* ── Post-game ready-up status + leaver notices ── */
    #gs-left-notices { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
    .gs-left-notice {
      text-align: center; font-size: 13px; font-weight: 800; color: #b03a3a;
      background: rgba(224,80,80,.10); border: 1px solid rgba(224,80,80,.28);
      border-radius: 10px; padding: 7px 12px;
    }
    .gs-left-notice em { font-style: italic; color: #8a2a2a; }
    #gs-again-status {
      text-align: center; font-size: 14px; font-weight: 900; color: #1868b0;
      letter-spacing: .4px; min-height: 0; display: none;
    }
    #gs-again-status.show { display: block; margin-bottom: 2px; }
    /* ── Buttons ── */
    #gs-btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
    .gs-btn {
      flex: 1; min-width: 150px; padding: 16px 18px; border-radius: 18px; font-size: 16px; font-weight: 900;
      font-family: "Nunito",sans-serif; cursor: pointer; border: none;
      transition: transform .14s, box-shadow .14s, filter .12s; letter-spacing: .4px;
    }
    .gs-btn:hover { transform: translateY(-3px); filter: brightness(1.08); }
    .gs-btn:active { transform: translateY(0px); filter: brightness(.96); }
    .gs-btn:disabled { cursor: default; opacity: .82; transform: none; filter: none; }
    .gs-btn-again {
      background: linear-gradient(155deg, #f7a927, #e07f08);
      color: #fff; border: 2px solid rgba(255,255,255,.45);
      box-shadow: 0 6px 22px rgba(220,130,0,.32);
    }
    .gs-btn-again.gs-btn-readied {
      background: linear-gradient(155deg, #3fbf6a, #1f9a4a);
      box-shadow: 0 6px 22px rgba(30,150,70,.3);
    }
    .gs-btn-home {
      background: linear-gradient(155deg, #3a7ad8, #1e58b8);
      color: #fff; border: 2px solid rgba(255,255,255,.4);
      box-shadow: 0 6px 22px rgba(30,80,180,.35);
    }
    .gs-btn-view {
      background: linear-gradient(155deg, #38b8a0, #229080);
      color: #fff; border: 2px solid rgba(255,255,255,.4);
      box-shadow: 0 6px 22px rgba(30,140,120,.3);
    }
    .gs-btn-secondary {
      background: rgba(255,255,255,.78); color: #2a5888;
      border: 1.5px solid rgba(100,160,220,.45);
      box-shadow: 0 4px 16px rgba(30,60,140,.1);
    }

    /* ── COMPETITIVE MODE ───────────────────────────────────────── */
    #comp-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(10,40,100,.72); z-index: 9500;
      align-items: center; justify-content: center;
      backdrop-filter: blur(8px); padding: 16px;
    }
    #comp-overlay.open { display: flex; }
    .comp-box {
      background: linear-gradient(180deg, #cce6f8 0%, #b4d4ee 55%, #9ec4e4 100%);
      border: 1.5px solid rgba(130,195,240,.55); border-radius: 26px;
      box-shadow: 0 10px 48px rgba(8,50,130,.22), 0 2px 8px rgba(8,50,130,.10);
      padding: 28px 24px 22px; max-width: 460px; width: 100%;
      display: flex; flex-direction: column;
      align-items: center; gap: 14px;
      position: relative; overflow: hidden;
      max-height: 93vh; overflow-y: auto;
    }
    .comp-box::before {
      content: ""; position: absolute; inset: 0; pointer-events: none;
      background: radial-gradient(ellipse at 30% 15%, rgba(255,255,255,.44) 0%, transparent 65%);
    }
    .comp-box h2 {
      font-family: "Cinzel", serif; font-size: 1.55rem; font-weight: 700;
      color: #0c2858; letter-spacing: .5px; margin: 0;
      position: relative; z-index: 1;
    }
    .comp-box .wr-subtitle { color: #5a82b0; font-size: .88rem; margin: 0; position: relative; z-index: 1; }
    #comp-overlay-close {
      position: absolute; top: 18px; right: 18px; z-index: 2;
      width: 42px; height: 42px; border-radius: 50%;
      background: rgba(190,220,248,.72); border: 1.5px solid rgba(120,185,235,.55);
      color: #2a5888; font-size: 18px; line-height: 1;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: background .15s;
    }
    #comp-overlay-close:hover { background: rgba(210,235,255,.9); }
    .comp-tabs { display: flex; gap: 8px; width: 100%; position: relative; z-index: 1; }
    .comp-tab {
      flex: 1; padding: 11px 6px; border-radius: 14px;
      border: 1.5px solid rgba(150,200,240,.5);
      background: rgba(255,255,255,.52); color: #5a82b0;
      font-weight: 700; font-size: 13px; cursor: pointer;
      transition: all .15s; text-align: center;
    }
    .comp-tab.active {
      background: linear-gradient(100deg, #f7a927 0%, #e98d10 60%, #d97a08 100%);
      border-color: #d97a08; color: #0c2858;
      box-shadow: 0 2px 10px rgba(220,130,0,.25);
    }
    .comp-tab:hover:not(.active) { background: rgba(255,255,255,.8); color: #0c2858; border-color: rgba(100,160,230,.6); }
    .comp-panel { display: none; width: 100%; flex-direction: column; gap: 10px; position: relative; z-index: 1; }
    .comp-panel.active { display: flex; }
    .comp-label { font-size: 11px; color: #0c2858; font-weight: 900; text-transform: uppercase; letter-spacing: .8px; text-align: left; }
    .comp-player-row { display: flex; align-items: center; gap: 10px; width: 100%; }
    .comp-player-badge {
      width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      font-weight: 900; font-size: 17px;
      background: rgba(255,255,255,.85); border: 2px solid rgba(100,160,230,.45); color: #0c2858;
    }
    .comp-name-display {
      flex: 1; padding: 10px 14px;
      background: rgba(255,255,255,.82); border: 1.5px solid rgba(150,200,240,.4);
      border-radius: 12px; font-size: 15px; color: #0c2858; font-weight: 700; text-align: center;
    }
    .comp-helper { font-size: 12px; color: #6a8aaa; line-height: 1.5; text-align: left; width: 100%; }
    .comp-hands-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .comp-hand-slot {
      background: rgba(255,255,255,.75); border: 1.5px solid rgba(150,200,240,.4);
      border-radius: 14px; padding: 12px 14px;
      display: flex; align-items: center; gap: 10px; text-align: left;
    }
    .comp-hand-emoji { font-size: 2.2rem; line-height: 1; flex-shrink: 0; }
    .comp-hand-label { font-weight: 800; font-size: 15px; color: #0c2858; }
    .comp-hand-owner { font-size: 12px; color: #6a8aaa; margin-top: 2px; }
    .comp-action-btn {
      width: 100%; padding: 16px; border-radius: 16px; font-size: 1.05rem; font-weight: 700;
      font-family: "Cinzel", serif; letter-spacing: .5px; cursor: pointer;
      background: linear-gradient(100deg, #f7a927 0%, #e98d10 60%, #d97a08 100%);
      border: none; color: #0c2858;
      box-shadow: 0 4px 18px rgba(200,110,0,.28); transition: filter .15s, transform .12s;
    }
    .comp-action-btn:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-2px); }
    .comp-action-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
    .comp-close-pill {
      background: #3a72b8; border: none; border-radius: 50px;
      color: #fff; font-weight: 700; font-size: 14px;
      padding: 10px 32px; cursor: pointer; transition: background .15s;
      position: relative; z-index: 1;
    }
    .comp-close-pill:hover { background: #2a5898; }
    .comp-room-code {
      font-family: "Cinzel", serif; font-size: 2.4rem; font-weight: 900;
      letter-spacing: 8px; color: #0c2858;
      background: rgba(255,255,255,.85); border: 2px solid rgba(100,160,230,.4);
      border-radius: 14px; padding: 12px 24px; cursor: pointer;
    }
    .comp-status { font-size: 12px; color: #5a7a9a; min-height: 16px; position: relative; z-index: 1; }
    .comp-status.err { color: #c0202a; }

    /* Hand-switch overlay */
    @keyframes hs-fadein { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }
    @keyframes hs-progress { from { width:100%; } to { width:0%; } }
    #comp-handswitch {
      display: none;
      position: fixed; inset: 0;
      background: #050e22;
      z-index: 9600;
      flex-direction: column;
      align-items: center; justify-content: center;
      gap: 20px; text-align: center;
      cursor: pointer; user-select: none;
    }
    #comp-handswitch.open { display: flex; animation: hs-fadein .18s ease; }
    #comp-handswitch .hs-title {
      font-family: "Cinzel", serif;
      font-size: 1rem; color: var(--muted);
      letter-spacing: 1px; text-transform: uppercase;
    }
    #comp-handswitch .hs-player {
      font-family: "Cinzel", serif;
      font-size: 2rem; font-weight: 900;
      letter-spacing: 2px;
    }
    #comp-handswitch .hs-player.p1 { color: var(--cyan); text-shadow: 0 0 30px rgba(34,216,248,.5); }
    #comp-handswitch .hs-player.p2 { color: var(--gold); text-shadow: 0 0 30px rgba(240,200,64,.5); }
    #comp-handswitch .hs-hand { font-size: 1.1rem; color: var(--muted); margin-top: -8px; }
    #comp-handswitch .hs-tap {
      margin-top: 12px;
      background: rgba(255,255,255,.06);
      border: 1px solid rgba(255,255,255,.15);
      border-radius: 50px; padding: 12px 32px;
      font-size: 1rem; font-weight: 700; color: var(--text);
      cursor: pointer;
    }
    #comp-handswitch .hs-shield {
      font-size: 3rem; margin-bottom: 4px;
    }
    #comp-hs-bar-wrap {
      width: 160px; height: 3px;
      background: rgba(255,255,255,.1);
      border-radius: 2px; overflow: hidden;
      margin-top: -10px;
    }
    #comp-hs-bar {
      height: 100%; background: var(--cyan);
      border-radius: 2px;
    }
    #comp-handswitch.open #comp-hs-bar {
      animation: hs-progress 2.2s linear forwards;
    }

    /* Leaderboard/history in comp overlay */
    .comp-lb-wrap {
      width: 100%; background: rgba(255,255,255,.68);
      border: 1.5px solid rgba(150,200,240,.4);
      border-radius: 14px; padding: 10px 14px; max-height: 280px; overflow-y: auto;
    }
    .comp-lb-row {
      display: flex; align-items: center; gap: 8px;
      padding: 7px 8px; border-bottom: 1px solid rgba(150,200,240,.3);
      font-size: 13px;
    }
    .comp-lb-row:last-child { border: none; }
    .comp-lb-rank { width: 22px; color: #8aaacc; font-weight: 800; text-align: right; flex-shrink: 0; }
    .comp-lb-name { flex: 1; font-weight: 700; color: #0c2858; text-align: left; }
    .comp-lb-wins { color: #1a70c8; font-weight: 800; width: 40px; text-align: center; }
    .comp-lb-losses { color: #8aaacc; width: 40px; text-align: center; }
    .comp-hist-row {
      background: rgba(255,255,255,.72); border: 1.5px solid rgba(150,200,240,.4);
      border-radius: 10px; padding: 10px 14px;
      font-size: 12px; color: #0c2858; text-align: left; width: 100%;
    }
    .comp-hist-winner { color: #c07800; font-weight: 800; }
    .comp-hist-action-btn {
      background: rgba(255,255,255,.65); border: 1.5px solid rgba(150,200,240,.5);
      color: #2a5888; border-radius: 10px; padding: 8px 16px; font-size: 13px;
      font-weight: 700; cursor: pointer; transition: background .15s;
    }
    .comp-hist-action-btn:hover { background: rgba(255,255,255,.9); }

    /* ── DEVICE SELECTION (first screen: Computer vs Mobile) ──────────
       Full-screen gate shown before anything else. The artwork is the
       whole background; two invisible click halves sit on top (left =
       computer, right = mobile) so the design is never altered. Highest
       possible z-index so it covers the loading screen, auth, and splash. */
    #cc-device-screen {
      position: fixed; inset: 0; z-index: 2147483000;
      background-color: #0a1d3a;
      background-image: url("/choose-device.png?v=1");
      background-size: contain;
      background-position: center;
      background-repeat: no-repeat;
      display: flex;
      overflow: hidden;
      touch-action: manipulation;
      -webkit-user-select: none; user-select: none;
    }
    #cc-device-screen.cc-device-hidden { display: none !important; }
    /* Two equal, full-height click/tap targets. Transparent by default so
       the painted COMPUTER / MOBILE buttons show through unchanged. */
    .cc-device-half {
      flex: 1 1 50%;
      width: 50%;
      height: 100%;
      min-width: 0;
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      display: block;
      cursor: pointer;
      background: transparent;
      border: none;
      outline: none;
      -webkit-appearance: none; appearance: none;
      font: inherit; color: inherit;
      -webkit-tap-highlight-color: transparent;
      transition: background-color .12s ease;
    }
    /* Gentle press/hover feedback only — keeps taps feeling responsive
       without covering or restyling the artwork. */
    @media (hover: hover) {
      .cc-device-half:hover { background-color: rgba(255,255,255,.06); }
    }
    .cc-device-half:active { background-color: rgba(255,255,255,.10); }
    .cc-device-half:focus-visible { background-color: rgba(255,255,255,.08); }

    /* ── TOUCH-FRIENDLY MOBILE CONTROLS ──────────────────────────────
       Activated by the Mobile device choice (body.cc-device-mobile). Two
       things happen: (1) tap-to-place stays delay-free and selection-free,
       (2) finger DRAGGING works — a touch-drag shim (see setupTouchDrag) turns
       finger gestures on cards into the same HTML5 drag/drop the game already
       handles. The layout/visual design is unchanged. Computer mode keeps the
       native mouse drag-and-drop and is unaffected by all of this. */
    body.cc-device-mobile { -webkit-text-size-adjust: 100%; }
    /* Draggable cards: a SINGLE finger drags the card cleanly (no page scroll
       mid-drag, tap/click still fires), while TWO fingers are reserved for the
       browser's pinch-zoom of the whole game. `pinch-zoom` (not `none`) is the
       key: it still blocks single-finger panning — so dragging never scroll-
       jitters — but it no longer swallows a two-finger pinch that happens to
       start on a card, so players can always pinch to zoom in/out. */
    body.cc-device-mobile [draggable="true"] {
      touch-action: pinch-zoom;
      -webkit-touch-callout: none;
      -webkit-user-select: none; user-select: none;
    }
    /* Non-draggable drop targets / zones: no long-press menu. (Draggable
       cards are handled by the [draggable] rule above so they always get
       touch-action:none — listing them here too would override that at equal
       specificity and let the page scroll-jitter when a drag begins.) */
    body.cc-device-mobile .pv-lane-slot,
    body.cc-device-mobile .pv-ocean-hub,
    body.cc-device-mobile #pv-pool-area,
    body.cc-device-mobile #pv-hand-zone {
      touch-action: manipulation;
      -webkit-touch-callout: none;
    }
    /* The floating card that follows the finger while dragging. */
    .cc-touch-ghost {
      pointer-events: none !important;
      border-radius: 8px;
      will-change: transform;
    }

    /* ── AUTH / LOGIN SYSTEM ───────────────────────────────── */
    #auth-loading-screen {
      position: fixed; inset: 0; z-index: 9200;
      background: #3ed6f2;
      display: flex; align-items: center; justify-content: center;
      color: rgba(16,53,86,.78); font-size: 14px; font-family: "Baloo 2", "Nunito", sans-serif; letter-spacing: .5px;
    }
    #auth-loading-screen.hidden { display: none; }

    /* ══ Game-window full-screen launch splash (Steam-style) ════════
       Shown ONLY in the separate game window. The big Play button is the
       user gesture the browser requires to enter true (chrome-less)
       full screen, so launching feels like opening a desktop game. */
    #cc-fs-splash {
      display: none; position: fixed; inset: 0; z-index: 100000;
      /* Ocean tone matching the artwork's edges (bright up top → deep blue
         below) so any letterbox bars around the square splash blend in. */
      background: linear-gradient(180deg, #02a6fb 0%, #0072e8 46%, #0030a3 100%);
      align-items: center; justify-content: center; text-align: center;
      font-family: "Nunito", sans-serif; color: #f5ede0;
    }
    #cc-fs-splash.show { display: flex; animation: dwm-fade-in .2s ease; }
    /* Square stage locked to the baked art's 1:1 ratio (fullscreen-splash.png
       is 1254×1254) and centered, so the invisible Play overlay always lines
       up with the painted button no matter the window's shape. */
    .ccfs-stage {
      position: relative;
      width: min(100vw, 100vh);
      height: min(100vw, 100vh);
      aspect-ratio: 1 / 1;
      overflow: hidden;
    }
    .ccfs-bg {
      position: absolute; inset: 0; width: 100%; height: 100%;
      object-fit: contain; display: block;
      user-select: none; -webkit-user-drag: none; pointer-events: none;
    }
    /* Invisible click target sitting exactly over the painted
       "▶ Play Full Screen" button in the artwork. */
    .ccfs-play {
      position: absolute; left: 30.5%; top: 60%; width: 39%; height: 11%;
      background: transparent; border: 0; padding: 0; margin: 0;
      border-radius: 16px; cursor: pointer;
      -webkit-tap-highlight-color: rgba(255,255,255,.18);
      transition: filter .12s ease, transform .12s ease;
    }
    @media (hover: hover) { .ccfs-play:hover { filter: brightness(1.05); } }
    .ccfs-play:active { transform: translateY(1px); }
    .ccfs-play:focus-visible { outline: 3px solid rgba(255,255,255,.85); outline-offset: -4px; border-radius: 18px; }
    /* Status + fallback link — hidden until the browser blocks full screen
       (#cc-fs-splash.ccfs-blocked), keeping the splash true to the artwork. */
    .ccfs-foot {
      position: absolute; left: 0; right: 0; bottom: 4%;
      display: flex; flex-direction: column; align-items: center; gap: 7px;
      padding: 0 18px;
    }
    .ccfs-window {
      display: none; cursor: pointer;
      background: rgba(4,28,60,.55); border: 1px solid rgba(159,192,224,.4);
      color: #d8e8fb; font-size: 13px; font-weight: 800; border-radius: 999px; padding: 8px 18px;
      -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    }
    #cc-fs-splash.ccfs-blocked .ccfs-window { display: inline-block; }
    .ccfs-window:hover { color: #ffffff; border-color: rgba(216,232,251,.7); }

    /* Slim "return to full screen" pill — nudges the player back to full
       screen if they drop out (Esc / browser), so the game stays full screen. */
    #cc-fs-resume {
      display: none; position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
      z-index: 100000; cursor: pointer;
      font-family: "Nunito", sans-serif; font-size: 13px; font-weight: 800; letter-spacing: .3px;
      color: #1a1208; background: linear-gradient(180deg, #f6c178 0%, #e8a052 100%);
      border: 1.5px solid rgba(244,165,116,.6); border-radius: 18px; padding: 8px 18px;
      box-shadow: 0 4px 16px rgba(0,0,0,.45); animation: dwm-fade-in .2s ease;
    }
    #cc-fs-resume.show { display: block; }
    #cc-fs-resume:hover { filter: brightness(1.06); }

    #auth-screen {
      position: fixed; inset: 0; z-index: 9000;
      background: #0a1d3a;
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      padding: 0;
      gap: 0;
      overflow: hidden;
      isolation: isolate;
    }
    #auth-screen.hidden { display: none; }
    #auth-screen .auth-logo { display: none !important; }

    /* ── AUTH SIDE STRIPS ───────────────────────────────────────── */
    .auth-side-strip {
      display: none;
      position: absolute;
      top: 0;
      bottom: 0;
      width: calc((100vw - 420px) / 2);
      max-width: 380px;
      overflow: hidden;
      pointer-events: none;
      z-index: 0;
    }
    .auth-side-strip-left  { left: 0; }
    .auth-side-strip-right { right: 0; }
    .auth-side-strip .strip-track {
      position: absolute;
      top: 0; left: 0;
      width: 100%;
      display: flex;
      flex-direction: column;
      will-change: transform;
    }
    .auth-side-strip .strip-track img {
      width: 100%;
      display: block;
      user-select: none;
      -webkit-user-drag: none;
    }
    .auth-side-strip-left  .strip-track { animation: authStripDown 45s linear infinite; }
    .auth-side-strip-right .strip-track { animation: authStripUp   45s linear infinite; }
    @keyframes authStripDown {
      0%   { transform: translate3d(0, -50%, 0); }
      100% { transform: translate3d(0, 0,     0); }
    }
    @keyframes authStripUp {
      0%   { transform: translate3d(0, 0,     0); }
      100% { transform: translate3d(0, -50%, 0); }
    }
    /* Keep the centered auth content above the strips */
    #auth-screen > .auth-box,
    #auth-screen > #auth-step-choose { position: relative; z-index: 2; }

    .auth-box {
      background: rgba(11,36,72,.9); border: 1px solid rgba(58,120,204,.45);
      border-radius: 14px; padding: 22px 20px;
      width: 100%; max-width: 360px;
      display: flex; flex-direction: column; gap: 11px;
      box-shadow: 0 8px 32px rgba(0,0,0,.45);
    }
    .auth-title {
      font-family: 'Cinzel', serif; color: var(--cyan);
      font-size: 17px; text-align: center;
    }
    .auth-subtitle { color: var(--muted); font-size: 12px; text-align: center; line-height: 1.55; }
    .auth-avatar-label {
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: .7px;
      text-transform: uppercase;
      margin-top: 4px;
    }
    .auth-avatar-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 8px;
    }
    .auth-avatar-option {
      position: relative;
      border: 1px solid rgba(58,120,204,.35);
      border-radius: 10px;
      background: rgba(255,255,255,.06);
      width: 100%;
      aspect-ratio: 1 / 1;
      padding: 3px;
      cursor: pointer;
      transition: border-color .14s, transform .14s, box-shadow .14s;
    }
    .auth-avatar-option img {
      width: 100%;
      height: 100%;
      border-radius: 8px;
      object-fit: cover;
      display: block;
    }
    .auth-avatar-option:hover {
      border-color: rgba(34,216,248,.55);
      transform: translateY(-1px);
    }
    .auth-avatar-option.active {
      border-color: rgba(34,216,248,.95);
      box-shadow: 0 0 0 2px rgba(34,216,248,.3);
      background: rgba(34,216,248,.16);
    }
    .auth-avatar-option.active::after {
      content: "✓";
      position: absolute;
      top: 4px;
      right: 4px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: #2f7ee0;
      color: #fff;
      font-size: 12px;
      font-weight: 800;
      line-height: 18px;
      text-align: center;
      box-shadow: 0 1px 6px rgba(18,58,116,.35);
      pointer-events: none;
    }

    /* ── Animal avatar selection cards ──────────────────────────── */
    .auth-avatar-grid.animal-grid {
      grid-template-columns: 1fr;
      gap: 8px;
      max-height: 58vh;
      overflow-y: auto;
      padding-right: 4px;
    }
    .animal-card {
      display: flex; gap: 10px; align-items: center;
      text-align: left; width: 100%;
      border: 1px solid rgba(58,120,204,.35);
      border-radius: 12px;
      background: rgba(10,30,60,.5);
      padding: 8px 10px;
      cursor: pointer; color: inherit; font: inherit;
      transition: border-color .14s, background .14s, transform .14s;
    }
    .animal-card:hover:not(.locked) { border-color: rgba(34,216,248,.6); transform: translateY(-1px); }
    .animal-card.active { border-color: rgba(34,216,248,.95); box-shadow: 0 0 0 2px rgba(34,216,248,.3); background: rgba(34,216,248,.12); }
    .animal-card.locked { cursor: default; background: rgba(8,20,40,.55); }
    .animal-card-thumb {
      position: relative; flex: 0 0 auto;
      width: 58px; height: 58px; border-radius: 50%;
      background: radial-gradient(circle at 50% 45%, rgba(40,90,150,.5), rgba(8,22,45,.7));
      display: flex; align-items: center; justify-content: center; overflow: hidden;
    }
    .animal-card-thumb img { width: 90%; height: 90%; object-fit: contain; display: block; }
    .animal-card.locked .animal-card-thumb img { filter: grayscale(1) brightness(.5); }
    .animal-card-lock {
      position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
      font-size: 20px; background: rgba(4,12,28,.4);
    }
    .animal-card-body { flex: 1 1 auto; min-width: 0; }
    .animal-card-name { font-weight: 800; color: #d7ecff; font-size: .95rem; margin-bottom: 2px; }
    .animal-card.locked .animal-card-name { color: #9fb6d4; }
    .animal-card-facts { font-size: .76rem; color: rgba(190,215,245,.8); line-height: 1.35; }
    .animal-card-req { font-size: .78rem; color: #f0c840; line-height: 1.3; }
    .animal-card-prog { font-size: .72rem; color: rgba(170,200,235,.75); margin-top: 2px; }
    .animal-card-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); margin-top: 4px; overflow: hidden; }
    .animal-card-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg,#22d8f8,#2f7ee0); }

    /* ── Click-to-place card picker ─────────────────────────────── */
    #ctp-backdrop {
      display: none; position: fixed; inset: 0; z-index: 4990;
      background: rgba(0,0,0,.42);
    }
    #ctp-backdrop.open { display: block; }
    #ctp-panel {
      display: none; position: fixed; bottom: 0;
      left: 50%; transform: translateX(-50%);
      z-index: 4991;
      background: rgba(8,22,58,.97);
      border: 1px solid rgba(58,120,204,.55); border-bottom: none;
      border-radius: 14px 14px 0 0;
      width: min(96vw, 960px); padding: 16px 18px 26px;
      box-shadow: 0 -6px 36px rgba(0,0,0,.65);
      max-height: 62vh; overflow-y: auto;
    }
    #ctp-panel.open { display: block; }
    .ctp-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 14px; padding-bottom: 10px;
      border-bottom: 1px solid rgba(58,120,204,.25);
    }
    #ctp-title {
      font-family: 'Cinzel', serif; color: var(--cyan);
      font-size: 16px; font-weight: 700;
    }
    .ctp-cancel-btn {
      background: transparent; border: 1px solid rgba(255,255,255,.2);
      color: rgba(200,225,255,.7); border-radius: 6px; padding: 5px 14px;
      font-size: 13px; cursor: pointer;
    }
    .ctp-cancel-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
    #ctp-cards {
      display: flex; flex-wrap: wrap; gap: 14px;
    }
    .ctp-card-item {
      position: relative; width: 140px; flex: 0 0 140px;
      cursor: pointer;
      border: 2px solid rgba(58,120,204,.4); border-radius: 11px;
      overflow: hidden; background: rgba(10,22,54,.7);
      transition: border-color .12s, transform .12s, box-shadow .12s;
    }
    .ctp-card-item:hover {
      border-color: rgba(34,216,248,.9);
      transform: translateY(-5px);
      box-shadow: 0 10px 26px rgba(0,0,0,.6);
    }
    .ctp-card-item img {
      width: 100%; display: block; height: 185px; object-fit: cover;
    }
    .ctp-card-label {
      padding: 6px 5px 5px; font-size: 12px; color: #b8d8f8;
      text-align: center; line-height: 1.3; word-break: break-word;
    }
    .ctp-card-cost {
      position: absolute; top: 5px; right: 5px;
      background: rgba(8,24,64,.88); color: var(--gold);
      font-size: 13px; font-weight: 800;
      border-radius: 5px; padding: 2px 7px;
      border: 1px solid rgba(240,184,64,.45);
    }
    .ctp-card-star {
      position: absolute; top: 5px; left: 5px;
      font-size: 14px; color: var(--gold); text-shadow: 0 0 6px rgba(240,184,64,.8);
    }
    .ctp-empty {
      color: rgba(170,200,240,.6); font-size: 14px;
      text-align: center; padding: 22px 0;
    }
    /* Glow on board slot while CTP picker is open */
    .ctp-slot-active {
      animation: ctp-pulse 1.1s ease-in-out infinite !important;
      border-color: var(--cyan) !important;
      box-shadow: 0 0 0 2px rgba(34,216,248,.4), 0 0 16px rgba(34,216,248,.35) !important;
    }
    @keyframes ctp-pulse {
      0%,100% { box-shadow: 0 0 0 2px rgba(34,216,248,.4), 0 0 16px rgba(34,216,248,.35); }
      50%      { box-shadow: 0 0 0 3px rgba(34,216,248,.65), 0 0 26px rgba(34,216,248,.55); }
    }

    /* ── Post-game animal unlock screen ─────────────────────────── */
    #animal-unlock-overlay {
      position: fixed; inset: 0; z-index: 9500; display: none;
      align-items: center; justify-content: center; padding: 24px;
      background: rgba(2,10,24,.93); overflow: hidden;
    }
    #animal-unlock-overlay.open { display: flex; }
    .au-wave {
      position: absolute; left: -10%; right: -10%; height: 280px;
      background: radial-gradient(ellipse at 50% 0%, rgba(34,216,248,.30), transparent 70%);
      pointer-events: none; animation: au-wave-sweep 2.8s ease-in-out infinite;
    }
    .au-wave.w2 { animation-delay: 1.4s; opacity: .7; }
    @keyframes au-wave-sweep {
      0%   { transform: translateY(-300px); opacity: 0; }
      35%  { opacity: 1; }
      100% { transform: translateY(115vh); opacity: 0; }
    }
    .au-card {
      position: relative; z-index: 2; text-align: center;
      max-width: 390px; width: 100%;
      display: flex; flex-direction: column; align-items: center; gap: 10px;
      animation: au-pop .55s cubic-bezier(.2,.9,.3,1.3);
    }
    @keyframes au-pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
    .au-eyebrow { color: #22d8f8; letter-spacing: .18em; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
    .au-animal-wrap { position: relative; width: 210px; height: 210px; display: flex; align-items: center; justify-content: center; }
    .au-glow {
      position: absolute; inset: -6%; border-radius: 50%;
      background: radial-gradient(circle, rgba(34,216,248,.55), rgba(47,126,224,.22) 45%, transparent 70%);
      filter: blur(6px); animation: au-glow-pulse 2.2s ease-in-out infinite;
    }
    @keyframes au-glow-pulse { 0%,100% { transform: scale(.9); opacity: .8; } 50% { transform: scale(1.1); opacity: 1; } }
    .au-animal-wrap img {
      position: relative; z-index: 2; width: 80%; height: 80%; object-fit: contain;
      filter: drop-shadow(0 10px 24px rgba(0,0,0,.5)); animation: au-float 3s ease-in-out infinite;
    }
    @keyframes au-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
    .au-name { font-family: 'Cinzel', serif; font-size: 1.5rem; font-weight: 800; color: #fff; }
    .au-species { font-size: .7rem; color: rgba(170,200,235,.7); text-transform: uppercase; letter-spacing: .12em; margin-top: -4px; }
    .au-facts { font-size: .85rem; color: rgba(200,225,255,.85); line-height: 1.5; }
    .au-q { font-size: .95rem; color: #fff; font-weight: 700; margin-top: 6px; }
    .au-btn-row { display: flex; gap: 12px; width: 100%; margin-top: 4px; }
    .au-btn-row .pv-btn { flex: 1; }

    .auth-err { color: var(--red); font-size: 12px; text-align: center; min-height: 16px; }
    .auth-ok  { color: var(--green); font-size: 12px; text-align: center; min-height: 16px; }
    .auth-link {
      color: var(--cyan); cursor: pointer; font-size: 12px; text-align: center;
    }
    .auth-link:hover { text-decoration: underline; }
    .auth-row-links { display: flex; justify-content: space-between; align-items: center; }
    /* ── LAUNCH STEP (game-window redirect) ─────────────────────── */
    #auth-step-launch { gap: 15px; align-items: center; text-align: center; }
    .auth-launch-logo { width: 88px; height: 88px; object-fit: contain; display: block; margin: 0 auto 4px; filter: drop-shadow(0 3px 12px rgba(0,0,0,.4)); }
    #auth-launch-avatar-wrap {
      width: 72px; height: 72px; border-radius: 50%;
      background: rgba(95,179,214,.15);
      border: 2px solid rgba(95,179,214,.4);
      display: flex; align-items: center; justify-content: center;
      overflow: hidden; flex-shrink: 0;
    }
    #auth-launch-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
    #auth-launch-initials { font-family: "Cinzel", serif; font-size: 26px; font-weight: 700; color: #5fb3d6; }
    #auth-launch-greeting { font-family: "Cinzel", serif; font-size: 15px; color: var(--cyan); line-height: 1.3; }
    #auth-launch-sub { font-size: 12px; color: var(--muted); line-height: 1.5; }
    #auth-launch-play-btn { font-size: 16px; padding: 14px 28px; letter-spacing: .4px; }
    #auth-launch-play-btn:disabled { opacity: .7; }
    #auth-launch-secondary-btn { font-size: 14px; padding: 11px 22px; letter-spacing: .3px; }
    .auth-launch-links { display: flex; flex-direction: column; gap: 6px; align-items: center; }
    .auth-divider {
      color: var(--muted); font-size: 11px; text-align: center;
      display: flex; align-items: center; gap: 8px;
    }
    .auth-divider::before, .auth-divider::after {
      content: ""; flex: 1; height: 1px; background: rgba(58,120,204,.35);
    }
    .auth-btn-google {
      display: flex; align-items: center; justify-content: center; gap: 10px;
      padding: 10px 16px; border-radius: 8px; border: 1px solid rgba(58,120,204,.5);
      background: rgba(255,255,255,.07); color: var(--text);
      font-size: 13px; font-weight: 700; cursor: pointer; width: 100%;
      transition: background .15s;
    }
    .auth-btn-google:hover { background: rgba(255,255,255,.14); }
    #auth-step-choose.auth-box {
      position: relative;
      width: min(100vw, calc(100vh * 1672 / 941));
      height: min(100vh, calc(100vw * 941 / 1672));
      max-width: none;
      min-height: 0;
      padding: 0 !important;
      border-radius: 0 !important;
      border: 0 !important;
      background: transparent !important;
      box-shadow: none !important;
      gap: 0 !important;
      backdrop-filter: none !important;
      display: block;
      overflow: visible;
    }
    #auth-step-choose .auth-step-choose-img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
      display: block;
      user-select: none;
      -webkit-user-drag: none;
      pointer-events: none;
    }
    #auth-step-choose .auth-title,
    #auth-step-choose .auth-subtitle,
    #auth-step-choose .auth-divider {
      display: none !important;
    }
    #auth-step-choose .pv-btn,
    #auth-step-choose .auth-btn-google {
      position: absolute;
      left: 36.90%;
      width: 26.08%;
      height: 8.18%;
      background: transparent !important;
      color: transparent !important;
      border: 0 !important;
      box-shadow: none !important;
      padding: 0 !important;
      margin: 0 !important;
      font-size: 0 !important;
      min-height: 0 !important;
      border-radius: 14px;
      cursor: pointer;
      -webkit-tap-highlight-color: rgba(255,255,255,.15);
      z-index: 2;
    }
    #auth-step-choose .pv-btn:focus-visible,
    #auth-step-choose .auth-btn-google:focus-visible {
      outline: 2px solid rgba(255,255,255,.75);
      outline-offset: -3px;
    }
    #auth-step-choose .pv-btn:active,
    #auth-step-choose .auth-btn-google:active {
      transform: translateY(1px);
    }
    #auth-step-choose #auth-guest-btn        { top: 51.22%; }
    #auth-step-choose #auth-choose-google-btn { top: 61.74%; }
    #auth-step-choose #auth-choose-google-btn svg { display: none; }
    #auth-step-choose .auth-err {
      position: absolute;
      left: 36.90%;
      top: 72%;
      width: 26.08%;
      text-align: center;
      min-height: 18px;
      font-size: .82rem;
      color: #9a2d37;
      font-weight: 700;
      font-family: "Baloo 2", "Nunito", sans-serif;
      z-index: 3;
      text-shadow: 0 1px 2px rgba(255,255,255,.6);
    }
    /* ── Guest overlay — rendered inside the octagon on the login image ── */
    #auth-guest-overlay {
      display: none;
      position: absolute;
      left: 33%;
      top: 41%;
      width: 34%;
      bottom: 27%;
      z-index: 5;
      background: rgba(6, 20, 56, 0.90);
      border: 1px solid rgba(90, 170, 235, 0.45);
      border-radius: 12px;
      padding: 4% 4% 3%;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: clamp(4px, 0.9vh, 10px);
      box-shadow: 0 4px 28px rgba(0, 0, 0, 0.6);
      overflow: hidden;
    }
    #auth-guest-overlay.visible { display: flex; }
    #auth-guest-overlay .ago-title {
      font-family: 'Cinzel', serif;
      color: #9ad4f5;
      font-size: clamp(10px, 1.5vw, 16px);
      text-align: center;
      font-weight: 700;
      line-height: 1.2;
    }
    #auth-guest-overlay .ago-sub {
      color: #7ab8d8;
      font-size: clamp(8px, 0.95vw, 11px);
      text-align: center;
      line-height: 1.4;
    }
    #auth-guest-overlay .pv-input {
      background: rgba(10, 38, 95, 0.70) !important;
      border-color: rgba(100, 180, 240, 0.5) !important;
      color: #d6eeff !important;
      font-size: clamp(9px, 1.1vw, 13px) !important;
      padding: clamp(4px, 0.7vh, 8px) clamp(6px, 1vw, 10px) !important;
      width: 100%;
      box-sizing: border-box;
    }
    #auth-guest-overlay .pv-input::placeholder { color: #4e88b0; }
    #auth-guest-overlay .pv-btn.gold {
      font-size: clamp(9px, 1.1vw, 13px) !important;
      padding: clamp(4px, 0.7vh, 9px) 0 !important;
      min-height: 0 !important;
      width: 100%;
    }
    #auth-guest-overlay .auth-err {
      font-size: clamp(8px, 0.9vw, 11px);
      min-height: 0;
      text-align: center;
      color: #e07070;
    }
    #auth-guest-overlay .auth-link {
      color: #7ec8e8;
      font-size: clamp(8px, 0.9vw, 11px);
      cursor: pointer;
      text-align: center;
    }
    #auth-guest-overlay .auth-link:hover { text-decoration: underline; }

    /* Profile bar inside lobby */
    #auth-profile-bar {
      width: 100%; max-width: 420px;
      background: rgba(11,36,72,.7); border: 1px solid rgba(58,120,204,.35);
      border-radius: 10px; padding: 7px 12px;
      display: none; flex-direction: row; align-items: center;
      gap: 8px; font-size: 12px; flex-wrap: wrap;
    }
    #auth-profile-bar .auth-pnick { color: var(--cyan); font-weight: 800; }
    #auth-profile-bar .auth-pfc   { color: var(--muted); font-size: 11px; }
    #auth-profile-bar .auth-pbtn  {
      font-size: 11px; padding: 3px 8px; margin-left: auto;
      background: rgba(255,255,255,.06); border: 1px solid rgba(58,120,204,.35);
      color: var(--text); border-radius: 6px; cursor: pointer;
    }
    #auth-profile-bar .auth-pbtn:hover { background: rgba(255,255,255,.13); }

    /* ── PLAYER STATS LOBBY ───────────────────────────────────── */
    /* ══ PLAYER HOME MENU ══════════════════════════════════════════ */
    /* ── PLAYER HOME (ph-*) ─────────────────────────────────────── */
    #auth-stats-lobby {
      position: fixed;
      inset: 0;
      z-index: 8900;
      display: none;
      flex-direction: column;
      align-items: center;
      overflow-y: auto;
      font-family: "Nunito", sans-serif;
      color: #17365a;
      isolation: isolate;
      background:
        radial-gradient(circle at 15% 10%, rgba(255,255,255,.6) 0%, rgba(255,255,255,0) 45%),
        radial-gradient(circle at 80% 20%, rgba(191,226,255,.55) 0%, rgba(191,226,255,0) 48%),
        linear-gradient(180deg, #b7e9fb 0%, #d4f2ff 42%, #c2e9ff 100%);
    }
    #auth-stats-lobby.visible { display: flex; }
    #auth-stats-lobby::before {
      content: "";
      position: fixed;
      inset: -36px;
      z-index: 0;
      background: url("/player-home-reference.jpg") center top / cover no-repeat;
      filter: blur(26px) saturate(1.05);
      transform: scale(1.04);
      opacity: .22;
      pointer-events: none;
    }
    #auth-stats-lobby::after {
      content: "";
      position: fixed;
      inset: 0;
      z-index: 0;
      background: linear-gradient(180deg, rgba(245,252,255,.54) 0%, rgba(220,244,255,.42) 100%);
      pointer-events: none;
    }
    .ph-coral {
      position: fixed;
      bottom: 0;
      height: min(78vh, 700px);
      width: clamp(150px, 16vw, 230px);
      pointer-events: none;
      z-index: 1;
      opacity: .78;
      filter: saturate(1.05);
    }
    .ph-coral-left { left: 0; }
    .ph-coral-right { right: 0; transform: scaleX(-1); }
    .ph-topbar {
      position: sticky;
      top: 0;
      z-index: 20;
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 22px 18px 12px;
      backdrop-filter: blur(2px);
    }
    .ph-icon-btn {
      width: 50px;
      height: 50px;
      border-radius: 14px;
      border: 1px solid rgba(108,158,210,.34);
      background: rgba(247,253,255,.9);
      color: #1b3f66;
      box-shadow: 0 4px 18px rgba(26,90,180,.12);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: transform .14s, box-shadow .14s, border-color .14s;
      flex-shrink: 0;
    }
    .ph-icon-btn:hover {
      transform: translateY(-1px);
      border-color: rgba(62,126,197,.45);
      box-shadow: 0 8px 20px rgba(26,90,180,.16);
    }
    .ph-topbar-title {
      font-family: "Cinzel", serif;
      font-size: clamp(1.5rem, 4vw, 3.05rem);
      font-weight: 900;
      color: #1a4ca2;
      letter-spacing: 2px;
      text-align: center;
      text-shadow: 0 1px 0 rgba(255,255,255,.75);
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ph-topbar-title::before,
    .ph-topbar-title::after {
      content: "≈";
      color: #2ba6e8;
      font-size: .74em;
      margin: 0 10px;
      opacity: .95;
    }
    .ph-bell-wrap { position: relative; }
    .ph-notif-dot {
      position: absolute;
      top: 4px;
      right: 6px;
      width: 11px;
      height: 11px;
      border-radius: 50%;
      background: #ff4b5d;
      border: 2px solid #f7fdff;
      display: none;
      animation: notif-pulse 1.8s ease-in-out infinite;
    }
    .ph-notif-dot.show { display: block; }
    @keyframes notif-pulse {
      0%,100% { box-shadow: 0 0 0 0 rgba(255,75,93,.5); }
      50%      { box-shadow: 0 0 0 5px rgba(255,75,93,0); }
    }
    #ph-bell-btn.notif-active { filter: drop-shadow(0 0 6px rgba(255,75,93,.7)); }
    .ph-wrap {
      width: 100%;
      max-width: 1500px;
      padding: 4px 22px 22px;
      position: relative;
      z-index: 3;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .ph-profile-card {
      background: rgba(252,255,255,.95);
      border: 1px solid rgba(168,203,232,.7);
      border-radius: 26px;
      box-shadow: 0 9px 30px rgba(28,90,150,.11);
      padding: 20px 22px;
      display: grid;
      grid-template-columns: auto minmax(180px, 1fr) auto auto auto;
      align-items: center;
      gap: 18px;
    }
    .ph-avatar {
      position: relative;
      width: 114px;
      height: 114px;
      border-radius: 50%;
      overflow: hidden;
      flex-shrink: 0;
      background: linear-gradient(145deg, #1f66bc 0%, #3ec0ee 100%);
      border: 4px solid rgba(255,255,255,.96);
      box-shadow: 0 0 0 2px rgba(35,121,206,.7), 0 7px 20px rgba(25,92,167,.25);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .ph-avatar.ph-avatar-clickable { cursor: pointer; }
    .ph-avatar.ph-avatar-clickable:hover {
      box-shadow: 0 0 0 2px rgba(35,121,206,.8), 0 10px 22px rgba(25,92,167,.3);
    }
    .ph-avatar.ph-avatar-clickable:focus-visible {
      outline: 3px solid rgba(34,216,248,.72);
      outline-offset: 2px;
    }
    .ph-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
    }
    .ph-avatar.has-image img { display: block; }
    .ph-avatar.has-image #stats-avatar-letter { display: none; }
    #stats-avatar-letter {
      font-family: "Cinzel", serif;
      font-size: 38px;
      font-weight: 900;
      color: #f3fbff;
      text-shadow: 0 2px 7px rgba(0,0,0,.22);
      line-height: 1;
    }
    .ph-pinfo { min-width: 0; }
    .ph-pname-row {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      flex-wrap: wrap;
    }
    .ph-pname {
      font-size: clamp(1.5rem, 2.7vw, 3rem);
      font-weight: 900;
      color: #102f67;
      line-height: 1.1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ph-verified { flex-shrink: 0; }
    .ph-name-meta {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-left: auto;
      min-width: 0;
      white-space: nowrap;
    }
    .ph-name-chip {
      display: inline-flex;
      align-items: center;
      padding: 4px 9px;
      border-radius: 999px;
      border: 1px solid rgba(110,151,190,.45);
      background: rgba(247,252,255,.92);
      color: #4a6888;
      font-size: .78rem;
      font-weight: 800;
      letter-spacing: .01em;
      line-height: 1;
    }
    .ph-name-chip.level {
      color: #1e63b8;
      border-color: rgba(74,139,212,.42);
      background: rgba(234,245,255,.95);
    }
    .ph-name-chip.active {
      color: #567494;
    }
    /* ── Alpha version square (own column, between the player name and the Level badge) ── */
    .ph-alpha-banner {
      align-self: stretch;
      width: 158px;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      gap: 8px;
      padding: 14px 12px;
      border-radius: 18px;
      border: 1px solid rgba(74,139,212,.32);
      background: linear-gradient(160deg, rgba(234,245,255,.96) 0%, rgba(214,236,255,.96) 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 10px rgba(28,90,150,.1);
    }
    .ph-alpha-banner.update-available {
      border-color: rgba(225,150,30,.55);
      background: linear-gradient(160deg, rgba(255,247,228,.97) 0%, rgba(255,235,200,.97) 100%);
      animation: phAlphaPulse 1.8s ease-in-out infinite;
    }
    @keyframes phAlphaPulse {
      0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 10px rgba(225,150,30,.2); }
      50%      { box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 20px rgba(225,150,30,.46); }
    }
    .ph-alpha-tag {
      display: inline-flex;
      align-items: center;
      padding: 5px 12px;
      border-radius: 999px;
      background: linear-gradient(135deg, #2d8be0 0%, #1e63b8 100%);
      color: #fff;
      font-size: .76rem;
      font-weight: 900;
      letter-spacing: .06em;
      text-transform: uppercase;
      box-shadow: 0 1px 4px rgba(30,99,184,.4);
    }
    .ph-alpha-banner.update-available .ph-alpha-tag {
      background: linear-gradient(135deg, #f0a020 0%, #d4800e 100%);
      box-shadow: 0 1px 4px rgba(212,128,14,.45);
    }
    .ph-alpha-msg {
      font-size: .8rem;
      font-weight: 700;
      color: #2b5f9e;
      line-height: 1.3;
    }
    .ph-alpha-banner.update-available .ph-alpha-msg { color: #9a5a05; }
    .ph-alpha-whatsnew, .ph-alpha-refresh {
      border: none;
      cursor: pointer;
      font-weight: 800;
      border-radius: 999px;
      padding: 6px 14px;
      font-size: .8rem;
      transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
    }
    .ph-alpha-whatsnew {
      background: rgba(255,255,255,.9);
      border: 1px solid rgba(74,139,212,.4);
      color: #1e63b8;
    }
    .ph-alpha-whatsnew:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(30,99,184,.22); background: #fff; }
    .ph-alpha-refresh {
      background: linear-gradient(135deg, #f0a020 0%, #d4800e 100%);
      color: #fff;
      box-shadow: 0 2px 6px rgba(212,128,14,.35);
    }
    .ph-alpha-refresh:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212,128,14,.5); }
    .ph-pfc {
      font-size: 1.12rem;
      color: #2b6ec3;
      font-weight: 700;
      margin-top: 6px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ph-pranks {
      display: grid;
      grid-template-columns: minmax(170px, 1fr) minmax(210px, 1.25fr);
      gap: 0;
      border: 1px solid #c5dbef;
      border-radius: 14px;
      overflow: hidden;
      min-height: 84px;
      max-width: 470px;
      width: 100%;
      background: #fafdff;
    }
    /* Competitive rank: allow the full name to wrap instead of clipping */
    .ph-rank-badge.ph-rank-comp .ph-rank-val {
      white-space: normal;
      line-height: 1.2;
      font-size: .96rem;
    }
    .ph-rank-badge {
      padding: 12px 16px;
      text-align: left;
      border-right: 1px solid #d8e7f4;
      border-left: none;
      border-top: none;
      border-bottom: none;
      border-radius: 0;
      min-width: 0;
      background: transparent;
    }
    .ph-rank-badge:last-child { border-right: none; }
    .ph-rank-badge.ph-rank-normal { color: #145fb4; }
    .ph-rank-badge.ph-rank-comp {
      color: #a16f04;
      text-align: center;
    }
    .ph-rank-type {
      font-size: .95rem;
      font-weight: 800;
      display: flex;
      align-items: center;
      gap: 6px;
      justify-content: flex-start;
      color: inherit;
      opacity: 1;
    }
    .ph-rank-badge.ph-rank-comp .ph-rank-type {
      justify-content: center;
    }
    .ph-rank-badge.ph-rank-comp .ph-rank-val {
      text-align: center;
    }
    .ph-rank-val {
      margin-top: 3px;
      font-size: 1.02rem;
      font-weight: 800;
      color: #2b486f;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    #stats-lobby-signed-actions {
      display: flex !important;
      gap: 8px;
      align-items: center;
      justify-content: flex-end;
      flex-wrap: wrap;
    }
    .ph-signout-btn {
      height: 46px;
      border: 1px solid #b9d0e3;
      border-radius: 12px;
      padding: 0 17px;
      font-size: .98rem;
      font-weight: 700;
      color: #3e6c9f;
      background: #f9fdff;
      cursor: pointer;
      transition: background .14s, border-color .14s, transform .14s;
      font-family: "Nunito", sans-serif;
      white-space: nowrap;
      display: inline-flex;
      align-items: center;
      gap: 7px;
    }
    .ph-signout-btn:hover {
      background: #fff;
      border-color: #82b1d6;
      transform: translateY(-1px);
    }
    .ph-guest-notice {
      background: rgba(253,246,229,.92);
      border: 1px solid rgba(211,178,88,.45);
      border-radius: 12px;
      padding: 10px 14px;
      font-size: 13px;
      color: #906715;
      line-height: 1.55;
    }
    .ph-tabs {
      display: grid;
      grid-template-columns: repeat(7, minmax(0, 1fr));
      background: rgba(252,255,255,.94);
      border-radius: 18px;
      box-shadow: 0 6px 22px rgba(35,100,165,.11);
      border: 1px solid rgba(169,203,230,.74);
      overflow: hidden;
    }
    .ph-tab {
      border: none;
      border-right: 1px solid #deebf7;
      background: transparent;
      color: #4d6587;
      font-family: "Nunito", sans-serif;
      font-size: clamp(.78rem, 1.0vw, 1.12rem);
      font-weight: 700;
      padding: 12px 5px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      cursor: pointer;
      border-bottom: 3px solid transparent;
      transition: color .14s, background .14s, border-bottom-color .14s;
    }
    .ph-tab:last-child { border-right: none; }
    .ph-tab:hover { color: #1f65be; background: rgba(60,131,212,.06); }
    .ph-tab.active {
      color: #1f65be;
      border-bottom-color: #2f7ee0;
      background: #fff;
    }
    /* ── Leaderboard panel elements ──────────────────────────────── */
    .ph-lb-mode-row {
      display: flex; gap: 6px; padding: 12px 16px 10px;
      border-bottom: 1px solid #e8f0f8; flex-wrap: wrap;
    }
    .ph-lb-mode-btn {
      padding: 7px 18px; border-radius: 999px; font-size: 12px; font-weight: 800;
      border: 1.5px solid rgba(169,203,230,.8); background: #f5faff; color: #4d6587;
      cursor: pointer; font-family: "Nunito", sans-serif; transition: all .12s ease;
    }
    .ph-lb-mode-btn.active { background: linear-gradient(180deg,#2e8fe0 0%,#1c70cc 100%); color: #fff; border-color: #1c70cc; }
    .ph-lb-size-row {
      display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
      padding: 10px 16px 8px; border-bottom: 1px solid #edf3f9;
    }
    .ph-lb-size-lbl { font-size: 11px; font-weight: 800; color: #7a9db8; text-transform: uppercase; letter-spacing: .4px; margin-right: 3px; white-space: nowrap; }
    .ph-lb-size-btn {
      padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800;
      border: 1.5px solid rgba(169,203,230,.7); background: #f5faff; color: #4d6587;
      cursor: pointer; font-family: "Nunito", sans-serif; transition: all .12s ease;
    }
    .ph-lb-size-btn.active { background: linear-gradient(180deg,#2e8fe0 0%,#1c70cc 100%); color: #fff; border-color: #1c70cc; }
    /* Competitive sub-tabs */
    .ph-lb-comp-tabs {
      display: flex; border-bottom: 1px solid #e4eef8; overflow: hidden;
    }
    .ph-lb-comp-tab {
      flex: 1; padding: 10px 6px; font-size: 11.5px; font-weight: 800;
      font-family: "Nunito",sans-serif; color: #5a7ea8; background: #f7fbff;
      border: none; border-right: 1px solid #e4eef8; cursor: pointer;
      text-align: center; transition: all .12s ease; line-height: 1.3;
    }
    .ph-lb-comp-tab:last-child { border-right: none; }
    .ph-lb-comp-tab:hover { background: #eaf3fb; color: #1c5fa8; }
    .ph-lb-comp-tab.active { background: linear-gradient(180deg,#2e8fe0 0%,#1c70cc 100%); color: #fff; }
    /* Summary card */
    .ph-lb-summary {
      display: flex; align-items: center; gap: 14px;
      margin: 12px 16px 0; padding: 12px 16px;
      background: linear-gradient(135deg, rgba(44,128,240,.07) 0%, rgba(42,190,140,.06) 100%);
      border: 1px solid rgba(44,128,240,.18); border-radius: 12px;
    }
    .ph-lb-sum-rank {
      width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      font-family: "Nunito",sans-serif; font-size: 18px; font-weight: 900;
      background: linear-gradient(145deg,#e0f0ff,#c8e4ff); border: 2px solid #90c8f0; color: #1460a8;
    }
    .ph-lb-sum-rank.rank-1 { background: linear-gradient(145deg,#fff8e0,#ffe98a); border-color: #f0c820; color: #a07000; }
    .ph-lb-sum-rank.rank-2 { background: linear-gradient(145deg,#f0f4f8,#dce8f0); border-color: #a8c0d0; color: #5a7080; }
    .ph-lb-sum-rank.rank-3 { background: linear-gradient(145deg,#fef0e8,#f5d8c0); border-color: #d89060; color: #8a4020; }
    .ph-lb-sum-body { flex: 1; min-width: 0; }
    .ph-lb-sum-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: #7a9db8; margin-bottom: 4px; }
    .ph-lb-sum-vals { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 2px; }
    .ph-lb-sum-val { font-size: 12px; font-weight: 700; color: #143d6d; }
    .ph-lb-sum-val span { color: #7a9db8; font-weight: 600; }

    /* ── Hidden invertebrate easter-egg (click 3× to reveal a digit) ── */
    .secret-wrap { position: relative; display: inline-block; line-height: 0; vertical-align: middle; }
    .secret-critter { cursor: pointer; -webkit-user-drag: none; user-select: none;
      transition: opacity 1s ease, transform 1s ease, filter .15s; }
    .secret-critter:hover { filter: brightness(1.08); }
    .secret-critter.secret-fading { opacity: 0; transform: scale(.55) rotate(-6deg); }
    .secret-bubble {
      position: fixed; z-index: 99999; transform: translate(-50%, -100%);
      background: rgba(8,24,58,.97); color: #eaf6ff;
      border: 1px solid rgba(120,190,235,.55); border-radius: 12px;
      padding: 8px 13px; font-size: 13px; font-weight: 700; line-height: 1.3;
      max-width: 240px; text-align: center; pointer-events: none;
      box-shadow: 0 8px 26px rgba(0,0,0,.45);
      font-family: "Baloo 2","Nunito",sans-serif;
      animation: secret-bubble-in .18s ease both;
    }
    .secret-bubble::after {
      content:""; position:absolute; left:50%; bottom:-7px; transform:translateX(-50%);
      border:7px solid transparent; border-top-color: rgba(8,24,58,.97); border-bottom:none;
    }
    @keyframes secret-bubble-in { from { opacity:0; transform: translate(-50%,-88%); } to { opacity:1; transform: translate(-50%,-100%); } }
    .secret-number {
      position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
      font-family: "Cinzel", serif; font-weight: 900; color: #22d8f8;
      text-shadow: 0 0 12px rgba(34,216,248,.85), 0 2px 6px rgba(0,0,0,.55);
      font-size: clamp(1.4rem, 3vw, 2.1rem); pointer-events: none; z-index: 6;
      animation: secret-num-in .55s cubic-bezier(.2,.8,.2,1.5) both; white-space: nowrap;
    }
    @keyframes secret-num-in { from { opacity:0; transform: translate(-50%,-50%) scale(.3); } to { opacity:1; transform: translate(-50%,-50%) scale(1); } }
    .secret-icon { display: block; object-fit: contain; }
    .ph-lb-secret-slot { display: flex; justify-content: center; align-items: center; min-height: 0; margin: 2px 0 0; }

    /* ── Giant Squid challenge modal ──────────────────────────────── */
    #giant-squid-modal {
      display: none; position: fixed; inset: 0; z-index: 9800;
      background: radial-gradient(circle at 50% 30%, rgba(20,10,60,.72), rgba(2,6,24,.92));
      backdrop-filter: blur(8px);
      align-items: center; justify-content: center; padding: 24px;
    }
    #giant-squid-modal.open { display: flex; }
    #gs-challenge-box {
      width: 100%; max-width: 460px; text-align: center;
      background: linear-gradient(180deg, #122046 0%, #0a1430 100%);
      border: 1px solid rgba(120,90,220,.5); border-radius: 22px;
      box-shadow: 0 20px 70px rgba(40,10,90,.55), inset 0 1px 0 rgba(180,160,255,.18);
      padding: 26px 26px 24px; position: relative;
      animation: gs-rise .3s cubic-bezier(.2,.8,.2,1.2) both;
    }
    @keyframes gs-rise { from { opacity:0; transform: translateY(24px) scale(.96); } to { opacity:1; transform: none; } }
    #gs-challenge-img {
      width: 116px; height: 116px; object-fit: contain; margin: 0 auto 6px;
      filter: drop-shadow(0 6px 18px rgba(150,80,255,.5));
      animation: gs-float 3.4s ease-in-out infinite;
    }
    @keyframes gs-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
    #gs-challenge-title { font-family: "Cinzel", serif; font-size: 1.2rem; font-weight: 900; color: #c9b6ff; letter-spacing: .5px; margin-bottom: 8px; }
    #gs-challenge-msg { color: #dfe8ff; font-size: 1rem; line-height: 1.5; font-weight: 600; margin: 0 12px 18px; min-height: 48px; }
    #gs-challenge-actions { display: flex; flex-direction: column; gap: 10px; }
    .gs-ch-btn {
      border: none; border-radius: 13px; padding: 13px 18px; font-size: 15px; font-weight: 800;
      cursor: pointer; font-family: "Baloo 2","Nunito",sans-serif; transition: transform .12s, box-shadow .12s, filter .12s;
    }
    .gs-ch-btn.fight { background: linear-gradient(135deg,#8a4bff,#5a1fd0); color: #fff; box-shadow: 0 6px 20px rgba(120,60,230,.5); }
    .gs-ch-btn.fight:hover { transform: translateY(-2px); filter: brightness(1.08); }
    .gs-ch-btn.later { background: rgba(255,255,255,.08); color: #b9c6e8; border: 1px solid rgba(150,170,230,.3); }
    .gs-ch-btn.later:hover { background: rgba(255,255,255,.14); }
    /* Table */
    .ph-lb-table-wrap { overflow-x: auto; margin-top: 10px; }
    .ph-lb-table {
      width: 100%; border-collapse: collapse; font-size: 12.5px;
    }
    .ph-lb-table thead th {
      background: linear-gradient(180deg,#eaf4ff 0%,#ddeefa 100%);
      color: #3a6a9a; font-size: 10px; font-weight: 800; text-transform: uppercase;
      letter-spacing: .4px; padding: 8px 12px; text-align: left;
      border-bottom: 1px solid #c4daf0; white-space: nowrap;
    }
    .ph-lb-table tbody tr { transition: background .1s; }
    .ph-lb-table tbody tr:hover { background: rgba(44,128,240,.04); }
    .ph-lb-table tbody tr.ph-lb-me { background: rgba(208,168,40,.07); }
    .ph-lb-table tbody tr.ph-lb-me:hover { background: rgba(208,168,40,.12); }
    .ph-lb-table tbody td {
      padding: 8px 12px; border-bottom: 1px solid rgba(195,220,240,.5);
      color: #143d6d; font-weight: 600; vertical-align: middle;
    }
    .ph-lb-table tbody tr:last-child td { border-bottom: none; }
    .ph-lb-rank-cell { font-family: "Nunito",sans-serif; font-size: 15px; font-weight: 900; width: 42px; }
    .ph-lb-medal { font-size: 17px; line-height: 1; }
    .ph-lb-player-cell { display: flex; align-items: center; gap: 8px; min-width: 100px; }
    .ph-lb-avatar {
      width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
      object-fit: cover; border: 1.5px solid rgba(120,180,230,.5);
      background: linear-gradient(145deg,#c8e4ff,#a0ccf0);
    }
    .ph-lb-pname { font-weight: 800; color: #143d6d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
    .ph-lb-you-tag { font-size: 9px; font-weight: 900; color: #b07000; background: #fff4cc; border: 1px solid #e8c840; border-radius: 999px; padding: 1px 5px; margin-left: 4px; white-space: nowrap; }
    .ph-lb-score-cell { font-family: "Nunito",sans-serif; font-size: 14px; font-weight: 900; color: #1a5aca; white-space: nowrap; }
    .ph-lb-score-cell.lb-top { color: #b07000; }
    .ph-lb-meta-cell { color: #5a7ea8; font-size: 12px; white-space: nowrap; }
    .ph-lb-pill {
      display: inline-block; background: rgba(44,128,240,.10); border: 1px solid rgba(44,128,240,.2);
      border-radius: 999px; padding: 1px 7px; font-size: 10.5px; font-weight: 800; color: #1a5a9a;
    }
    .ph-lb-empty { color: #8aaccc; font-size: 13px; text-align: center; padding: 28px 16px; font-style: italic; }
    .ph-lb-add-cell { width: 36px; text-align: center; padding: 0 2px; }
    .ph-lb-add-btn {
      display: inline-flex; align-items: center; justify-content: center;
      width: 28px; height: 28px; border-radius: 50%;
      border: 1.5px solid rgba(44,128,240,.35);
      background: rgba(44,128,240,.08);
      color: #2c80f0; font-size: 16px; font-weight: 900; line-height: 1;
      cursor: pointer; transition: background .15s, border-color .15s, transform .12s;
      font-family: "Nunito",sans-serif; padding: 0;
    }
    .ph-lb-add-btn svg { width: 14px; height: 14px; flex-shrink: 0; pointer-events: none; }
    .ph-lb-add-btn:hover { background: rgba(44,128,240,.18); border-color: rgba(44,128,240,.6); transform: scale(1.12); }
    .ph-lb-add-btn.lb-add-sent { border-color: rgba(45,189,130,.5); background: rgba(45,189,130,.12); color: #1daa72; cursor: default; transform: none; }
    .ph-lb-add-btn.lb-add-friends { border-color: rgba(255,180,0,.4); background: rgba(255,180,0,.1); color: #b07000; cursor: default; transform: none; }
    .ph-lb-scroll {
      max-height: calc(100vh - 340px); /* expand: fills available screen, leaving room for header + filters */
      min-height: 200px;
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: #7dd3fc #dff0fb;
      padding-bottom: 16px; /* last row never clipped */
    }
    .ph-actions {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 14px;
    }
    /* ── Action cards: tall, colorful, ocean-art style ── */
    .ph-action-card {
      border: none;
      border-radius: 22px;
      height: 185px;
      padding: 18px 20px 20px;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      text-align: left;
      cursor: pointer;
      transition: transform .16s, box-shadow .16s;
      box-shadow: 0 8px 26px rgba(0,45,110,.20), inset 0 1px 0 rgba(255,255,255,.18);
      overflow: hidden;
      position: relative;
    }
    /* Bottom-left readability scrim (a gradient, not a blur) — guarantees the
       title/subtitle stay legible on the lighter top of each gradient. Anchored
       to the bottom-left and faded to transparent before the coral art on the
       right, so it never darkens the illustration. */
    .ph-action-card::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      background: radial-gradient(92% 80% at 0% 100%,
                  rgba(0,16,42,.36) 0%,
                  rgba(0,16,42,.12) 42%,
                  rgba(0,16,42,0) 64%);
    }
    .ph-action-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 16px 38px rgba(0,45,110,.30), inset 0 1px 0 rgba(255,255,255,.22);
    }
    /* ── Image-based action cards: the exact reference artwork ───────
       The button shows ONE image (text + coral baked in). It matches the
       image aspect ratio so nothing is cropped, and the image sits on top of
       any gradient/scrim/per-tab styling so the artwork is identical on every
       tab. The button stays fully clickable. */
    .ph-action-img-card {
      aspect-ratio: 472 / 304;
      height: auto !important;
      min-height: 0 !important;
      padding: 0 !important;
      border: none !important;
      background: transparent !important;
    }
    .ph-action-img-card::before { display: none !important; }  /* no scrim — text is in the image */
    .ph-action-img {
      position: absolute; inset: 0;
      width: 100%; height: 100%;
      object-fit: cover;
      border-radius: inherit;
      display: block;
      z-index: 2;
      -webkit-user-drag: none; user-select: none;
      pointer-events: none;   /* clicks pass through to the button */
    }
    /* Individual card gradient themes — cleaner, evenly-weighted stops */
    .ph-action-card:nth-child(1) { background: linear-gradient(145deg, #6fd6f2 0%, #2cb4e6 38%, #1583c9 72%, #0f63a4 100%); } /* Create — ocean blue */
    .ph-action-card:nth-child(2) { background: linear-gradient(145deg, #ff8b78 0%, #f24f49 38%, #d62f2e 72%, #ad2024 100%); } /* Join — clean red */
    .ph-action-card:nth-child(3) { background: linear-gradient(145deg, #b2d965 0%, #82b837 38%, #5d9627 72%, #437a16 100%); } /* Tutorial — reef green */
    .ph-action-card:nth-child(4) { background: linear-gradient(145deg, #cb9af2 0%, #9d5fdd 38%, #7c3fc4 72%, #592a9c 100%); } /* Competitive — clean purple */
    /* Circular icon holder — no backdrop-filter (causes GPU blur on entire card) */
    .ph-action-icon {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background: rgba(255,255,255,.28);
      border: 1.5px solid rgba(255,255,255,.75);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.5),
                  0 2px 8px rgba(0,30,70,.18);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      position: absolute;
      top: 18px;
      left: 20px;
      z-index: 2;
    }
    /* Coral art SVG container */
    .ph-ac-art {
      position: absolute;
      top: 50%; right: 10px;
      transform: translateY(-50%);
      height: 84%;
      width: 52%;
      pointer-events: none;
      z-index: 1;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    /* Exact coral creature image — full art visible, no distortion */
    .ph-ac-art img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      object-position: center center;
      filter: drop-shadow(0 5px 12px rgba(0,30,70,.28));
    }
    /* Text in front */
    .ph-action-copy { position: relative; z-index: 2; }
    .ph-ai-blue, .ph-ai-green, .ph-ai-teal, .ph-ai-gold { background: transparent; }
    .ph-action-label {
      font-size: clamp(1.05rem, 1.3vw, 1.5rem);
      font-weight: 900;
      color: #fff;
      line-height: 1.1;
      letter-spacing: .2px;
      text-shadow: 0 1px 2px rgba(0,0,0,.45), 0 2px 12px rgba(0,0,0,.35);
    }
    .ph-action-card.ph-action-gold .ph-action-label { color: #fff; }
    .ph-action-sub {
      margin-top: 4px;
      font-size: .88rem;
      font-weight: 600;
      color: #fff;
      line-height: 1.25;
      text-shadow: 0 1px 3px rgba(0,0,0,.42), 0 1px 8px rgba(0,0,0,.30);
    }

    .stats-join-row {
      display: none;
      flex-direction: row;
      gap: 8px;
      align-items: center;
      width: 100%;
    }
    .stats-join-row.open { display: flex; }
    .stats-join-row .pv-input {
      background: #fff;
      border-color: #a9c9e6;
      color: #173f6f;
    }
    .stats-join-row .pv-input::placeholder { color: #7390ac; }
    .stats-join-row .pv-btn {
      background: linear-gradient(135deg, #2482df 0%, #1a66c4 100%);
      border: 1px solid #73abe1;
      color: #f6fbff;
    }
    .ph-panel { width: 100%; }

    /* ── Daily / Weekly Challenge Strip (Overview tab) ─────────────── */
    .ph-cs-strip {
      display: flex;
      align-items: stretch;
      gap: 14px;
      padding: 14px 16px;
      background: rgba(252,255,255,.95);
      border: 1px solid rgba(169,203,230,.78);
      border-radius: 18px;
      box-shadow: 0 6px 26px rgba(35,100,165,.11);
      margin-bottom: 14px;
    }
    /* Left: calendar icon + title block */
    .ph-cs-header {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 0 0 auto;
      min-width: 230px;
      max-width: 280px;
      padding-right: 12px;
      border-right: 1px solid rgba(165,204,233,.45);
    }
    .ph-cs-icon-btn {
      width: 50px; height: 50px;
      border-radius: 14px;
      border: 1px solid rgba(95,179,214,.45);
      background: rgba(120,200,230,.13);
      display: flex; align-items: center; justify-content: center;
      cursor: pointer;
      transition: transform .14s, background .14s, border-color .14s, box-shadow .14s;
      flex-shrink: 0;
      position: relative;
    }
    .ph-cs-icon-btn:hover {
      transform: translateY(-1px);
      background: rgba(120,200,230,.22);
      border-color: #5fb3d6;
      box-shadow: 0 4px 14px rgba(34,98,162,.14);
    }
    .ph-cs-icon-btn svg { width: 26px; height: 26px; }
    .ph-cs-title-block { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
    .ph-cs-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .ph-cs-title {
      font-family: "Cinzel", serif;
      font-size: 1.05rem;
      font-weight: 700;
      color: #173f6f;
      letter-spacing: .3px;
      line-height: 1.15;
    }
    .ph-cs-pill {
      font-size: .68rem;
      font-weight: 800;
      letter-spacing: .8px;
      text-transform: uppercase;
      padding: 2px 8px;
      border-radius: 999px;
      background: linear-gradient(135deg, #2482df 0%, #1a66c4 100%);
      color: #f6fbff;
      box-shadow: 0 2px 6px rgba(36,130,223,.32);
    }
    .ph-cs-pill.weekly {
      background: linear-gradient(135deg, #d9a12b 0%, #b87a16 100%);
      box-shadow: 0 2px 6px rgba(217,161,43,.32);
    }
    .ph-cs-sub {
      font-size: .78rem;
      color: #4b6f94;
      line-height: 1.3;
    }
    /* Middle: 3 challenge cards */
    .ph-cs-cards {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
      flex: 1 1 auto;
      min-width: 0;
      transition: opacity .22s ease;
    }
    .ph-cs-cards.fading { opacity: 0; }
    .ph-cs-card {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 10px 12px;
      background: rgba(245,250,255,.85);
      border: 1px solid rgba(165,204,233,.55);
      border-radius: 13px;
      min-width: 0;
      transition: border-color .14s, transform .14s, box-shadow .14s;
    }
    .ph-cs-card:hover {
      border-color: #7fb6dd;
      transform: translateY(-1px);
      box-shadow: 0 4px 14px rgba(34,98,162,.10);
    }
    .ph-cs-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
    .ph-cs-card-icon {
      width: 30px; height: 30px;
      border-radius: 9px;
      background: rgba(28,130,214,.13);
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      font-size: 16px;
    }
    .ph-cs-card.is-weekly .ph-cs-card-icon { background: rgba(224,173,52,.16); }
    .ph-cs-card-meta { min-width: 0; flex: 1; }
    .ph-cs-card-type {
      font-size: .58rem;
      font-weight: 800;
      letter-spacing: 1px;
      color: #2680c8;
      text-transform: uppercase;
      line-height: 1;
    }
    .ph-cs-card.is-weekly .ph-cs-card-type { color: #a77000; }
    .ph-cs-card-name {
      font-size: .92rem;
      font-weight: 800;
      color: #1559b0;
      line-height: 1.15;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ph-cs-card-req {
      font-size: .74rem;
      color: #4b6f94;
      line-height: 1.25;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
    }
    .ph-cs-card-foot {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 2px;
    }
    .ph-cs-card-bar {
      flex: 1;
      height: 6px;
      border-radius: 999px;
      background: rgba(95,179,214,.18);
      overflow: hidden;
      min-width: 0;
    }
    .ph-cs-card-fill {
      height: 100%;
      background: linear-gradient(90deg, #2482df 0%, #1a66c4 100%);
      border-radius: 999px;
      transition: width .35s ease;
    }
    .ph-cs-card.is-weekly .ph-cs-card-fill {
      background: linear-gradient(90deg, #d9a12b 0%, #b87a16 100%);
    }
    .ph-cs-card-progress {
      font-size: .72rem;
      font-weight: 800;
      color: #1a4a90;
      white-space: nowrap;
    }
    .ph-cs-card-xp {
      font-size: .7rem;
      font-weight: 800;
      color: #a77000;
      white-space: nowrap;
    }
    /* Completed state — green tint + checkmark + countdown to next refresh */
    .ph-cs-card.is-completed {
      background: linear-gradient(135deg, rgba(232,250,239,.95) 0%, rgba(214,247,229,.92) 100%);
      border-color: rgba(80,180,120,.55);
    }
    .ph-cs-card.is-completed .ph-cs-card-fill {
      background: linear-gradient(90deg, #2bb673 0%, #1d9b4e 100%);
    }
    .ph-cs-card-completed-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: .68rem;
      font-weight: 800;
      color: #1d9b4e;
      letter-spacing: .3px;
    }
    .ph-cs-card-next {
      font-size: .68rem;
      color: #4a7a5a;
      font-weight: 700;
      white-space: nowrap;
      margin-left: auto;
    }
    /* Right: weekly reward / view challenges */
    .ph-cs-reward {
      flex: 0 0 auto;
      width: 188px;
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      background: linear-gradient(135deg, rgba(255,253,246,.96) 0%, rgba(255,238,196,.95) 100%);
      border: 1px solid rgba(226,186,98,.72);
      border-radius: 14px;
      cursor: pointer;
      transition: transform .14s, box-shadow .14s, border-color .14s;
      text-align: left;
      font-family: inherit;
    }
    .ph-cs-reward:hover {
      transform: translateY(-1px);
      border-color: #d9a12b;
      box-shadow: 0 6px 16px rgba(217,161,43,.20);
    }
    .ph-cs-reward-icon {
      font-size: 32px;
      flex-shrink: 0;
      filter: drop-shadow(0 2px 3px rgba(0,0,0,0.12));
    }
    .ph-cs-reward-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
    .ph-cs-reward-label {
      font-size: .78rem;
      font-weight: 800;
      color: #a77000;
      letter-spacing: .3px;
      line-height: 1.1;
    }
    .ph-cs-reward-count {
      font-size: .72rem;
      font-weight: 800;
      color: #8a5a00;
    }
    .ph-cs-reward-bar {
      height: 5px;
      border-radius: 999px;
      background: rgba(217,161,43,.18);
      overflow: hidden;
    }
    .ph-cs-reward-fill {
      height: 100%;
      background: linear-gradient(90deg, #d9a12b 0%, #b87a16 100%);
      border-radius: 999px;
      transition: width .35s ease;
    }
    /* Responsive — stack the layout vertically on narrower screens */
    @media (max-width: 1100px) {
      .ph-cs-strip { flex-wrap: wrap; }
      .ph-cs-header { border-right: 0; padding-right: 0; max-width: none; flex: 1 1 100%; min-width: 0; padding-bottom: 6px; border-bottom: 1px solid rgba(165,204,233,.45); }
      .ph-cs-cards { flex: 1 1 100%; }
      .ph-cs-reward { width: 100%; }
    }
    @media (max-width: 720px) {
      .ph-cs-cards { grid-template-columns: 1fr; }
    }

    .ph-main {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 430px;
      gap: 14px;
      align-items: start;
    }
    .ph-side {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .ph-stats-card {
      background: rgba(252,255,255,.95);
      border: 1px solid rgba(169,203,230,.78);
      border-radius: 18px;
      overflow: hidden;
      box-shadow: 0 6px 26px rgba(35,100,165,.11);
    }
    .ph-stats-card.ph-comp-card {
      border-color: rgba(224,184,90,.58);
      background: linear-gradient(135deg, rgba(255,253,245,.98) 0%, rgba(255,248,227,.95) 100%);
    }
    .ph-stats-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 16px 20px 12px;
      border-bottom: 1px solid #e7f0f8;
    }
    .ph-stats-title {
      font-size: clamp(1.05rem, 1.38vw, 1.56rem);
      font-weight: 800;
      color: #184f9c;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .ph-pcounts {
      display: flex;
      gap: 0;
      border: 1px solid #caddef;
      border-radius: 13px;
      overflow: hidden;
      background: #f8fcff;
    }
    .ph-pc {
      border: none;
      border-right: 1px solid #ddeaf5;
      background: transparent;
      color: #416286;
      padding: 8px 14px;
      min-width: 52px;
      font-size: .95rem;
      font-weight: 700;
      cursor: pointer;
      transition: background .14s, color .14s;
      font-family: "Nunito", sans-serif;
    }
    .ph-pc:last-child { border-right: none; }
    .ph-pc:hover { color: #1f65be; background: rgba(47,126,224,.07); }
    .ph-pc.active {
      background: linear-gradient(180deg, #3a94f0 0%, #1f73dd 100%);
      color: #fff;
    }
    .ph-sg {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 1px;
      background: #e8f0f8;
    }
    .ph-sc {
      background: #fff;
      padding: 18px 16px;
      min-height: 152px;
      display: flex;
      flex-direction: column;
      gap: 7px;
      justify-content: flex-start;
    }
    .ph-sc-feat .ph-scv { font-size: clamp(2rem, 3.6vw, 3rem); }
    .ph-sci {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      margin-bottom: 3px;
    }
    .ph-sci-blue   { background: rgba(28,130,214,.12); }
    .ph-sci-gold   { background: rgba(224,173,52,.16); }
    .ph-sci-teal   { background: rgba(44,197,185,.13); }
    .ph-sci-purple { background: rgba(107,120,235,.13); }
    .ph-sci-green  { background: rgba(32,185,132,.13); }
    .ph-scl {
      font-size: .85rem;
      color: #4a6a8d;
      font-weight: 700;
      line-height: 1.25;
    }
    .ph-scv {
      font-size: clamp(1.9rem, 3vw, 2.4rem);
      font-weight: 900;
      line-height: 1.06;
      color: #103a74;
    }
    .ph-scs {
      font-size: .96rem;
      color: #2b9f5b;
      font-weight: 700;
    }
    .ph-card-list {
      display: flex;
      flex-direction: column;
      gap: 5px;
      margin-top: 2px;
    }
    .ph-card-item {
      font-size: .95rem;
      color: #194777;
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ph-scard {
      border: 1px solid rgba(169,203,230,.78);
      border-radius: 18px;
      background: rgba(252,255,255,.95);
      overflow: hidden;
      box-shadow: 0 6px 24px rgba(35,100,165,.1);
    }
    .ph-scard.ph-full { width: 100%; }
    .ph-sh {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 14px 18px 10px;
      border-bottom: 1px solid #e8f0f8;
      background: rgba(247,252,255,.92);
    }
    .ph-st {
      font-size: clamp(1rem, 1.3vw, 1.32rem);
      font-weight: 800;
      color: #164f9a;
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .ph-sl {
      border: none;
      background: none;
      color: #2474cd;
      font-size: .9rem;
      font-weight: 700;
      padding: 0;
      cursor: pointer;
      font-family: "Nunito", sans-serif;
      white-space: nowrap;
    }
    .ph-sl:hover { text-decoration: underline; }
    .ph-rg,
    .ph-fr {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
      align-items: center;
      column-gap: 10px;
      row-gap: 5px;
      padding: 10px 15px;
      border-top: 1px solid #edf3f9;
    }
    .ph-fr {
      grid-template-columns: auto minmax(0, 1fr) auto;
    }
    .ph-rg-ico { font-size: 18px; line-height: 1; }
    .ph-rg-opp {
      font-size: .95rem;
      font-weight: 700;
      color: #143d6d;
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ph-rg-badge {
      font-size: .87rem;
      font-weight: 800;
      border-radius: 7px;
      padding: 4px 9px;
      white-space: nowrap;
    }
    .ph-rg-badge.win { color: #1d9b4e; background: rgba(31,175,95,.13); }
    .ph-rg-badge.loss { color: #c0392b; background: rgba(220,60,60,.11); }
    .ph-rg-badge.draw { color: #7a6800; background: rgba(224,184,90,.18); }
    .ph-rg-pts {
      font-size: .94rem;
      font-weight: 800;
      color: #153d6d;
      white-space: nowrap;
    }
    .ph-rg-date {
      font-size: .85rem;
      color: #6f8dab;
      white-space: nowrap;
    }
    .ph-rg-strat {
      font-size: 11px; font-weight: 700; color: #2c95d1;
      background: rgba(44,149,209,.12); border-radius: 8px; padding: 2px 8px;
      white-space: nowrap;
    }
    .ph-rg-view-btn {
      font-size: .8rem;
      font-weight: 700;
      color: #1a6fc4;
      background: rgba(38,128,200,.10);
      border: 1px solid rgba(38,128,200,.30);
      border-radius: 7px;
      padding: 4px 10px;
      cursor: pointer;
      white-space: nowrap;
      transition: background .15s, border-color .15s;
    }
    .ph-rg-view-btn:hover { background: rgba(38,128,200,.20); border-color: rgba(38,128,200,.55); }

    /* ── Game Detail Modal ─────────────────────────────────────────── */
    #ph-game-detail-modal {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 9800;
      background: rgba(10,28,60,.55);
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    #ph-game-detail-modal.open { display: flex; }
    #ph-gdm-box {
      background: #fff;
      border-radius: 16px;
      box-shadow: 0 12px 48px rgba(10,30,70,.22);
      width: 100%;
      max-width: 720px;
      max-height: 88vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      color: #143d6d;
      font-family: "Nunito", sans-serif;
    }
    #ph-gdm-hdr {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 18px 20px 14px;
      border-bottom: 1px solid #e8f0f9;
    }
    #ph-gdm-title {
      font-size: 1.05rem;
      font-weight: 800;
      color: #0e2f5a;
    }
    #ph-gdm-close {
      background: #f0f4f9;
      border: none;
      border-radius: 50%;
      width: 30px; height: 30px;
      cursor: pointer;
      font-size: 14px;
      color: #4a6f9a;
      display: flex; align-items: center; justify-content: center;
      transition: background .15s;
    }
    #ph-gdm-close:hover { background: #dce8f5; }
    #ph-gdm-body {
      overflow-y: auto;
      padding: 18px 20px 24px;
      flex: 1;
    }
    .ph-gdm-section-label {
      font-size: .78rem;
      font-weight: 800;
      color: #4a7aaa;
      letter-spacing: .7px;
      text-transform: uppercase;
      margin-bottom: 10px;
    }
    .ph-gdm-score-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 12px;
      border-radius: 10px;
      background: #f5f9ff;
      margin-bottom: 6px;
    }
    .ph-gdm-score-row.winner {
      background: rgba(245,200,66,.12);
      border: 1.5px solid rgba(245,200,66,.45);
    }
    .ph-gdm-rank {
      font-size: .8rem;
      font-weight: 800;
      color: #7aaad0;
      width: 18px;
      text-align: center;
      flex-shrink: 0;
    }
    .ph-gdm-pname {
      flex: 1;
      font-size: .96rem;
      font-weight: 700;
      color: #0e2f5a;
      min-width: 0;
    }
    .ph-gdm-pscore {
      font-size: .95rem;
      font-weight: 800;
      color: #1a6fc4;
      white-space: nowrap;
    }
    .ph-gdm-score-row.winner .ph-gdm-pscore { color: #c47a00; }
    .ph-gdm-player-board {
      margin-bottom: 14px;
      background: #f5f9ff;
      border-radius: 10px;
      overflow: hidden;
    }
    .ph-gdm-pb-name {
      font-size: .9rem;
      font-weight: 800;
      color: #0e2f5a;
      padding: 9px 12px 6px;
      border-bottom: 1px solid #e4eef8;
    }
    .ph-gdm-pb-name.winner { color: #a06500; }
    .ph-gdm-ocean-row {
      display: flex;
      flex-direction: column;
      padding: 6px 12px 7px;
      border-bottom: 1px solid #edf3fa;
      gap: 2px;
    }
    .ph-gdm-ocean-row:last-child { border-bottom: none; }
    .ph-gdm-ocean-name {
      font-size: .88rem;
      font-weight: 700;
      color: #1a6fc4;
    }
    .ph-gdm-animals {
      font-size: .83rem;
      color: #4a6f9a;
    }
    .ph-gdm-pb-empty {
      padding: 8px 12px;
      font-size: .85rem;
      color: #8aa5c0;
      font-style: italic;
    }
    .ph-gdm-no-board {
      font-size: .88rem;
      color: #8aa5c0;
      font-style: italic;
      text-align: center;
      padding: 16px 0;
    }

    /* Clickable player chips (avatar + name + score) */
    #ph-gdm-players {
      display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
    }
    .ph-gdm-pchip {
      display: flex; align-items: center; gap: 9px;
      background: #f5f9ff; border: 2px solid #e2ecf8;
      border-radius: 12px; padding: 7px 12px 7px 8px;
      cursor: pointer; font-family: inherit; text-align: left;
      transition: border-color .15s, background .15s, transform .1s;
    }
    .ph-gdm-pchip:hover { border-color: #9cc4ec; transform: translateY(-1px); }
    .ph-gdm-pchip.selected { border-color: #2680c8; background: #e9f3ff; }
    .ph-gdm-pchip.winner { background: rgba(245,200,66,.14); }
    .ph-gdm-pchip.winner.selected { border-color: #d9a400; }
    .ph-gdm-pchip-av {
      width: 38px; height: 38px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: linear-gradient(145deg, #2f8be3 0%, #226ec4 100%);
      display: flex; align-items: center; justify-content: center;
      color: #fff; font-size: .95rem; font-weight: 800;
    }
    .ph-gdm-pchip-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .ph-gdm-pchip-info { display: flex; flex-direction: column; min-width: 0; }
    .ph-gdm-pchip-name { font-size: .9rem; font-weight: 800; color: #0e2f5a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
    .ph-gdm-pchip-score { font-size: .8rem; font-weight: 700; color: #1a6fc4; }
    .ph-gdm-pchip.winner .ph-gdm-pchip-score { color: #c47a00; }

    /* Selected player's board view ("screenshot") */
    #ph-gdm-board-view { }
    .ph-gdm-bv-header {
      display: flex; align-items: center; gap: 12px;
      background: #eef5fe; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
    }
    .ph-gdm-bv-header.winner { background: rgba(245,200,66,.16); }
    .ph-gdm-bv-av {
      width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: linear-gradient(145deg, #2f8be3 0%, #226ec4 100%);
      display: flex; align-items: center; justify-content: center;
      color: #fff; font-size: 1.3rem; font-weight: 800;
      border: 2px solid rgba(38,128,200,.35);
    }
    .ph-gdm-bv-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .ph-gdm-bv-htext { min-width: 0; }
    .ph-gdm-bv-name { font-size: 1.05rem; font-weight: 800; color: #0e2f5a; }
    .ph-gdm-bv-sub { font-size: .85rem; font-weight: 700; color: #1a6fc4; margin-top: 2px; }
    .ph-gdm-bv-header.winner .ph-gdm-bv-sub { color: #c47a00; }
    .ph-gdm-bv-oceans {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
    }
    .ph-gdm-bv-ocean {
      background: #f5f9ff; border: 1px solid #e4eef8; border-radius: 12px;
      padding: 10px 11px; display: flex; flex-direction: column; gap: 7px;
    }
    .ph-gdm-bv-ocean-name {
      font-size: .82rem; font-weight: 800; color: #1565b0;
      display: flex; align-items: center; gap: 5px;
      padding-bottom: 6px; border-bottom: 1px solid #e4eef8;
    }
    .ph-gdm-bv-animals { display: flex; flex-wrap: wrap; gap: 5px; }
    .ph-gdm-bv-animal {
      font-size: .76rem; font-weight: 700; color: #2f5a86;
      background: #e3eefb; border: 1px solid #d2e2f5; border-radius: 7px;
      padding: 3px 8px;
    }
    .ph-gdm-bv-empty { font-size: .8rem; color: #9ab0c8; font-style: italic; }
    /* Visual board mode: the real card-image board ("screenshot") rendered by
       renderReadOnlyBoard, on a dark game-table panel so the cards read like
       they do in-game. Overrides the text-grid layout of #ph-gdm-bv-oceans. */
    #ph-gdm-bv-oceans.ph-gdm-bv-visual { display: block; }
    .ph-gdm-ro-host {
      --focus-scale: 1;
      --mini-w: calc(70px * var(--focus-scale));
      --mini-h: calc(98px * var(--focus-scale));
      background: linear-gradient(160deg, #0d2c54 0%, #0a1f3c 100%);
      border: 1px solid rgba(95,179,214,.25);
      border-radius: 12px;
      padding: 14px 10px;
      overflow-x: auto;
    }
    .ph-gdm-ro-host .pv-ocean-face {
      width: calc(82px * var(--focus-scale));
      height: calc(116px * var(--focus-scale));
    }

    .ph-fr-av {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      overflow: hidden;
      background: linear-gradient(145deg, #2f8be3 0%, #226ec4 100%);
      border: 2px solid rgba(119,173,224,.4);
      color: #fff;
      font-size: .95rem;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .ph-fr-av img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .ph-fr-avatar-wrap {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 46px;
      min-width: 46px;
      height: 42px;
    }
    .ph-fr-favorite {
      position: absolute;
      top: -4px;
      right: -3px;
      width: 26px;
      height: 26px;
      padding: 5px;
      border: 1px solid #b9d5e9;
      border-radius: 50%;
      background: linear-gradient(145deg, #ffffff 0%, #e9f6ff 100%);
      color: #7da8c7;
      box-shadow: 0 2px 7px rgba(35, 103, 158, .18);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: color .16s ease, border-color .16s ease, background .16s ease,
        box-shadow .16s ease, transform .16s ease;
      z-index: 2;
    }
    .ph-fr-favorite svg {
      width: 100%;
      height: 100%;
      overflow: visible;
    }
    .ph-fr-favorite path {
      fill: transparent;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linejoin: round;
    }
    .ph-fr-favorite:hover {
      color: #2b83c6;
      border-color: #78b9e4;
      transform: translateY(-1px);
      box-shadow: 0 4px 10px rgba(35, 103, 158, .23);
    }
    .ph-fr-favorite:focus-visible {
      outline: 3px solid rgba(47, 169, 238, .3);
      outline-offset: 2px;
    }
    .ph-fr-favorite.active {
      color: #f4b72f;
      border-color: #efc65f;
      background: linear-gradient(145deg, #fff9dc 0%, #ffed9b 100%);
      box-shadow: 0 2px 9px rgba(210, 145, 20, .27);
    }
    .ph-fr-favorite.active path {
      fill: currentColor;
      stroke: #d59216;
    }
    .ph-fr-favorite:disabled {
      cursor: wait;
      opacity: .62;
      transform: none;
    }
    #ph-panel-friends .ph-fr.ph-fr-is-favorite {
      border-color: #c9dfec;
      background: linear-gradient(90deg, #fffdf4 0%, #ffffff 34%);
      box-shadow: 0 2px 10px rgba(39, 111, 161, .08);
    }
    .ph-fr-name {
      font-size: .98rem;
      font-weight: 700;
      color: #163f6f;
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ph-fr-main {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .ph-fr-meta {
      font-size: .76rem;
      font-weight: 700;
      color: #6f8dad;
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.2;
    }
    .ph-fr-status {
      font-size: .84rem;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      white-space: nowrap;
    }
    .ph-fr-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
    }
    .ph-fr-online { color: #1e9b50; }
    .ph-fr-online .ph-fr-dot { background: #2ebf67; box-shadow: 0 0 6px rgba(46,191,103,.9); }
    .ph-fr-offline { color: #7d97b0; }
    .ph-fr-offline .ph-fr-dot { background: #c7d6e3; }
    .ph-empty {
      padding: 20px;
      text-align: center;
      color: #6f8ea9;
      font-size: .95rem;
      line-height: 1.45;
    }
    .ph-empty-panel {
      border: 1px solid rgba(169,203,230,.78);
      border-radius: 18px;
      background: rgba(252,255,255,.95);
      box-shadow: 0 6px 26px rgba(35,100,165,.11);
      padding: 35px 26px;
      text-align: center;
      color: #537293;
      font-size: 1rem;
      line-height: 1.55;
    }
    /* Guest sign-in gate: shown over stat/social tabs for guests */
    .ph-guest-gate { display: none; }
    .ph-panel.is-guest-gated > *:not(.ph-guest-gate) { display: none !important; }
    .ph-panel.is-guest-gated > .ph-guest-gate {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: 14px; text-align: center;
      min-height: 320px; padding: 48px 28px;
      border: 1px solid rgba(140,200,240,.55); border-radius: 22px;
      background: linear-gradient(180deg, rgba(240,250,255,.92), rgba(216,238,252,.88));
      box-shadow: 0 8px 30px rgba(0,60,120,.1);
    }
    .ph-guest-gate-ico { font-size: 3rem; opacity: .7; }
    .ph-guest-gate-msg { font-size: 1.25rem; font-weight: 800; color: #1a4a90; max-width: 420px; line-height: 1.4; }
    .ph-guest-gate-sub { font-size: .9rem; color: #5a86b0; max-width: 380px; line-height: 1.5; margin-top: -6px; }
    .ph-guest-gate-btn {
      margin-top: 6px; padding: 12px 32px; border-radius: 12px; border: none;
      background: linear-gradient(135deg, #2e90e0, #1a6ad0); color: #fff;
      font-size: 1rem; font-weight: 800; cursor: pointer; font-family: inherit;
      box-shadow: 0 4px 14px rgba(26,106,208,.35); transition: transform .12s;
    }
    .ph-guest-gate-btn:hover { transform: translateY(-2px); }
    .ph-empty-panel small {
      display: block;
      margin-top: 6px;
      font-size: .92rem;
      opacity: .9;
      color: #6f8ea9;
    }
    .ph-footer {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      flex-wrap: wrap;
    }
    .ph-footer-btn {
      border: 1px solid rgba(146,187,218,.82);
      border-radius: 12px;
      background: rgba(250,254,255,.92);
      box-shadow: 0 3px 11px rgba(35,100,165,.1);
      color: #3b6590;
      font-size: .93rem;
      font-weight: 700;
      padding: 10px 16px;
      cursor: pointer;
      transition: transform .12s, border-color .12s;
      font-family: "Nunito", sans-serif;
    }
    .ph-footer-btn:hover {
      transform: translateY(-1px);
      border-color: #78add6;
    }
    /* ── Desktop sidebar layout ──────────────────────────────────── */
    /* ID-scoped (#auth-stats-lobby) so these beat the bare .ph-wrap
       max-width:1170px override that lives later in the stylesheet. */
    @media (min-width: 1100px) {
      #auth-stats-lobby { flex-direction: row; align-items: stretch; }
      #auth-stats-lobby .ph-topbar { display: none !important; }
      #auth-stats-lobby .ph-footer { display: none !important; }
      #auth-stats-lobby .ph-sidebar {
        display: flex !important;
        flex-direction: column;
        width: 220px;
        flex-shrink: 0;
        padding: 0;
        margin: 20px 0 20px 20px;
        position: sticky;
        top: 20px;
        align-self: stretch;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        gap: 0;
        z-index: 10;
        background: transparent;
        border: none;
        box-shadow: none;
      }
      /* Nav card — holds logo + navigation + daily streak section */
      #auth-stats-lobby .ph-sidebar-nav-card {
        background: rgba(248,253,255,.94);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border: 1px solid rgba(140,200,235,.5);
        border-radius: 26px;
        box-shadow: 0 8px 32px rgba(0,60,120,.12);
        padding: 16px 16px 14px;
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
      }
      /* Fill the rest of the screen — no max-width cap on desktop. */
      #auth-stats-lobby .ph-wrap {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        max-width: none !important;
        padding: 22px 32px 36px 18px;
        gap: 14px;
      }
      #auth-stats-lobby #ph-tabs { display: flex; }
    }

    /* Sidebar branding */
    .ph-sidebar-logo {
      font-family: "Cinzel", serif;
      font-size: 1.42rem;
      font-weight: 900;
      color: #1558b0;
      text-align: center;
      line-height: 1.2;
      padding: 2px 4px 10px;
      margin-bottom: 6px;
      letter-spacing: .4px;
    }
    .ph-sidebar-logo span { color: #2ea8ea; }

    /* Sidebar nav items */
    .ph-sidebar-nav {
      display: flex;
      flex-direction: column;
      gap: 2px;
      flex: 1;
      justify-content: space-evenly;
    }
    .ph-snav-item {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 9px 16px;
      border-radius: 12px;
      font-size: 1.02rem;
      font-weight: 700;
      color: #3a6088;
      background: transparent;
      border: none;
      cursor: pointer;
      font-family: "Nunito", sans-serif;
      transition: background .15s, color .15s;
      text-align: left;
      width: 100%;
    }
    .ph-snav-item:hover {
      background: rgba(38,128,200,.1);
      color: #1a5fa0;
    }
    .ph-snav-item.active {
      background: rgba(70,160,225,.16);
      color: #1558b0;
    }
    .ph-snav-item svg { flex-shrink: 0; opacity: .9; width: 20px; height: 20px; }
    .ph-snav-divider {
      height: 1px;
      background: rgba(100,170,220,.22);
      margin: 12px 8px;
    }
    /* ── Background Store (coral-reef themed, light frosted glass) ──── */
    #ph-panel-store .ph-scard { padding: 22px 26px 26px; }
    .phst-section-title {
      font-family: "Cinzel", serif;
      font-size: 1.1rem; font-weight: 900; color: #0f5390;
      display: flex; align-items: center; gap: 9px;
      margin: 26px 0 14px;
    }
    .phst-section-title:first-child { margin-top: 4px; }
    .phst-section-title .phst-sec-rule { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(80,180,225,.5), transparent); }
    .phst-section-sub { font-size: .8rem; color: #4f7ba6; font-weight: 600; margin: -8px 0 14px; }

    /* Redeem-a-code box (donation codes arrive by email) */
    .phst-code-box {
      display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
      background: linear-gradient(120deg, rgba(255,231,214,.85) 0%, rgba(255,214,224,.82) 55%, rgba(214,242,255,.85) 100%);
      border: 1px solid rgba(244,160,150,.5);
      border-radius: 16px; padding: 16px 20px; margin-bottom: 6px;
      box-shadow: 0 4px 20px rgba(210,110,120,.14);
    }
    .phst-code-ico { font-size: 1.8rem; flex-shrink: 0; }
    .phst-code-text { flex: 1; min-width: 160px; }
    .phst-code-title { font-size: .96rem; font-weight: 900; color: #c0506a; margin-bottom: 2px; }
    .phst-code-desc { font-size: .76rem; color: #7a5a6a; line-height: 1.45; }
    .phst-code-form { display: flex; gap: 8px; flex-shrink: 0; }
    .phst-code-form input {
      width: 130px; font-size: 1rem; font-weight: 800; letter-spacing: 3px; text-align: center;
      background: rgba(255,255,255,.85); border: 1px solid rgba(200,120,130,.45);
      color: #5a3a48; border-radius: 9px; padding: 9px 10px;
    }
    .phst-code-form input:focus { outline: none; border-color: #f08aa0; box-shadow: 0 0 0 3px rgba(240,138,160,.18); }
    .phst-code-form button {
      background: linear-gradient(120deg,#ff8f6b 0%,#f0628a 100%);
      color: #fff; font-size: .85rem; font-weight: 800;
      border: none; border-radius: 9px; padding: 9px 18px; cursor: pointer;
      box-shadow: 0 3px 12px rgba(240,98,138,.35); white-space: nowrap;
      transition: filter .15s, transform .12s;
    }
    .phst-code-form button:hover { filter: brightness(1.08); transform: translateY(-1px); }
    #phst-code-msg { width: 100%; font-size: .78rem; font-weight: 700; min-height: 0; }
    #phst-code-msg.ok  { color: #1d9a6c; min-height: 1.2em; }
    #phst-code-msg.err { color: #d6526a; min-height: 1.2em; }

    /* Bundle hero */
    .phst-hero {
      display: flex; align-items: center; justify-content: space-between;
      gap: 16px; flex-wrap: wrap;
      background: linear-gradient(120deg, rgba(40,180,200,.92) 0%, rgba(70,150,220,.9) 50%, rgba(150,120,220,.9) 100%);
      border: 1px solid rgba(255,255,255,.35);
      border-radius: 16px; padding: 20px 24px; margin-bottom: 8px;
      box-shadow: 0 6px 26px rgba(30,110,160,.25);
    }
    .phst-hero-text { flex: 1; min-width: 0; }
    .phst-hero-title { font-size: 1.3rem; font-weight: 900; color: #fff; margin: 0 0 4px; text-shadow: 0 1px 6px rgba(0,50,80,.3); }
    .phst-hero-sub { font-size: .84rem; color: rgba(255,255,255,.92); line-height: 1.5; }
    .phst-hero-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
    .phst-bundle-price {
      font-size: 1.7rem; font-weight: 900; color: #fff;
      text-shadow: 0 2px 10px rgba(0,40,70,.35); white-space: nowrap;
    }
    .phst-buy-all-btn {
      background: linear-gradient(120deg,#fff 0%,#eafaff 100%);
      color: #0d6cb0; font-size: .9rem; font-weight: 900;
      border: none; border-radius: 10px; padding: 11px 22px;
      cursor: pointer; white-space: nowrap;
      box-shadow: 0 4px 16px rgba(0,40,80,.22);
      transition: filter .15s, transform .12s;
    }
    .phst-buy-all-btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
    .phst-hero-owned {
      font-size: .9rem; font-weight: 900; color: #fff;
      background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.5);
      border-radius: 9px; padding: 9px 16px; white-space: nowrap;
    }

    .phst-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
      gap: 16px;
    }
    .phst-card {
      background: rgba(255,255,255,.78);
      border: 1px solid rgba(120,200,230,.5);
      border-radius: 14px; overflow: hidden;
      display: flex; flex-direction: column;
      box-shadow: 0 3px 14px rgba(30,110,160,.12);
      transition: transform .15s, box-shadow .15s;
    }
    .phst-card:hover { transform: translateY(-3px); box-shadow: 0 8px 26px rgba(30,110,160,.22); }
    .phst-card-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
    .phst-card-body { padding: 11px 13px 13px; flex: 1; display: flex; flex-direction: column; gap: 7px; }
    .phst-card-name { font-size: .9rem; font-weight: 800; color: #11588f; }
    .phst-card-fact { font-size: .73rem; color: #5b82a3; line-height: 1.4; flex: 1; }
    .phst-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
    .phst-card-price { font-size: .95rem; font-weight: 900; color: #e8736a; }
    .phst-card-owned {
      font-size: .73rem; font-weight: 800; color: #1d9a6c;
      background: rgba(34,192,132,.14); border: 1px solid rgba(34,192,132,.4);
      border-radius: 6px; padding: 3px 9px;
    }
    .phst-card-buy {
      font-size: .8rem; font-weight: 800; color: #fff;
      background: linear-gradient(120deg,#2bb8d8 0%,#1f8fcf 100%);
      border: none; border-radius: 8px; padding: 6px 15px; cursor: pointer;
      box-shadow: 0 2px 8px rgba(31,143,207,.3);
      transition: filter .12s, transform .1s;
    }
    .phst-card-buy:hover { filter: brightness(1.08); transform: translateY(-1px); }

    /* Seasonal — Coming Soon teaser cards */
    .phst-card.phst-seasonal { position: relative; }
    .phst-seasonal .phst-card-img-wrap { position: relative; overflow: hidden; }
    .phst-seasonal .phst-card-img { filter: saturate(.7) brightness(.82); }
    .phst-seasonal .phst-card-img-wrap::after {
      content: ""; position: absolute; inset: 0;
      background: linear-gradient(120deg, rgba(120,150,220,.45), rgba(150,120,200,.35));
    }
    .phst-season-ribbon {
      position: absolute; top: 10px; right: -28px;
      transform: rotate(38deg);
      background: linear-gradient(120deg,#ffb347,#ff8f6b);
      color: #fff; font-size: .62rem; font-weight: 900; letter-spacing: .5px;
      padding: 3px 34px; box-shadow: 0 2px 8px rgba(200,90,40,.3); z-index: 2;
    }
    .phst-season-lock {
      position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
      font-size: 2rem; z-index: 2; text-shadow: 0 2px 8px rgba(0,0,0,.35);
    }
    .phst-seasonal .phst-card-buy {
      background: rgba(120,140,180,.35); color: #fff; cursor: default;
      box-shadow: none;
    }
    .phst-seasonal .phst-card-buy:hover { filter: none; transform: none; }

    /* Purchase modal (light frosted ocean) */
    #phst-modal {
      position: fixed; inset: 0; z-index: 9200;
      background: rgba(8,40,70,.55); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
      display: none; align-items: center; justify-content: center;
    }
    #phst-modal.open { display: flex; }
    #phst-modal-box {
      background: linear-gradient(165deg, rgba(238,250,255,.97) 0%, rgba(224,244,255,.97) 60%, rgba(244,236,255,.97) 100%);
      border: 1px solid rgba(120,200,235,.6); border-radius: 20px;
      padding: 26px 28px; max-width: 420px; width: 92%;
      box-shadow: 0 24px 70px rgba(10,50,90,.4);
      animation: phstFadeIn .2s ease;
    }
    @keyframes phstFadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
    #phst-modal-close {
      float: right; background: none; border: none; color: #6a92b5;
      font-size: 18px; cursor: pointer; line-height: 1; margin: -4px -4px 0 0;
    }
    #phst-modal-close:hover { color: #1a5a90; }
    #phst-modal-preview { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; margin: 14px 0 12px; display: block; box-shadow: 0 4px 16px rgba(30,110,160,.2); }
    #phst-modal-name { font-size: 1.15rem; font-weight: 900; color: #11588f; margin: 0 0 4px; }
    #phst-modal-price { font-size: 1.7rem; font-weight: 900; color: #e8736a; margin: 0 0 14px; }
    #phst-modal-info { font-size: .82rem; color: #5b82a3; line-height: 1.55; margin-bottom: 14px; }
    .phst-modal-code-row { display: flex; gap: 8px; margin-top: 10px; }
    .phst-modal-code-row input {
      flex: 1; font-size: 1rem; font-weight: 800; background: rgba(255,255,255,.85);
      border: 1px solid rgba(120,180,215,.5); color: #2a4a66; border-radius: 9px;
      padding: 9px 10px; letter-spacing: 3px; text-align: center;
    }
    .phst-modal-code-row input:focus { outline: none; border-color: #2bb8d8; box-shadow: 0 0 0 3px rgba(43,184,216,.18); }
    .phst-modal-redeem-btn {
      background: linear-gradient(120deg,#2bb8d8 0%,#1f8fcf 100%);
      color: #fff; font-size: .85rem; font-weight: 800;
      border: none; border-radius: 9px; padding: 9px 16px; cursor: pointer;
      white-space: nowrap;
    }
    .phst-modal-redeem-btn:hover { filter: brightness(1.08); }
    #phst-modal-msg { font-size: .8rem; font-weight: 700; margin-top: 8px; min-height: 1.2em; }
    #phst-modal-msg.ok  { color: #1d9a6c; }
    #phst-modal-msg.err { color: #d6526a; }

    /* Daily Streak — section at bottom of nav card, no separate card bg */
    .ph-sidebar-streak {
      margin-top: 8px;
      padding-top: 10px;
      border-top: 1px solid rgba(100,170,220,.22);
    }
    .ph-ss-header {
      font-family: "Cinzel", serif;
      font-size: .92rem;
      font-weight: 900;
      color: #1558b0;
      text-align: center;
      letter-spacing: .5px;
      margin-bottom: 2px;
    }
    .ph-ss-sub {
      text-align: center;
      font-size: .75rem;
      color: #5a86b0;
      font-weight: 600;
      margin-bottom: 8px;
    }
    .ph-ss-main {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      margin-bottom: 10px;
    }
    .ph-ss-icon { font-size: 2.4rem; line-height: 1; margin-bottom: 4px; display:flex; align-items:center; justify-content:center; }
    .ph-ss-star-img { width: 52px; height: 52px; object-fit: contain; display: block; filter: drop-shadow(0 2px 6px rgba(200,40,100,.25)); }
    .ph-ss-days {
      font-size: 2.6rem;
      font-weight: 900;
      color: #0f4080;
      line-height: 1;
    }
    .ph-ss-label { font-size: .8rem; color: #4a7aaa; font-weight: 600; margin-top: 4px; }
    .ph-ss-week {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 3px;
      margin-bottom: 10px;
      padding: 0 2px;
    }
    .ph-ss-day-col {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
      min-width: 0;
    }
    .ph-ss-day-lbl { font-size: .66rem; font-weight: 700; color: #6a96bb; }
    .ph-ss-dot {
      width: 100%; max-width: 24px; aspect-ratio: 1 / 1; height: auto;
      border-radius: 50%;
      background: rgba(130,190,230,.2);
      border: 1.5px solid rgba(100,170,220,.3);
      box-sizing: border-box;
    }
    .ph-ss-dot.done {
      background: linear-gradient(135deg, #2ea8ea, #1a77c9);
      border-color: #1a77c9;
    }
    .ph-ss-dot.today {
      background: linear-gradient(135deg, #22d8f8, #1a9ad7);
      border-color: #22d8f8;
      box-shadow: 0 0 8px rgba(34,216,248,.5);
    }
    .ph-ss-xp {
      background: rgba(200,240,255,.55);
      border-radius: 12px;
      padding: 10px 13px;
      margin-bottom: 10px;
      display: flex;
      flex-direction: column;
      gap: 7px;
    }
    .ph-ss-xp-row { display: flex; flex-direction: column; gap: 1px; }
    .ph-ss-xp-lbl { font-size: .76rem; font-weight: 700; color: #4a7aaa; }
    .ph-ss-xp-val { font-size: 1.05rem; font-weight: 900; color: #1a9ad7; line-height: 1.1; }
    .ph-ss-btn {
      width: 100%;
      padding: 11px;
      border-radius: 12px;
      border: 1px solid rgba(100,180,225,.45);
      background: rgba(255,255,255,.55);
      color: #2272b6;
      font-size: .88rem;
      font-weight: 700;
      cursor: pointer;
      font-family: "Nunito", sans-serif;
      transition: background .15s;
    }
    .ph-ss-btn:hover { background: rgba(255,255,255,.8); }

    /* ── Mobile / tablet (< 1100px): show the REAL side menu ──────────
       The hamburger + bell top bar is gone. Instead the full sidebar
       (logo + navigation + Daily Streak) renders as a card stacked on
       top of the content — the same parts as the desktop simulation,
       just laid out to fit an iPhone / iPad / Android screen (scroll for
       more). Desktop (≥1100px) keeps the left-hand sidebar via the
       min-width:1100px block above; its #auth-stats-lobby-scoped rules
       out-rank these plain-class rules, so this only affects mobile. */
    .ph-sidebar {
      display: flex;
      flex-direction: column;
      width: 100%;
      max-width: 1170px;
      margin: 14px auto 2px;
      padding: 0 12px;
      box-sizing: border-box;
      position: static;
      z-index: 5;
    }
    .ph-sidebar-nav-card {
      background: rgba(248,253,255,.94);
      -webkit-backdrop-filter: blur(18px);
      backdrop-filter: blur(18px);
      border: 1px solid rgba(140,200,235,.5);
      border-radius: 22px;
      box-shadow: 0 8px 32px rgba(0,60,120,.12);
      padding: 14px 16px 12px;
      display: flex;
      flex-direction: column;
    }

    /* ── Narrow phones (≤560px): stack the profile card into one column so
       the avatar, XP/streak chips, level, banner and Sign-Out never run off
       the right edge on an iPhone / Android. ID-scoped so it beats the
       desktop-fidelity grid rules regardless of source order. */
    @media (max-width: 560px) {
      #auth-stats-lobby .ph-profile-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 12px;
      }
      #auth-stats-lobby .ph-avatar { width: 92px; height: 92px; }
      #auth-stats-lobby .ph-pinfo { width: 100%; min-width: 0; }
      #auth-stats-lobby .ph-pname-row,
      #auth-stats-lobby .ph-pmeta2 { justify-content: center; flex-wrap: wrap; }
      #auth-stats-lobby .ph-pranks,
      #auth-stats-lobby .ph-alpha-banner,
      #auth-stats-lobby #stats-lobby-signed-actions {
        width: 100%;
        grid-column: 1 / -1;
      }
      #auth-stats-lobby #stats-lobby-signed-actions { justify-content: center; }
    }

    @media (max-width: 1180px) {
      .ph-main { grid-template-columns: 1fr; }
      .ph-profile-card {
        grid-template-columns: auto minmax(180px, 1fr);
        gap: 14px;
      }
      .ph-alpha-banner {
        grid-column: 1 / -1;
        width: 100%;
        align-self: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 14px;
      }
      .ph-pranks {
        grid-column: 1 / -1;
        max-width: none;
      }
      #stats-lobby-signed-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
      }
    }
    @media (max-width: 860px) {
      .ph-coral { display: none; }
      .ph-topbar-title::before,
      .ph-topbar-title::after { display: none; }
      .ph-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .ph-sg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .ph-tab { font-size: .92rem; }
      .ph-rg { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
      .ph-rg-date { grid-column: 2 / -1; justify-self: end; }
    }
    @media (max-width: 560px) {
      .ph-topbar { padding: 14px 10px 8px; }
      .ph-icon-btn { width: 42px; height: 42px; }
      .ph-wrap { padding: 2px 10px 44px; }
      .ph-profile-card { padding: 14px; border-radius: 20px; }
      .ph-avatar { width: 78px; height: 78px; }
      #stats-avatar-letter { font-size: 28px; }
      .ph-pname { font-size: 1.38rem; }
      .ph-pfc { font-size: .92rem; }
      .ph-pranks { grid-template-columns: 1fr; }
      .ph-rank-badge { border-right: none; border-top: 1px solid #d8e7f4; }
      .ph-rank-badge:first-child { border-top: none; }
      .ph-actions { grid-template-columns: 1fr; }
      .ph-sg { grid-template-columns: 1fr; }
      .ph-tabs {
        display: flex;
        overflow-x: auto;
      }
      .ph-tab {
        flex: 0 0 auto;
        min-width: 116px;
      }
      .ph-rg,
      .ph-fr {
        padding: 10px 12px;
      }
      .ph-rg {
        grid-template-columns: auto minmax(0, 1fr) auto;
      }
      .ph-rg-pts,
      .ph-rg-date {
        grid-column: 2 / -1;
        justify-self: end;
      }
    }

    /* Screenshot Fidelity Override (post-login home screen only) */
    #auth-stats-lobby {
      background:
        radial-gradient(circle at 16% 10%, rgba(255,255,255,.34) 0%, rgba(255,255,255,0) 38%),
        radial-gradient(circle at 84% 18%, rgba(190,231,255,.36) 0%, rgba(190,231,255,0) 42%),
        linear-gradient(180deg, #b6e9fa 0%, #daf4ff 45%, #c8ecfb 100%);
    }
    #auth-stats-lobby::before {
      content: none;
    }
    #auth-stats-lobby::after {
      content: none;
    }
    /* ── Overview: ocean reef illustration background ── */
    #auth-stats-lobby[data-bg-tab="overview"] {
      background: url("/multiplayer/client/ph-bg-overview-art.png") center center / cover no-repeat !important;
    }
    #auth-stats-lobby[data-bg-tab="overview"]::before,
    #auth-stats-lobby[data-bg-tab="overview"]::after {
      content: none !important;
    }
    /* Cards — frosted sea glass over the ocean art */
    #auth-stats-lobby[data-bg-tab="overview"] .ph-profile-card,
    #auth-stats-lobby[data-bg-tab="overview"] .ph-stats-card,
    #auth-stats-lobby[data-bg-tab="overview"] .ph-scard {
      background: rgba(220,245,255,0.68) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(120,200,235,0.50) !important;
      box-shadow: 0 6px 28px rgba(0,60,120,0.14) !important;
    }
    /* Nav tabs bar */
    #auth-stats-lobby[data-bg-tab="overview"] .ph-tabs {
      background: rgba(210,242,255,0.70) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(120,200,235,0.45) !important;
      box-shadow: 0 4px 18px rgba(0,60,120,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="overview"] .ph-tab.active {
      background: rgba(240,252,255,0.90) !important;
    }
    /* Action cards keep their vibrant gradient — no glassmorphism override */
    #auth-stats-lobby[data-bg-tab="overview"] .ph-action-card {
      box-shadow: 0 8px 30px rgba(0,30,80,.22) !important;
    }
    /* Stat grid container — nearly invisible so art shows between cells */
    #auth-stats-lobby[data-bg-tab="overview"] .ph-sg {
      background: rgba(160,225,255,0.08) !important;
    }
    /* Individual stat cells */
    #auth-stats-lobby[data-bg-tab="overview"] .ph-sc {
      background: rgba(230,250,255,0.72) !important;
    }
    /* Section header */
    #auth-stats-lobby[data-bg-tab="overview"] .ph-sh {
      background: rgba(215,245,255,0.75) !important;
    }
    /* Topbar: fully transparent so ocean art shows through */
    #auth-stats-lobby[data-bg-tab="overview"] .ph-topbar {
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* ── Casual tab: soft seafoam green ── */
    /* ── Casual tab: beachside pier illustration ── */
    #auth-stats-lobby[data-bg-tab="normal"] {
      background: url("/multiplayer/client/ph-bg-casual-art.png") center center / cover no-repeat !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"]::before,
    #auth-stats-lobby[data-bg-tab="normal"]::after {
      content: none !important;
    }
    /* Cards — warm sandy-cream frosted glass matching the pier's peach tones */
    #auth-stats-lobby[data-bg-tab="normal"] .ph-profile-card,
    #auth-stats-lobby[data-bg-tab="normal"] .ph-stats-card,
    #auth-stats-lobby[data-bg-tab="normal"] .ph-scard {
      background: rgba(255,244,228,0.80) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(200,170,130,0.45) !important;
      box-shadow: 0 6px 28px rgba(80,50,20,0.14) !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"] .ph-tabs {
      background: rgba(255,242,220,0.78) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(200,170,130,0.40) !important;
      box-shadow: 0 4px 18px rgba(80,50,20,0.12) !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"] .ph-tab.active {
      background: rgba(255,252,244,0.94) !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"] .ph-action-card {
      background: rgba(255,244,228,0.78) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(200,170,130,0.45) !important;
      box-shadow: 0 4px 18px rgba(80,50,20,0.12) !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"] .ph-action-card.ph-action-gold {
      background: rgba(255,242,200,0.84) !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"] .ph-sg {
      background: rgba(200,160,100,0.08) !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"] .ph-sc {
      background: rgba(255,247,234,0.80) !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"] .ph-sh {
      background: rgba(255,244,228,0.80) !important;
    }
    #auth-stats-lobby[data-bg-tab="normal"] .ph-topbar {
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* ── Competitive tab: deep navy / golden ── */
    /* ── Competitive tab: iceberg deep-ocean illustration ── */
    #auth-stats-lobby[data-bg-tab="competitive"] {
      background: url("/multiplayer/client/ph-bg-competitive-art.png") center center / cover no-repeat !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"]::before,
    #auth-stats-lobby[data-bg-tab="competitive"]::after {
      content: none !important;
    }
    /* Cards — icy blue frosted glass; enough opacity for dark text on mid-blue bg */
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-profile-card,
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-stats-card,
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-scard {
      background: rgba(215,235,255,0.80) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(100,160,240,0.45) !important;
      box-shadow: 0 6px 28px rgba(20,40,120,0.20) !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-tabs {
      background: rgba(210,232,255,0.78) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(100,160,240,0.40) !important;
      box-shadow: 0 4px 18px rgba(20,40,120,0.16) !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-tab.active {
      background: rgba(238,248,255,0.94) !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-action-card {
      background: rgba(215,235,255,0.78) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(100,160,240,0.45) !important;
      box-shadow: 0 4px 18px rgba(20,40,120,0.16) !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-action-card.ph-action-gold {
      background: rgba(255,246,210,0.84) !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-sg {
      background: rgba(100,150,240,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-sc {
      background: rgba(222,240,255,0.80) !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-sh {
      background: rgba(210,232,255,0.80) !important;
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-topbar {
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* ── History tab: warm slate / parchment ── */
    /* ── History tab: deep-sea purple coral illustration ── */
    #auth-stats-lobby[data-bg-tab="history"] {
      background: url("/multiplayer/client/ph-bg-history-art.png") center center / cover no-repeat !important;
    }
    #auth-stats-lobby[data-bg-tab="history"]::before,
    #auth-stats-lobby[data-bg-tab="history"]::after {
      content: none !important;
    }
    /* Cards — light lavender frosted glass so text stays readable on the dark bg */
    #auth-stats-lobby[data-bg-tab="history"] .ph-profile-card,
    #auth-stats-lobby[data-bg-tab="history"] .ph-stats-card,
    #auth-stats-lobby[data-bg-tab="history"] .ph-scard {
      background: rgba(220,210,255,0.80) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(160,120,255,0.45) !important;
      box-shadow: 0 6px 28px rgba(30,0,80,0.25) !important;
    }
    #auth-stats-lobby[data-bg-tab="history"] .ph-tabs {
      background: rgba(215,205,255,0.78) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(160,120,255,0.40) !important;
      box-shadow: 0 4px 18px rgba(30,0,80,0.20) !important;
    }
    #auth-stats-lobby[data-bg-tab="history"] .ph-tab.active {
      background: rgba(240,235,255,0.92) !important;
    }
    #auth-stats-lobby[data-bg-tab="history"] .ph-action-card {
      background: rgba(220,210,255,0.78) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(160,120,255,0.45) !important;
      box-shadow: 0 4px 18px rgba(30,0,80,0.20) !important;
    }
    #auth-stats-lobby[data-bg-tab="history"] .ph-action-card.ph-action-gold {
      background: rgba(255,245,200,0.82) !important;
    }
    #auth-stats-lobby[data-bg-tab="history"] .ph-sg {
      background: rgba(120,80,220,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="history"] .ph-sc {
      background: rgba(228,220,255,0.80) !important;
    }
    #auth-stats-lobby[data-bg-tab="history"] .ph-sh {
      background: rgba(218,210,255,0.78) !important;
    }
    #auth-stats-lobby[data-bg-tab="history"] .ph-topbar {
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* ── Friends tab: warm coral / social ── */
    /* ── Friends tab: underwater seaweed illustration ── */
    #auth-stats-lobby[data-bg-tab="friends"] {
      background: url("/multiplayer/client/ph-bg-friends-art.png") center center / cover no-repeat !important;
    }
    #auth-stats-lobby[data-bg-tab="friends"]::before,
    #auth-stats-lobby[data-bg-tab="friends"]::after {
      content: none !important;
    }
    /* Cards — frosted glass tinted to the green/teal underwater palette */
    #auth-stats-lobby[data-bg-tab="friends"] .ph-profile-card,
    #auth-stats-lobby[data-bg-tab="friends"] .ph-stats-card,
    #auth-stats-lobby[data-bg-tab="friends"] .ph-scard {
      background: rgba(215,248,235,0.68) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(80,190,160,0.45) !important;
      box-shadow: 0 6px 28px rgba(0,80,60,0.13) !important;
    }
    #auth-stats-lobby[data-bg-tab="friends"] .ph-tabs {
      background: rgba(210,248,232,0.70) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(80,190,160,0.40) !important;
      box-shadow: 0 4px 18px rgba(0,80,60,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="friends"] .ph-tab.active {
      background: rgba(235,255,245,0.90) !important;
    }
    #auth-stats-lobby[data-bg-tab="friends"] .ph-action-card {
      background: rgba(215,248,235,0.68) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(80,190,160,0.45) !important;
      box-shadow: 0 4px 18px rgba(0,80,60,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="friends"] .ph-sg {
      background: rgba(140,220,195,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="friends"] .ph-sc {
      background: rgba(225,252,240,0.72) !important;
    }
    #auth-stats-lobby[data-bg-tab="friends"] .ph-sh {
      background: rgba(210,248,232,0.75) !important;
    }
    #auth-stats-lobby[data-bg-tab="friends"] .ph-topbar {
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* ── Achievements tab: gold / trophy ── */
    /* ── Achievements tab: vibrant coral reef illustration ── */
    #auth-stats-lobby[data-bg-tab="achievements"] {
      background: url("/multiplayer/client/ph-bg-achievements-art.png") center center / cover no-repeat !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"]::before,
    #auth-stats-lobby[data-bg-tab="achievements"]::after {
      content: none !important;
    }
    /* Cards — crisp white-cyan frosted glass over the vivid coral scene */
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-profile-card,
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-stats-card,
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-scard {
      background: rgba(225,250,255,0.74) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(80,210,230,0.45) !important;
      box-shadow: 0 6px 28px rgba(0,80,120,0.14) !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-tabs {
      background: rgba(215,248,255,0.74) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(80,210,230,0.40) !important;
      box-shadow: 0 4px 18px rgba(0,80,120,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-tab.active {
      background: rgba(240,254,255,0.92) !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-action-card {
      background: rgba(225,250,255,0.74) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(80,210,230,0.45) !important;
      box-shadow: 0 4px 18px rgba(0,80,120,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-action-card.ph-action-gold {
      background: rgba(255,246,210,0.80) !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-sg {
      background: rgba(100,220,240,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-sc {
      background: rgba(230,252,255,0.76) !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-sh {
      background: rgba(218,250,255,0.78) !important;
    }
    #auth-stats-lobby[data-bg-tab="achievements"] .ph-topbar {
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* ── Leaderboard tab: pastel tide pool illustration ── */
    #auth-stats-lobby[data-bg-tab="leaderboard"] {
      background: url("/multiplayer/client/leaderboard-bg.jpg") center center / cover no-repeat !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"]::before,
    #auth-stats-lobby[data-bg-tab="leaderboard"]::after {
      content: none !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-profile-card,
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-stats-card,
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-scard {
      background: rgba(225,248,255,0.78) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(100,200,220,0.45) !important;
      box-shadow: 0 6px 28px rgba(0,80,120,0.14) !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-tabs {
      background: rgba(215,246,255,0.78) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(100,200,220,0.40) !important;
      box-shadow: 0 4px 18px rgba(0,80,120,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-tab.active {
      background: rgba(240,252,255,0.94) !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-action-card {
      background: rgba(225,248,255,0.78) !important;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(100,200,220,0.45) !important;
      box-shadow: 0 4px 18px rgba(0,80,120,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-action-card.ph-action-gold {
      background: rgba(255,248,220,0.82) !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-sg {
      background: rgba(100,210,230,0.08) !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-sc {
      background: rgba(220,248,255,0.80) !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-sh {
      background: rgba(210,246,255,0.82) !important;
    }
    #auth-stats-lobby[data-bg-tab="leaderboard"] .ph-topbar {
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* ── Store tab: coral-reef scene background ── */
    #auth-stats-lobby[data-bg-tab="store"] {
      background:
        url("/multiplayer/client/store-bg.png") center center / cover no-repeat,
        linear-gradient(160deg, #aee9f5 0%, #bfe6ff 40%, #e6d9f7 100%) !important;
    }
    #auth-stats-lobby[data-bg-tab="store"]::before,
    #auth-stats-lobby[data-bg-tab="store"]::after {
      content: none !important;
    }
    /* Cards — frosted glass tinted to the turquoise/coral/lavender palette */
    #auth-stats-lobby[data-bg-tab="store"] .ph-profile-card,
    #auth-stats-lobby[data-bg-tab="store"] .ph-stats-card,
    #auth-stats-lobby[data-bg-tab="store"] .ph-scard {
      background: rgba(228,248,255,0.72) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(120,205,235,0.5) !important;
      box-shadow: 0 6px 30px rgba(20,90,140,0.16) !important;
    }
    #auth-stats-lobby[data-bg-tab="store"] .ph-tabs {
      background: rgba(222,246,255,0.74) !important;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(120,205,235,0.42) !important;
      box-shadow: 0 4px 18px rgba(20,90,140,0.10) !important;
    }
    #auth-stats-lobby[data-bg-tab="store"] .ph-tab.active {
      background: rgba(240,252,255,0.92) !important;
    }
    #auth-stats-lobby[data-bg-tab="store"] .ph-sh {
      background: rgba(222,246,255,0.78) !important;
    }
    #auth-stats-lobby[data-bg-tab="store"] .ph-topbar {
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* ── Action cards stay COLORFUL on every tab (consistent everywhere) ──
       Placed after all per-tab overrides so these win the !important ties.
       Each tab used to repaint these cards as frosted glass; we force the
       blue / red / green / purple identity to match the reference on all
       pages (Overview, Casual, Competitive, History, Friends, Achievements,
       Leaderboard). */
    #auth-stats-lobby[data-bg-tab] .ph-action-card {
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
      border: none !important;
      box-shadow: 0 8px 26px rgba(0,45,110,.20), inset 0 1px 0 rgba(255,255,255,.18) !important;
    }
    #auth-stats-lobby[data-bg-tab] .ph-action-card:nth-child(1) { background: linear-gradient(145deg, #6fd6f2 0%, #2cb4e6 38%, #1583c9 72%, #0f63a4 100%) !important; }
    #auth-stats-lobby[data-bg-tab] .ph-action-card:nth-child(2) { background: linear-gradient(145deg, #ff8b78 0%, #f24f49 38%, #d62f2e 72%, #ad2024 100%) !important; }
    #auth-stats-lobby[data-bg-tab] .ph-action-card:nth-child(3) { background: linear-gradient(145deg, #b2d965 0%, #82b837 38%, #5d9627 72%, #437a16 100%) !important; }
    #auth-stats-lobby[data-bg-tab] .ph-action-card:nth-child(4) { background: linear-gradient(145deg, #cb9af2 0%, #9d5fdd 38%, #7c3fc4 72%, #592a9c 100%) !important; }

    #ph-panel-friends .ph-scard {
      background: rgba(250,253,255,.95);
      border: 1px solid #c8ddec;
      box-shadow: 0 5px 16px rgba(44,111,166,.09);
    }
    #ph-panel-friends .pv-input {
      height: 44px;
      border-radius: 12px;
      border: 1px solid #bdd6ea;
      background: #ffffff;
      color: #1b4679;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
      font-family: "Nunito", sans-serif;
    }
    #ph-panel-friends .pv-input::placeholder {
      color: #7793b0;
    }
    #ph-panel-friends #ph-add-friend-btn {
      height: 44px;
      padding: 0 16px;
      border-radius: 12px;
      border: 1px solid #79afe0;
      background: linear-gradient(135deg, #2c8ce7 0%, #1e71d4 100%);
      color: #f7fbff;
      font-size: .94rem;
      font-weight: 800;
      font-family: "Nunito", sans-serif;
    }
    #ph-panel-friends #ph-friends-list {
      max-height: 420px;
      overflow-y: auto;
      padding: 2px 10px 12px;
    }
    #ph-panel-friends .ph-fr {
      border: 1px solid #dbe9f4;
      border-radius: 14px;
      background: #fff;
      box-shadow: 0 1px 0 rgba(255,255,255,.8);
      margin-top: 10px;
      padding: 10px 12px;
      border-top-color: #dbe9f4;
    }
    #ph-panel-friends .ph-empty {
      padding: 18px 12px;
    }
    .ph-coral { display: none; }
    .ph-topbar {
      padding: 12px 20px 10px;
      backdrop-filter: none;
    }
    .ph-icon-btn {
      width: 52px;
      height: 52px;
      border-radius: 13px;
      border: 1px solid #c4dded;
      background: rgba(249,253,255,.98);
      box-shadow: 0 4px 14px rgba(58,126,184,.12);
    }
    .ph-icon-btn svg rect,
    .ph-icon-btn svg path {
      fill: #1f4d92;
      stroke: #1f4d92;
    }
    .ph-topbar-title {
      font-size: clamp(1.78rem, 3.2vw, 3.18rem);
      color: #1a4ca6;
      letter-spacing: 1.1px;
      line-height: 1.02;
      text-shadow: 0 1px 0 rgba(255,255,255,.88);
    }
    .ph-topbar-title::before,
    .ph-topbar-title::after {
      color: #2fa9ee;
      opacity: .86;
    }
    .ph-wrap {
      max-width: 1170px;
      padding: 2px 18px 32px;
      gap: 12px;
    }
    .ph-profile-card,
    #ph-tabs,
    .ph-actions,
    #stats-join-row,
    .ph-panel {
      width: 100%;
    }
    .ph-profile-card { order: 1; }
    #ph-tabs { order: 2; }
    .ph-actions { order: 3; }
    #stats-join-row { order: 4; }
    .ph-panel { order: 5; }
    #stats-guest-notice { display: none !important; }
    .ph-footer { display: none !important; }

    .ph-profile-card {
      grid-template-columns: 132px minmax(200px, 1fr) auto minmax(340px, 430px) auto;
      gap: 21px;
      padding: 17px 22px;
      border-radius: 23px;
      border: 1px solid #cadfed;
      box-shadow: 0 5px 16px rgba(44,111,166,.09);
      background: rgba(250,253,255,.94);
    }
    .ph-avatar {
      width: 116px;
      height: 116px;
      border-width: 3px;
      box-shadow: 0 0 0 2px #66b2e6, 0 5px 14px rgba(43,113,177,.18);
    }
    .ph-pname {
      font-size: clamp(1.85rem, 2.45vw, 2.9rem);
      line-height: 1.04;
      color: #0f346f;
      font-weight: 900;
    }
    .ph-verified {
      width: 27px;
      height: 27px;
    }
    .ph-name-meta {
      gap: 6px;
    }
    .ph-name-chip {
      font-size: .74rem;
      padding: 4px 8px;
    }
    .ph-pfc {
      font-size: 1.01rem;
      margin-top: 5px;
      color: #2f6eba;
      font-weight: 700;
    }
    .ph-pranks {
      min-height: 82px;
      border-radius: 14px;
      border: 1px solid #c9ddef;
      background: #fbfdff;
    }
    .ph-rank-badge {
      padding: 11px 13px;
    }
    .ph-rank-badge.ph-rank-level { color: #145fb4; }
    .ph-rank-type {
      font-size: .96rem;
      font-weight: 800;
      gap: 7px;
    }
    .ph-rank-type svg {
      width: 24px;
      height: 24px;
    }
    .ph-rank-val {
      margin-top: 2px;
      font-size: .98rem;
      color: #2e4e73;
      font-weight: 700;
    }
    .ph-level-xp-wrap {
      margin-top: 6px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .ph-level-xp-bar {
      width: 100%;
      height: 6px;
      border-radius: 999px;
      background: #dfebf6;
      overflow: hidden;
    }
    .ph-level-xp-fill {
      width: 68%;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, #34a5f3 0%, #1f79df 100%);
    }
    .ph-level-xp-text {
      font-size: .78rem;
      color: #5f7f9f;
      font-weight: 700;
      line-height: 1;
    }
    #stats-lobby-signed-actions {
      justify-content: flex-end;
      align-self: center;
    }
    .ph-signout-btn {
      height: 44px;
      min-width: 130px;
      border-radius: 12px;
      border: 1px solid #bcd5e7;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
      font-size: 1rem;
      padding: 0 20px;
      color: #285596;
      background: #fafdff;
    }
    /* Header Total XP + Streak chips */
    .ph-pmeta2 {
      display: flex; gap: 10px; margin-top: 9px; flex-wrap: wrap;
    }
    .ph-meta-chip {
      display: inline-flex; align-items: center; gap: 8px;
      background: rgba(235,247,255,.85);
      border: 1px solid #c5dbef;
      border-radius: 12px;
      padding: 6px 12px 6px 10px;
    }
    .ph-meta-chip-ico { font-size: 1.05rem; line-height: 1; }
    .ph-meta-chip-txt { display: flex; flex-direction: column; line-height: 1.1; }
    .ph-meta-chip-lbl { font-size: .66rem; font-weight: 700; color: #6a93bd; }
    .ph-meta-chip-val { font-size: .98rem; font-weight: 900; color: #16407e; }
    /* Bigger, more visible XP progress bar (desktop) */
    .ph-level-xp-bar { height: 11px !important; box-shadow: inset 0 1px 2px rgba(40,90,150,.12); }
    .ph-level-xp-fill { transition: width .55s cubic-bezier(.4,0,.2,1); box-shadow: 0 0 8px rgba(52,165,243,.5); }
    .ph-level-xp-text { font-size: .86rem !important; }
    /* Message button badge */
    .msg-badge {
      position: absolute; top: -5px; right: -5px;
      min-width: 18px; height: 18px; padding: 0 5px;
      border-radius: 9px; background: #e8404f; color: #fff;
      font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
      box-shadow: 0 1px 4px rgba(180,30,50,.5); border: 1.5px solid #fff;
    }

    .ph-tabs {
      border-radius: 20px;
      border: 1px solid #cdddea;
      box-shadow: 0 5px 14px rgba(44,111,166,.08);
      background: rgba(250,253,255,.93);
    }
    .ph-tab {
      min-height: 54px;
      padding: 10px 8px;
      font-size: .98rem;
      color: #294d7e;
      border-right: 1px solid #d8e6f2;
      border-bottom: 3px solid transparent;
      font-weight: 700;
    }
    .ph-tab.active {
      color: #1a66be;
      border-bottom-color: #2f87e8;
      background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(247,251,255,1) 100%);
      box-shadow: inset 0 -1px 0 #d8e6f2;
    }
    .ph-tab svg { flex-shrink: 0; }
    /* Achievements tab is visible in nav */

    .ph-actions {
      gap: 11px;
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .ph-action-card {
      min-height: 74px;
      border-radius: 18px;
      border: 1px solid #b8d7ec;
      box-shadow: 0 4px 12px rgba(44,111,166,.08);
      background: rgba(250,253,255,.95);
      padding: 10px 16px;
      gap: 11px;
    }
    .ph-action-card.ph-action-gold {
      border-color: #e8cf9c;
      background: linear-gradient(180deg, rgba(255,253,248,.95) 0%, rgba(255,247,227,.95) 100%);
    }
    .ph-action-icon {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: 1px solid #c3dbed;
      background: #f4fbff;
    }
    .ph-ai-blue { border-color: #9bc6ea; background: #edf7ff; }
    .ph-ai-green { border-color: #9bc6ea; background: #edf7ff; }
    .ph-ai-teal { border-color: #b8e5df; background: #edfdfa; }
    .ph-ai-gold { border-color: #f0d9ab; background: #fff8e8; }
    .ph-action-label {
      font-size: 1.02rem;
      font-weight: 800;
      color: #1860b8;
      line-height: 1.1;
    }
    .ph-action-sub {
      margin-top: 2px;
      font-size: .9rem;
      color: #3f6f99;
      font-weight: 600;
    }
    .ph-action-sub:empty { display: none; }

    .ph-main {
      grid-template-columns: minmax(0, 1fr) 420px;
      gap: 12px;
    }
    .ph-side {
      gap: 12px;
    }
    #stats-normal-block .ph-stats-card {
      min-height: 432px;
    }
    #stats-normal-block .ph-side > .ph-scard:first-child {
      min-height: 239px;
    }
    #stats-friends-mini {
      min-height: 181px;
    }
    .ph-stats-card,
    .ph-scard {
      border-radius: 20px;
      border: 1px solid #c8ddec;
      box-shadow: 0 5px 16px rgba(44,111,166,.09);
      background: rgba(250,253,255,.95);
    }
    .ph-stats-top {
      padding: 13px 18px 8px;
      border-bottom: none;
    }
    .ph-stats-title {
      font-size: 1.58rem;
      font-weight: 800;
      color: #154b98;
      gap: 10px;
    }
    .ph-pcounts {
      border-radius: 14px;
      border: 1px solid #caddee;
      background: #f8fbff;
      overflow: hidden;
      display: grid;
      grid-template-columns: repeat(7, minmax(0, 1fr));
      gap: 1px;
      flex: 1 1 540px;
      min-width: 0;
      max-width: 560px;
    }
    .ph-pc {
      box-sizing: border-box;
      border-right: none;
      min-width: 0;
      width: 100%;
      height: 41px;
      font-size: .98rem;
      font-weight: 700;
      color: #4c6788;
      background: #f8fbff;
      padding-left: 0;
      padding-right: 0;
    }
    .ph-pc.active {
      background: linear-gradient(180deg, #3f95f4 0%, #2a7ee5 100%);
      color: #fff;
    }

    @media (max-width: 1360px) {
      .ph-stats-top {
        flex-wrap: wrap;
      }
      .ph-pcounts {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
      }
      .ph-pc {
        min-width: 0;
        width: 100%;
        padding-left: 8px;
        padding-right: 8px;
      }
    }
    @media (max-width: 760px) {
      .ph-pcounts {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
      .ph-pc {
        border-bottom: none;
      }
    }

    .ph-sg {
      gap: 9px;
      padding: 9px 9px 10px;
      background: transparent;
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .ph-sc {
      min-height: 150px;
      border-radius: 16px;
      border: 1px solid #d9e8f4;
      padding: 12px 14px 10px;
      background: #fff;
      box-shadow: 0 1px 0 rgba(255,255,255,.8);
      gap: 8px;
    }
    .ph-sci {
      width: 50px;
      height: 50px;
      font-size: 20px;
      margin-bottom: 1px;
    }
    .ph-scl {
      font-size: .9rem;
      line-height: 1.26;
      color: #244d81;
      font-weight: 700;
    }
    .ph-scv {
      font-size: clamp(2.3rem, 2.7vw, 3rem);
      color: #103a74;
      font-weight: 900;
    }
    .ph-sc-feat .ph-scv { font-size: clamp(2.55rem, 2.9vw, 3.15rem); }
    .ph-scs {
      font-size: .92rem;
      font-weight: 700;
      color: #2c95d1;
    }
    .ph-card-list { gap: 8px; margin-top: 2px; }
    .ph-card-item {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 1rem;
      font-weight: 700;
      color: #1e4a7c;
    }
    .ph-card-g {
      width: 18px;
      text-align: center;
      flex-shrink: 0;
    }

    #ph-panel-overview .ph-main {
      grid-template-columns: minmax(0, 1fr);
      gap: 10px;
      align-items: start;
    }
    #ph-panel-overview .ph-stats-card {
      min-height: 0;
    }
    /* Quick Stats: 5 wide × 3 tall — matches reference image layout */
    #ph-panel-overview .ph-sg {
      grid-template-columns: repeat(5, minmax(0, 1fr));
      grid-auto-rows: 1fr;
      gap: 10px;
      padding: 12px;
    }
    #ph-panel-overview .ph-sc {
      min-height: 100px;
      padding: 12px 14px;
      gap: 5px;
    }
    #ph-panel-overview .ph-sc .ph-scl {
      min-height: 2.45em;
      font-size: .78rem;
    }
    #ph-panel-overview .ph-sci {
      width: 32px;
      height: 32px;
      margin-bottom: 0;
    }
    #ph-panel-overview .ph-sc:not(.ph-sc-string) .ph-scv {
      font-size: clamp(1.45rem, 1.7vw, 2.0rem);
      line-height: 1.02;
    }
    #ph-panel-overview .ph-sc-string .ph-scv {
      font-size: clamp(0.95rem, 1.1vw, 1.2rem);
      line-height: 1.24;
      margin-top: 2px;
      word-break: break-word;
    }
    #ph-panel-overview .ph-sc-string .ph-scs {
      margin-top: 2px;
      color: #6f89a5;
      font-size: .76rem;
      font-weight: 700;
    }
    #ph-panel-overview .ph-side > .ph-scard {
      min-height: 0;
    }
    /* Overview tab profile/avatar sizing */
    #auth-stats-lobby[data-bg-tab="overview"] .ph-profile-card {
      padding: 18px 22px;
    }
    #auth-stats-lobby[data-bg-tab="overview"] .ph-avatar {
      width: 96px;
      height: 96px;
    }
    /* Responsive breakpoints for 5-col grid */
    @media (max-width: 1400px) {
      #ph-panel-overview .ph-sg { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    }
    @media (max-width: 1050px) {
      #ph-panel-overview .ph-sg { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    }
    @media (max-width: 760px) {
      #ph-panel-overview .ph-sg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (max-width: 520px) {
      #ph-panel-overview .ph-sg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }

    /* ── Desktop: enlarge cards to fill the wider layout (matches reference) ── */
    @media (min-width: 1100px) {
      #auth-stats-lobby .ph-sg {
        gap: 14px;
        padding: 16px;
      }
      #auth-stats-lobby #ph-panel-overview .ph-sc {
        min-height: 132px;
        padding: 18px 20px;
        gap: 8px;
        border-radius: 18px;
      }
      #auth-stats-lobby #ph-panel-overview .ph-sci {
        width: 38px;
        height: 38px;
      }
      #auth-stats-lobby #ph-panel-overview .ph-sc .ph-scl {
        font-size: .9rem;
      }
      #auth-stats-lobby #ph-panel-overview .ph-sc:not(.ph-sc-string) .ph-scv {
        font-size: clamp(1.8rem, 1.9vw, 2.3rem);
      }
      #auth-stats-lobby #ph-panel-overview .ph-sc-string .ph-scv {
        font-size: clamp(1.1rem, 1.25vw, 1.4rem);
      }
      /* Action cards — full-height colorful cards on desktop */
      #auth-stats-lobby .ph-actions { gap: 16px; }
      #auth-stats-lobby[data-bg-tab="overview"] .ph-action-card {
        height: 195px;
        padding: 18px 20px 20px;
      }
      /* Profile header — roomier */
      #auth-stats-lobby[data-bg-tab="overview"] .ph-profile-card {
        padding: 22px 28px;
      }
      #auth-stats-lobby[data-bg-tab="overview"] .ph-avatar {
        width: 110px;
        height: 110px;
      }
      /* Quick Stats section title bigger */
      #auth-stats-lobby .ph-stats-title { font-size: 1.4rem; }
      /* Daily challenge strip cards — larger */
      #auth-stats-lobby .ph-cs-cards { gap: 14px; }
    }

    /* ── Casual tab: match Overview's compact wide-grid dimensions ── */
    /* The Casual stats grid was cramped because the base .ph-sg uses
       only 3 columns and 152px-tall cards. We give it the same compact
       layout as the Overview Quick Stats so all stats fit cleanly on
       one screen without scrolling. */
    #ph-panel-normal .ph-main {
      grid-template-columns: minmax(0, 1fr) 380px;
      gap: 12px;
      align-items: start;
    }
    #ph-panel-normal .ph-stats-card { min-height: 0; }
    #ph-panel-normal .ph-sg {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      grid-auto-rows: 1fr;
      gap: 10px;
      padding: 10px;
    }
    #ph-panel-normal .ph-sc {
      min-height: 110px;
      padding: 12px 14px;
    }
    #ph-panel-normal .ph-sc .ph-scl { min-height: 2.45em; }
    #ph-panel-normal .ph-sc:not(.ph-sc-string) .ph-scv {
      font-size: clamp(1.7rem, 2.2vw, 2.5rem);
      line-height: 1.02;
    }
    #ph-panel-normal .ph-sc-string .ph-scv {
      font-size: clamp(1.05rem, 1.3vw, 1.45rem);
      line-height: 1.24;
      margin-top: 2px;
      word-break: break-word;
    }
    #ph-panel-normal .ph-side > .ph-scard { min-height: 0; }
    /* Compact side cards so the whole Casual layout fits one screen */
    #ph-panel-normal .ph-side .ph-sh {
      padding: 10px 14px;
    }
    #ph-panel-normal .ph-side .ph-rg,
    #ph-panel-normal .ph-side .ph-fr {
      padding: 8px 12px;
    }
    /* On narrower screens, drop the side panel below the stats card */
    @media (max-width: 1100px) {
      #ph-panel-normal .ph-main { grid-template-columns: minmax(0, 1fr); }
    }
    @media (max-width: 720px) {
      #ph-panel-normal .ph-sg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }

    #stat-normal-pie,
    #stat-comp-pie {
      display: none !important;
    }

    .ph-sh {
      padding: 12px 18px 8px;
      border-bottom: 1px solid #dce9f4;
      background: rgba(247,252,255,.82);
    }
    .ph-st {
      font-size: 1.42rem;
      font-weight: 800;
      color: #184f9c;
    }
    .ph-sl {
      font-size: .91rem;
      color: #2d78c7;
      font-weight: 700;
    }
    .ph-rg,
    .ph-fr {
      grid-template-columns: auto minmax(0, 1fr) auto auto auto;
      padding: 9px 16px;
      column-gap: 10px;
      border-top: 1px solid #e6eff6;
    }
    .ph-rg-opp,
    .ph-fr-name {
      font-size: .96rem;
      color: #173f70;
      font-weight: 700;
    }
    .ph-fr-meta {
      font-size: .78rem;
      color: #6a89aa;
      font-weight: 700;
    }
    .ph-rg-ico {
      width: 22px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .ph-rg-badge {
      padding: 0;
      border-radius: 0;
      font-size: .92rem;
      font-weight: 700;
      background: transparent;
    }
    .ph-rg-badge.win { color: #29994a; background: transparent; }
    .ph-rg-badge.loss { color: #d45a5a; background: transparent; }
    .ph-rg-badge.draw { color: #7a6800; background: transparent; }
    .ph-rg-pts {
      font-size: .95rem;
      font-weight: 800;
      color: #153c6b;
    }
    .ph-rg-date {
      font-size: .9rem;
      color: #6482a3;
      font-weight: 600;
    }
    .ph-fr {
      grid-template-columns: auto minmax(0, 1fr) auto;
      min-height: 60px;
    }
    .ph-fr-av {
      width: 39px;
      height: 39px;
      border-width: 1px;
    }
    .ph-fr-status {
      font-size: .92rem;
      font-weight: 600;
      gap: 10px;
    }
    .ph-fr-dot {
      width: 10px;
      height: 10px;
    }
    .ph-ach-card .ph-sh {
      padding-bottom: 10px;
    }
    .ph-ach-list {
      display: flex;
      flex-direction: column;
      gap: 0;
      padding: 4px 0;
    }
    .ph-ach-item + .ph-ach-item {
      border-top: 1px solid #e6eff6;
    }
    .ph-ach-summary {
      width: 100%;
      border: none;
      background: transparent;
      text-align: left;
      padding: 12px 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      cursor: pointer;
      transition: background .14s ease;
      font-family: "Nunito", sans-serif;
    }
    .ph-ach-summary:hover {
      background: rgba(43,129,211,.05);
    }
    .ph-ach-meta {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .ph-ach-label {
      font-size: .98rem;
      font-weight: 800;
      color: #1a4f97;
      line-height: 1.2;
    }
    .ph-ach-subtitle {
      font-size: .84rem;
      color: #6788a8;
      font-weight: 700;
      line-height: 1.2;
    }
    .ph-ach-preview {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
      justify-content: flex-end;
    }
    .ph-ach-mini {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: .74rem;
      font-weight: 800;
      color: #1f5da8;
      border: 1px solid #bcd5e8;
      background: #f2f9ff;
    }
    .ph-ach-mini.completed {
      background: rgba(45,189,130,.16);
      border-color: rgba(45,189,130,.45);
      color: #1f7f5b;
    }
    .ph-ach-mini.uncompleted {
      background: #f0f4f8;
      border-color: #d6e0ea;
      color: #8ea4bb;
    }
    .ph-ach-mini.progress {
      background: #eef7ff;
      border-color: #a9cae8;
      color: #296ab4;
    }
    .ph-ach-details {
      display: none;
      padding: 0 14px 12px;
    }
    .ph-ach-item.open .ph-ach-details {
      display: block;
    }
    .ph-ach-detail-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border: 1px solid #dce9f4;
      border-radius: 12px;
      background: #fff;
      padding: 8px 10px;
      margin-top: 7px;
    }
    .ph-ach-name {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: .89rem;
      color: #244d81;
      font-weight: 700;
    }
    .ph-ach-progress {
      flex-shrink: 0;
      font-size: .8rem;
      color: #5d7d9d;
      font-weight: 800;
    }
    .ph-ach-badge-dot {
      flex-shrink: 0;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #c2d8ec;
      background: #f0f8ff;
      font-size: .92rem;
    }
    .ph-ach-badge-dot.completed {
      background: rgba(45,189,130,.16);
      border-color: rgba(45,189,130,.42);
    }
    .ph-ach-badge-dot.uncompleted {
      background: #f0f4f8;
      border-color: #d6e0ea;
      color: #8ea4bb;
    }

    @media (max-width: 1180px) {
      .ph-profile-card {
        grid-template-columns: 120px minmax(180px, 1fr);
        gap: 14px;
      }
      .ph-pranks,
      #stats-lobby-signed-actions {
        grid-column: 1 / -1;
      }
      #stats-lobby-signed-actions {
        justify-content: flex-start;
      }
      .ph-main {
        grid-template-columns: 1fr;
      }
    }
    @media (max-width: 860px) {
      .ph-topbar-title::before,
      .ph-topbar-title::after { display: none; }
      .ph-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .ph-sg {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .ph-stats-title,
      .ph-st {
        font-size: 1.35rem;
      }
      .ph-ach-summary {
        padding: 10px 12px;
      }
      .ph-ach-mini {
        width: 31px;
        height: 31px;
        font-size: .7rem;
      }
    }
    @media (max-width: 560px) {
      .ph-wrap {
        padding: 4px 10px 30px;
      }
      .ph-actions {
        grid-template-columns: 1fr;
      }
      .ph-sg {
        grid-template-columns: 1fr;
      }
      .ph-tab {
        min-width: 118px;
      }
      .ph-rg {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
      }
      .ph-rg-date {
        grid-column: 2 / -1;
        justify-self: end;
      }
    }
    /* Keep old auth-fc-badge for friend code display in modal */
    .stats-player-header {
      display: flex; align-items: center; gap: 14px;
      width: 100%; max-width: 420px;
      background: rgba(11,36,72,.85); border: 1px solid rgba(58,120,204,.4);
      border-radius: 14px; padding: 14px 16px;
    }
    .stats-avatar {
      width: 52px; height: 52px; border-radius: 50%;
      background: linear-gradient(135deg, #1a5276, #0e3454);
      border: 2px solid rgba(34,216,248,.5);
      display: flex; align-items: center; justify-content: center;
      font-size: 22px; font-weight: 900; color: var(--cyan);
      font-family: 'Cinzel', serif; flex-shrink: 0;
    }
    .stats-player-info { display: flex; flex-direction: column; gap: 3px; }
    .stats-lobby-nick {
      font-size: 20px; font-weight: 800; color: var(--text);
      font-family: 'Nunito', sans-serif;
    }
    .stats-lobby-fc { font-size: 11px; color: var(--muted); }
    .stats-lobby-actions {
      display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
    }
    .stats-empty-state {
      width: 100%; max-width: 420px;
      text-align: center; color: var(--muted); font-size: 13px;
      padding: 18px; background: rgba(11,36,72,.7);
      border: 1px solid rgba(58,120,204,.25); border-radius: 12px;
    }
    .stats-empty-icon { font-size: 28px; margin-bottom: 6px; }
    .stats-section-label {
      width: 100%; max-width: 420px;
      font-size: 11px; font-weight: 700; color: var(--muted);
      text-transform: uppercase; letter-spacing: 1px;
    }
    .stats-mode-block { width: 100%; max-width: 420px; }
    .stats-mode-header {
      font-size: 11px; font-weight: 700; letter-spacing: .8px;
      text-transform: uppercase; margin-bottom: 8px; padding: 0 2px;
    }
    .stats-mode-header.normal { color: var(--cyan); }
    .stats-mode-header.comp   { color: var(--gold); }
    .stats-grid {
      display: grid; grid-template-columns: repeat(2, 1fr);
      gap: 10px; width: 100%; max-width: 420px;
    }
    .stats-grid.three-col { grid-template-columns: repeat(3, 1fr); }
    .stat-panel {
      background: rgba(11,36,72,.85); border: 1px solid rgba(58,120,204,.4);
      border-radius: 12px; padding: 11px 12px;
      display: flex; flex-direction: column; gap: 3px;
    }
    .stat-panel.comp-panel {
      background: rgba(42,28,8,.85); border-color: rgba(240,200,64,.25);
    }
    .stat-label {
      font-size: 9px; color: var(--muted); font-weight: 700;
      text-transform: uppercase; letter-spacing: .8px;
    }
    .stat-value {
      font-size: 22px; font-weight: 800; color: var(--text);
      font-family: 'Nunito', sans-serif;
    }
    .stat-value.rank-val { font-size: 16px; }
    .stat-value.strategy-val { font-size: 13px; font-weight: 700; }
    .stats-friends-mini {
      width: 100%; max-width: 420px;
      background: rgba(11,36,72,.7); border: 1px solid rgba(58,120,204,.3);
      border-radius: 12px; padding: 12px 14px; display: flex;
      flex-direction: column; gap: 8px;
    }
    .stats-friends-mini .stats-section-label { width: auto; }
    .stats-friend-entry-mini {
      display: flex; align-items: center; gap: 8px;
      font-size: 13px; color: var(--text); padding: 4px 0;
      border-bottom: 1px solid rgba(58,120,204,.12);
    }
    .stats-friend-entry-mini:last-child { border-bottom: none; }
    .stats-friend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
    .stats-friend-dot.online { background: #2ecc71; box-shadow: 0 0 4px #2ecc71; }
    /* Friend request badge */
    .friend-badge {
      display: inline-flex; align-items: center; justify-content: center;
      background: #e06c75; color: #fff; border-radius: 50%;
      width: 16px; height: 16px; font-size: 10px; font-weight: 700;
      margin-left: 4px; vertical-align: middle; line-height: 1;
    }
    .friend-badge:empty, .friend-badge[data-count="0"] { display: none; }
    /* Left-nav Friends tab request badge */
    .ph-snav-badge {
      display: inline-flex; align-items: center; justify-content: center;
      background: #e53e3e; color: #fff; border-radius: 999px;
      min-width: 18px; height: 18px; font-size: 10.5px; font-weight: 800;
      padding: 0 4px; margin-left: auto; line-height: 1;
      box-shadow: 0 1px 4px rgba(229,62,62,.45);
      animation: ph-snav-badge-pop .22s cubic-bezier(.3,1.5,.5,1) both;
    }
    .ph-snav-badge:empty { display: none; }
    @keyframes ph-snav-badge-pop {
      from { transform: scale(0.4); opacity: 0; }
      to   { transform: scale(1);   opacity: 1; }
    }
    /* ── Friend request cards ──────────────────────────────────── */
    .ph-freq-card {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 12px; border-radius: 10px; margin-bottom: 8px;
      background: rgba(46,204,113,.07); border: 1.5px solid rgba(46,204,113,.25);
    }
    .ph-freq-card:last-child { margin-bottom: 0; }
    .ph-freq-av {
      width: 38px; height: 38px; border-radius: 50%;
      overflow: hidden; flex-shrink: 0;
      background: #c8e6fa; display: flex; align-items: center; justify-content: center;
      font-size: 15px; font-weight: 800; color: #2d6fa8;
    }
    .ph-freq-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .ph-freq-info { flex: 1; min-width: 0; }
    .ph-freq-name { font-weight: 700; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ph-freq-code { font-size: 11px; color: #9ab8d0; margin-top: 1px; }
    .ph-freq-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
    .ph-freq-accept {
      background: #2ecc71; color: #fff; border: none; border-radius: 8px;
      padding: 8px 18px; font-size: 13px; font-weight: 700;
      cursor: pointer; font-family: 'Nunito', sans-serif;
      min-width: 90px; white-space: nowrap;
      transition: background .15s, transform .1s;
    }
    .ph-freq-accept:hover:not(:disabled) { background: #27ae60; transform: translateY(-1px); }
    .ph-freq-accept:disabled { opacity: .5; cursor: default; }
    .ph-freq-decline {
      background: transparent; color: #c0392b;
      border: 1.5px solid rgba(192,57,43,.4); border-radius: 8px;
      padding: 7px 18px; font-size: 13px; font-weight: 700;
      cursor: pointer; font-family: 'Nunito', sans-serif;
      min-width: 90px; white-space: nowrap;
      transition: background .15s, border-color .15s;
    }
    .ph-freq-decline:hover:not(:disabled) { background: rgba(192,57,43,.08); border-color: rgba(192,57,43,.7); }
    .ph-freq-decline:disabled { opacity: .5; cursor: default; }
    /* Section header inside the requests block */
    .ph-freq-header {
      font-size: 11px; font-weight: 800; text-transform: uppercase;
      letter-spacing: .8px; color: #1a7a5a; margin-bottom: 8px;
    }
    .stats-nav-grid {
      display: grid; grid-template-columns: repeat(2, 1fr);
      gap: 10px; width: 100%; max-width: 420px;
    }
    .stats-nav-btn {
      padding: 12px 8px; border-radius: 10px; font-size: 13px;
      font-weight: 700; cursor: pointer; border: 1px solid rgba(58,120,204,.4);
      background: rgba(11,36,72,.85); color: var(--text);
      transition: background .15s; font-family: 'Nunito', sans-serif;
    }
    .stats-nav-btn.primary {
      background: linear-gradient(135deg, #0a4a8c, #0c3060);
      border-color: rgba(34,216,248,.45); color: var(--cyan);
    }
    .stats-nav-btn:hover { background: rgba(34,72,140,.7); }
    .stats-nav-btn.primary:hover { background: linear-gradient(135deg,#0e5aa0,#0f3a70); }
    .stats-pie-wrap {
      display: none; flex-direction: row; align-items: center; gap: 14px;
      margin-top: 10px; padding: 12px 14px;
      background: rgba(11,36,72,.6); border: 1px solid rgba(58,120,204,.25);
      border-radius: 12px; position: relative;
    }
    .stats-pie-wrap-comp { background: rgba(42,28,8,.6); border-color: rgba(240,200,64,.2); }
    .stats-pie-wrap.visible { display: flex; }
    .stats-pie-svg { flex-shrink: 0; cursor: pointer; }
    .stats-pie-svg path { transition: transform .15s, filter .15s; transform-origin: 60px 60px; }
    .stats-pie-svg path:hover { transform: scale(1.08); filter: brightness(1.25); }
    .stats-pie-legend { display: flex; flex-direction: column; gap: 5px; flex: 1; }
    .stats-pie-legend-item {
      display: flex; align-items: center; gap: 6px;
      font-size: 11px; color: var(--text); cursor: default;
      padding: 3px 6px; border-radius: 6px; transition: background .12s;
    }
    .stats-pie-legend-item:hover { background: rgba(255,255,255,.06); }
    .stats-pie-legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
    .stats-pie-legend-label { font-weight: 700; min-width: 22px; }
    .stats-pie-legend-count { color: var(--muted); font-size: 10px; }
    .stats-pie-tooltip {
      position: fixed; background: rgba(4,20,35,.96);
      border: 1px solid rgba(34,216,248,.4); border-radius: 8px;
      padding: 6px 11px; font-size: 12px; font-weight: 700; color: #fff;
      pointer-events: none; display: none; z-index: 9999;
      white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.5);
    }
    .stats-pie-title {
      font-size: 9px; font-weight: 700; color: var(--muted);
      text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px;
    }
    .stats-join-row {
      display: none; flex-direction: row; gap: 8px; align-items: center;
      width: 100%; max-width: none;
    }
    .stats-join-row.open { display: flex; }

    /* ── OVERLAY MODALS (Settings, Leaderboard) ───────────────── */
    .overlay-modal {
      position: fixed; inset: 0; z-index: 9100;
      background: rgba(0,0,0,.72); display: none;
      align-items: center; justify-content: center; padding: 20px;
    }
    .overlay-modal.open { display: flex; }
    .modal-box {
      background: rgba(11,36,72,.97); border: 1px solid rgba(58,120,204,.55);
      border-radius: 14px; padding: 20px 18px; width: 100%; max-width: 360px;
      display: flex; flex-direction: column; gap: 12px;
      box-shadow: 0 8px 32px rgba(0,0,0,.5);
    }
    .avatar-modal-box { max-width: 430px; }
    .modal-title {
      font-family: 'Cinzel', serif; color: var(--cyan);
      font-size: 16px; text-align: center; font-weight: 700;
    }

    /* ── Challenge of Challenges ──────────────────────────────── */
    .coc-amp { cursor: pointer; }
    .coc-modal-box { max-width: 340px; }
    .coc-modal-desc {
      color: rgba(200,225,255,.85); font-size: .92rem;
      text-align: center; margin: 0; line-height: 1.5;
    }
    .coc-btn-row {
      display: flex; gap: 10px; justify-content: center; margin-top: 4px;
    }
    .coc-btn-row .pv-btn { flex: 1; }
    .coc-req-list { display: flex; flex-direction: column; gap: 10px; }
    .coc-req-row {
      display: flex; align-items: center; gap: 10px;
      background: rgba(10,30,60,.55); border: 1px solid rgba(58,120,204,.22);
      border-radius: 8px; padding: 10px 14px;
    }
    .coc-req-icon { font-size: 1.2rem; min-width: 22px; text-align: center; }
    .coc-check { color: #2ecc71; }
    .coc-cross { color: #e06c75; }
    .coc-req-label { flex: 1; color: rgba(200,225,255,.85); font-size: .9rem; }
    .coc-req-value { color: rgba(160,200,240,.7); font-size: .82rem; }
    .coc-trivia-question {
      color: rgba(200,225,255,.9); font-size: .95rem;
      text-align: center; line-height: 1.5; margin: 0;
    }
    .coc-trivia-options { display: flex; flex-direction: column; gap: 8px; }
    .coc-trivia-btn {
      background: rgba(10,30,60,.7); border: 1px solid rgba(58,120,204,.35);
      border-radius: 8px; color: rgba(200,225,255,.85); font-size: .88rem;
      padding: 10px 14px; cursor: pointer; text-align: left; transition: background .15s, border-color .15s;
    }
    .coc-trivia-btn:hover:not(:disabled) { background: rgba(30,60,100,.8); border-color: rgba(58,120,204,.7); }
    .coc-trivia-btn:disabled { opacity: .7; cursor: default; }
    .coc-trivia-btn.coc-correct { background: rgba(20,80,40,.8); border-color: #2ecc71; color: #2ecc71; }
    .coc-trivia-btn.coc-wrong   { background: rgba(80,20,20,.8); border-color: #e06c75; color: #e06c75; }
    .coc-trivia-result {
      text-align: center; font-size: .92rem; font-weight: 700;
      min-height: 1.4em; padding-top: 2px;
    }
    .coc-result-correct { color: #2ecc71; }
    .coc-result-wrong   { color: #e06c75; }
    .coc-modal-close {
      position: absolute; top: 10px; right: 14px;
      background: none; border: none; color: rgba(160,200,240,.6);
      font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 2px 4px;
    }
    .coc-modal-close:hover { color: #fff; }
    .coc-modal-box { position: relative; }
    /* Avatar grid separator for unlocked icons */
    .auth-avatar-sep {
      grid-column: 1 / -1; color: var(--cyan); font-size: .78rem;
      font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
      padding: 6px 0 2px; border-top: 1px solid rgba(58,120,204,.3);
      text-align: center; margin-top: 4px;
    }

    .settings-row {
      display: flex; align-items: center; gap: 8px;
      padding: 8px 0; border-bottom: 1px solid rgba(58,120,204,.18);
    }
    .settings-row-label { font-size: 11px; color: var(--muted); width: 80px; flex-shrink: 0; }
    .settings-row-val { color: var(--text); font-size: 13px; }
    /* Music toggle */
    .settings-toggle-track {
      width: 42px; height: 24px; border-radius: 12px;
      background: rgba(80,110,160,.4); border: 1.5px solid rgba(100,160,220,.4);
      position: relative; transition: background .2s, border-color .2s; cursor: pointer;
    }
    .settings-toggle-track.on {
      background: rgba(34,200,130,.55); border-color: rgba(34,200,130,.8);
    }
    .settings-toggle-thumb {
      width: 18px; height: 18px; border-radius: 50%;
      background: rgba(200,230,255,.85); position: absolute; top: 2px; left: 2px;
      transition: left .2s, background .2s; box-shadow: 0 1px 4px rgba(0,0,0,.3);
    }
    .settings-toggle-track.on .settings-toggle-thumb {
      left: 20px; background: #fff;
    }

    /* ══ MESSAGING DRAWER (DMs + room chat bridge) ══════════════════ */
    #cc-msg-drawer {
      position: fixed; top: 0; right: 0; bottom: 0;
      width: 380px; max-width: 92vw; z-index: 9700;
      transform: translateX(100%);
      transition: transform .28s cubic-bezier(.4,0,.2,1);
      display: flex; flex-direction: column;
      background: linear-gradient(180deg, rgba(225,243,255,.97) 0%, rgba(200,230,250,.97) 100%);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      border-left: 1px solid rgba(120,190,235,.55);
      box-shadow: -8px 0 40px rgba(0,50,120,.22);
    }
    #cc-msg-drawer.open { transform: translateX(0); }
    /* When inside a game room, make it a touch wider */
    #cc-msg-drawer.in-game { width: 420px; }
    .ccm-header {
      display: flex; align-items: center; gap: 10px;
      padding: 16px 16px 13px; border-bottom: 1px solid rgba(120,190,235,.4);
      flex-shrink: 0;
    }
    .ccm-back-btn {
      width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
      border: 1px solid rgba(120,190,235,.5); background: rgba(255,255,255,.5);
      color: #1a5cbf; font-size: 17px; cursor: pointer; display: none;
      align-items: center; justify-content: center;
    }
    .ccm-back-btn.show { display: flex; }
    .ccm-title { font-family:"Cinzel",serif; font-size: 1.1rem; font-weight: 900; color: #15407e; flex: 1; min-width: 0; }
    .ccm-title.editable { cursor: pointer; }
    .ccm-title.editable:hover { text-decoration: underline dotted rgba(21,64,126,.5); }
    .ccm-title-edit { width: 100%; box-sizing: border-box; border-radius: 8px; border: 1px solid rgba(34,130,240,.6);
      background: rgba(255,255,255,.92); padding: 4px 8px; font-family:"Cinzel",serif; font-size: 1rem; font-weight: 800; color: #15407e; }
    .ccm-title-edit:focus { outline: none; }
    .ccm-close { width: 32px; height: 32px; border-radius: 9px; border: 1px solid rgba(120,190,235,.5); background: rgba(255,255,255,.5); color: #1a5cbf; font-size: 18px; cursor: pointer; flex-shrink: 0; }
    .ccm-close:hover, .ccm-back-btn:hover { background: rgba(255,255,255,.85); }
    .ccm-search-row { padding: 10px 14px 6px; display: flex; gap: 8px; flex-shrink: 0; }
    .ccm-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
    .ccm-conv {
      display: flex; align-items: center; gap: 11px; padding: 10px 11px;
      border-radius: 13px; cursor: pointer; transition: background .14s; position: relative;
    }
    .ccm-conv:hover { background: rgba(255,255,255,.55); }
    .ccm-conv.room-chat { background: rgba(255,238,200,.5); border: 1px solid rgba(220,170,40,.4); margin-bottom: 6px; }
    .ccm-conv.room-chat:hover { background: rgba(255,238,200,.75); }
    .ccm-av { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; position: relative; overflow: hidden; background: linear-gradient(145deg,#3ec0ee,#1f66bc); display:flex;align-items:center;justify-content:center; }
    .ccm-av img { width: 100%; height: 100%; object-fit: cover; }
    .ccm-av-letter { color:#fff; font-weight:900; font-size:18px; font-family:"Cinzel",serif; }
    .ccm-online-dot { position: absolute; bottom: 1px; right: 1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #e6f3ff; background: #9bb5cc; }
    .ccm-online-dot.on { background: #2ec866; }
    .ccm-conv-body { flex: 1; min-width: 0; }
    .ccm-conv-top { display: flex; align-items: baseline; gap: 6px; }
    .ccm-conv-name { font-size: .92rem; font-weight: 800; color: #16407e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
    .ccm-conv-time { font-size: .66rem; color: #6a93bd; flex-shrink: 0; }
    .ccm-conv-preview { font-size: .78rem; color: #5a7fa8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
    .ccm-conv-unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e8404f; color: #fff; font-size: 10.5px; font-weight: 800; line-height: 18px; text-align: center; flex-shrink: 0; }
    .ccm-empty { text-align: center; color: #5a7fa8; font-size: .86rem; padding: 40px 24px; line-height: 1.6; }
    .ccm-empty-ico { font-size: 2.6rem; opacity: .55; margin-bottom: 10px; }
    /* Conversation view */
    .ccm-conv-view { flex: 1; display: none; flex-direction: column; min-height: 0; }
    .ccm-conv-view.show { display: flex; }
    .ccm-list.hide { display: none; }
    .ccm-search-row.hide { display: none; }
    .ccm-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
    .ccm-bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: .86rem; line-height: 1.4; word-break: break-word; }
    .ccm-bubble.mine { align-self: flex-end; background: linear-gradient(135deg,#2e90e0,#1a6ad0); color: #fff; border-bottom-right-radius: 4px; }
    .ccm-bubble.theirs { align-self: flex-start; background: rgba(255,255,255,.8); color: #16407e; border: 1px solid rgba(120,190,235,.4); border-bottom-left-radius: 4px; }
    .ccm-bubble-time { font-size: .62rem; opacity: .7; margin-top: 3px; display: block; }
    .ccm-sys { align-self: center; max-width: 88%; text-align: center; font-size: .68rem; color: #5a7fa8; margin: 4px 0; line-height: 1.4; }
    .ccm-bubble-sender { display: flex; align-items: center; gap: 5px; font-size: .64rem; font-weight: 800; color: #1a6ad0; margin-bottom: 3px; }
    .ccm-bubble-av { width: 18px; height: 18px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: linear-gradient(145deg,#3ec0ee,#1f66bc); display: flex; align-items: center; justify-content: center; }
    .ccm-bubble-av img { width: 100%; height: 100%; object-fit: cover; }
    .ccm-bubble-av-lt { color: #fff; font-weight: 900; font-size: 9px; }
    .ccm-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(120,190,235,.4); flex-shrink: 0; }
    .ccm-input-row textarea {
      flex: 1; min-width: 0; border-radius: 11px; border: 1px solid rgba(120,190,235,.5);
      background: rgba(255,255,255,.8); padding: 9px 12px; font-size: 13px; color: #16407e;
      resize: none; font-family: inherit; max-height: 80px;
    }
    .ccm-send {
      border-radius: 11px; border: none; background: linear-gradient(135deg,#2e90e0,#1a6ad0);
      color: #fff; font-weight: 800; font-size: 13px; padding: 0 18px; cursor: pointer; flex-shrink: 0;
    }
    .ccm-send:disabled { opacity: .5; cursor: not-allowed; }
    .ccm-guest-note { padding: 14px; text-align: center; font-size: .82rem; color: #b06800; background: rgba(255,238,200,.5); }

    /* ── NEW MESSAGE COMPOSE (shared recipient picker, lobby theme) ── */
    .ccm-compose { display: flex; flex-direction: column; flex: 1; min-width: 0; }
    .ccm-compose-recip {
      display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
      background: rgba(255,255,255,.8); border: 1px solid rgba(120,190,235,.5); border-radius: 11px;
      padding: 7px 9px; min-height: 40px; flex-shrink: 0;
    }
    .ccm-chip {
      display: inline-flex; align-items: center; gap: 6px; padding: 3px 5px 3px 3px;
      background: linear-gradient(135deg,#2e90e0,#1a6ad0); color: #fff; border-radius: 20px;
      font-size: 12px; font-weight: 800; max-width: 100%;
    }
    .ccm-chip-av { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; }
    .ccm-chip-av img { width: 100%; height: 100%; object-fit: cover; }
    .ccm-chip-av-lt { font-size: 11px; color: #fff; font-weight: 900; }
    .ccm-chip-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
    .ccm-chip-x { background: none; border: none; color: rgba(255,255,255,.9); cursor: pointer;
      font-size: 15px; line-height: 1; padding: 0 2px; }
    .ccm-chip-x:hover { color: #fff; }
    .ccm-compose-input {
      flex: 1; min-width: 110px; background: none; border: none; outline: none;
      color: #16407e; font-size: 13px; font-family: inherit; padding: 4px 2px;
    }
    .ccm-compose-input::placeholder { color: #6a93bd; }
    .ccm-compose-sugg {
      display: none; flex-direction: column; margin-top: 6px; max-height: 240px; overflow-y: auto;
      background: rgba(255,255,255,.92); border: 1px solid rgba(120,190,235,.5); border-radius: 11px;
    }
    .ccm-compose-sugg.show { display: flex; }
    .ccm-sugg-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; border-radius: 9px; }
    .ccm-sugg-row:hover, .ccm-sugg-row.active { background: rgba(46,144,224,.14); }
    .ccm-sugg-av { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
      background: linear-gradient(145deg,#3ec0ee,#1f66bc); display: flex; align-items: center; justify-content: center; }
    .ccm-sugg-av img { width: 100%; height: 100%; object-fit: cover; }
    .ccm-sugg-av-lt { color: #fff; font-weight: 900; font-size: 14px; font-family: "Cinzel", serif; }
    .ccm-sugg-nm { font-size: 13.5px; font-weight: 700; color: #16407e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ccm-compose-name {
      margin-top: 10px; width: 100%; box-sizing: border-box; background: rgba(255,255,255,.8);
      border: 1px solid rgba(120,190,235,.5); color: #16407e; border-radius: 11px; padding: 9px 12px;
      font-size: 13px; font-family: inherit;
    }
    .ccm-compose-name:focus, .ccm-compose-input:focus { outline: none; }
    .ccm-compose-go {
      margin-top: 10px; width: 100%; background: linear-gradient(135deg,#2e90e0,#1a6ad0); color: #fff;
      border: none; border-radius: 11px; padding: 11px; font-size: 13.5px; font-weight: 800; cursor: pointer;
    }
    .ccm-compose-go:hover { filter: brightness(1.06); }
    .ccm-compose-go:disabled { opacity: .45; cursor: default; filter: none; }
    .ccm-compose-hint { font-size: .76rem; color: #5a7fa8; text-align: center; padding: 12px 8px; line-height: 1.55; }

    /* ══ STREAK CALENDAR MODAL ══════════════════════════════════════ */
    #streak-cal-modal {
      display: none; position: fixed; inset: 0; z-index: 9750;
      background: rgba(8,40,90,.6); backdrop-filter: blur(8px);
      align-items: center; justify-content: center; padding: 24px;
    }
    #streak-cal-modal.open { display: flex; }
    #streak-cal-box {
      width: 100%; max-width: 1120px; max-height: 90vh; overflow-y: auto;
      background:
        radial-gradient(circle at 12% 0%, rgba(255,255,255,.7) 0%, rgba(255,255,255,0) 40%),
        linear-gradient(180deg, #eaf7ff 0%, #d2ecfc 55%, #c2e4f8 100%);
      border: 1px solid rgba(140,200,240,.7); border-radius: 28px;
      box-shadow: 0 20px 70px rgba(0,50,120,.34);
      padding: 26px 30px 30px;
    }
    #streak-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
    #streak-cal-title {
      font-family: "Cinzel", serif; font-size: 1.6rem; font-weight: 900; color: #15407e;
      letter-spacing: .5px;
    }
    #streak-cal-close {
      width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(120,190,235,.5);
      background: rgba(255,255,255,.7); color: #1a5cbf; font-size: 19px; cursor: pointer;
      transition: background .15s, transform .12s;
    }
    #streak-cal-close:hover { background: #fff; transform: scale(1.05); }
    #streak-cal-stats { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
    .sc-stat {
      flex: 1; min-width: 140px;
      background: linear-gradient(160deg, rgba(255,255,255,.85), rgba(232,246,255,.7));
      border: 1px solid rgba(120,190,235,.5); border-radius: 18px; padding: 16px 18px; text-align: center;
      box-shadow: 0 3px 12px rgba(0,60,120,.07);
    }
    .sc-stat-val {
      font-size: 2.2rem; font-weight: 900; line-height: 1;
      background: linear-gradient(135deg, #1a9ad7, #1558b0);
      -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    }
    .sc-stat-lbl { font-size: .76rem; font-weight: 700; color: #5a86b0; margin-top: 6px; text-transform: uppercase; letter-spacing: .4px; }
    #streak-cal-legend {
      display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px;
      background: rgba(255,255,255,.45); border-radius: 12px; padding: 10px 16px;
      border: 1px solid rgba(120,190,235,.3);
    }
    .sc-leg { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 700; color: #3a6090; }
    .sc-leg-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; }
    .sc-leg-dot.done   { background: linear-gradient(135deg,#5cd0f5,#1a77c9); box-shadow: 0 1px 4px rgba(26,119,201,.4); }
    .sc-leg-dot.missed { background: rgba(150,165,180,.4); }
    .sc-leg-dot.avatar { background: linear-gradient(135deg,#ffd86a,#f5a623); color: #fff; box-shadow: 0 0 0 2px rgba(245,166,35,.35); }
    #streak-cal-year-row { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 20px; }
    #streak-cal-year-row button {
      width: 36px; height: 36px; border-radius: 11px; border: 1px solid rgba(120,190,235,.5);
      background: rgba(255,255,255,.7); color: #1a5cbf; font-size: 18px; font-weight: 900; cursor: pointer;
      transition: background .15s, transform .12s;
    }
    #streak-cal-year-row button:hover { background: #fff; transform: scale(1.06); }
    #sc-year-label { font-family: "Cinzel", serif; font-size: 1.4rem; font-weight: 900; color: #15407e; min-width: 90px; text-align: center; }
    /* 12-month grid: responsive columns */
    #streak-cal-grid {
      display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
    }
    @media (max-width: 980px) { #streak-cal-grid { grid-template-columns: repeat(3, 1fr); } }
    @media (max-width: 720px) { #streak-cal-grid { grid-template-columns: repeat(2, 1fr); } }
    .sc-month {
      background: linear-gradient(170deg, rgba(255,255,255,.78), rgba(238,248,255,.6));
      border: 1px solid rgba(130,195,240,.45);
      border-radius: 18px; padding: 14px 16px 16px;
      box-shadow: 0 3px 12px rgba(0,60,120,.06);
    }
    .sc-month.sc-cur-month { border-color: rgba(34,150,235,.7); box-shadow: 0 0 0 2px rgba(34,150,235,.22), 0 4px 14px rgba(0,60,120,.1); }
    .sc-month-name {
      font-family: "Cinzel", serif; font-size: .95rem; font-weight: 800; color: #1a4a90;
      text-align: center; margin-bottom: 10px; letter-spacing: .3px;
    }
    /* 7-col day-of-week header */
    .sc-dow {
      display: grid; grid-template-columns: repeat(7, 1fr);
      gap: 0; justify-items: center; align-items: center;
      margin-bottom: 4px;
    }
    .sc-dow span { font-size: .56rem; font-weight: 800; color: #8aa8c8; width: 100%; text-align: center; }
    /* Days grid — no gap so trail bridges connect flush between cells */
    .sc-days {
      display: grid; grid-template-columns: repeat(7, 1fr);
      gap: 0; justify-items: center; align-items: center;
    }
    /* Wrapper cell: holds the trail bridges + the inner day circle */
    .sc-cell {
      position: relative; width: 100%;
      display: flex; align-items: center; justify-content: center;
      padding: 2.5px 0; box-sizing: border-box;
    }
    /* Left trail half: shown when previous day in SAME ROW is done */
    .sc-cell::before {
      content: ""; display: none;
      position: absolute; z-index: 0;
      top: 50%; transform: translateY(-50%);
      height: 38%; left: 0; right: 50%;
      background: rgba(92,208,245,.38);
      border-radius: 0;
    }
    /* Right trail half: shown when next day in SAME ROW is done */
    .sc-cell::after {
      content: ""; display: none;
      position: absolute; z-index: 0;
      top: 50%; transform: translateY(-50%);
      height: 38%; left: 50%; right: 0;
      background: rgba(92,208,245,.38);
      border-radius: 0;
    }
    .sc-cell[data-tl="1"]::before { display: block; }
    .sc-cell[data-tr="1"]::after  { display: block; }
    /* The actual day circle */
    .sc-day {
      position: relative; z-index: 1;
      width: clamp(16px, 76%, 24px); aspect-ratio: 1 / 1; height: auto;
      border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: .52rem; font-weight: 800; box-sizing: border-box;
      transition: transform .12s;
    }
    .sc-day.done:hover, .sc-day.avatar:hover { transform: scale(1.22); cursor: default; }
    .sc-day.blank { background: transparent; }
    .sc-day.done {
      background: linear-gradient(135deg,#5cd0f5,#1a77c9); color: #fff;
      box-shadow: 0 1px 5px rgba(26,119,201,.45);
    }
    .sc-day.missed {
      background: rgba(150,165,180,.28);
    }
    .sc-day.today-empty {
      background: rgba(120,190,235,.14); border: 1.5px dashed rgba(70,150,215,.55);
    }
    /* Avatar cell: the player's current position on the trail */
    .sc-day.avatar {
      background: transparent;
      box-shadow: 0 0 0 2.5px rgba(245,166,35,.55), 0 2px 8px rgba(200,120,0,.35);
      overflow: hidden; padding: 0;
      width: clamp(18px, 85%, 26px);
    }
    .sc-day.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
    /* Trail colour on the avatar's bridge matches the done trail */
    .sc-cell.sc-avatar-cell::before,
    .sc-cell.sc-avatar-cell::after { background: rgba(245,166,35,.38); }

    /* ── LOBBY BROWSER MODAL ────────────────────────────────────── */
    #lobby-browser-modal {
      display: none; position: fixed; inset: 0; z-index: 9100;
      background: rgba(10,40,100,.72); backdrop-filter: blur(8px);
      align-items: center; justify-content: center; padding: 16px;
    }
    #lobby-browser-modal.open { display: flex; }
    #lobby-browser-box {
      background: linear-gradient(180deg, #cce6f8 0%, #b4d4ee 55%, #9ec4e4 100%);
      border: 1.5px solid rgba(130,195,240,.55); border-radius: 26px;
      box-shadow: 0 10px 48px rgba(8,50,130,.22), 0 2px 8px rgba(8,50,130,.10);
      padding: 28px 26px 26px; width: 100%; max-width: 640px;
      max-height: 88vh; display: flex; flex-direction: column; gap: 18px;
      position: relative; overflow: hidden;
    }
    #lobby-browser-box::before {
      content: ""; position: absolute; inset: 0; pointer-events: none;
      background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.42) 0%, transparent 68%);
    }
    #lobby-browser-box h2 {
      font-family: "Cinzel", serif; font-size: 1.6rem; font-weight: 700;
      color: #0c2858; letter-spacing: .5px; margin: 0; position: relative; z-index: 1;
    }
    #lb-browser-close {
      position: absolute; top: 18px; right: 18px; z-index: 2;
      width: 42px; height: 42px; border-radius: 50%;
      background: rgba(190,220,248,.72); border: 1.5px solid rgba(120,185,235,.55);
      color: #2a5888; font-size: 18px; line-height: 1;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: background .15s, border-color .15s;
    }
    #lb-browser-close:hover { background: rgba(210,235,255,.9); border-color: rgba(70,150,230,.65); }
    .lb-browser-tabs { display: flex; gap: 10px; position: relative; z-index: 1; }
    .lb-browser-tab {
      flex: 1; padding: 13px 8px; border-radius: 16px; font-size: 15px;
      font-weight: 700; cursor: pointer;
      background: rgba(255,255,255,.52); border: 1.5px solid rgba(150,200,240,.45);
      color: #5a82b0; transition: all .15s; text-align: center;
    }
    .lb-browser-tab.active {
      background: rgba(255,255,255,.88); border-color: #4a82cc;
      color: #0c2858; box-shadow: 0 2px 10px rgba(30,80,180,.13);
    }
    #lb-browser-list {
      flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
      min-height: 140px; max-height: 360px; position: relative; z-index: 1;
    }
    .room-card {
      background: rgba(255,255,255,.72); border: 1.5px solid rgba(150,200,240,.4);
      border-radius: 14px; padding: 12px 16px; display: flex; align-items: center;
      gap: 12px; transition: border-color .15s;
    }
    .room-card:hover { border-color: rgba(60,130,220,.5); }
    .room-card-info { flex: 1; min-width: 0; }
    .room-card-host { font-weight: 800; color: #0c2858; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .room-card-meta { font-size: 12px; color: #5a7a9a; margin-top: 2px; }
    .room-card-badge {
      font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
      background: rgba(60,130,220,.1); color: #2a60b0; border: 1px solid rgba(60,130,220,.25);
    }
    .room-card-badge.private { background: rgba(180,130,20,.1); color: #8a6010; border-color: rgba(180,130,20,.3); }
    .room-card-join {
      padding: 7px 16px; border-radius: 10px; font-size: 13px; font-weight: 700;
      background: linear-gradient(135deg,#1a60c0,#0e3a80); border: none;
      color: #fff; cursor: pointer; white-space: nowrap; flex-shrink: 0;
      transition: background .15s, transform .1s;
    }
    .room-card-join:hover { background: linear-gradient(135deg,#2070d8,#1048a0); transform: translateY(-1px); }
    .lb-browser-empty { color: #6a8aaa; font-size: 15px; text-align: center; padding: 36px 0; }
    #lb-pw-prompt { display: none; flex-direction: column; gap: 10px; padding: 14px; background: rgba(255,255,255,.8); border-radius: 14px; border: 1.5px solid rgba(150,200,240,.5); position: relative; z-index: 1; }
    #lb-pw-prompt.open { display: flex; }
    #lb-pw-err { color: #c0202a; font-size: 12px; min-height: 16px; }

    /* ── NEW CURRENT MODAL ──────────────────────────────────────── */
    #new-current-modal {
      display: none; position: fixed; inset: 0; z-index: 9100;
      background: rgba(10,40,100,.72); backdrop-filter: blur(8px);
      align-items: center; justify-content: center; padding: 16px;
    }
    #new-current-modal.open { display: flex; }
    #new-current-box {
      background: linear-gradient(180deg, #cce6f8 0%, #b4d4ee 55%, #9ec4e4 100%);
      border: 1.5px solid rgba(130,195,240,.55);
      border-radius: 26px;
      box-shadow: 0 10px 48px rgba(8,50,130,.22), 0 2px 8px rgba(8,50,130,.10);
      padding: 28px 26px 22px; width: 100%; max-width: 500px;
      position: relative; display: flex; flex-direction: column; gap: 22px;
      overflow: hidden;
    }
    #new-current-box::before {
      content: "";
      position: absolute; inset: 0; pointer-events: none;
      background:
        radial-gradient(ellipse at 25% 80%, rgba(255,255,255,.22) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(180,230,255,.18) 0%, transparent 50%);
    }
    #new-current-box h2 {
      font-family: "Cinzel", serif; font-size: 1.5rem; font-weight: 700;
      color: #0c3472; letter-spacing: 1.5px; margin: 0; position: relative; z-index: 1;
    }
    #new-current-box .nc-fields-row {
      display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px; position: relative; z-index: 1;
    }
    @media (max-width: 380px) {
      #new-current-box .nc-fields-row { grid-template-columns: 1fr; }
    }
    #new-current-box .nc-field {
      display: flex; flex-direction: column; gap: 6px; min-width: 0;
    }
    /* Locked fields (Competitive mode): clearly disabled but clean. */
    #new-current-box .nc-big-input:disabled {
      opacity: .6; cursor: not-allowed;
      background: rgba(232,240,250,.6);
      border-color: rgba(140,200,240,.4);
      color: #5a7bb0;
    }
    #new-current-box .nc-field.nc-locked .nc-field-label { color: #6a86b6; }
    #new-current-box .nc-field.nc-locked .nc-field-label::after {
      content: " 🔒"; font-size: 11px;
    }
    #new-current-box .nc-field.nc-locked .nc-select-wrap::after { opacity: .4; }
    /* Mode field accents the active choice so the locked state reads clearly. */
    #new-current-box.nc-comp #nc-field-mode .nc-big-input {
      border-color: rgba(120,90,220,.7);
      box-shadow: 0 0 0 3px rgba(120,90,220,.14);
      color: #4a2a9a;
    }
    #new-current-box.nc-comp #nc-field-mode .nc-field-label { color: #5a32b0; }
    #new-current-box .nc-field-label {
      font-size: 13px; font-weight: 700; color: #2050a0; letter-spacing: .3px;
    }
    #new-current-box .nc-big-input {
      background: rgba(255,255,255,.88);
      border: 1.5px solid rgba(140,200,240,.55);
      border-radius: 16px; padding: 16px 18px;
      font-size: 1.35rem; font-weight: 800; color: #0d3070;
      width: 100%; font-family: "Nunito", sans-serif;
      transition: border-color .15s, box-shadow .15s;
      appearance: none; -webkit-appearance: none;
      cursor: pointer;
    }
    #new-current-box .nc-big-input:focus {
      outline: none;
      border-color: rgba(50,140,240,.65);
      box-shadow: 0 0 0 3px rgba(50,140,240,.15);
    }
    #new-current-box .nc-select-wrap {
      position: relative;
    }
    #new-current-box .nc-select-wrap::after {
      content: "⌄";
      position: absolute; right: 16px; top: 50%; transform: translateY(-56%);
      font-size: 18px; color: #2050a0; pointer-events: none; line-height: 1;
    }
    #nc-password-row { position: relative; z-index: 1; }
    #nc-current-err { color: #c01830; font-size: 12px; min-height: 14px; position: relative; z-index: 1; }
    #nc-close {
      position: absolute; top: 16px; right: 16px;
      width: 40px; height: 40px; border-radius: 50%;
      background: rgba(190,220,248,.72); border: 1.5px solid rgba(120,185,235,.55);
      color: #2a5888; font-size: 18px;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: background .15s, border-color .15s; z-index: 2;
    }
    #nc-close:hover { background: rgba(210,235,255,.9); border-color: rgba(70,150,230,.65); }
    #nc-create-btn {
      position: relative; z-index: 1;
      width: 100%; height: 82px;
      background: url("/nc-btn-full.png") center/cover no-repeat;
      border: none; border-radius: 18px;
      font-family: "Cinzel", serif; font-size: 1.2rem; font-weight: 700;
      color: transparent; letter-spacing: .5px;
      cursor: pointer; overflow: hidden;
      display: flex; align-items: center; justify-content: center;
      transition: filter .15s, transform .12s;
      box-shadow: 0 4px 20px rgba(200,110,0,.3);
    }
    #nc-create-btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(200,110,0,.38); }
    #nc-create-btn:active:not(:disabled) { transform: translateY(0); filter: brightness(.97); }
    #nc-create-btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
    #nc-create-btn.generating {
      background: linear-gradient(100deg, #fbbf58 0%, #fdc964 50%, #fcc55c 100%);
      color: #0c2858;
    }
    #nc-create-btn .nc-btn-label {
      position: relative; z-index: 1; color: inherit;
    }

    /* ── QUICK MATCH: searching bar + mode chooser ──────────────── */
    .qm-search-bar {
      display: flex; align-items: center; gap: 12px;
      margin: 2px 0 16px; padding: 12px 16px;
      background: linear-gradient(90deg, rgba(46,140,240,.16), rgba(120,90,220,.14));
      border: 1.5px solid rgba(60,150,240,.40);
      border-radius: 16px;
      box-shadow: 0 4px 16px rgba(30,99,184,.14);
      position: relative; z-index: 5;
    }
    .qm-spinner {
      width: 18px; height: 18px; flex: none; border-radius: 50%;
      border: 3px solid rgba(46,140,240,.25); border-top-color: #2a7fe0;
      animation: qm-spin .8s linear infinite;
    }
    @keyframes qm-spin { to { transform: rotate(360deg); } }
    .qm-search-text {
      flex: 1; min-width: 0; font-family: "Nunito", sans-serif;
      font-weight: 800; font-size: .98rem; color: #15539e; letter-spacing: .2px;
    }
    .qm-search-secs { color: #6a3fb0; font-variant-numeric: tabular-nums; }
    .qm-cancel-btn {
      flex: none; border: 1.5px solid rgba(200,60,80,.45);
      background: rgba(255,255,255,.85); color: #c0304a;
      font-family: "Nunito", sans-serif; font-weight: 800; font-size: .9rem;
      padding: 8px 14px; border-radius: 12px; cursor: pointer;
      transition: background .15s, transform .12s, box-shadow .15s;
    }
    .qm-cancel-btn:hover { background: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(200,60,80,.22); }
    .qm-cancel-btn:active { transform: translateY(0); }

    /* ── SEAT PICKER MODAL ──────────────────────────────────────── */
    #seat-picker-modal {
      display: none; position: fixed; inset: 0; z-index: 9100;
      background: rgba(180,210,245,.55); backdrop-filter: blur(8px);
      align-items: center; justify-content: center;
    }
    #seat-picker-modal.open { display: flex; }
    #seat-picker-box {
      background: linear-gradient(160deg, #deeaf8 0%, #c8d8f0 100%);
      border: none; border-radius: 28px;
      box-shadow: 0 8px 48px rgba(30,80,160,.22);
      padding: 28px 26px 0; width: 95%; max-width: 520px;
      position: relative; display: flex; flex-direction: column; gap: 16px;
      overflow: hidden;
    }
    #seat-picker-box h2 { font-family:"Cinzel",serif; font-size:1.4rem; color:#1a2d5a; letter-spacing:1.5px; margin:0; font-weight:700; }
    #seat-picker-box .sp-subtitle { font-size:13px; font-weight:600; color:#3a6aaa; margin:0; }
    #seat-picker-err { color: #c03030; font-size: 12px; min-height: 16px; }
    #sp-close {
      position: absolute; top: 14px; right: 14px;
      width: 32px; height: 32px; border-radius: 50%;
      background: rgba(30,60,120,.15); border: none;
      color: #1a2d5a; font-size: 15px; font-weight: 700;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; padding: 0; line-height: 1;
      transition: background .15s;
    }
    #sp-close:hover { background: rgba(30,60,120,.28); }
    #sp-join-btn {
      display: flex; align-items: center; justify-content: center;
      width: calc(100% + 52px); margin-left: -26px;
      background: linear-gradient(90deg, #e8b820, #d4a010);
      border: none; border-radius: 0;
      padding: 20px 24px; font-family: "Cinzel",serif;
      font-size: 1rem; font-weight: 700; color: #1a2d5a;
      letter-spacing: 1px; cursor: pointer; position: relative;
      transition: background .15s;
    }
    #sp-join-btn:not(:disabled):hover { background: linear-gradient(90deg, #f0c830, #e0b020); }
    #sp-join-btn:disabled { cursor: default; }
    #sp-join-btn::before { content: none; }
    #sp-join-btn::after { content: "🪸"; font-size: 26px; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); }
    #sp-crab {
      position: absolute; left: -8px; bottom: 0;
      width: 90px; height: auto;
      pointer-events: none; z-index: 10;
    }

    .lb-tabs {
      display: flex; gap: 5px; overflow-x: auto; padding-bottom: 4px;
      scrollbar-width: none;
    }
    .lb-tabs::-webkit-scrollbar { display: none; }
    .lb-tab {
      flex-shrink: 0; padding: 6px 10px; border-radius: 8px; font-size: 12px;
      font-weight: 700; cursor: pointer; border: 1px solid rgba(58,120,204,.4);
      background: rgba(11,36,72,.7); color: var(--muted); transition: all .15s;
      white-space: nowrap;
    }
    .lb-tab.active { background: rgba(34,72,140,.6); color: var(--cyan); border-color: var(--cyan); }
    .lb-row {
      display: flex; align-items: center; gap: 10px;
      padding: 7px 4px; border-bottom: 1px solid rgba(58,120,204,.12);
      font-size: 13px;
    }
    .lb-row:last-child { border-bottom: none; }
    .lb-rank { width: 24px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
    .lb-name { flex: 1; color: var(--text); font-weight: 700; }
    .lb-score { color: var(--cyan); font-weight: 800; font-family: 'Nunito', sans-serif; }
    .lb-you { color: var(--gold) !important; }

    /* ── Competitive Tab: Ranked Dashboard ───────────────────────── */
    .ph-comp-rank-section {
      padding: 14px 18px 12px;
      display: flex;
      align-items: center;
      gap: 14px;
      flex-wrap: wrap;
      border-bottom: 1px solid rgba(224,184,90,.22);
    }
    .ph-comp-rank-name {
      font-size: 1.25rem;
      font-weight: 900;
      color: #a16f04;
      letter-spacing: .3px;
      min-width: 120px;
    }
    .ph-comp-cp-wrap { flex: 1; min-width: 150px; }
    .ph-comp-cp-row {
      display: flex;
      justify-content: space-between;
      font-size: 11.5px;
      font-weight: 700;
      color: #7a5a10;
      margin-bottom: 5px;
    }
    .ph-cp-bar {
      height: 8px;
      border-radius: 4px;
      background: rgba(224,184,90,.2);
      overflow: hidden;
    }
    .ph-cp-fill {
      height: 100%;
      border-radius: 4px;
      background: linear-gradient(90deg, #d4a017, #f0c840);
      transition: width .5s ease;
      min-width: 4px;
    }
    .ph-comp-season-row {
      font-size: 11px;
      color: rgba(121,88,12,.75);
      width: 100%;
      margin-top: 5px;
    }
    .ph-king-card {
      background: linear-gradient(135deg, rgba(255,250,230,.97) 0%, rgba(255,243,195,.94) 100%);
      border: 1px solid rgba(224,184,90,.52) !important;
    }
    .ph-king-content {
      padding: 10px 16px 14px;
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .ph-king-crown { font-size: 26px; line-height: 1; flex-shrink: 0; }
    .ph-king-info  { flex: 1; min-width: 0; }
    .ph-king-name  { font-size: 14px; font-weight: 800; color: #1a2e4a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ph-king-meta  { font-size: 12px; color: #7a5a10; margin-top: 2px; }
    /* competitive tab overrides for the dash elements */
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-comp-rank-section {
      border-bottom-color: rgba(34,120,240,.18);
    }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-comp-rank-name { color: #0d52a2; }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-comp-cp-row    { color: #1a4a90; }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-comp-season-row{ color: rgba(22,70,160,.7); }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-cp-bar         { background: rgba(34,120,240,.14); }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-cp-fill        { background: linear-gradient(90deg, #1c82d6, #56c2f8); }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-king-card      { background: rgba(215,235,255,.84) !important; border-color: rgba(34,120,240,.28) !important; }
    #auth-stats-lobby[data-bg-tab="competitive"] .ph-king-meta      { color: #1a4a90; }

    /* ── Rank tier badge colors ─────────────────────────────────── */
    .ph-rank-badge {
      display: inline-flex; align-items: center; gap: 5px;
      font-weight: 900; border-radius: 6px; padding: 2px 8px;
      font-size: .82rem; white-space: nowrap;
    }
    .ph-rank-bronze   { background: rgba(176,113,50,.15); color: #8b5a1a; border: 1px solid rgba(176,113,50,.35); }
    .ph-rank-silver   { background: rgba(140,154,166,.15); color: #4a6375; border: 1px solid rgba(140,154,166,.4); }
    .ph-rank-gold     { background: rgba(212,160,0,.16); color: #7a5a00; border: 1px solid rgba(212,160,0,.38); }
    .ph-rank-diamond  { background: rgba(60,160,220,.14); color: #1558a0; border: 1px solid rgba(60,160,220,.35); }
    .ph-rank-emerald  { background: rgba(30,165,100,.13); color: #0e6040; border: 1px solid rgba(30,165,100,.38); }
    .ph-rank-king     { background: linear-gradient(135deg,rgba(255,200,0,.22),rgba(255,140,0,.18)); color: #7a3e00; border: 1px solid rgba(255,160,0,.5); }
    /* CP progress bar tier colors */
    .ph-cp-fill.tier-silver   { background: linear-gradient(90deg,#8fa8b8,#b8cdd8); }
    .ph-cp-fill.tier-gold     { background: linear-gradient(90deg,#d4a017,#f0c840); }
    .ph-cp-fill.tier-diamond  { background: linear-gradient(90deg,#1c82d6,#56c2f8); }
    .ph-cp-fill.tier-emerald  { background: linear-gradient(90deg,#1ea864,#42d68a); }
    .ph-cp-fill.tier-king     { background: linear-gradient(90deg,#ff9800,#ffd740,#ff9800); background-size: 200%; animation: ph-king-shimmer 2s linear infinite; }
    @keyframes ph-king-shimmer { 0%{background-position:0%} 100%{background-position:200%} }
    /* ── Rank Progression Strip ─────────────────────────────────── */
    .ph-rank-prog-strip {
      background: rgba(230,245,255,.82);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(120,190,235,.4);
      border-radius: 20px;
      padding: 18px 22px 16px;
      margin-bottom: 14px;
      box-shadow: 0 4px 18px rgba(0,50,120,.08);
    }
    .ph-rank-prog-title {
      font-size: .82rem;
      font-weight: 800;
      color: #3a6090;
      letter-spacing: .5px;
      margin-bottom: 14px;
      display: flex;
      align-items: center;
      gap: 7px;
    }
    .ph-rank-prog-tiers {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 6px;
    }
    .ph-rank-prog-tier {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      flex: 1;
      min-width: 0;
    }
    /* Connector dots between tiers */
    .ph-rank-prog-connector {
      width: 28px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding-bottom: 28px;
    }
    .ph-rank-prog-connector::after {
      content: "";
      display: block;
      width: 100%;
      height: 2px;
      background: rgba(130,185,230,.4);
      border-radius: 1px;
      border-top: 1.5px dashed rgba(100,170,220,.5);
      background: none;
    }
    .ph-rank-prog-badge-wrap {
      width: 56px; height: 56px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
      position: relative;
      border: 2.5px solid transparent;
      transition: transform .15s;
    }
    .ph-rank-prog-badge-wrap.tier-bronze  { background: linear-gradient(145deg,#f5dbb0,#dfa060); border-color: #c87830; }
    .ph-rank-prog-badge-wrap.tier-silver  { background: linear-gradient(145deg,#dce8f4,#aac0d0); border-color: #88a8c0; }
    .ph-rank-prog-badge-wrap.tier-gold    { background: linear-gradient(145deg,#fff0a0,#e8c030); border-color: #c8a000; }
    .ph-rank-prog-badge-wrap.tier-diamond { background: linear-gradient(145deg,#c0e0f8,#70b8f0); border-color: #3890d8; }
    .ph-rank-prog-badge-wrap.tier-emerald { background: linear-gradient(145deg,#b0e8c8,#50c880); border-color: #28a060; }
    .ph-rank-prog-badge-wrap.tier-king    { background: linear-gradient(145deg,#fff0c0,#ffc840,#ff9800); border-color: #e08000; }
    .ph-rank-prog-badge-wrap.prog-active {
      transform: scale(1.18);
      box-shadow: 0 0 0 3px rgba(34,130,240,.35), 0 6px 18px rgba(34,130,240,.22);
      border-color: #2282f0 !important;
    }
    .ph-rank-prog-badge-wrap.prog-done { opacity: .7; }
    .ph-rank-prog-badge-wrap.prog-future { opacity: .42; filter: grayscale(.4); }
    .ph-rank-prog-tier-name {
      font-size: .68rem;
      font-weight: 700;
      color: #4a7aaa;
      text-align: center;
      line-height: 1.2;
      white-space: nowrap;
    }
    .ph-rank-prog-divs {
      display: flex;
      gap: 4px;
    }
    .ph-rank-prog-div {
      width: 20px; height: 20px;
      border-radius: 5px;
      background: rgba(130,190,230,.2);
      border: 1.5px solid rgba(100,170,220,.3);
      display: flex; align-items: center; justify-content: center;
      font-size: .6rem;
      font-weight: 800;
      color: #6a96bb;
    }
    .ph-rank-prog-div.div-done  { background: rgba(34,130,240,.18); border-color: #2282f0; color: #1a5cbf; }
    .ph-rank-prog-div.div-active { background: #2282f0; border-color: #1a6ad8; color: #fff; box-shadow: 0 2px 6px rgba(34,130,240,.4); }
    .ph-rank-prog-div.div-king  { font-size: .72rem; color: #c87800; }

    /* ── Season Summary Card (right panel) ──────────────────────── */
    .ph-season-summary-card {
      background: rgba(230,245,255,.88);
      backdrop-filter: blur(14px);
      border: 1px solid rgba(120,190,235,.45);
      border-radius: 20px;
      padding: 18px 18px 14px;
      box-shadow: 0 4px 18px rgba(0,50,120,.1);
      margin-bottom: 14px;
    }
    .ph-ss-card-title {
      display: flex; align-items: center; gap: 8px;
      font-size: 1rem; font-weight: 800; color: #1a4a90;
      margin-bottom: 14px;
    }
    .ph-ss-rank-row {
      display: flex; align-items: center; gap: 14px;
      background: rgba(255,255,255,.6);
      border-radius: 14px;
      padding: 12px 14px;
      margin-bottom: 12px;
      border: 1px solid rgba(120,190,235,.3);
    }
    .ph-ss-rank-badge-img {
      width: 54px; height: 54px; border-radius: 50%; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      font-size: 1.6rem;
    }
    .ph-ss-rank-info { min-width: 0; }
    .ph-ss-rank-label { font-size: .72rem; font-weight: 700; color: #5a86b0; }
    .ph-ss-rank-name  { font-size: 1.05rem; font-weight: 900; color: #1a3a7a; line-height: 1.1; }
    .ph-ss-rank-cp    { font-size: .82rem; font-weight: 800; color: #2a7ad8; margin-top: 2px; }
    .ph-ss-mini-stats {
      display: grid; grid-template-columns: repeat(3, 1fr);
      gap: 8px; margin-bottom: 12px;
    }
    .ph-ss-mini-stat {
      background: rgba(255,255,255,.55);
      border: 1px solid rgba(120,190,235,.3);
      border-radius: 10px;
      padding: 8px 6px;
      text-align: center;
    }
    .ph-ss-mini-label { font-size: .65rem; font-weight: 700; color: #5a86b0; }
    .ph-ss-mini-val   { font-size: 1.05rem; font-weight: 900; color: #1a3a7a; }
    .ph-ss-breakdown-btn {
      width: 100%;
      padding: 10px;
      border-radius: 12px;
      border: 1px solid rgba(34,130,240,.3);
      background: rgba(34,130,240,.08);
      color: #1a5cbf;
      font-size: .85rem; font-weight: 700;
      cursor: pointer;
      display: flex; align-items: center; justify-content: space-between;
      transition: background .15s;
    }
    .ph-ss-breakdown-btn:hover { background: rgba(34,130,240,.15); }

    /* ── King of the Critters redesign ─────────────────────────── */
    .ph-king-redesign {
      background: rgba(230,245,255,.88);
      backdrop-filter: blur(14px);
      border: 1px solid rgba(120,190,235,.45);
      border-radius: 20px;
      padding: 18px 18px 16px;
      box-shadow: 0 4px 18px rgba(0,50,120,.1);
    }
    .ph-king-redesign-title {
      display: flex; align-items: center; gap: 8px;
      font-size: 1rem; font-weight: 800; color: #1a4a90;
      margin-bottom: 14px;
    }
    .ph-king-art {
      text-align: center;
      font-size: 4rem;
      line-height: 1;
      margin: 8px 0 12px;
      filter: drop-shadow(0 4px 8px rgba(200,140,0,.35));
    }
    .ph-king-desc {
      text-align: center;
      font-size: .82rem;
      color: #2a5090;
      line-height: 1.5;
      margin-bottom: 8px;
    }
    .ph-king-empty-state {
      text-align: center;
      padding: 10px 0 6px;
    }
    .ph-king-empty-art {
      font-size: 3rem;
      opacity: .5;
      margin-bottom: 8px;
    }
    .ph-king-empty-text {
      font-size: .82rem;
      color: #4a7aaa;
      font-style: italic;
    }
    .ph-king-current {
      background: rgba(255,255,255,.55);
      border: 1px solid rgba(200,160,0,.35);
      border-radius: 12px;
      padding: 10px 12px;
      margin-bottom: 8px;
    }
    .ph-king-current-name { font-size: 1rem; font-weight: 900; color: #1a3a7a; }
    .ph-king-current-meta { font-size: .78rem; color: #7a5a10; margin-top: 2px; }

    /* Season history */
    .ph-season-history-btn {
      background: rgba(34,120,240,.08); border: 1px solid rgba(34,120,240,.22);
      border-radius: 7px; padding: 6px 12px; font-size: 12px; font-weight: 700;
      color: #1a5cbf; cursor: pointer; transition: background .15s;
    }
    .ph-season-history-btn:hover { background: rgba(34,120,240,.15); }
    /* Season history modal */
    #ph-season-modal {
      position: fixed; inset: 0; z-index: 9999; display: none;
      background: rgba(4,18,40,.65); align-items: center; justify-content: center;
    }
    #ph-season-modal.open { display: flex; }
    #ph-whatsnew-modal {
      position: fixed; inset: 0; z-index: 10000; display: none;
      background: rgba(4,18,40,.65); align-items: center; justify-content: center;
    }
    #ph-whatsnew-modal.open { display: flex; }
    .ph-whatsnew-box {
      background: linear-gradient(160deg,#f0f8ff 0%,#e8f4fd 100%);
      border: 1px solid rgba(34,120,240,.28); border-radius: 16px;
      width: 90%; max-width: 500px; max-height: 82vh; overflow-y: auto;
      padding: 20px 22px; box-shadow: 0 12px 48px rgba(4,18,80,.22);
    }
    .ph-whatsnew-title { font-size: 1.15rem; font-weight: 900; color: #0d3a78; }
    .ph-whatsnew-sub { font-size: .82rem; font-weight: 700; color: #4a78b8; margin-bottom: 14px; }
    .ph-wn-entry {
      padding: 11px 13px; margin-bottom: 9px; border-radius: 11px;
      background: rgba(255,255,255,.78); border: 1px solid rgba(34,120,240,.14);
    }
    .ph-wn-entry-head {
      display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
    }
    .ph-wn-ver {
      font-size: .72rem; font-weight: 900; color: #fff; letter-spacing: .04em;
      background: linear-gradient(135deg,#2d8be0,#1e63b8); padding: 3px 9px; border-radius: 999px;
    }
    .ph-wn-entry-title { font-size: .95rem; font-weight: 800; color: #0e2f5a; }
    .ph-wn-list { margin: 0; padding-left: 18px; }
    .ph-wn-list li { font-size: .86rem; color: #335c8a; line-height: 1.45; margin-bottom: 3px; }

    /* ══ HELP & FEEDBACK button tooltip ══════════════════════════════ */
    .ph-help-tip {
      position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
      background: linear-gradient(135deg,#1e63b8,#2d8be0); color: #fff;
      font-size: .74rem; font-weight: 800; letter-spacing: .01em;
      padding: 5px 10px; border-radius: 8px; white-space: nowrap;
      box-shadow: 0 6px 18px rgba(4,40,100,.28);
      opacity: 0; pointer-events: none; transition: opacity .14s, transform .14s; z-index: 30;
    }
    .ph-help-tip::before {
      content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
      border: 5px solid transparent; border-bottom-color: #2476c9;
    }
    .ph-help-btn:hover .ph-help-tip,
    .ph-help-btn:focus-visible .ph-help-tip { opacity: 1; transform: translateX(-50%) translateY(0); }

    /* ══ HELP & FEEDBACK modal ═══════════════════════════════════════ */
    #ph-help-modal {
      position: fixed; inset: 0; z-index: 10001; display: none;
      background: rgba(4,18,40,.66); align-items: center; justify-content: center;
      padding: 16px; -webkit-overflow-scrolling: touch;
    }
    #ph-help-modal.open { display: flex; }
    .ph-help-box {
      position: relative;
      background: linear-gradient(165deg,#f3faff 0%,#e4f1fc 58%,#dbeefb 100%);
      border: 1px solid rgba(34,120,240,.30); border-radius: 20px;
      width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
      padding: 22px 22px 24px; box-shadow: 0 18px 54px rgba(4,18,80,.30);
    }
    .ph-help-x {
      position: absolute; top: 12px; right: 14px; background: rgba(255,255,255,.7);
      border: 1px solid rgba(34,120,240,.2); width: 30px; height: 30px; border-radius: 50%;
      font-size: 15px; cursor: pointer; color: #2f6190; line-height: 1; z-index: 2;
      display: flex; align-items: center; justify-content: center;
    }
    .ph-help-x:hover { background: #fff; color: #14406e; }
    .ph-help-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-right: 30px; }
    .ph-help-wave {
      font-size: 30px; width: 52px; height: 52px; flex-shrink: 0; border-radius: 16px;
      display: flex; align-items: center; justify-content: center;
      background: linear-gradient(135deg,rgba(120,190,235,.30),rgba(45,139,224,.20));
      border: 1px solid rgba(34,120,240,.22);
    }
    .ph-help-title { font-size: 1.32rem; font-weight: 900; color: #0d3a78; line-height: 1.1; }
    .ph-help-sub { font-size: .86rem; font-weight: 700; color: #3f78bb; margin-top: 3px; }
    /* Three tappable cards — each opens its own Google Form in a new tab */
    .ph-help-cards { display: flex; flex-direction: column; gap: 11px; }
    .ph-help-card {
      display: flex; align-items: center; gap: 13px; text-decoration: none;
      padding: 14px 15px; border-radius: 16px; cursor: pointer;
      background: rgba(255,255,255,.74); border: 1px solid rgba(34,120,240,.20);
      box-shadow: 0 4px 14px rgba(26,90,180,.10);
      transition: transform .13s, box-shadow .13s, border-color .13s, background .13s;
    }
    .ph-help-card:hover {
      transform: translateY(-2px); background: #fff;
      border-color: rgba(45,139,224,.5); box-shadow: 0 10px 24px rgba(26,90,180,.20);
    }
    .ph-help-card:focus-visible { outline: 3px solid rgba(45,139,224,.45); outline-offset: 2px; }
    .ph-help-card-emoji {
      font-size: 26px; width: 50px; height: 50px; flex-shrink: 0; border-radius: 14px;
      display: flex; align-items: center; justify-content: center;
      background: linear-gradient(135deg,rgba(120,190,235,.28),rgba(45,139,224,.16));
      border: 1px solid rgba(34,120,240,.16);
    }
    .ph-help-card-b .ph-help-card-emoji { background: linear-gradient(135deg,rgba(255,170,120,.30),rgba(240,120,90,.18)); border-color: rgba(230,120,80,.22); }
    .ph-help-card-i .ph-help-card-emoji { background: linear-gradient(135deg,rgba(120,225,180,.30),rgba(70,200,150,.18)); border-color: rgba(60,190,140,.22); }
    .ph-help-card-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
    .ph-help-card-title { font-size: 1.04rem; font-weight: 900; color: #0d3a78; line-height: 1.15; }
    .ph-help-card-desc { font-size: .82rem; font-weight: 600; color: #4d7bb0; margin-top: 2px; }
    .ph-help-card-arrow { font-size: 1.5rem; font-weight: 900; color: #6aa0d6; flex-shrink: 0; transition: transform .13s; }
    .ph-help-card:hover .ph-help-card-arrow { transform: translateX(3px); color: #2d8be0; }
    .ph-help-foot {
      margin-top: 16px; text-align: center; font-size: .8rem; font-weight: 700;
      color: #4d7bb0; line-height: 1.4;
    }
    @media (max-width: 560px) {
      #ph-help-modal { padding: 10px; align-items: flex-start; }
      .ph-help-box { max-height: 92vh; padding: 18px 16px 20px; border-radius: 18px; margin-top: 8px; }
      .ph-help-title { font-size: 1.18rem; }
      .ph-help-card { padding: 15px 14px; }
      .ph-help-card-title { font-size: 1.06rem; }
    }
    .ph-season-modal-box {
      background: linear-gradient(160deg,#f0f8ff 0%,#e8f4fd 100%);
      border: 1px solid rgba(34,120,240,.28); border-radius: 16px;
      width: 90%; max-width: 480px; max-height: 80vh; overflow-y: auto;
      padding: 20px 22px; box-shadow: 0 12px 48px rgba(4,18,80,.22);
    }
    .ph-season-modal-title { font-size: 1.1rem; font-weight: 900; color: #0d3a78; margin-bottom: 14px; }
    .ph-season-hist-row {
      display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px;
      border-radius: 9px; background: rgba(255,255,255,.72); margin-bottom: 8px;
      border: 1px solid rgba(34,120,240,.12);
    }
    .ph-season-hist-id { font-weight: 800; color: #0d3a78; font-size: .9rem; min-width: 72px; }
    .ph-season-hist-info { flex: 1; font-size: .82rem; color: #2a4a6e; line-height: 1.5; }
    .ph-season-hist-king { font-size: .78rem; color: #7a5a10; margin-top: 2px; }
    /* Enhanced leaderboard in overlay */
    .comp-lb-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
    .comp-lb-tab {
      background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
      color: rgba(255,255,255,.7); border-radius: 6px; padding: 5px 10px;
      font-size: 11px; font-weight: 700; cursor: pointer; transition: all .15s;
    }
    .comp-lb-tab.active { background: rgba(34,120,240,.5); border-color: rgba(34,120,240,.8); color: #fff; }
    .comp-lb-tab:hover:not(.active) { background: rgba(255,255,255,.14); }
    .comp-lb-cell-cp   { font-weight: 800; color: #f5d060; font-size: 11px; }
    .comp-lb-cell-rank { font-size: 10px; color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
    .comp-lb-cell-pct  { font-size: 11px; color: rgba(255,255,255,.8); }

    /* ── ACHIEVEMENT POPUP ───────────────────────────────────────────── */
    #ach-unlock-popup {
      position: fixed;
      top: 18px;
      right: -380px;
      z-index: 99999;
      width: 300px;
      background: linear-gradient(135deg, #e8f7ff 0%, #d0f0f8 50%, #c8efe6 100%);
      border: 2px solid rgba(37,165,124,.55);
      border-radius: 18px;
      padding: 13px 15px;
      box-shadow: 0 6px 28px rgba(34,130,190,.22), 0 0 0 4px rgba(37,165,124,.10), inset 0 1px 0 rgba(255,255,255,.8);
      transition: right .45s cubic-bezier(.22,1,.36,1), opacity .3s ease;
      opacity: 0;
      pointer-events: none;
    }
    #ach-unlock-popup.visible {
      right: 18px;
      opacity: 1;
    }
    .ach-popup-label {
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 1.6px;
      text-transform: uppercase;
      color: #1a8a6a;
      margin-bottom: 8px;
    }
    .ach-popup-body {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .ach-popup-icon {
      font-size: 2rem;
      width: 50px;
      height: 50px;
      border-radius: 13px;
      background: linear-gradient(135deg, rgba(37,165,124,.18) 0%, rgba(34,216,248,.18) 100%);
      border: 1.5px solid rgba(37,165,124,.4);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      box-shadow: 0 2px 12px rgba(37,165,124,.2);
    }
    .ach-popup-info { min-width: 0; }
    .ach-popup-name {
      font-size: .95rem;
      font-weight: 800;
      color: #0d4a3a;
      line-height: 1.25;
      margin-bottom: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ach-popup-xp {
      font-size: .84rem;
      font-weight: 900;
      color: #c07a00;
    }

    /* ── ACHIEVEMENT PAGE (Steam-inspired, ocean themed) ─────────────── */
    .ach-main-card { padding: 0 !important; overflow: visible; }
    .ach-page-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 18px 22px 14px;
      border-bottom: 1px solid rgba(38,128,200,.15);
    }
    .ach-page-title {
      font-size: 1.15rem;
      font-weight: 800;
      color: #1a4f97;
    }
    /* Overall progress panel */
    .ach-progress-panel {
      margin: 16px 20px;
      background: linear-gradient(135deg, rgba(38,128,200,.1) 0%, rgba(13,148,136,.08) 100%);
      border: 1.5px solid rgba(38,128,200,.22);
      border-radius: 14px;
      padding: 16px 20px;
    }
    .ach-prog-header {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 10px;
    }
    .ach-prog-stat {
      font-size: 1.25rem;
      font-weight: 900;
      color: #1a4f97;
    }
    .ach-prog-stat span { color: #3a7abf; }
    .ach-prog-pct-val {
      font-size: 1.1rem;
      font-weight: 800;
      color: #0d8a6e;
    }
    .ach-prog-bar-track {
      height: 12px;
      background: rgba(38,128,200,.14);
      border-radius: 8px;
      overflow: hidden;
      margin-bottom: 8px;
      border: 1px solid rgba(38,128,200,.18);
    }
    .ach-prog-fill {
      height: 100%;
      background: linear-gradient(90deg, #1ca87a 0%, #27c8a0 50%, #22d8f8 100%);
      border-radius: 8px;
      transition: width .6s ease;
      box-shadow: 0 0 8px rgba(39,200,160,.4);
    }
    .ach-prog-remaining {
      font-size: .82rem;
      color: #5a7a9a;
      font-weight: 700;
    }
    /* Filter row */
    .ach-filter-row {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: auto;
    }
    .ach-filter-sel {
      border: 1.5px solid rgba(38,128,200,.3);
      background: rgba(255,255,255,.85);
      border-radius: 8px;
      padding: 6px 28px 6px 10px;
      font-size: .88rem;
      font-weight: 700;
      color: #1a4f97;
      font-family: "Nunito", sans-serif;
      cursor: pointer;
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234a7ab8'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
    }
    .ach-filter-sel:focus { outline: 2px solid rgba(38,128,200,.4); }
    /* Achievement list */
    .ach-steam-list {
      display: flex;
      flex-direction: column;
      gap: 0;
      padding: 0 16px 20px;
      max-height: 520px;
      overflow-y: auto;
    }
    .ach-empty {
      text-align: center;
      color: #7a9ab8;
      font-size: .92rem;
      padding: 28px 16px;
    }
    /* Achievement card */
    .ach-steam-card {
      display: flex;
      align-items: flex-start;
      gap: 14px;
      padding: 13px 14px;
      border-radius: 12px;
      margin-bottom: 7px;
      border: 1.5px solid rgba(38,128,200,.18);
      background: rgba(255,255,255,.78);
      transition: border-color .15s, box-shadow .15s;
      position: relative;
    }
    .ach-steam-card:last-child { margin-bottom: 0; }
    .ach-steam-card:hover { border-color: rgba(38,128,200,.38); box-shadow: 0 2px 10px rgba(38,128,200,.08); }
    .ach-steam-card.ach-done {
      background: linear-gradient(135deg, #e6faf3 0%, #d4f5ea 100%);
      border-color: rgba(22,163,103,.55);
      box-shadow: 0 0 0 1px rgba(22,163,103,.18) inset, 0 2px 8px rgba(22,163,103,.12);
    }
    .ach-steam-card.ach-done:hover { border-color: rgba(22,163,103,.8); box-shadow: 0 2px 14px rgba(22,163,103,.22); }
    .ach-steam-card.ach-secret { opacity: .72; }
    /* Icon */
    .ach-icon-wrap {
      width: 50px;
      height: 50px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.7rem;
      flex-shrink: 0;
      background: rgba(38,128,200,.07);
      border: 1.5px solid rgba(38,128,200,.18);
    }
    .ach-icon-done {
      background: linear-gradient(135deg, rgba(22,163,103,.28) 0%, rgba(39,200,160,.18) 100%);
      border: 1.5px solid rgba(22,163,103,.6);
      box-shadow: 0 0 14px rgba(22,163,103,.25);
    }
    .ach-icon-locked {
      background: rgba(38,128,200,.08);
      border: 1.5px solid rgba(38,128,200,.2);
      filter: grayscale(.6);
    }
    /* Info */
    .ach-info { flex: 1; min-width: 0; }
    .ach-name {
      font-size: .95rem;
      font-weight: 800;
      color: #1a3e7a;
      margin-bottom: 3px;
      line-height: 1.2;
    }
    .ach-steam-card.ach-done .ach-name { color: #065f39; font-weight: 900; }
    .ach-steam-card.ach-secret .ach-name { color: #5a7a9a; }
    .ach-desc {
      font-size: .82rem;
      color: #5a7a9a;
      line-height: 1.4;
      margin-bottom: 6px;
    }
    .ach-steam-card.ach-done .ach-desc { color: #1a6048; }
    /* Progress bar on card */
    .ach-steam-prog-wrap { margin-top: 5px; }
    .ach-steam-prog-bar {
      height: 6px;
      background: rgba(38,128,200,.15);
      border-radius: 4px;
      overflow: hidden;
      margin-bottom: 3px;
    }
    .ach-steam-prog-bar.ach-prog-complete .ach-steam-prog-fill {
      background: linear-gradient(90deg, #1ca87a, #27c8a0);
    }
    .ach-steam-prog-fill {
      height: 100%;
      background: linear-gradient(90deg, #2680c8, #22d8f8);
      border-radius: 4px;
      transition: width .5s ease;
    }
    .ach-steam-prog-text {
      font-size: .76rem;
      color: #6a8aaa;
      font-weight: 700;
    }
    /* Right side */
    .ach-right {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 5px;
      flex-shrink: 0;
      min-width: 90px;
    }
    .ach-xp {
      font-size: .9rem;
      font-weight: 900;
      color: #c89a00;
      white-space: nowrap;
    }
    .ach-steam-card.ach-done .ach-xp { color: #1d8a6e; }
    .ach-badge {
      font-size: .72rem;
      font-weight: 800;
      padding: 3px 8px;
      border-radius: 6px;
      white-space: nowrap;
    }
    .ach-badge-done {
      background: rgba(45,189,130,.16);
      color: #0d6040;
      border: 1px solid rgba(45,189,130,.35);
    }
    .ach-badge-locked {
      background: rgba(38,128,200,.1);
      color: #4a6a8a;
      border: 1px solid rgba(38,128,200,.2);
    }
    .ach-unlock-date {
      font-size: .72rem;
      color: #6a8aaa;
      white-space: nowrap;
    }
    @media (max-width: 600px) {
      .ach-steam-list { max-height: none; }
      .ach-right { min-width: 72px; }
      .ach-icon-wrap { width: 42px; height: 42px; font-size: 1.4rem; }
    }

    .av-ach-section {
      display: none; /* section removed from achievements panel */
    }
    .av-ach-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 10px;
      padding: 16px 20px 10px;
    }
    .av-ach-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 1rem;
      font-weight: 900;
      color: #1a3e7a;
      letter-spacing: .2px;
    }
    .av-ach-summary {
      margin: 0 20px 8px;
      background: linear-gradient(135deg, rgba(107,72,255,.07) 0%, rgba(22,200,180,.06) 100%);
      border: 1.5px solid rgba(107,72,255,.18);
      border-radius: 12px;
      padding: 12px 16px;
    }
    .av-ach-sum-row {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 8px;
    }
    .av-ach-sum-stat {
      font-size: 1.1rem;
      font-weight: 900;
      color: #4a2a9a;
    }
    .av-ach-sum-stat span { color: #7a4af0; }
    .av-ach-sum-pct {
      font-size: 1rem;
      font-weight: 800;
      color: #0d8a6e;
    }
    .av-ach-bar-track {
      height: 10px;
      background: rgba(107,72,255,.12);
      border-radius: 6px;
      overflow: hidden;
      border: 1px solid rgba(107,72,255,.16);
    }
    .av-ach-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, #7c3aed 0%, #a855f7 50%, #22d8f8 100%);
      border-radius: 6px;
      transition: width .6s ease;
      box-shadow: 0 0 8px rgba(168,85,247,.35);
    }
    .av-ach-list {
      display: flex;
      flex-direction: column;
      gap: 0;
      padding: 0 16px 20px;
      max-height: 480px;
      overflow-y: auto;
    }
    .av-ach-card {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      border-radius: 12px;
      margin-bottom: 7px;
      border: 1.5px solid rgba(107,72,255,.15);
      background: rgba(255,255,255,.8);
      transition: border-color .15s, box-shadow .15s;
    }
    .av-ach-card:last-child { margin-bottom: 0; }
    .av-ach-card:hover { border-color: rgba(107,72,255,.35); box-shadow: 0 2px 10px rgba(107,72,255,.1); }
    .av-ach-card.av-done {
      background: linear-gradient(135deg, rgba(45,189,130,.08) 0%, rgba(39,200,160,.05) 100%);
      border-color: rgba(45,189,130,.38);
    }
    .av-ach-card.av-done:hover { border-color: rgba(45,189,130,.55); box-shadow: 0 2px 10px rgba(45,189,130,.12); }
    .av-icon-wrap {
      width: 46px;
      height: 46px;
      border-radius: 50%;
      border: 2px solid rgba(107,72,255,.22);
      background: rgba(107,72,255,.06);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      overflow: hidden;
    }
    .av-icon-wrap img { width: 100%; height: 100%; object-fit: contain; }
    .av-ach-card.av-done .av-icon-wrap { border-color: rgba(45,189,130,.45); background: rgba(45,189,130,.08); }
    .av-info { flex: 1; min-width: 0; }
    .av-name {
      font-size: .9rem;
      font-weight: 800;
      color: #1a3e7a;
      margin-bottom: 1px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .av-ach-card.av-done .av-name { color: #0d6040; }
    .av-species-tag {
      font-size: .72rem;
      font-weight: 700;
      color: #7a5ab8;
      margin-bottom: 3px;
    }
    .av-req {
      font-size: .78rem;
      color: #5a7a9a;
      line-height: 1.35;
    }
    .av-ach-card.av-done .av-req { color: #3a7060; }
    .av-prog-wrap { margin-top: 5px; }
    .av-prog-bar {
      height: 5px;
      background: rgba(107,72,255,.12);
      border-radius: 3px;
      overflow: hidden;
      margin-bottom: 2px;
    }
    .av-prog-fill {
      height: 100%;
      background: linear-gradient(90deg, #7c3aed, #a855f7);
      border-radius: 3px;
      transition: width .5s ease;
    }
    .av-ach-card.av-done .av-prog-fill { background: linear-gradient(90deg, #1ca87a, #27c8a0); }
    .av-prog-text {
      font-size: .72rem;
      color: #7a5ab8;
      font-weight: 700;
    }
    .av-right {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 4px;
      flex-shrink: 0;
    }
    .av-badge {
      font-size: .7rem;
      font-weight: 800;
      padding: 3px 7px;
      border-radius: 6px;
      white-space: nowrap;
    }
    .av-badge-done { background: rgba(45,189,130,.16); color: #0d6040; border: 1px solid rgba(45,189,130,.35); }
    .av-badge-locked { background: rgba(107,72,255,.1); color: #5a3ab8; border: 1px solid rgba(107,72,255,.2); }
    .av-badge-secret { background: rgba(80,80,100,.08); color: #6a7a9a; border: 1px solid rgba(80,80,100,.16); }
    @media (max-width: 600px) {
      .av-ach-list { max-height: none; }
    }

    /* ════ SPECTATOR MODE ════════════════════════════════════════ */
    #pv-spectator-panel {
      display: none; flex-direction: row; align-items: center; justify-content: center;
      gap: 12px; padding: 7px 18px; flex-wrap: wrap;
      background: rgba(8,28,60,.92); border-top: 1px solid rgba(95,179,214,.25);
      text-align: center; flex-shrink: 0;
    }
    #pv-spectator-panel.active { display: flex; }
    .spec-title { font-family:"Cinzel",serif; font-size:.95rem; font-weight:900; color:#22d8f8; }
    .spec-hint { font-size:.8rem; color:rgba(200,225,255,.7); }
    .spec-viewing { font-size:.88rem; font-weight:800; color:#ffd36b; margin-top:4px; }
    #pv-spectator-list {
      display: none; padding: 6px 14px;
      background: rgba(8,24,50,.7); border-top: 1px solid rgba(95,179,214,.15);
    }
    #pv-spectator-list.visible { display: block; }
    .spec-list-title { font-size:.72rem; font-weight:900; text-transform:uppercase;
      letter-spacing:.08em; color:#8fb8da; margin-bottom:4px; }
    .spec-list-row { display:flex; align-items:center; gap:8px;
      font-size:.8rem; color:#bfe6ff; padding:3px 0; }
    .spec-list-row .spec-name { flex:1; }
    .spec-kick-btn { font-size:.7rem; padding:2px 8px; border-radius:5px; cursor:pointer;
      background:rgba(232,64,87,.15); border:1px solid rgba(232,64,87,.4);
      color:#e84057; font-weight:800; font-family:"Nunito",sans-serif; }
    .spec-kick-btn:hover { background:rgba(232,64,87,.3); }
    .spec-kick-progress { font-size:.7rem; color:#f0a860; font-weight:700; }
    /* Friends tab in-game status */
    .ph-fr-ingame { color: #22d8f8; }
    .ph-fr-ingame .ph-fr-dot { background: #22d8f8; box-shadow: 0 0 6px rgba(34,216,248,.9); }
    .ph-fr-spectate-btn { font-size:.72rem; font-weight:800; padding:4px 10px;
      border-radius:8px; background:rgba(34,216,248,.15); border:1px solid rgba(34,216,248,.4);
      color:#22d8f8; cursor:pointer; font-family:"Nunito",sans-serif; margin-top:5px; display:block; }
    .ph-fr-spectate-btn:hover { background:rgba(34,216,248,.28); }

    /* ════ AVATAR GALLERY (full-screen hero-select) ════════════════ */
    #avatar-gallery {
      position: fixed; inset: 0; z-index: 9200; display: none;
      flex-direction: column;
      font-family: "Nunito", sans-serif;
      color: #eaf4ff;
      background:
        radial-gradient(ellipse at 50% -8%, rgba(34,216,248,.18) 0%, transparent 55%),
        radial-gradient(ellipse at 12% 88%, rgba(24,200,168,.12) 0%, transparent 50%),
        linear-gradient(180deg, #0c2a52 0%, #0a2244 45%, #07182f 100%);
      overflow: hidden;
    }
    #avatar-gallery.open { display: flex; animation: gal-pop-in .22s cubic-bezier(.2,.9,.4,1) both; }
    #avatar-gallery.gal-closing { display: flex !important; animation: gal-pop-out .18s cubic-bezier(.4,0,.6,1) both !important; }
    @keyframes gal-pop-in  { from { opacity:0; transform:scale(.94) translateY(8px); } to { opacity:1; transform:scale(1) translateY(0); } }
    @keyframes gal-pop-out { from { opacity:1; transform:scale(1) translateY(0); } to { opacity:0; transform:scale(.94) translateY(8px); } }
    /* drifting light rays + bubbles */
    #avatar-gallery::before {
      content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
      background:
        radial-gradient(circle at 20% 0%, rgba(120,200,255,.10) 0%, transparent 22%),
        radial-gradient(circle at 70% 0%, rgba(120,200,255,.08) 0%, transparent 20%);
    }
    .gal-header {
      position: relative; z-index: 2;
      display: flex; align-items: center; gap: 14px;
      padding: 14px 22px;
      border-bottom: 1px solid rgba(95,179,214,.22);
      background: linear-gradient(180deg, rgba(8,28,55,.6), rgba(8,28,55,.2));
      backdrop-filter: blur(6px);
      flex-shrink: 0;
    }
    .gal-back-btn {
      flex-shrink: 0;
      background: rgba(95,179,214,.14); color: #bfe6ff;
      border: 1.5px solid rgba(95,179,214,.4);
      border-radius: 10px; padding: 9px 16px;
      font-weight: 800; font-size: .9rem; cursor: pointer;
      font-family: "Nunito", sans-serif;
      transition: background .15s, transform .15s;
    }
    .gal-back-btn:hover { background: rgba(95,179,214,.26); transform: translateX(-2px); }
    .gal-hero-avatar {
      width: 54px; height: 54px; border-radius: 50%;
      border: 2.5px solid #ffd36b; overflow: hidden; flex-shrink: 0;
      background: #0e2747; display: flex; align-items: center; justify-content: center;
      box-shadow: 0 0 16px rgba(255,211,107,.35);
    }
    .gal-hero-avatar img { width: 100%; height: 100%; object-fit: contain; }
    .gal-hero-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
    .gal-title {
      font-family: "Cinzel", serif; font-size: 1.35rem; font-weight: 900;
      letter-spacing: 1.5px; color: #ffd36b;
      text-shadow: 0 0 22px rgba(255,211,107,.4);
      line-height: 1.1;
    }
    .gal-hero-sub { font-size: .82rem; color: #9fc6e8; font-weight: 700; }
    .gal-hero-sub .gal-hero-name { color: #eaf4ff; }
    .gal-code-box {
      position: relative; flex-shrink: 0;
      display: flex; align-items: center; gap: 7px;
      margin-left: 16px;
    }
    .gal-code-input {
      width: 108px; border-radius: 9px;
      border: 1.5px solid rgba(255,211,107,.45);
      background: rgba(8,28,55,.72); color: #ffe9b8;
      padding: 8px 11px; font-size: .9rem; font-weight: 800;
      letter-spacing: 2.5px; text-align: center;
      font-family: "Nunito", sans-serif; outline: none;
      transition: border-color .15s, box-shadow .15s;
    }
    .gal-code-input::placeholder { color: #7fa8cc; letter-spacing: .5px; font-weight: 700; }
    .gal-code-input:focus { border-color: #ffd36b; box-shadow: 0 0 12px rgba(255,211,107,.35); }
    .gal-code-btn {
      border: 1.5px solid rgba(255,211,107,.5);
      background: linear-gradient(135deg, #e8b34a, #c8971a); color: #1a2d5a;
      border-radius: 9px; padding: 8px 14px;
      font-size: .85rem; font-weight: 900; cursor: pointer;
      font-family: "Nunito", sans-serif; letter-spacing: .3px;
      transition: transform .12s, filter .15s, box-shadow .15s;
    }
    .gal-code-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 4px 14px rgba(232,179,74,.45); }
    .gal-code-btn:disabled { opacity: .55; cursor: default; }
    .gal-code-msg {
      position: absolute; top: calc(100% + 5px); left: 0; right: 0;
      font-size: .72rem; font-weight: 800; text-align: center;
      line-height: 1.25; pointer-events: none;
    }
    .gal-code-msg.ok  { color: #7be0a4; }
    .gal-code-msg.err { color: #ff9a9a; }
    @media (max-width: 620px) {
      .gal-code-box { margin-left: 8px; }
      .gal-code-input { width: 84px; }
    }
    .gal-header-spacer { flex: 1; }
    .gal-sort-sel {
      border: 1.5px solid rgba(95,179,214,.4);
      background: rgba(8,28,55,.7); color: #cfeaff;
      border-radius: 9px; padding: 8px 30px 8px 12px;
      font-size: .85rem; font-weight: 700; cursor: pointer;
      font-family: "Nunito", sans-serif; appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237fc0e0'/%3E%3C/svg%3E");
      background-repeat: no-repeat; background-position: right 11px center;
    }
    /* species tabs */
    .gal-tabs {
      position: relative; z-index: 2;
      display: flex; gap: 8px; padding: 12px 22px;
      overflow-x: auto; flex-shrink: 0;
      border-bottom: 1px solid rgba(95,179,214,.14);
      scrollbar-width: thin;
    }
    .gal-tab {
      flex-shrink: 0; white-space: nowrap;
      background: rgba(95,179,214,.08); color: #9fc6e8;
      border: 1.5px solid rgba(95,179,214,.2);
      border-radius: 20px; padding: 7px 16px;
      font-weight: 800; font-size: .85rem; cursor: pointer;
      font-family: "Nunito", sans-serif;
      transition: all .15s;
    }
    .gal-tab:hover { background: rgba(95,179,214,.18); color: #cfeaff; }
    .gal-tab.active {
      background: linear-gradient(135deg, #1ba0d8, #22d8f8); color: #04243c;
      border-color: #22d8f8; box-shadow: 0 0 14px rgba(34,216,248,.4);
    }
    /* body: grid + detail panel */
    .gal-body {
      position: relative; z-index: 2;
      flex: 1; display: flex; min-height: 0;
    }
    .gal-grid-wrap { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
    .gal-species-section { margin-bottom: 26px; }
    .gal-species-title {
      font-family: "Cinzel", serif; font-size: 1.05rem; font-weight: 900;
      color: #bfe6ff; letter-spacing: .8px; margin-bottom: 12px;
      padding-bottom: 6px; border-bottom: 1px solid rgba(95,179,214,.2);
      display: flex; align-items: center; gap: 8px;
    }
    .gal-species-count { font-size: .78rem; color: #7fa8cc; font-weight: 700; font-family: "Nunito", sans-serif; }
    .gal-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
      gap: 16px;
    }
    .gal-tile {
      position: relative; cursor: pointer;
      background:
        radial-gradient(ellipse at 50% 28%, rgba(56,140,210,.28) 0%, transparent 62%),
        linear-gradient(165deg, rgba(20,54,96,.85) 0%, rgba(9,28,54,.92) 100%);
      border: 1.5px solid rgba(150,200,240,.5);
      border-radius: 16px; padding: 13px 9px 11px;
      display: flex; flex-direction: column; align-items: center; gap: 9px;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 8px rgba(0,0,0,.3);
      transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    }
    .gal-tile:hover {
      transform: translateY(-4px) scale(1.02);
      border-color: rgba(34,216,248,.7);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 10px 26px rgba(34,216,248,.3);
    }
    .gal-tile.gal-locked {
      border-color: rgba(70,96,130,.5);
      background:
        radial-gradient(ellipse at 50% 28%, rgba(40,70,110,.22) 0%, transparent 62%),
        linear-gradient(165deg, rgba(12,30,54,.9) 0%, rgba(6,18,36,.95) 100%);
    }
    .gal-tile.gal-locked .gal-tile-img { filter: grayscale(.8) brightness(.55); }
    .gal-tile.gal-locked .gal-tile-img-ring {
      background: radial-gradient(circle, rgba(120,150,190,.18) 0%, transparent 70%);
    }
    .gal-tile.gal-selected {
      border-color: #22d8f8;
      box-shadow: 0 0 0 2px rgba(34,216,248,.6), inset 0 1px 0 rgba(255,255,255,.15), 0 10px 26px rgba(34,216,248,.4);
    }
    .gal-tile.gal-equipped {
      border-color: #ffd36b;
      box-shadow: 0 0 0 2px rgba(255,211,107,.55), inset 0 1px 0 rgba(255,255,255,.15), 0 6px 22px rgba(255,211,107,.32);
    }
    /* circular spotlight frame behind each animal */
    .gal-tile-img-ring {
      position: relative;
      width: 86px; height: 86px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      background: radial-gradient(circle, rgba(120,200,255,.32) 0%, rgba(60,130,220,.10) 50%, transparent 72%);
      border: 1.5px solid rgba(160,210,255,.35);
      box-shadow: inset 0 0 14px rgba(34,216,248,.18);
    }
    .gal-tile.gal-equipped .gal-tile-img-ring {
      border-color: rgba(255,211,107,.6);
      background: radial-gradient(circle, rgba(255,211,107,.3) 0%, rgba(255,180,60,.1) 50%, transparent 72%);
      box-shadow: inset 0 0 16px rgba(255,211,107,.28);
    }
    .gal-tile-img {
      width: 70px; height: 70px;
      object-fit: contain;
      filter: drop-shadow(0 4px 8px rgba(0,0,0,.45));
      transition: transform .16s ease;
    }
    .gal-tile:hover .gal-tile-img { transform: scale(1.08); }
    /* Background tiles: rounded-rectangle preview instead of a round avatar */
    .gal-bg-ring {
      width: 92px; height: 70px; border-radius: 12px; overflow: hidden;
      padding: 0; background: #0b2140;
    }
    .gal-bg-img {
      width: 100%; height: 100%; object-fit: cover; border-radius: 12px;
      filter: none;
    }
    .gal-bg-tile.gal-locked .gal-bg-img { filter: grayscale(.7) brightness(.6); }
    .gal-bg-detail-preview {
      width: 100%; max-width: 260px; aspect-ratio: 4 / 3;
      border-radius: 16px; overflow: hidden; margin: 4px auto 10px;
      border: 2px solid rgba(255,211,107,.4); box-shadow: 0 8px 28px rgba(0,0,0,.4);
    }
    .gal-bg-detail-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .gal-tile-name {
      font-size: .84rem; font-weight: 800; color: #eaf4ff; text-align: center;
      line-height: 1.18; max-width: 100%; letter-spacing: .2px;
      text-shadow: 0 1px 3px rgba(0,0,0,.4);
      overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
      -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    }
    .gal-tile.gal-locked .gal-tile-name { color: #8aa6c6; text-shadow: none; }
    .gal-tile-lock {
      position: absolute; top: 7px; right: 8px;
      font-size: .82rem; opacity: .85;
    }
    .gal-tag {
      position: absolute; top: 6px; left: 6px;
      font-size: .62rem; font-weight: 900; letter-spacing: .4px;
      padding: 2px 7px; border-radius: 7px; text-transform: uppercase;
    }
    .gal-tag-equipped { background: #ffd36b; color: #4a2e00; }
    .gal-tag-new { background: #ff5e7e; color: #fff; box-shadow: 0 0 10px rgba(255,94,126,.6); }
    /* detail panel */
    .gal-detail {
      width: 340px; flex-shrink: 0;
      border-left: 1px solid rgba(95,179,214,.22);
      background: linear-gradient(180deg, rgba(10,32,62,.75), rgba(7,22,44,.85));
      backdrop-filter: blur(8px);
      overflow-y: auto; padding: 24px 22px;
      display: flex; flex-direction: column; align-items: center; gap: 12px;
    }
    .gal-detail.gal-detail-empty { justify-content: center; color: #6f93b6; text-align: center; font-size: .92rem; }
    .gal-detail-img-wrap {
      position: relative; width: 180px; height: 180px;
      display: flex; align-items: center; justify-content: center;
    }
    .gal-detail-glow {
      position: absolute; inset: -4%; border-radius: 50%;
      background: radial-gradient(circle, rgba(34,216,248,.4), rgba(47,126,224,.12) 50%, transparent 70%);
      filter: blur(8px); animation: gal-glow-pulse 2.4s ease-in-out infinite;
    }
    @keyframes gal-glow-pulse { 0%,100%{transform:scale(.92);opacity:.7;} 50%{transform:scale(1.06);opacity:1;} }
    .gal-detail-img { position: relative; z-index: 2; width: 84%; height: 84%; object-fit: contain;
      filter: drop-shadow(0 10px 22px rgba(0,0,0,.5)); }
    .gal-detail.gal-locked-detail .gal-detail-img { filter: grayscale(.7) brightness(.65) drop-shadow(0 8px 16px rgba(0,0,0,.5)); }
    .gal-detail-name { font-family: "Cinzel", serif; font-size: 1.5rem; font-weight: 900; color: #fff; text-align: center; line-height: 1.1; }
    .gal-detail-species { font-size: .72rem; color: #8fb8da; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; margin-top: -4px; }
    .gal-detail-status {
      font-size: .8rem; font-weight: 800; padding: 4px 12px; border-radius: 8px;
    }
    .gal-status-unlocked { background: rgba(45,189,130,.2); color: #6ff0b8; border: 1px solid rgba(45,189,130,.45); }
    .gal-status-locked  { background: rgba(120,80,255,.16); color: #c9b3ff; border: 1px solid rgba(120,80,255,.4); }
    .gal-status-equipped { background: rgba(255,211,107,.2); color: #ffe2a0; border: 1px solid rgba(255,211,107,.5); }
    .gal-detail-facts { font-size: .86rem; color: #c5ddf2; line-height: 1.55; text-align: center; }
    .gal-detail-reqbox {
      width: 100%; background: rgba(120,80,255,.1);
      border: 1px solid rgba(120,80,255,.28); border-radius: 12px; padding: 12px 14px;
    }
    .gal-req-label { font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: #b39aff; margin-bottom: 4px; }
    .gal-req-text { font-size: .85rem; color: #dcd2ff; line-height: 1.45; }
    .gal-prog-row { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 0 5px; }
    .gal-prog-label { font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: #b39aff; }
    .gal-prog-val { font-size: .82rem; font-weight: 800; color: #eaf4ff; }
    .gal-prog-track { height: 9px; background: rgba(120,80,255,.16); border-radius: 6px; overflow: hidden; border: 1px solid rgba(120,80,255,.22); }
    .gal-prog-fill { height: 100%; background: linear-gradient(90deg,#7c3aed,#a855f7 55%,#22d8f8); border-radius: 6px; transition: width .5s ease; }
    .gal-rarity { font-size: .76rem; color: #8fb8da; font-weight: 700; margin-top: 2px; }
    .gal-equip-q { font-size: .92rem; color: #fff; font-weight: 800; text-align: center; margin-top: 6px; }
    .gal-equip-row { display: flex; gap: 12px; width: 100%; margin-top: 2px; }
    .gal-equip-row .pv-btn { flex: 1; }
    .gal-equip-confirm { font-size: .85rem; font-weight: 800; color: #6ff0b8; text-align: center; }
    @media (max-width: 760px) {
      .gal-body { flex-direction: column; }
      .gal-detail {
        width: 100%; border-left: none; border-top: 1px solid rgba(95,179,214,.22);
        max-height: 46%; flex-shrink: 0;
      }
      .gal-detail.gal-detail-empty { display: none; }
      .gal-title { font-size: 1.1rem; }
      .gal-tile-img-ring { width: 72px; height: 72px; }
      .gal-tile-img { width: 58px; height: 58px; }
      .gal-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    }

    /* ── Public Profile Modal ──────────────────────────────────── */
    #pub-profile-overlay {
      position: fixed; inset: 0; z-index: 9999;
      background: rgba(8,20,40,.88);
      backdrop-filter: blur(6px);
      overflow-y: auto;
      padding: 20px 16px 40px;
    }
    .pub-modal-inner {
      max-width: 1100px;
      margin: 0 auto;
    }
    /* Make the public Quick Stats grid IDENTICAL to the real Overview page:
       same 7-wide compact grid, card sizing, and responsive breakpoints. */
    #pub-profile-overlay .ph-sg {
      grid-template-columns: repeat(7, minmax(0, 1fr));
      grid-auto-rows: 1fr;
      gap: 10px;
      padding: 12px;
    }
    #pub-profile-overlay .ph-sc { min-height: 100px; padding: 12px 14px; gap: 5px; }
    #pub-profile-overlay .ph-sc .ph-scl { min-height: 2.45em; font-size: .78rem; }
    #pub-profile-overlay .ph-sci { width: 32px; height: 32px; margin-bottom: 0; }
    #pub-profile-overlay .ph-sc:not(.ph-sc-string) .ph-scv {
      font-size: clamp(1.45rem, 1.7vw, 2.0rem); line-height: 1.02;
    }
    #pub-profile-overlay .ph-sc-string .ph-scv {
      font-size: clamp(0.95rem, 1.1vw, 1.2rem); line-height: 1.24;
      margin-top: 2px; word-break: break-word;
    }
    @media (max-width: 1050px) { #pub-profile-overlay .ph-sg { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
    @media (max-width: 760px)  { #pub-profile-overlay .ph-sg { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
    @media (max-width: 520px)  { #pub-profile-overlay .ph-sg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
    .pub-back-btn {
      display: inline-flex; align-items: center; gap: 6px;
      background: rgba(38,128,200,.13); border: 1.5px solid rgba(38,128,200,.3);
      color: #7ecdf5; border-radius: 8px; padding: 7px 14px;
      font-size: 13px; font-weight: 600; cursor: pointer;
      margin-bottom: 18px; transition: background .15s;
    }
    .pub-back-btn:hover { background: rgba(38,128,200,.22); }
    /* Public profile card — reuses the real .ph-profile-card design, trimmed to
       3 columns (avatar | info | ranks) since it has no alpha-banner/actions. */
    .pub-profile-card { grid-template-columns: auto minmax(160px, 1fr) auto; margin-bottom: 14px; }
    button.pub-avatar-btn.ph-avatar {
      padding: 0; cursor: pointer; outline: none;
      transition: box-shadow .15s, transform .15s;
    }
    /* Public avatar always has an <img> (defaults to mullet), so show it without
       needing the .has-image class the real profile toggles via JS. */
    button.pub-avatar-btn.ph-avatar img { display: block; }
    button.pub-avatar-btn.ph-avatar:hover {
      transform: translateY(-2px);
      box-shadow: 0 0 0 2px #2680c8, 0 8px 22px rgba(25,92,167,.32);
    }
    .pub-avatar-cam {
      position: absolute; right: 5px; bottom: 5px; z-index: 3;
      width: 28px; height: 28px; border-radius: 50%;
      background: rgba(8,30,55,.85); border: 1.5px solid rgba(255,255,255,.9);
      display: flex; align-items: center; justify-content: center; font-size: 14px;
    }
    @media (max-width: 720px) {
      .pub-profile-card { grid-template-columns: auto 1fr; }
      .pub-profile-card .ph-pranks { grid-column: 1 / -1; max-width: none; }
    }
    .pub-critter-hint {
      font-size: 12px; color: #cfe8fb; text-align: center;
      margin-bottom: 14px; opacity: .85;
    }
    .pub-stats-title {
      font-size: 13px; font-weight: 700; color: #7ecdf5;
      display: flex; align-items: center; gap: 6px;
      margin-bottom: 10px;
    }
    .pub-loading, .pub-error {
      text-align: center; padding: 32px 0; font-size: 14px; color: var(--muted);
    }
    .pub-error { color: #c0392b; }
    /* Make ph-fr avatar/name clickable in friends list */
    .ph-fr-clickable { cursor: pointer; }
    .ph-fr-clickable:hover { opacity: .82; }
    /* Make leaderboard player cells clickable */
    .ph-lb-player-cell.pub-clickable { cursor: pointer; }
    .ph-lb-player-cell.pub-clickable:hover { opacity: .82; }

    /* ============================================================
       Desktop profile-card layout (≥1181px)
         top row:  avatar | name + friend-code + XP/Streak chips | Level (w/ XP bar) + Competitive | message + Sign Out
         bottom:   full-width ALPHA · "latest version" · What's New bar
       ============================================================ */
    @media (min-width: 1181px) {
      #auth-stats-lobby .ph-profile-card {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 18px;
        row-gap: 16px;
      }
      #auth-stats-lobby .ph-avatar { flex: 0 0 auto; align-self: center; }
      #auth-stats-lobby .ph-pinfo  { flex: 1 1 260px; min-width: 0; align-self: center; }
      /* Level + Competitive — sits in the top row, right of the name */
      #auth-stats-lobby .ph-pranks {
        flex: 0 1 auto;
        width: auto;
        max-width: 400px;
        align-self: center;
      }
      /* Message + Sign Out — pinned to the far right of the top row */
      #auth-stats-lobby #stats-lobby-signed-actions {
        order: 1;
        flex: 0 0 auto;
        align-self: center;
        justify-content: flex-end;
      }
      /* ALPHA · "latest version" · What's New — full-width bar along the bottom,
         laid out wide-ways underneath the XP / Streak chips */
      #auth-stats-lobby .ph-alpha-banner {
        order: 2;
        flex: 1 1 100%;
        width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 8px 16px;
        padding: 11px 18px;
      }
      #auth-stats-lobby .ph-alpha-banner .ph-alpha-msg { line-height: 1.2; }
      /* Show the player's full name — wrap instead of clipping with an ellipsis */
      #auth-stats-lobby .ph-pname {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
      }
      /* Total XP + Current Streak chips always sit side by side */
      #auth-stats-lobby .ph-pmeta2 {
        flex-wrap: nowrap;
        margin-top: 10px;
      }
    }

    /* ── Accessibility + launch polish ───────────────────────────── */
    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    [role="button"]:focus-visible,
    [role="switch"]:focus-visible,
    .auth-link:focus-visible {
      outline: 3px solid var(--cyan);
      outline-offset: 3px;
      box-shadow: 0 0 0 5px rgba(34,216,248,.18);
    }
    .ccfs-status {
      min-height: 18px;
      color: #ffd574;
      font-size: 12px;
      font-weight: 800;
      text-align: center;
      max-width: 420px;
      line-height: 1.35;
    }
    #cc-fs-resume {
      min-width: 210px;
      text-align: center;
    }
    body.cc-large-card-text .pv-tooltip {
      font-size: 14px;
      line-height: 1.5;
      max-width: 270px;
    }
    body.cc-large-card-text .pv-tooltip .tt-name { font-size: 15px; }
    body.cc-large-card-text .pv-tooltip .tt-species,
    body.cc-large-card-text .pv-tooltip .tt-text,
    body.cc-large-card-text .pv-tooltip .tt-star { font-size: 13px; }
    body.cc-large-card-text #pv-zoom-info .zm-name { font-size: 20px; }
    body.cc-large-card-text #pv-zoom-info .zm-species,
    body.cc-large-card-text #pv-zoom-info .zm-text,
    body.cc-large-card-text #pv-zoom-info .zm-star {
      font-size: 15px;
      line-height: 1.75;
    }
    body.cc-large-card-text #pv-action-select,
    body.cc-large-card-text #pv-status-text,
    body.cc-large-card-text #pv-payment-mode-text,
    body.cc-large-card-text .ctp-card-label {
      font-size: 14px;
    }
    body.cc-colorblind-hints .pv-hand-card[data-species] .pv-card-inner::after,
    body.cc-colorblind-hints .pv-board-card[data-species]::after {
      content: attr(data-species);
      position: absolute;
      left: 4px;
      right: 4px;
      bottom: 4px;
      z-index: 5;
      padding: 2px 4px;
      border-radius: 5px;
      background: rgba(4, 18, 34, .86);
      border: 1px solid rgba(218, 238, 255, .45);
      color: #fff;
      font-size: 8px;
      font-weight: 900;
      line-height: 1.1;
      text-align: center;
      text-shadow: 0 1px 2px rgba(0,0,0,.8);
      pointer-events: none;
    }
    body.cc-colorblind-hints .pv-hand-card.star-sym-match .pv-card-inner,
    body.cc-colorblind-hints .pv-board-card.strat-hl {
      outline-style: dashed;
    }
