  /* ========== RESET & GLOBAL ========== */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --board-size: 7;
    --cell-size: min(11.5vw, 88px);
    --red: #b91c1c;
    --red-dark: #7f1d1d;
    --white-rose: #e2e8f0;
    --gold: #facc15;
    --gold-dark: #a16207;
    --bg: #080810;
    --panel: #12121e;
    --panel-border: #2d2d50;
    --text: #e2e8f0;
    --highlight-move: rgba(34,197,94,.5);
    --highlight-attack: rgba(239,68,68,.6);
    --highlight-summon: rgba(250,204,21,.5);
  }
  html { font-size: 14px; }
  body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    background-image:
      radial-gradient(ellipse at 50% 0%, rgba(120,40,40,.15) 0%, transparent 60%),
      radial-gradient(ellipse at 50% 100%, rgba(40,40,120,.1) 0%, transparent 60%);
    color: var(--text);
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center;
    padding: 10px;
    user-select: none;
    overflow-x: hidden;
  }
  #app { width: 100%; display: flex; flex-direction: column; align-items: center; }

  /* ----- Duel CSS (board, FX, cinematics, hand, card detail, duelist select)
           moved to src/duel.css for caching + parse speed ----- */

  /* ----- Menu/Auth/Rules CSS moved to src/menu.css -----
     Story Map v2 / Skill-Tree / Rose modal CSS moved to src/story-map.css
     Admin / Map-Editor / Terrain-Editor / Deck-Editor CSS moved to src/admin.css
     Graveyard / Slot-machine appended to src/duel.css -----
     (Utility buttons + responsive media queries remain inline below) */

  /* =====================================================================
     UTILITY BUTTONS (used across multiple screens)
  ===================================================================== */
  .btn-back {
    background: rgba(255,255,255,.07); border: 1px solid #1e293b;
    color: #94a3b8; padding: 6px 14px; border-radius: 6px;
    font-size: .75rem; cursor: pointer; transition: all .2s;
  }
  .btn-back:hover { background: rgba(255,255,255,.12); color: #f1f5f9; }
  .btn-danger {
    background: rgba(239,68,68,.15); border: 1px solid #ef4444;
    color: #f87171; padding: 5px 12px; border-radius: 6px;
    font-size: .7rem; cursor: pointer;
  }
  .btn-reset {
    background: rgba(255,255,255,.05); border: 1px solid var(--panel-border);
    color: #64748b; padding: 5px 12px; border-radius: 6px;
    font-size: .7rem; cursor: pointer; transition: all .2s;
  }
  .btn-reset:hover { color: #f87171; border-color: #f87171; }

  /* ========== RESPONSIVE ========== */
  @media (max-width: 560px) {
    :root { --cell-size: 12.5vw; }
    .hand-card { width: 78px; min-height: 110px; }
    .board-scene { perspective: 600px; }
    .status-row, .hand-area, .log-area, .timeline-area { max-width: 95vw; }
    /* ── Story Map mobile overhaul ── */

    /* Top bar: on mobile show hamburger, hide desktop nav buttons */
    .sm2-top-hud {
      padding: 5px 10px; gap: 6px;
      justify-content: space-between;
    }
    .sm2-hud-left { display: none; }
    .sm2-hamburger-wrap { display: block; }
    /* Center title: hidden on mobile */
    .sm2-hud-title { display: none; }
    /* Right: shrink avatar pill, hide name+caret */
    .sm2-avatar-name { display: none; }
    .sm2-avatar-caret { display: none; }
    .sm2-avatar-btn { padding: 4px 7px; border-radius: 8px; }
    .sm2-avatar-img { width: 32px; height: 32px; }
    .sm2-avatar-initials { width: 32px; height: 32px; font-size: .85rem; }
    .sm2-hud-right { min-width: auto; }
    /* Profile dropdown aligns below avatar */
    .sm2-profile-menu { right: 0; left: auto; }

    /* Bottom HUD: single-row, compact */
    .sm2-bottom-hud { padding: 5px 10px; gap: 8px; }
    .sm2-bottom-actions { display: none; }
    .sm2-rose-label { font-size: .5rem; letter-spacing: 1px; }
    .sm2-rose-track { max-width: 120px; }
    .sm2-rose-count { font-size: .68rem; }
    .sm2-rose-collection-btn { font-size: .5rem; padding: 3px 7px; white-space: nowrap; }

    /* FAB: show on mobile */
    .sm2-fab-wrap { display: flex; }
    /* Push zoom controls above bottom HUD + safe margin */
    .sm2-zoom-controls { bottom: 76px; right: 10px; }
    .sm2-zoom-btn { width: 34px; height: 34px; font-size: 1.2rem; }

    /* Map markers: slightly smaller */
    .sm2-marker-ring { width: 38px; height: 38px; }
    .sm2-marker-icon { font-size: 1.1rem; }
    .sm2-marker-portrait { width: 34px; height: 34px; }
    .sm2-marker-badge { width: 14px; height: 14px; font-size: .45rem; top: calc(50% - 22px); left: calc(50% + 11px); }
    .sm2-marker-label { font-size: .45rem; margin-top: 12px; }
    .sm2-marker-order { width: 13px; height: 13px; font-size: .4rem; }

    /* Info panel: tighter */
    .sm2-info-panel { width: 170px; padding: 11px; }
    .sm2-info-portrait { width: 40px; height: 40px; }
    .sm2-info-name { font-size: .78rem; }
    .sm2-info-icon { font-size: 1.5rem; }
  }

  /* ── Mobile landscape: ultra-compact story map HUD ── */
  @media (max-height: 440px) and (orientation: landscape) {
    .sm2-top-hud { padding: 2px 8px; }
    .sm2-hud-logo { height: 22px; max-width: 140px; }
    .sm2-avatar-img { width: 24px; height: 24px; }
    .sm2-avatar-initials { width: 24px; height: 24px; font-size: .65rem; }
    .sm2-avatar-btn { padding: 2px 5px; }
    .sm2-hud-btn { width: 28px; height: 28px; font-size: .7rem; }
    .sm2-hamburger-btn { width: 28px; height: 28px; font-size: .7rem; }
    .sm2-bottom-hud { padding: 2px 8px; gap: 6px; }
    .sm2-rose-label { font-size: .42rem; }
    .sm2-rose-track { height: 5px; max-width: 100px; }
    .sm2-rose-count { font-size: .55rem; }
    .sm2-rose-collection-btn { font-size: .42rem; padding: 2px 5px; }
    .sm2-leader-pill { padding: 2px 6px; font-size: .5rem; }
    .sm2-leader-pill-icon { font-size: .7rem; }
    .sm2-leader-pill-name { font-size: .48rem; }
    .sm2-leader-pill-rank { font-size: .38rem; }
    .sm2-zoom-btn { width: 28px; height: 28px; font-size: 1rem; }
    .sm2-zoom-controls { bottom: 36px; }
    .sm2-fab-btn { width: 36px; height: 36px; font-size: .9rem; }
  }

  /* ═══════════════════════════════════════════════════════════════
     REPLAY CONTROLS (in-duel playback bar)
     ═══════════════════════════════════════════════════════════════ */
  .replay-controls {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    border: 1px solid #6366f1;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 8px auto;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(99,102,241,.3);
  }
  /* Replay controls always visible and fixed at bottom in PS2 immersive */
  .ps2-immersive .replay-controls {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    width: 94vw;
    max-width: 520px;
  }
  .replay-controls-top {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; font-size: .75rem; color: #a5b4fc;
  }
  .replay-label { font-weight: 700; font-size: .85rem; color: #c4b5fd; }
  .replay-turn-info { color: #94a3b8; }
  .replay-counter { color: #64748b; font-size: .7rem; }
  .replay-controls-bar {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-bottom: 8px;
  }
  .replay-btn {
    background: #1e293b; border: 1px solid #334155; color: #e2e8f0;
    border-radius: 8px; width: 36px; height: 36px; font-size: 1rem;
    cursor: pointer; transition: all .15s;
    display: flex; align-items: center; justify-content: center;
  }
  .replay-btn:hover:not(:disabled) { background: #334155; border-color: #6366f1; }
  .replay-btn:disabled { opacity: .4; cursor: not-allowed; }
  .replay-btn-play {
    width: 44px; height: 44px; font-size: 1.2rem;
    background: #4f46e5; border-color: #818cf8;
  }
  .replay-btn-play:hover { background: #6366f1; }
  .replay-speed-select {
    background: #1e293b; border: 1px solid #334155; color: #e2e8f0;
    border-radius: 6px; padding: 4px 8px; font-size: .75rem; cursor: pointer;
    margin-left: 8px;
  }
  .replay-slider {
    width: 100%; margin: 4px 0 8px; accent-color: #6366f1;
    cursor: pointer;
  }
  .replay-exit-btn {
    background: #7f1d1d; border: 1px solid #991b1b; color: #fecaca;
    border-radius: 8px; padding: 6px 18px; font-size: .8rem;
    cursor: pointer; transition: all .15s;
  }
  .replay-exit-btn:hover { background: #991b1b; }

  /* ═══════════════════════════════════════════════════════════════
     REPLAY LIST PAGE
     ═══════════════════════════════════════════════════════════════ */
  .replay-list-page {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(180deg, #080810 0%, #0f172a 100%);
    padding: 20px;
    color: #e2e8f0;
  }
  .replay-list-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 24px;
  }
  .replay-list-header h2 {
    font-size: 1.4rem; color: #f1f5f9; margin: 0;
  }
  .replay-list-loading, .replay-list-empty {
    text-align: center; padding: 60px 20px; color: #94a3b8;
    font-size: 1rem;
  }
  .replay-share-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: #2563eb; color: #fff; padding: 10px 24px;
    border-radius: 8px; font-size: .85rem; z-index: 9999;
    box-shadow: 0 4px 16px rgba(37,99,235,.5);
    animation: fadeInOut 2s ease-in-out;
  }
  @keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  }
  .replay-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
  }
  .replay-card {
    background: #0d1117;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 16px;
    transition: transform .15s, box-shadow .15s;
  }
  .replay-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.4); }
  .replay-card.replay-win { border-color: #166534; }
  .replay-card.replay-loss { border-color: #7f1d1d; }
  .replay-card-top {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
  }
  .replay-result-badge {
    font-size: .8rem; font-weight: 700; padding: 2px 10px;
    border-radius: 6px;
  }
  .replay-win .replay-result-badge { background: #14532d; color: #4ade80; }
  .replay-loss .replay-result-badge { background: #450a0a; color: #f87171; }
  .replay-mode-badge {
    font-size: .7rem; color: #94a3b8; background: #1e293b;
    padding: 2px 8px; border-radius: 4px;
  }
  .replay-card-opponent {
    font-size: 1.05rem; font-weight: 600; color: #f1f5f9;
    margin-bottom: 6px;
  }
  .replay-card-info {
    display: flex; gap: 12px; font-size: .75rem; color: #64748b;
    margin-bottom: 12px;
  }
  .replay-card-actions {
    display: flex; gap: 8px;
  }
  .replay-watch-btn {
    flex: 1; background: #2563eb; border: none; color: #fff;
    border-radius: 8px; padding: 8px; font-size: .8rem;
    cursor: pointer; font-weight: 600; transition: background .15s;
  }
  .replay-watch-btn:hover { background: #3b82f6; }
  .replay-share-btn {
    background: #1e293b; border: 1px solid #1e293b; color: #60a5fa;
    border-radius: 8px; padding: 8px 12px; font-size: .75rem;
    cursor: pointer; transition: all .15s;
  }
  .replay-share-btn:hover { background: #334155; }
  .replay-delete-btn {
    background: #1e293b; border: 1px solid #1e293b; color: #f87171;
    border-radius: 8px; padding: 8px 10px; font-size: .8rem;
    cursor: pointer; transition: all .15s;
  }
  .replay-delete-btn:hover { background: #450a0a; border-color: #7f1d1d; }

  /* Replay menu button */
  .menu-btn-replays {
    background: #0d1117; border: 1px solid #1e293b; border-left: 4px solid #2563eb;
  }
  .menu-btn-replays:hover {
    transform: translateY(-2px); box-shadow: 0 4px 24px rgba(37,99,235,.25); border-color: #2563eb;
  }

  /* ═══════════════════════════════════════════════════════════════
     DAILY MISSIONS PAGE
     ═══════════════════════════════════════════════════════════════ */
  .daily-missions-page {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(180deg, #080810 0%, #0d1117 100%);
    padding: 20px;
    color: #e2e8f0;
  }
  .daily-missions-embedded {
    padding: 12px 16px 20px;
    color: #e2e8f0;
  }
  .dm-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 24px; flex-wrap: wrap;
  }
  .dm-header h2 { font-size: 1.4rem; color: #f1f5f9; margin: 0; flex: 1; }
  .dm-timer {
    font-size: .8rem; color: #94a3b8;
    background: #1e293b; padding: 6px 14px; border-radius: 20px;
    border: 1px solid #334155;
  }
  .dm-loading, .dm-empty {
    text-align: center; padding: 60px 20px; color: #94a3b8; font-size: 1rem;
  }

  /* Claim toast */
  .dm-claim-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff; padding: 12px 24px; border-radius: 12px;
    font-size: .85rem; z-index: 9999;
    box-shadow: 0 4px 20px rgba(37,99,235,.4);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    animation: fadeInOut 5s ease-in-out;
  }
  .dm-claim-cards { font-size: .75rem; color: #fef3c7; }
  .dm-claim-xp { font-size: .75rem; color: #d9f99d; }

  /* Mission list */
  .dm-list {
    display: flex; flex-direction: column; gap: 14px;
    max-width: 700px; margin: 0 auto;
  }

  /* Mission card */
  .dm-card {
    display: flex; align-items: center; gap: 14px;
    background: #0d1117;
    border: 1px solid #1e293b;
    border-radius: 12px; padding: 16px;
    transition: transform .15s, box-shadow .15s;
  }
  .dm-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.3); }
  .dm-completed { border-color: #2563eb; box-shadow: 0 0 12px rgba(37,99,235,.15); }
  .dm-claimed { opacity: .65; border-color: #1e293b; box-shadow: none; }

  .dm-card-icon {
    font-size: 2rem; width: 50px; height: 50px;
    display: flex; align-items: center; justify-content: center;
    background: #0f172a; border-radius: 12px; flex-shrink: 0;
  }

  .dm-card-body { flex: 1; min-width: 0; }
  .dm-card-top {
    display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  }
  .dm-card-name { font-weight: 700; font-size: .95rem; color: #f1f5f9; }
  .dm-ready-badge {
    font-size: .65rem; background: #2563eb; color: #fff;
    padding: 2px 8px; border-radius: 10px; font-weight: 700;
    animation: pulse 1.5s ease-in-out infinite;
  }
  .dm-done-badge {
    font-size: .65rem; background: #334155; color: #94a3b8;
    padding: 2px 8px; border-radius: 10px;
  }
  .dm-card-desc {
    font-size: .78rem; color: #94a3b8; margin-bottom: 8px;
  }

  /* Progress bar */
  .dm-progress-bar {
    position: relative; height: 18px;
    background: #0f172a; border-radius: 10px;
    overflow: hidden; margin-bottom: 6px;
    border: 1px solid #1e293b;
  }
  .dm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    border-radius: 10px;
    transition: width .4s ease;
  }
  .dm-completed .dm-progress-fill {
    background: linear-gradient(90deg, #22c55e, #16a34a);
  }
  .dm-progress-text {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: .65rem; font-weight: 700; color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,.5);
  }

  /* Rewards */
  .dm-rewards {
    display: flex; align-items: center; gap: 8px;
    font-size: .7rem; color: #64748b;
  }
  .dm-reward-label { color: #94a3b8; }
  .dm-reward-cards {
    background: rgba(37,99,235,.15); color: #60a5fa;
    padding: 2px 8px; border-radius: 6px;
  }
  .dm-reward-xp {
    background: #422006; color: #fbbf24;
    padding: 2px 8px; border-radius: 6px;
  }

  /* Action column */
  .dm-card-action {
    flex-shrink: 0; text-align: center; min-width: 80px;
  }
  .dm-claim-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none; color: #fff; font-weight: 700;
    border-radius: 10px; padding: 10px 16px; font-size: .8rem;
    cursor: pointer; transition: all .15s;
    animation: pulse 1.5s ease-in-out infinite;
  }
  .dm-claim-btn:hover { transform: scale(1.05); }
  .dm-claim-btn:disabled { opacity: .6; animation: none; }
  .dm-check { font-size: 1.5rem; }
  .dm-pct { font-size: 1.1rem; font-weight: 700; color: #64748b; }

  @keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,.4); }
    50% { box-shadow: 0 0 12px 4px rgba(37,99,235,.2); }
  }

  /* Mobile responsive */
  @media (max-width: 480px) {
    .dm-card { flex-wrap: wrap; padding: 12px; gap: 10px; }
    .dm-card-icon { width: 40px; height: 40px; font-size: 1.5rem; }
    .dm-card-action { width: 100%; text-align: right; }
  }

  /* ═══════════════════════════════════════════════════════════════
     GAMEOVER CINEMATIC OVERLAY
     ═══════════════════════════════════════════════════════════════ */
  .gameover-overlay {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; text-align: center; overflow: hidden;
  }
  .gameover-bg {
    position: absolute; inset: 0; z-index: 0;
    animation: gameoverBgFade .8s ease-out forwards;
  }
  .gameover-win .gameover-bg {
    background: radial-gradient(ellipse at 50% 40%, rgba(250,204,21,.12) 0%, rgba(0,0,0,.92) 60%);
  }
  .gameover-lose .gameover-bg {
    background: radial-gradient(ellipse at 50% 40%, rgba(239,68,68,.10) 0%, rgba(0,0,0,.94) 60%);
  }
  .gameover-lose { animation: goShake .5s ease-out .2s; }

  @keyframes gameoverBgFade {
    from { opacity: 0; } to { opacity: 1; }
  }
  @keyframes goShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-8px); }
    20% { transform: translateX(8px); }
    30% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    50% { transform: translateX(-3px); }
    60% { transform: translateX(3px); }
  }

  /* ── Leader portrait ── */
  .gameover-leader-wrap {
    position: relative; z-index: 1;
    width: 120px; height: 120px;
    animation: goLeaderEntry .6s cubic-bezier(.17,.67,.35,1.3) forwards;
    opacity: 0;
  }
  .gameover-leader-img {
    width: 100%; height: 100%; object-fit: cover;
    border-radius: 50%; position: relative; z-index: 2;
    box-shadow: 0 0 30px rgba(0,0,0,.6);
  }
  .gameover-leader-icon {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3.5rem; border-radius: 50%;
    background: #0d1117; border: 2px solid #1e293b;
    position: relative; z-index: 2;
  }
  .gameover-leader-ring {
    position: absolute; inset: -6px; border-radius: 50%; z-index: 1;
    border: 3px solid transparent;
    animation: goRingPulse 2s ease-in-out infinite;
  }
  .ring-win {
    border-color: rgba(250,204,21,.6);
    box-shadow: 0 0 20px rgba(250,204,21,.3), inset 0 0 20px rgba(250,204,21,.1);
  }
  .ring-lose {
    border-color: rgba(239,68,68,.5);
    box-shadow: 0 0 20px rgba(239,68,68,.3), inset 0 0 20px rgba(239,68,68,.1);
  }
  @keyframes goLeaderEntry {
    from { opacity: 0; transform: scale(.3) translateY(30px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }
  @keyframes goRingPulse {
    0%, 100% { transform: scale(1); opacity: .8; }
    50%      { transform: scale(1.08); opacity: 1; }
  }

  /* ── Title ── */
  .gameover-title {
    position: relative; z-index: 1;
    font-size: 2.4rem; font-weight: 900; letter-spacing: 4px;
    margin: 0; text-transform: uppercase;
    animation: goTitleEntry .5s ease-out .3s forwards;
    opacity: 0;
  }
  .gt-win {
    color: #facc15;
    text-shadow: 0 0 30px rgba(250,204,21,.6), 0 0 60px rgba(250,204,21,.3);
  }
  .gt-lose {
    color: #ef4444;
    text-shadow: 0 0 30px rgba(239,68,68,.5), 0 0 60px rgba(239,68,68,.2);
  }
  @keyframes goTitleEntry {
    from { opacity: 0; transform: scale(1.8) translateY(-10px); filter: blur(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
  }

  /* ── Subtitle ── */
  .gameover-subtitle {
    position: relative; z-index: 1;
    color: #cbd5e1; font-size: .95rem; margin: 0;
    animation: goFadeUp .4s ease-out .6s forwards;
    opacity: 0;
  }

  /* ── LP row ── */
  .gameover-lp-row {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 16px;
    animation: goFadeUp .4s ease-out .75s forwards;
    opacity: 0;
  }
  .gameover-lp {
    font-size: 1.1rem; font-weight: 700; padding: 4px 14px;
    border-radius: 8px; background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
  }
  .gameover-lp.you { color: #4ade80; }
  .gameover-lp.opp { color: #f87171; }
  .gameover-lp-vs { color: #475569; font-size: .8rem; font-weight: 600; }

  /* ── Actions ── */
  .gameover-actions {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; gap: 8px;
    margin-top: 8px;
    animation: goFadeUp .4s ease-out .95s forwards;
    opacity: 0;
  }
  .gameover-btn-primary {
    background: #2563eb !important; padding: 12px 32px !important;
    font-size: .95rem !important;
  }
  .gameover-btn-primary:hover { background: #3b82f6 !important; }
  .gameover-btn-secondary {
    background: #1e293b !important; border: 1px solid #334155 !important;
  }

  @keyframes goFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ── Confetti ── */
  .gameover-confetti {
    position: absolute; inset: 0; z-index: 0;
    pointer-events: none; overflow: hidden;
  }
  .confetti-piece {
    position: absolute;
    top: -12px; left: var(--x, 50vw);
    width: var(--size, 8px); height: calc(var(--size, 8px) * 0.6);
    background: var(--color, #facc15);
    border-radius: 2px;
    animation: confettiFall var(--dur, 3.5s) ease-in var(--delay, 0s) forwards;
    opacity: 0;
  }
  @keyframes confettiFall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
    20%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(100vh) rotate(var(--rot, 360deg)); }
  }

  /* ── Responsive ── */
  @media (max-width: 480px) {
    .gameover-leader-wrap { width: 90px; height: 90px; }
    .gameover-title { font-size: 1.8rem; letter-spacing: 2px; }
    .gameover-subtitle { font-size: .82rem; }
    .gameover-lp { font-size: .9rem; padding: 3px 10px; }
  }

  /* ═══════════════════════════════════════════════════════════════
     IN-APP NOTIFICATION TOASTS
     ═══════════════════════════════════════════════════════════════ */
  .notif-toast-stack {
    position: fixed; top: 16px; right: 16px; z-index: 99999;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none; max-width: 340px; width: 100%;
  }
  .notif-toast {
    pointer-events: auto;
    display: flex; align-items: center; gap: 10px;
    background: #0d1117; border: 1px solid #1e293b;
    border-radius: 12px; padding: 12px 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    cursor: pointer; transition: all .2s;
    animation: notifSlideIn .3s ease-out;
    border-left: 4px solid #2563eb;
  }
  .notif-toast:hover { transform: translateX(-4px); box-shadow: 0 8px 40px rgba(0,0,0,.6); }
  .notif-toast-icon { font-size: 1.4rem; flex-shrink: 0; }
  .notif-toast-body { flex: 1; min-width: 0; }
  .notif-toast-title {
    font-size: .82rem; font-weight: 700; color: #f1f5f9;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .notif-toast-text {
    font-size: .72rem; color: #94a3b8; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .notif-toast-close {
    background: none; border: none; color: #475569; font-size: .7rem;
    cursor: pointer; padding: 2px 4px; flex-shrink: 0; transition: color .15s;
  }
  .notif-toast-close:hover { color: #f1f5f9; }

  /* Type-specific accent colors */
  .notif-challenge  { border-left-color: #ef4444; }
  .notif-friend     { border-left-color: #a855f7; }
  .notif-online     { border-left-color: #22c55e; }
  .notif-message    { border-left-color: #0ea5e9; }
  .notif-mission    { border-left-color: #f59e0b; }

  @keyframes notifSlideIn {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @media (max-width: 480px) {
    .notif-toast-stack { right: 8px; left: 8px; max-width: none; }
  }

  /* ═══════════════════════════════════════════════════════════
     DDE LEADER PICKER — admin duelist deck editor leader UI
     ═══════════════════════════════════════════════════════════ */
  .dde-leader-section {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 16px; background: #0d1117; border-bottom: 1px solid #1e293b;
  }
  .dde-leader-label { font-size: .75rem; color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
  .dde-leader-current {
    display: flex; align-items: center; gap: 10px;
    background: #161b22; border: 1px solid #1e293b; border-radius: 8px;
    padding: 6px 14px 6px 6px; cursor: pointer; transition: border-color .15s;
    flex: 1; max-width: 400px;
  }
  .dde-leader-current:hover { border-color: #2563eb; }
  .dde-leader-avatar { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
  .dde-leader-avatar-fallback {
    width: 36px; height: 36px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    background: #0d1117; font-size: 1.2rem;
  }
  .dde-leader-name { font-size: .82rem; font-weight: 600; color: #f1f5f9; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dde-leader-changed-badge { font-size: .7rem; }
  .dde-leader-change-btn {
    font-size: .65rem; color: #2563eb; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; background: #2563eb18;
    white-space: nowrap;
  }

  /* Leader Picker Modal */
  .dde-leader-picker {
    background: #0d1117; border: 1px solid #1e293b; border-radius: 12px;
    width: 720px; max-width: 94vw; max-height: 85vh; overflow: hidden;
    display: flex; flex-direction: column;
    animation: ppSlideUp .25s ease;
  }
  .dde-lp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 12px; border-bottom: 1px solid #1e293b;
  }
  .dde-lp-header h3 { margin: 0; font-size: 1rem; color: #f1f5f9; }
  .dde-lp-search {
    margin: 12px 18px 8px; padding: 8px 12px;
    background: #161b22; border: 1px solid #1e293b; border-radius: 6px;
    color: #e2e8f0; font-size: .82rem; outline: none;
  }
  .dde-lp-search:focus { border-color: #2563eb; }
  .dde-lp-card-grid {
    flex: 1; overflow-y: auto; padding: 10px 14px 14px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px;
    align-content: start;
    scrollbar-width: thin; scrollbar-color: #1e293b transparent;
  }
  .dde-lp-tile {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 7px; padding: 5px;
    cursor: pointer; transition: all .15s; text-align: center;
  }
  .dde-lp-tile:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
    z-index: 1;
  }
  .dde-lp-tile.selected {
    border-color: #2563eb;
    box-shadow: 0 0 10px rgba(37,99,235,.5);
    background: rgba(37,99,235,.08);
  }
  .dde-lp-thumb-wrap { position: relative; }
  img.dde-lp-thumb {
    width: 100%; aspect-ratio: 421/614;
    object-fit: cover; border-radius: 4px; display: block;
  }
  span.dde-lp-thumb {
    width: 100%; aspect-ratio: 421/614;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; background: rgba(255,255,255,.04); border-radius: 4px;
  }
  .dde-lp-tile-name {
    color: #cbd5e1; font-size: .6rem; font-weight: 600;
    margin-top: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .dde-lp-tile-stats {
    color: #64748b; font-size: .55rem; margin-top: 1px;
  }
  .dde-lp-tile-orig {
    position: absolute; top: 3px; right: 3px;
    font-size: .5rem; font-weight: 700; color: #22c55e;
    background: rgba(0,0,0,.8); padding: 1px 5px; border-radius: 3px;
  }

  @media (max-width: 560px) {
    .dde-leader-section { flex-wrap: wrap; }
    .dde-leader-current { max-width: none; }
    .dde-lp-card-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  }

  /* Millennium Eye — revealed card indicator */
  .millennium-eye-revealed {
    position: relative;
    box-shadow: 0 0 8px 2px rgba(168,85,247,.45), inset 0 0 6px rgba(168,85,247,.2);
    border: 1px solid rgba(168,85,247,.5);
  }
  .millennium-eye-badge {
    position: absolute; top: 2px; right: 2px; z-index: 3;
    font-size: .7rem; line-height: 1;
    background: rgba(88,28,135,.85); border-radius: 50%;
    width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 6px rgba(168,85,247,.6);
    animation: eyePulse 2s ease-in-out infinite;
  }
  @keyframes eyePulse {
    0%,100% { box-shadow: 0 0 6px rgba(168,85,247,.6); }
    50% { box-shadow: 0 0 12px rgba(168,85,247,.9); }
  }

  /* HUD duelist card hover + clickable */
  .player-info.hud-clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
  .player-info.hud-clickable:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(37,99,235,.3);
  }
  .player-info.hud-clickable:active { transform: translateY(0) scale(0.99); }

  /* ═══════════════════════════════════════════════════════════
     PLAYER PROFILE — Public profile overlay
     ═══════════════════════════════════════════════════════════ */
  .pp-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    animation: ppFadeIn .2s ease;
  }
  @keyframes ppFadeIn { from { opacity: 0; } to { opacity: 1; } }

  .pp-modal {
    background: #0d1117; border: 1px solid #1e293b; border-radius: 12px;
    width: 520px; max-width: 94vw; max-height: 88vh; overflow-y: auto;
    padding: 28px 24px; position: relative;
    animation: ppSlideUp .25s ease;
    scrollbar-width: thin; scrollbar-color: #1e293b transparent;
  }
  @keyframes ppSlideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

  .pp-close {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none; color: #64748b; font-size: 1.3rem; cursor: pointer;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; transition: background .15s, color .15s;
  }
  .pp-close:hover { background: #1e293b; color: #f1f5f9; }

  .pp-loading, .pp-error {
    text-align: center; padding: 48px 16px; color: #64748b; font-size: .95rem;
  }

  /* Header */
  .pp-header { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
  .pp-avatar-wrap {
    position: relative; width: 80px; height: 80px; flex-shrink: 0;
    border-radius: 50%; overflow: hidden; border: 2px solid #1e293b;
    background: #161b22;
  }
  .pp-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pp-avatar-letter {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; color: #2563eb; background: #0d1117;
  }
  .pp-presence-dot {
    position: absolute; bottom: 2px; right: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid #0d1117;
  }
  .pp-header-info { flex: 1; min-width: 0; }
  .pp-name { margin: 0; font-size: 1.35rem; font-weight: 700; color: #f1f5f9; line-height: 1.2; }
  .pp-rank { display: flex; align-items: center; gap: 6px; font-size: .95rem; font-weight: 600; margin-top: 4px; }
  .pp-rank-icon { font-size: 1.1rem; }
  .pp-meta { display: flex; gap: 12px; margin-top: 6px; font-size: .75rem; color: #64748b; }
  .pp-joined { opacity: .8; }

  /* Stats Grid */
  .pp-stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    margin-bottom: 18px;
  }
  .pp-stat-card {
    background: #161b22; border: 1px solid #1e293b; border-radius: 8px;
    padding: 12px 8px; text-align: center;
  }
  .pp-stat-value { font-size: 1.25rem; font-weight: 700; color: #f1f5f9; }
  .pp-stat-label { font-size: .65rem; color: #64748b; margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

  /* Sections */
  .pp-sections-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
  .pp-section { margin-bottom: 14px; }
  .pp-sections-row .pp-section { margin-bottom: 0; }
  .pp-section-title {
    font-size: .8rem; font-weight: 700; color: #94a3b8; margin: 0 0 10px 0;
    text-transform: uppercase; letter-spacing: .5px;
  }

  /* Win/Loss Bars */
  .pp-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .pp-bar-label { font-size: .7rem; color: #64748b; width: 56px; flex-shrink: 0; }
  .pp-bar {
    flex: 1; height: 20px; background: #161b22; border-radius: 4px;
    position: relative; overflow: hidden; border: 1px solid #1e293b;
    display: flex; align-items: center;
  }
  .pp-bar span { position: relative; z-index: 1; font-size: .7rem; font-weight: 600; color: #f1f5f9; padding-left: 8px; }
  .pp-bar-fill { position: absolute; top: 0; left: 0; height: 100%; border-radius: 4px; transition: width .4s ease; }
  .pp-bar-win { background: linear-gradient(90deg, #166534, #22c55e); }
  .pp-bar-loss { background: linear-gradient(90deg, #7f1d1d, #ef4444); }

  /* Leaders */
  .pp-leaders-row { display: flex; gap: 10px; flex-wrap: wrap; }
  .pp-leader-card {
    display: flex; align-items: center; gap: 10px;
    background: #161b22; border: 1px solid #1e293b; border-radius: 8px;
    padding: 8px 12px; flex: 1; min-width: 140px;
  }
  .pp-leader-main { border-color: #2563eb40; }
  .pp-leader-img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
  .pp-leader-info { min-width: 0; }
  .pp-leader-name { font-size: .8rem; font-weight: 600; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pp-leader-xp { font-size: .65rem; color: #64748b; }

  /* Active Deck */
  .pp-deck-card {
    display: flex; align-items: center; gap: 12px;
    background: #161b22; border: 1px solid #1e293b; border-radius: 8px;
    padding: 10px 14px;
  }
  .pp-deck-leader-img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
  .pp-deck-info { min-width: 0; }
  .pp-deck-name { font-size: .9rem; font-weight: 600; color: #f1f5f9; }
  .pp-deck-meta { font-size: .7rem; color: #64748b; margin-top: 2px; }

  /* Achievements */
  .pp-achievements { display: flex; flex-wrap: wrap; gap: 6px; }
  .pp-achievement {
    display: flex; align-items: center; gap: 6px;
    background: #161b22; border: 1px solid #1e293b; border-radius: 6px;
    padding: 5px 10px; font-size: .72rem; color: #94a3b8;
  }
  .pp-ach-icon { font-size: .9rem; }
  .pp-ach-label { white-space: nowrap; }

  /* Clickable player name in leaderboard/chat */
  .lb-player-name-link {
    cursor: pointer; transition: color .15s;
  }
  .lb-player-name-link:hover { color: #2563eb; text-decoration: underline; }

  @media (max-width: 560px) {
    .pp-modal { padding: 20px 14px; }
    .pp-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .pp-sections-row { grid-template-columns: 1fr; }
    .pp-header { flex-direction: column; text-align: center; gap: 12px; }
    .pp-meta { justify-content: center; }
    .pp-leaders-row { flex-direction: column; }
  }
