    /* ===========================
       CSS VARIABLES & RESET
    =========================== */
    :root {
      --bg-primary: #0f0c29;
      --bg-secondary: #1a1547;
      --bg-card: #12103a;
      --bg-card-front: #1e1b4b;
      --accent-1: #7c3aed;
      --accent-2: #06b6d4;
      --accent-3: #f59e0b;
      --accent-4: #ec4899;
      --text-primary: #f8fafc;
      --text-secondary: #94a3b8;
      --text-muted: #64748b;
      --success: #10b981;
      --error: #ef4444;
      --warning: #f59e0b;
      --card-back: linear-gradient(135deg, #7c3aed, #06b6d4);
      --card-radius: 14px;
      --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.4);
      --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.4);
      --transition-fast: 0.2s ease;
      --transition-medium: 0.35s ease;
      --flip-duration: 0.5s;
    }
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
      user-select: none;
    }
    html,
    body {
      width: 100%;
      height: 100%;
      overflow: hidden;
      font-family: 'Outfit', sans-serif;
      background: var(--bg-primary);
      color: var(--text-primary);
    }
    /* Safe area insets for notched phones */
    body {
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }
    /* ===========================
       BACKGROUND ANIMATION
    =========================== */
    .bg-animation {
      position: fixed;
      inset: 0;
      z-index: 0;
      overflow: hidden;
      pointer-events: none;
    }
    .bg-animation::before,
    .bg-animation::after {
      content: '';
      position: absolute;
      border-radius: 50%;
      filter: blur(80px);
      animation: floatBlob 12s ease-in-out infinite alternate;
    }
    .bg-animation::before {
      width: 60vw;
      height: 60vw;
      background: rgba(124, 58, 237, 0.15);
      top: -20vw;
      left: -10vw;
      animation-delay: 0s;
    }
    .bg-animation::after {
      width: 50vw;
      height: 50vw;
      background: rgba(6, 182, 212, 0.12);
      bottom: -10vw;
      right: -10vw;
      animation-delay: -6s;
    }
    @keyframes floatBlob {
      0% {
        transform: translate(0, 0) scale(1);
      }
      100% {
        transform: translate(5vw, 5vw) scale(1.1);
      }
    }
    /* ===========================
       SCREEN SYSTEM
    =========================== */
    /* Hide everything instantly until JS init is complete — prevents flicker */
    body.app-initializing .screen {
      opacity: 0 !important;
      pointer-events: none !important;
      transition: none !important;
    }
    .screen {
      position: fixed;
      inset: 0;
      z-index: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 16px;
      overflow: hidden;
      transition: opacity 0.4s ease, transform 0.4s ease;
    }
    .screen.hidden {
      opacity: 0;
      pointer-events: none;
      transform: scale(0.95);
    }
    /* Home & Auth screens need vertical scrolling on short devices */
    #screen-home,
    #screen-auth {
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      justify-content: flex-start;
      padding-top: max(16px, env(safe-area-inset-top));
      padding-bottom: max(96px, env(safe-area-inset-bottom));
      align-items: center;
    }
    /* ===========================
       SPLASH / HOME SCREEN
    =========================== */
    #screen-home {
      gap: 0;
      text-align: center;
    }
    #screen-auth {
      gap: 0;
      text-align: center;
    }
    .home-logo {
      margin-bottom: 8px;
      animation: logoPulse 3s ease-in-out infinite;
    }
    .home-logo .logo-icon {
      font-size: clamp(48px, 14vw, 72px);
      display: block;
      filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.7));
    }
    @keyframes logoPulse {
      0%,
      100% {
        transform: scale(1);
      }
      50% {
        transform: scale(1.06);
      }
    }
    .home-title {
      font-size: clamp(26px, 8vw, 40px);
      font-weight: 900;
      background: linear-gradient(135deg, #a78bfa, #06b6d4, #f59e0b);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      letter-spacing: -0.5px;
      line-height: 1.1;
      margin-bottom: 6px;
    }
    .home-subtitle {
      font-size: clamp(12px, 3.5vw, 14px);
      color: var(--text-secondary);
      margin-bottom: 20px;
    }
    /* ===========================
       GLASS CARD COMPONENT
    =========================== */
    .glass-card {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 20px;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
    /* ===========================
       THEME SELECTOR
    =========================== */
    .section-label {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: var(--text-muted);
      margin-bottom: 10px;
      text-align: left;
      width: 100%;
    }
    .menu-section {
      width: 100%;
      max-width: 400px;
      margin-bottom: 12px;
    }
    .theme-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }
    .theme-btn {
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 18px;
      padding: 16px 8px;
      background: rgba(30, 27, 75, 0.6);
      cursor: pointer;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      color: var(--text-secondary);
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    }
    .theme-btn:active {
      transform: scale(0.92);
    }
    .theme-btn:hover {
      background: rgba(255, 255, 255, 0.1);
      transform: translateY(-2px);
    }
    .theme-btn .t-emoji {
      font-size: 32px;
      transition: transform 0.3s ease;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    }
    .theme-btn:hover .t-emoji {
      transform: scale(1.1) translateY(-2px);
    }
    .theme-btn .t-name {
      font-size: 13px;
      font-weight: 800;
      letter-spacing: 0.5px;
    }
    .theme-btn.active {
      border: 2px solid #a78bfa;
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(6, 182, 212, 0.2));
      color: #fff;
      box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4), inset 0 0 15px rgba(124, 58, 237, 0.3);
      transform: translateY(-4px);
    }
    .theme-btn.active .t-emoji {
      transform: scale(1.15);
      filter: drop-shadow(0 4px 8px rgba(124, 58, 237, 0.6));
    }
    /* ===========================
       STAGE / DIFFICULTY GRID
    =========================== */
    .stage-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }
    .stage-btn {
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 16px;
      padding: 16px 14px;
      background: rgba(30, 27, 75, 0.6);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
      color: var(--text-secondary);
      position: relative;
      overflow: hidden;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    }
    .stage-btn:hover:not(.locked) {
      background: rgba(255, 255, 255, 0.1);
      transform: translateY(-2px);
    }
    .stage-btn:active {
      transform: scale(0.94);
    }
    .stage-btn .s-badge {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 1px;
      text-transform: uppercase;
      padding: 2px 8px;
      border-radius: 99px;
      margin-bottom: 2px;
    }
    .stage-btn .s-name {
      font-size: 15px;
      font-weight: 700;
      color: var(--text-primary);
    }
    .stage-btn .s-info {
      font-size: 11px;
    }
    .stage-btn .s-lock {
      font-size: 13px;
      position: absolute;
      top: 10px;
      right: 10px;
    }
    /* Stage colour themes */
    .stage-btn[data-diff="easy"].active {
      border-color: #10b981;
      background: rgba(16, 185, 129, 0.15);
      box-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
    }
    .stage-btn[data-diff="easy"].active .s-name {
      color: #34d399;
    }
    .stage-btn[data-diff="easy"] .s-badge {
      background: rgba(16, 185, 129, 0.2);
      color: #34d399;
    }
    .stage-btn[data-diff="medium"].active {
      border-color: var(--accent-2);
      background: rgba(6, 182, 212, 0.15);
      box-shadow: var(--shadow-glow-cyan);
    }
    .stage-btn[data-diff="medium"].active .s-name {
      color: #67e8f9;
    }
    .stage-btn[data-diff="medium"] .s-badge {
      background: rgba(6, 182, 212, 0.2);
      color: #67e8f9;
    }
    .stage-btn[data-diff="hard"].active {
      border-color: var(--accent-4);
      background: rgba(236, 72, 153, 0.15);
      box-shadow: 0 0 18px rgba(236, 72, 153, 0.35);
    }
    .stage-btn[data-diff="hard"].active .s-name {
      color: #f9a8d4;
    }
    .stage-btn[data-diff="hard"] .s-badge {
      background: rgba(236, 72, 153, 0.2);
      color: #f9a8d4;
    }
    .stage-btn[data-diff="expert"].active {
      border-color: var(--accent-3);
      background: rgba(245, 158, 11, 0.15);
      box-shadow: 0 0 18px rgba(245, 158, 11, 0.35);
    }
    .stage-btn[data-diff="expert"].active .s-name {
      color: #fcd34d;
    }
    .stage-btn[data-diff="expert"] .s-badge {
      background: rgba(245, 158, 11, 0.2);
      color: #fcd34d;
    }
    .stage-btn.locked {
      opacity: 0.45;
      cursor: not-allowed;
    }
    /* Leaderboard entries */
    .lb-entry {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: 14px;
      margin-bottom: 8px;
      transition: background 0.2s;
    }
    .lb-entry:hover {
      background: rgba(255, 255, 255, 0.07);
    }
    .lb-rank {
      font-size: 18px;
      font-weight: 900;
      min-width: 28px;
      text-align: center;
    }
    .lb-info {
      flex: 1;
    }
    .lb-theme {
      font-size: 12px;
      color: var(--text-muted);
    }
    .lb-score {
      font-size: 20px;
      font-weight: 900;
      color: #a78bfa;
    }
    .lb-meta {
      font-size: 10px;
      color: var(--text-muted);
      text-align: right;
    }
    .lb-tab {
      padding: 6px 14px;
      font-size: 12px;
      font-weight: 700;
      font-family: 'Outfit', sans-serif;
      border-radius: 99px;
      border: 1.5px solid rgba(255, 255, 255, 0.1);
      background: rgba(255, 255, 255, 0.04);
      color: var(--text-muted);
      cursor: pointer;
      transition: all 0.2s;
    }
    .lb-tab.active {
      background: rgba(124, 58, 237, 0.25);
      border-color: #7c3aed;
      color: #a78bfa;
    }
    .lb-empty {
      text-align: center;
      padding: 40px 20px;
      color: var(--text-muted);
      font-size: 14px;
    }
    .lb-skeleton {
      background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
      background-size: 200% 100%;
      animation: skeletonLoading 1.5s infinite ease-in-out;
      border-radius: 4px;
      color: transparent !important;
    }
    .lb-skeleton * {
      opacity: 0;
    }
    @keyframes skeletonLoading {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }
    /* ===========================
       DIFFICULTY SELECTOR (kept for reference, stage replaces it)
    =========================== */
    .diff-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }
    .diff-btn {
      border: 2px solid rgba(255, 255, 255, 0.1);
      border-radius: 14px;
      padding: 12px;
      background: rgba(255, 255, 255, 0.04);
      cursor: pointer;
      transition: all var(--transition-fast);
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
      color: var(--text-secondary);
    }
    .diff-btn:active {
      transform: scale(0.94);
    }
    .diff-btn .d-name {
      font-size: 15px;
      font-weight: 700;
      color: var(--text-primary);
    }
    .diff-btn .d-info {
      font-size: 11px;
    }
    .diff-btn.active {
      border-color: var(--accent-2);
      background: rgba(6, 182, 212, 0.15);
      box-shadow: var(--shadow-glow-cyan);
    }
    .diff-btn.active .d-name {
      color: #67e8f9;
    }
    /* Hard colors */
    .diff-btn[data-diff="hard"].active {
      border-color: var(--accent-4);
      background: rgba(236, 72, 153, 0.15);
      box-shadow: 0 0 20px rgba(236, 72, 153, 0.35);
    }
    .diff-btn[data-diff="hard"].active .d-name {
      color: #f9a8d4;
    }
    .diff-btn[data-diff="expert"].active {
      border-color: var(--accent-3);
      background: rgba(245, 158, 11, 0.15);
      box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
    }
    .diff-btn[data-diff="expert"].active .d-name {
      color: #fcd34d;
    }
    /* ===========================
       BUTTONS
    =========================== */
    .btn-primary {
      width: 100%;
      max-width: 400px;
      padding: 18px;
      font-size: 19px;
      font-weight: 900;
      font-family: 'Outfit', sans-serif;
      letter-spacing: 1px;
      border: 3px solid rgba(124, 58, 237, 0.5);
      border-radius: 20px;
      cursor: pointer;
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.8), rgba(6, 182, 212, 0.8));
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      color: white;
      text-transform: uppercase;
      box-shadow: 0 0 30px rgba(124, 58, 237, 0.5), 0 0 10px rgba(6, 182, 212, 0.5) inset;
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      position: relative;
      overflow: hidden;
      animation: pulseBtn 2.5s infinite;
    }
    @keyframes pulseBtn {
      0%,
      100% {
        box-shadow: 0 0 30px rgba(124, 58, 237, 0.5), 0 0 10px rgba(6, 182, 212, 0.5) inset;
      }
      50% {
        box-shadow: 0 0 50px rgba(124, 58, 237, 0.8), 0 0 20px rgba(6, 182, 212, 0.8) inset;
      }
    }
    .btn-primary::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 100%);
      transform: translateX(-100%);
      transition: transform 0.6s ease;
    }
    .btn-primary:active::after,
    .btn-primary:hover::after {
      transform: translateX(100%);
    }
    .btn-primary:active {
      transform: scale(0.95);
    }
    .btn-secondary {
      padding: 12px 22px;
      font-size: 14px;
      font-weight: 700;
      font-family: 'Outfit', sans-serif;
      border: 1.5px solid rgba(255, 255, 255, 0.2);
      border-radius: 12px;
      cursor: pointer;
      background: rgba(255, 255, 255, 0.06);
      color: var(--text-secondary);
      transition: all var(--transition-fast);
    }
    .btn-secondary:active {
      transform: scale(0.95);
      background: rgba(255, 255, 255, 0.1);
    }
    /* ===========================
       GAME SCREEN
    =========================== */
    #screen-game {
      justify-content: flex-start;
      padding: 0;
      overflow-y: auto;
      overflow-x: hidden;
    }
    .game-header {
      width: 100%;
      padding: 16px 16px 10px;
      display: flex;
      align-items: center;
      gap: 10px;
      background: rgba(15, 12, 41, 0.8);
      backdrop-filter: blur(12px);
      position: sticky;
      top: 0;
      z-index: 10;
    }
    .game-back-btn {
      width: 38px;
      height: 38px;
      border: 1.5px solid rgba(255, 255, 255, 0.15);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.06);
      cursor: pointer;
      color: var(--text-secondary);
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: all var(--transition-fast);
    }
    .game-back-btn:active {
      transform: scale(0.9);
      background: rgba(255, 255, 255, 0.12);
    }
    /* Music toggle button */
    .music-btn {
      width: 38px;
      height: 38px;
      border: 1.5px solid rgba(255, 255, 255, 0.15);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.06);
      cursor: pointer;
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: all var(--transition-fast);
      color: var(--text-secondary);
    }
    .music-btn:active {
      transform: scale(0.9);
    }
    .music-btn.muted {
      color: #ef4444;
      border-color: rgba(239, 68, 68, 0.35);
      background: rgba(239, 68, 68, 0.08);
    }
    .game-title-area {
      flex: 1;
    }
    .game-title {
      font-size: 15px;
      font-weight: 800;
      color: var(--text-primary);
    }
    .game-level-info {
      font-size: 11px;
      color: var(--text-muted);
    }
    /* Stats Row */
    .stats-row {
      width: 100%;
      padding: 10px 16px;
      display: flex;
      gap: 8px;
    }
    .stat-box {
      flex: 1;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 12px;
      padding: 8px 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
    }
    .stat-label {
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
    }
    .stat-value {
      font-size: 18px;
      font-weight: 800;
      color: var(--text-primary);
    }
    .stat-box.timer-box .stat-value {
      color: #67e8f9;
    }
    .stat-box.timer-box.warning .stat-value {
      color: var(--warning);
      animation: timerPulse 0.5s ease infinite alternate;
    }
    .stat-box.timer-box.danger .stat-value {
      color: var(--error);
      animation: timerPulse 0.35s ease infinite alternate;
    }
    .stat-box.score-box .stat-value {
      color: #a78bfa;
    }
    .stat-box.matches-box .stat-value {
      color: var(--success);
    }
    @keyframes timerPulse {
      from {
        transform: scale(1);
      }
      to {
        transform: scale(1.08);
      }
    }
    /* Combo */
    .combo-area {
      width: 100%;
      padding: 0 16px 8px;
      min-height: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .combo-badge {
      background: linear-gradient(135deg, var(--accent-3), var(--accent-4));
      border-radius: 20px;
      padding: 4px 16px;
      font-size: 12px;
      font-weight: 800;
      letter-spacing: 0.5px;
      color: white;
      opacity: 0;
      transform: scale(0.8) translateY(4px);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
    }
    .combo-badge.show {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
    /* Card Grid */
    .card-grid-wrapper {
      width: 100%;
      padding: 0 12px 24px;
      display: flex;
      justify-content: center;
    }
    .card-grid {
      display: grid;
      gap: 10px;
      width: 100%;
      max-width: 420px;
    }
    /* ===========================
       MEMORY CARD
    =========================== */
    .card {
      aspect-ratio: 1;
      perspective: 600px;
      cursor: pointer;
    }
    .card-inner {
      width: 100%;
      height: 100%;
      position: relative;
      transform-style: preserve-3d;
      transition: transform var(--flip-duration) cubic-bezier(0.4, 0, 0.2, 1);
      border-radius: var(--card-radius);
    }
    .card.flipped .card-inner,
    .card.matched .card-inner,
    .card.flipped-opponent .card-inner {
      transform: rotateY(180deg);
    }
    .card.flipped-opponent .card-front {
      border-color: var(--error);
      box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    }
    .card.flipped-opponent .card-front::after {
      content: 'OPP';
      position: absolute;
      top: 4px;
      right: 4px;
      font-size: 8px;
      font-weight: 900;
      color: #fff;
      background: var(--error);
      padding: 1px 4px;
      border-radius: 4px;
      z-index: 5;
    }
    .card-face {
      position: absolute;
      inset: 0;
      border-radius: var(--card-radius);
      display: flex;
      align-items: center;
      justify-content: center;
      backface-visibility: hidden;
      -webkit-backface-visibility: hidden;
    }
    /* Card Back */
    .card-back {
      background: var(--card-back);
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
      position: relative;
      overflow: hidden;
    }
    .card-back::before {
      content: '';
      position: absolute;
      inset: 0;
      background: repeating-linear-gradient(45deg,
          rgba(255, 255, 255, 0.03) 0px,
          rgba(255, 255, 255, 0.03) 5px,
          transparent 5px,
          transparent 10px);
    }
    .card-back-icon {
      font-size: 26px;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    }
    /* Card Front */
    .card-front {
      background: var(--bg-card-front);
      border: 2px solid rgba(124, 58, 237, 0.35);
      transform: rotateY(180deg);
      box-shadow: 0 4px 20px rgba(124, 58, 237, 0.2), 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    .card-front .card-emoji {
      font-size: clamp(24px, 9vw, 44px);
      filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
      transition: transform 0.2s ease;
    }
    .card.flipped:active .card-front .card-emoji {
      transform: scale(1.1);
    }
    /* Matched State */
    .card.matched .card-front {
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 182, 212, 0.2));
      border-color: rgba(16, 185, 129, 0.6);
      box-shadow: 0 0 20px rgba(16, 185, 129, 0.35), 0 4px 16px rgba(0, 0, 0, 0.2);
    }
    /* Wrong State */
    .card.wrong {
      animation: wrongShake 0.4s ease;
    }
    @keyframes wrongShake {
      0% {
        transform: translateX(0);
      }
      20% {
        transform: translateX(-6px) rotateZ(-2deg);
      }
      40% {
        transform: translateX(6px) rotateZ(2deg);
      }
      60% {
        transform: translateX(-4px);
      }
      80% {
        transform: translateX(4px);
      }
      100% {
        transform: translateX(0);
      }
    }
    /* Card appear animation */
    .card {
      animation: cardAppear 0.4s backwards cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    @keyframes cardAppear {
      from {
        opacity: 0;
        transform: scale(0.6) translateY(10px);
      }
      to {
        opacity: 1;
        transform: scale(1) translateY(0);
      }
    }
    /* ===========================
       PREVIEW PHASE
    =========================== */
    /* Show card front face during preview */
    .card.preview .card-inner {
      transform: rotateY(180deg);
    }
    /* Disable flip transition for instant reveal */
    .card.no-flip-transition .card-inner {
      transition: none !important;
    }
    /* Preview overlay */
    .preview-overlay {
      position: absolute;
      inset: 0;
      z-index: 15;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.35s ease;
    }
    .preview-overlay.show {
      opacity: 1;
      pointer-events: all;
    }
    .preview-banner {
      background: linear-gradient(135deg, rgba(30, 27, 75, 0.94), rgba(15, 12, 41, 0.94));
      border: 1px solid rgba(167, 139, 250, 0.35);
      border-radius: 24px;
      padding: 22px 40px;
      text-align: center;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 50px rgba(124, 58, 237, 0.25);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
    }
    .preview-eyebrow {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 2px;
      color: #a78bfa;
      margin-bottom: 6px;
    }
    .preview-main {
      font-size: 17px;
      font-weight: 800;
      color: var(--text-secondary);
      margin-bottom: 10px;
    }
    .preview-countdown-num {
      font-size: 72px;
      font-weight: 900;
      line-height: 1;
      background: linear-gradient(135deg, #a78bfa, #06b6d4);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.6));
    }
    .preview-countdown-num.pop {
      animation: countdownPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }
    @keyframes countdownPop {
      0% {
        transform: scale(0.5);
        opacity: 0.3;
      }
      60% {
        transform: scale(1.15);
      }
      100% {
        transform: scale(1);
        opacity: 1;
      }
    }
    /* Flip-back notice */
    .preview-shuffling {
      margin-top: 14px;
      font-size: 13px;
      font-weight: 700;
      color: var(--text-muted);
      letter-spacing: 0.5px;
      opacity: 0;
      transform: translateY(6px);
      transition: all 0.4s ease;
    }
    .preview-shuffling.show {
      opacity: 1;
      transform: translateY(0);
    }
    /* ===========================
       PROGRESS BAR
    =========================== */
    .progress-wrap {
      width: 100%;
      padding: 0 16px 6px;
    }
    .progress-track {
      height: 6px;
      background: rgba(255, 255, 255, 0.07);
      border-radius: 99px;
      overflow: hidden;
    }
    .progress-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
      border-radius: 99px;
      transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
    }
    /* ===========================
       HEALTH BAR
    =========================== */
    .health-wrap {
      width: 100%;
      padding: 0 16px 8px;
    }
    .health-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 5px;
    }
    .health-label {
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .health-pct {
      font-size: 11px;
      font-weight: 800;
      color: var(--success);
      transition: color 0.4s ease;
    }
    .health-pct.warning {
      color: var(--warning);
    }
    .health-pct.danger {
      color: var(--error);
      animation: healthPulse 0.5s ease infinite alternate;
    }
    .health-track {
      height: 8px;
      background: rgba(255, 255, 255, 0.07);
      border-radius: 99px;
      overflow: hidden;
      position: relative;
    }
    .health-fill {
      height: 100%;
      border-radius: 99px;
      background: linear-gradient(90deg, #10b981, #34d399);
      transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease, box-shadow 0.4s ease;
      box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    }
    .health-fill.warning {
      background: linear-gradient(90deg, #d97706, #f59e0b);
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    }
    .health-fill.danger {
      background: linear-gradient(90deg, #b91c1c, #ef4444);
      box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
    }
    @keyframes healthPulse {
      from {
        transform: scaleX(1);
      }
      to {
        transform: scaleX(1.01);
      }
    }
    /* Damage flash overlay */
    .damage-flash {
      position: fixed;
      inset: 0;
      z-index: 200;
      pointer-events: none;
      background: rgba(239, 68, 68, 0);
      transition: background 0.1s ease;
    }
    .damage-flash.hit {
      background: rgba(239, 68, 68, 0.18);
    }
    /* ===========================
       MODALS (Pause, Win, Lose)
    =========================== */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 50;
      background: rgba(0, 0, 0, 0.75);
      backdrop-filter: blur(6px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }
    .modal-backdrop.show {
      opacity: 1;
      pointer-events: all;
    }
    .modal-box {
      width: 100%;
      max-width: 360px;
      background: linear-gradient(160deg, #1a1547, #12103a);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 24px;
      padding: 30px 24px;
      text-align: center;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
      transform: scale(0.9) translateY(20px);
      transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .modal-backdrop.show .modal-box {
      transform: scale(1) translateY(0);
    }
    .modal-icon {
      font-size: 60px;
      display: block;
      margin-bottom: 12px;
    }
    .modal-title {
      font-size: 26px;
      font-weight: 900;
      margin-bottom: 6px;
    }
    .modal-caption {
      font-size: 14px;
      color: var(--text-secondary);
      margin-bottom: 22px;
    }
    .modal-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      margin-bottom: 24px;
    }
    .modal-stat {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 12px;
      padding: 10px 8px;
    }
    .modal-stat .ms-label {
      font-size: 9px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
      margin-bottom: 4px;
    }
    .modal-stat .ms-value {
      font-size: 18px;
      font-weight: 800;
    }
    .modal-actions {
      display: flex;
      gap: 10px;
    }
    .modal-actions .btn-primary {
      max-width: none;
      flex: 1;
      padding: 14px;
      font-size: 15px;
    }
    .modal-actions .btn-secondary {
      flex: 1;
    }
    /* Stars */
    .stars-row {
      display: flex;
      justify-content: center;
      gap: 8px;
      margin-bottom: 16px;
    }
    .star-icon {
      font-size: 32px;
      opacity: 0.2;
      transform: scale(0.6);
      transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
      filter: grayscale(100%);
    }
    .star-icon.lit {
      opacity: 1;
      transform: scale(1);
      filter: none;
    }
    /* ===========================
       PAUSE BTN
    =========================== */
    .game-pause-btn {
      width: 38px;
      height: 38px;
      border: 1.5px solid rgba(255, 255, 255, 0.15);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.06);
      cursor: pointer;
      color: var(--text-secondary);
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: all var(--transition-fast);
    }
    .game-pause-btn:active {
      transform: scale(0.9);
    }
    /* ===========================
       BEST SCORE
    =========================== */
    .best-score-banner {
      width: 100%;
      max-width: 400px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 16px;
      background: rgba(245, 158, 11, 0.1);
      border: 1px solid rgba(245, 158, 11, 0.2);
      border-radius: 14px;
      margin-bottom: 16px;
    }
    .best-score-banner .bs-left {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .best-score-banner .bs-icon {
      font-size: 20px;
    }
    .best-score-banner .bs-label {
      font-size: 13px;
      color: var(--text-secondary);
    }
    .best-score-banner .bs-value {
      font-size: 18px;
      font-weight: 800;
      color: var(--accent-3);
    }
    .best-score-banner.hidden-banner {
      opacity: 0;
      pointer-events: none;
    }
    /* ===========================
       SCROLLBAR
    =========================== */
    ::-webkit-scrollbar {
      width: 0;
    }
    /* ===========================
       PARTICLE EFFECT
    =========================== */
    .particle {
      position: fixed;
      pointer-events: none;
      z-index: 100;
      border-radius: 50%;
      animation: particleFly 0.8s ease-out forwards;
    }
    @keyframes particleFly {
      to {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
      }
    }
    /* Floating background symbols */
    .home-floating-symbols {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 0;
      overflow: hidden;
    }
    .floating-symbol {
      position: absolute;
      color: rgba(255, 255, 255, 0.05);
      font-size: 32px;
      animation: floatUp 15s linear infinite;
      filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.2));
    }
    @keyframes floatUp {
      from {
        transform: translateY(110vh) rotate(0deg);
        opacity: 0;
      }
      10% {
        opacity: 1;
      }
      90% {
        opacity: 1;
      }
      to {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
      }
    }
    /* ===========================
       RESPONSIVE
    =========================== */
    /* ── Extra-small phones (≤ 360px wide) ── */
    @media (max-width: 360px) {
      .screen {
        padding: 10px;
      }
      #screen-home,
      #screen-auth {
        padding-left: 10px;
        padding-right: 10px;
      }
      .home-logo .logo-icon {
        font-size: 44px;
      }
      .home-title {
        font-size: 22px;
      }
      .menu-section {
        margin-bottom: 8px;
      }
      .theme-btn {
        padding: 8px 4px;
      }
      .theme-btn .t-emoji {
        font-size: 20px;
      }
      .theme-btn .t-name {
        font-size: 10px;
      }
      .stage-btn {
        padding: 9px;
      }
      .stage-btn .s-name {
        font-size: 13px;
      }
      .btn-primary {
        padding: 14px;
        font-size: 15px;
      }
      .stat-value {
        font-size: 15px;
      }
      .stat-label {
        font-size: 8px;
      }
      .card-grid {
        gap: 6px;
      }
      .card-front .card-emoji {
        font-size: clamp(18px, 7vw, 32px);
      }
      .modal-box {
        padding: 20px 14px;
        border-radius: 18px;
      }
      .modal-title {
        font-size: 20px;
      }
      .modal-icon {
        font-size: 44px;
      }
      .modal-stat .ms-value {
        font-size: 14px;
      }
    }
    /* ── Small phones (default styles already target ~375px) ── */
    @media (min-width: 361px) and (max-width: 479px) {
      .card-back-icon {
        font-size: 26px;
      }
    }
    /* ── Medium screens (≥ 480px) ── */
    @media (min-width: 480px) {
      .screen {
        padding: 24px;
      }
      #screen-home,
      #screen-auth {
        padding-left: 24px;
        padding-right: 24px;
      }
      .card-back-icon {
        font-size: 30px;
      }
      .home-logo .logo-icon {
        font-size: 72px;
      }
      .home-title {
        font-size: 36px;
      }
      .home-subtitle {
        margin-bottom: 26px;
      }
      .menu-section {
        margin-bottom: 16px;
      }
      .btn-primary {
        padding: 18px;
        font-size: 17px;
      }
      .stat-value {
        font-size: 20px;
      }
      .game-header {
        padding: 18px 20px 12px;
      }
      .stats-row {
        padding: 12px 20px;
      }
      .card-grid-wrapper {
        padding: 0 16px 28px;
      }
      .card-grid {
        max-width: 460px;
        gap: 12px;
      }
    }
    /* ── Tablets (≥ 600px) ── */
    @media (min-width: 600px) {
      .menu-section {
        max-width: 480px;
      }
      .btn-primary {
        max-width: 480px;
      }
      .auth-panel {
        max-width: 460px;
      }
      .card-grid {
        max-width: 520px;
      }
      .modal-box {
        max-width: 420px;
        padding: 36px 32px;
      }
      .modal-title {
        font-size: 30px;
      }
      .modal-icon {
        font-size: 70px;
      }
      .preview-countdown-num {
        font-size: 88px;
      }
      .combo-badge {
        font-size: 14px;
        padding: 6px 22px;
      }
    }
    /* ── Desktop (≥ 900px) ── */
    @media (min-width: 900px) {
      #screen-home,
      #screen-auth {
        justify-content: center;
        overflow-y: auto;
      }
      .menu-section {
        max-width: 520px;
      }
      .btn-primary {
        max-width: 520px;
      }
      #leaderboard-btn {
        max-width: 520px !important;
      }
      .auth-panel {
        max-width: 520px;
      }
      .card-grid {
        max-width: 600px;
        gap: 14px;
      }
      .card-grid-wrapper {
        padding: 0 24px 32px;
      }
      .theme-btn {
        padding: 14px 10px;
      }
      .theme-btn .t-emoji {
        font-size: 30px;
      }
      .theme-btn .t-name {
        font-size: 13px;
      }
      .stage-btn {
        padding: 16px;
      }
      .stage-btn .s-name {
        font-size: 16px;
      }
      .game-header {
        padding: 20px 28px 14px;
      }
      .stats-row {
        padding: 12px 28px;
        gap: 12px;
      }
      .health-wrap {
        padding: 0 28px 10px;
      }
      .progress-wrap {
        padding: 0 28px 8px;
      }
      .combo-area {
        padding: 0 28px 10px;
      }
      .install-btn-wrapper {
        bottom: 32px;
        right: 32px;
      }
    }
    /* ── Very tall screens (landscape / desktop) — shrink the card emoji ── */
    @media (min-height: 800px) and (min-width: 480px) {
      .home-logo .logo-icon {
        font-size: 80px;
      }
    }
    /* ── Short landscape phones ── */
    @media (max-height: 500px) and (orientation: landscape) {
      #screen-home,
      #screen-auth {
        padding-top: 8px;
        padding-bottom: 8px;
        justify-content: flex-start;
      }
      .home-logo {
        display: none;
      }
      .home-title {
        font-size: 20px;
        margin-bottom: 4px;
      }
      .home-subtitle {
        margin-bottom: 8px;
        font-size: 12px;
      }
      .menu-section {
        margin-bottom: 6px;
      }
      .theme-btn {
        padding: 6px 4px;
      }
      .theme-btn .t-emoji {
        font-size: 18px;
      }
      .stage-btn {
        padding: 8px;
      }
      .stage-btn .s-name {
        font-size: 12px;
      }
      .btn-primary {
        padding: 12px;
        font-size: 14px;
      }
      .stat-box {
        padding: 6px 8px;
      }
      .stat-value {
        font-size: 14px;
      }
      .card-grid {
        gap: 6px;
      }
    }
    /* ===========================
       AUTH / LOGIN SCREEN
    =========================== */
    /* #screen-auth base styles already handled above */
    .auth-logo {
      font-size: 60px;
      display: block;
      margin-bottom: 10px;
      animation: logoPulse 3s ease-in-out infinite;
    }
    .auth-title {
      font-size: clamp(26px, 8vw, 38px);
      font-weight: 900;
      background: linear-gradient(135deg, #a78bfa, #06b6d4, #f59e0b);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      margin-bottom: 8px;
    }
    .auth-sub {
      font-size: 14px;
      line-height: 1.4;
      color: var(--text-muted);
      margin-bottom: 32px;
      max-width: 360px;
      margin-left: auto;
      margin-right: auto;
    }
    .auth-panel {
      width: 100%;
      max-width: 420px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.10);
      border-radius: 24px;
      padding: 32px 28px;
      backdrop-filter: blur(14px);
      margin-bottom: 24px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 2px 10px rgba(255, 255, 255, 0.05);
    }
    .auth-panel-title {
      font-size: 13px;
      font-weight: 800;
      letter-spacing: 1.2px;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 14px;
      text-align: left;
    }
    /* Google button */
    .btn-google {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 16px 18px;
      background: #fff;
      color: #1f1f1f;
      border: none;
      border-radius: 14px;
      font-family: 'Outfit', sans-serif;
      font-size: 15px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
      margin-bottom: 16px;
    }
    .btn-google:hover {
      background: #f5f5f5;
      transform: translateY(-2px);
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    }
    .btn-google:active {
      transform: scale(0.97);
    }
    .btn-google svg {
      flex-shrink: 0;
    }
    .auth-divider {
      display: flex;
      align-items: center;
      gap: 12px;
      margin: 16px 0;
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
    }
    .auth-divider::before,
    .auth-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: rgba(255, 255, 255, 0.08);
    }
    .input-group {
      position: relative;
      width: 100%;
      margin-bottom: 14px;
    }
    .input-icon {
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      width: 18px;
      height: 18px;
      color: var(--text-muted);
      pointer-events: none;
      transition: color 0.3s;
    }
    .auth-input {
      width: 100%;
      padding: 16px 44px 16px 44px;
      background: rgba(255, 255, 255, 0.06);
      border: 1.5px solid rgba(255, 255, 255, 0.1);
      border-radius: 14px;
      color: var(--text-primary);
      font-family: 'Outfit', sans-serif;
      font-size: 15px;
      outline: none;
      transition: all 0.3s;
      box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    .btn-toggle-pass {
      position: absolute;
      right: 14px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      padding: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: color 0.3s;
    }
    .btn-toggle-pass:hover {
      color: var(--text-primary);
    }
    .auth-input:focus {
      border-color: #a78bfa;
      background: rgba(124, 58, 237, 0.07);
      box-shadow: 0 0 15px rgba(124, 58, 237, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    .input-group:focus-within .input-icon {
      color: #a78bfa;
    }
    .auth-input::placeholder {
      color: rgba(148, 163, 184, 0.7);
    }
    .auth-error {
      font-size: 13px;
      color: var(--error);
      margin-bottom: 12px;
      text-align: left;
      min-height: 18px;
    }
    .auth-tabs {
      display: flex;
      gap: 6px;
      margin-bottom: 24px;
      background: rgba(0, 0, 0, 0.2);
      border-radius: 14px;
      padding: 6px;
      box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    .auth-tab {
      flex: 1;
      padding: 12px;
      border: none;
      border-radius: 10px;
      background: transparent;
      color: var(--text-muted);
      font-family: 'Outfit', sans-serif;
      font-size: 14px;
      font-weight: 800;
      cursor: pointer;
      transition: all 0.3s ease;
    }
    .auth-tab:hover:not(.active) {
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-secondary);
    }
    .auth-tab.active {
      background: linear-gradient(135deg, #7c3aed, #06b6d4);
      color: #fff;
      box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
    }
    /* Player chip on home screen */
    .player-chip {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 12px 6px 8px;
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 99px;
      margin-bottom: 14px;
      cursor: pointer;
      transition: all 0.2s;
      max-width: 380px;
      width: 100%;
    }
    .player-chip:hover {
      background: rgba(255, 255, 255, 0.1);
    }
    .player-avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      object-fit: cover;
      flex-shrink: 0;
    }
    .player-avatar-placeholder {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      font-weight: 800;
      color: #fff;
      flex-shrink: 0;
    }
    .player-name {
      font-size: 13px;
      font-weight: 700;
      color: var(--text-primary);
      flex: 1;
      text-align: left;
    }
    .player-switch {
      font-size: 10px;
      color: var(--text-muted);
    }
    /* Round badge on game header */
    .round-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      border-radius: 99px;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.5px;
      background: rgba(245, 158, 11, 0.2);
      color: #fcd34d;
      border: 1px solid rgba(245, 158, 11, 0.3);
      margin-left: 6px;
      vertical-align: middle;
    }
    /* Escalation toast */
    .escalate-toast {
      position: fixed;
      top: 80px;
      left: 50%;
      transform: translateX(-50%) translateY(-20px);
      z-index: 300;
      background: linear-gradient(135deg, #7c3aed, #ec4899);
      color: #fff;
      font-family: 'Outfit', sans-serif;
      font-size: 13px;
      font-weight: 800;
      padding: 10px 20px;
      border-radius: 99px;
      box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
      opacity: 0;
      transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
      white-space: nowrap;
      pointer-events: none;
    }
    .escalate-toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    /* ===========================
       WIZARD STAGE WIN POPUP CSS
       Fixed side popup that slides in from the right
       when the player completes a stage / wins a round.
    =========================== */
    /* -- Main container: positioned off-screen right by default -- */
    .wizard-popup {
      position: fixed;
      bottom: 200px;
      right: -340px;
      /* hidden off-screen */
      z-index: 2000;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 10px;
      pointer-events: none;
      /* never blocks game UI */
      opacity: 0;
      /* Smooth entry transition */
      transition: right 0.65s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.45s ease;
    }
    /* -- Visible state: slides in -- */
    .wizard-popup.wizard-visible {
      right: 14px;
      opacity: 1;
    }
    /* -- Exit state: slides back out -- */
    .wizard-popup.wizard-exit {
      right: -340px;
      opacity: 0;
      transition: right 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.4s ease;
    }
    /* -- Wizard character image wrapper -- */
    .wizard-char-wrap {
      position: relative;
      width: 150px;
      height: 170px;
      flex-shrink: 0;
      /* Idle floating animation (runs after popup appears) */
      animation: wizardFloat 3s ease-in-out infinite;
      filter:
        drop-shadow(0 0 18px rgba(124, 58, 237, 0.75)) drop-shadow(0 0 40px rgba(6, 182, 212, 0.4));
    }
    /* Glow pulse layered on top of idle float */
    .wizard-popup.wizard-visible .wizard-char-wrap {
      animation:
        wizardFloat 3s ease-in-out infinite,
        wizardGlowPulse 2.4s ease-in-out infinite;
    }
    @keyframes wizardFloat {
      0%,
      100% {
        transform: translateY(0px) scale(1);
      }
      50% {
        transform: translateY(-12px) scale(1.02);
      }
    }
    @keyframes wizardGlowPulse {
      0%,
      100% {
        filter:
          drop-shadow(0 0 16px rgba(124, 58, 237, 0.75)) drop-shadow(0 0 36px rgba(6, 182, 212, 0.4));
      }
      50% {
        filter:
          drop-shadow(0 0 30px rgba(124, 58, 237, 1)) drop-shadow(0 0 60px rgba(6, 182, 212, 0.75)) drop-shadow(0 0 20px rgba(245, 158, 11, 0.4));
      }
    }
    /* -- Wizard image -- */
    .wizard-img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: 16px;
      transform-origin: bottom right;
    }
    /* -- Speech bubble / dialog -- */
    .wizard-speech-bubble {
      background: rgba(10, 8, 36, 0.92);
      border: 1.5px solid rgba(167, 139, 250, 0.65);
      border-radius: 18px 18px 4px 18px;
      padding: 12px 16px;
      max-width: 210px;
      min-width: 145px;
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      box-shadow:
        0 0 22px rgba(124, 58, 237, 0.5),
        0 0 44px rgba(6, 182, 212, 0.2),
        0 8px 28px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
      position: relative;
      transform-origin: bottom right;
      /* Pop-in animation with a short delay so it appears after slide */
      animation: wizardBubblePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
      animation-delay: 0.3s;
    }
    @keyframes wizardBubblePop {
      0% {
        transform: scale(0.5) translateY(10px);
        opacity: 0;
      }
      100% {
        transform: scale(1) translateY(0);
        opacity: 1;
      }
    }
    /* Bubble tail pointing down-right toward wizard */
    .wizard-speech-bubble::after {
      content: '';
      position: absolute;
      bottom: -10px;
      right: 22px;
      border-width: 10px 8px 0 0;
      border-style: solid;
      border-color: rgba(167, 139, 250, 0.65) transparent transparent transparent;
    }
    /* Message text inside bubble */
    #wizard-message {
      font-family: 'Outfit', sans-serif;
      font-size: 14px;
      font-weight: 800;
      letter-spacing: 0.3px;
      line-height: 1.4;
      display: block;
      text-align: center;
      background: linear-gradient(135deg, #a78bfa, #06b6d4, #f59e0b);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    /* -- Magical sparkle particles (absolutely positioned inside wizard-char-wrap) -- */
    .wizard-particles {
      position: absolute;
      inset: -25px;
      pointer-events: none;
      overflow: visible;
    }
    .wizard-spark {
      position: absolute;
      border-radius: 50%;
      animation: wizardSparkFly var(--dur, 1.8s) ease-in-out infinite;
      animation-delay: var(--delay, 0s);
      opacity: 0;
    }
    @keyframes wizardSparkFly {
      0% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
      }
      20% {
        opacity: 1;
      }
      80% {
        opacity: 0.6;
      }
      100% {
        transform: translate(var(--tx, 20px), var(--ty, -50px)) scale(0);
        opacity: 0;
      }
    }
    /* -- Rune glyphs floating around the wizard -- */
    .wizard-runes {
      position: absolute;
      inset: 0;
      pointer-events: none;
      overflow: visible;
    }
    .wizard-rune {
      position: absolute;
      font-family: 'Outfit', sans-serif;
      font-size: 18px;
      font-weight: 900;
      opacity: 0;
      pointer-events: none;
      animation: wizardRuneFloat var(--dur, 2.5s) ease-in-out infinite;
      animation-delay: var(--delay, 0s);
      text-shadow: 0 0 14px rgba(124, 58, 237, 0.9), 0 0 28px rgba(6, 182, 212, 0.6);
    }
    @keyframes wizardRuneFloat {
      0% {
        transform: translate(0, 0) scale(0.5) rotate(0deg);
        opacity: 0;
      }
      25% {
        opacity: 0.95;
      }
      75% {
        opacity: 0.5;
      }
      100% {
        transform: translate(var(--tx, 10px), var(--ty, -65px)) scale(1) rotate(var(--rot, 20deg));
        opacity: 0;
      }
    }
    /* -- Responsive: shrink wizard on small screens -- */
    @media (max-width: 479px) {
      .wizard-popup {
        bottom: 75px;
      }
      .wizard-char-wrap {
        width: 115px;
        height: 130px;
      }
      .wizard-speech-bubble {
        max-width: 165px;
        min-width: 120px;
        padding: 10px 12px;
      }
      #wizard-message {
        font-size: 12px;
      }
    }
    /* -- Hide wizard in short landscape (keyboard visible, etc.) -- */
    @media (max-height: 500px) and (orientation: landscape) {
      .wizard-popup {
        display: none !important;
      }
    }
    /* ===========================
       ML / AI INSIGHT PANEL
    =========================== */
    .ml-panel {
      width: 100%;
      max-width: 400px;
      margin-bottom: 12px;
      border-radius: 18px;
      overflow: hidden;
      background: rgba(124, 58, 237, 0.06);
      border: 1px solid rgba(124, 58, 237, 0.25);
    }
    .ml-panel-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px 8px;
      cursor: pointer;
      user-select: none;
    }
    .ml-panel-title {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 12px;
      font-weight: 800;
      letter-spacing: 1px;
      text-transform: uppercase;
      color: #a78bfa;
    }
    .ml-panel-title .ml-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #a78bfa;
      box-shadow: 0 0 6px #a78bfa;
      animation: mlPulse 1.8s ease-in-out infinite;
    }
    @keyframes mlPulse {
      0%,
      100% {
        opacity: 1;
        transform: scale(1);
      }
      50% {
        opacity: 0.45;
        transform: scale(0.7);
      }
    }
    .ml-chevron {
      font-size: 11px;
      color: var(--text-muted);
      transition: transform 0.3s ease;
    }
    .ml-panel.open .ml-chevron {
      transform: rotate(180deg);
    }
    .ml-body {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .ml-panel.open .ml-body {
      max-height: 700px;
    }
    .ml-inner {
      padding: 0 14px 14px;
    }
    /* ── Radar Chart ── */
    .ml-radar-wrap {
      display: flex;
      justify-content: center;
      margin-bottom: 10px;
    }
    #ml-radar-canvas {
      border-radius: 12px;
      display: none; /* Shown via JS when data exists */
    }
    .ml-radar-placeholder {
      width: 180px;
      height: 150px;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      font-size: 11px;
      color: var(--text-muted);
      background: rgba(255,255,255,0.03);
      border: 1px dashed rgba(255,255,255,0.1);
      border-radius: 12px;
      padding: 20px;
    }
    /* ── Stage Recommendation ── */
    .ml-recommend {
      display: flex;
      align-items: center;
      gap: 8px;
      background: rgba(16, 185, 129, 0.1);
      border: 1px solid rgba(16, 185, 129, 0.3);
      border-radius: 10px;
      padding: 8px 12px;
      margin-bottom: 10px;
      font-size: 12px;
      color: #6ee7b7;
    }
    .ml-recommend .ml-rec-icon {
      font-size: 16px;
      flex-shrink: 0;
    }
    .ml-recommend strong {
      color: #34d399;
      font-weight: 800;
    }
    /* Stat grid rows */
    .ml-stats {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 7px;
      margin-bottom: 10px;
    }
    .ml-stat-box {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: 10px;
      padding: 8px 10px;
    }
    .ml-stat-label {
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
      margin-bottom: 3px;
    }
    .ml-stat-val {
      font-size: 15px;
      font-weight: 800;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .ml-trend {
      font-size: 10px;
    }
    /* Mini progress bar inside stat */
    .ml-bar-track {
      height: 4px;
      background: rgba(255, 255, 255, 0.07);
      border-radius: 99px;
      margin-top: 4px;
      overflow: hidden;
    }
    .ml-bar-fill {
      height: 100%;
      border-radius: 99px;
      background: linear-gradient(90deg, #7c3aed, #06b6d4);
      transition: width 0.6s ease;
    }
    /* ── Win rate per difficulty ── */
    .ml-winrates {
      margin-bottom: 10px;
    }
    .ml-winrate-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 5px;
      font-size: 10px;
    }
    .ml-winrate-label {
      width: 42px;
      font-weight: 700;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      flex-shrink: 0;
    }
    .ml-winrate-track {
      flex: 1;
      height: 5px;
      background: rgba(255, 255, 255, 0.07);
      border-radius: 99px;
      overflow: hidden;
    }
    .ml-winrate-fill {
      height: 100%;
      border-radius: 99px;
      transition: width 0.6s ease;
    }
    .ml-winrate-pct {
      width: 28px;
      text-align: right;
      font-weight: 700;
      color: var(--text-secondary);
    }
    /* AI Suggestion chip */
    .ml-suggestion {
      background: rgba(124, 58, 237, 0.12);
      border: 1px solid rgba(124, 58, 237, 0.3);
      border-radius: 10px;
      padding: 8px 12px;
      font-size: 12px;
      color: #c4b5fd;
      line-height: 1.6;
      margin-bottom: 8px;
    }
    .ml-suggestion strong {
      color: #a78bfa;
      font-weight: 800;
    }
    /* Neural net training bar */
    .ml-train-row {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 10px;
      color: var(--text-muted);
      margin-bottom: 8px;
    }
    .ml-train-bar {
      flex: 1;
      height: 3px;
      background: rgba(255, 255, 255, 0.07);
      border-radius: 99px;
      overflow: hidden;
    }
    .ml-train-fill {
      height: 100%;
      background: linear-gradient(90deg, #10b981, #06b6d4);
      border-radius: 99px;
      transition: width 0.5s ease;
    }

    /* In-game ML badge */
    .ml-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 9px;
      background: rgba(124, 58, 237, 0.2);
      border: 1px solid rgba(124, 58, 237, 0.45);
      border-radius: 99px;
      font-size: 10px;
      font-weight: 800;
      color: #c4b5fd;
      letter-spacing: 0.4px;
      position: relative;
    }
    .ml-badge .ml-dot-sm {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: #a78bfa;
      box-shadow: 0 0 4px #a78bfa;
      animation: mlPulse 1.8s ease-in-out infinite;
    }
    /* ===========================
       PROFILE DROPDOWN
    =========================== */
    .profile-dropdown-overlay {
      position: fixed;
      inset: 0;
      z-index: 500;
      background: transparent;
      display: none;
    }
    .profile-dropdown-overlay.open {
      display: block;
    }
    .profile-dropdown {
      position: absolute;
      top: calc(100% + 10px);
      left: 0;
      min-width: 220px;
      background: linear-gradient(160deg, rgba(26, 21, 71, 0.98), rgba(18, 16, 58, 0.98));
      border: 1px solid rgba(124, 58, 237, 0.35);
      border-radius: 18px;
      padding: 8px;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 30px rgba(124, 58, 237, 0.15);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      opacity: 0;
      transform: translateY(-8px) scale(0.97);
      transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
      pointer-events: none;
      z-index: 501;
    }
    .profile-dropdown.open {
      opacity: 1;
      transform: translateY(0) scale(1);
      pointer-events: all;
    }
    .dropdown-user-header {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.07);
      margin-bottom: 6px;
    }
    .dropdown-avatar {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      object-fit: cover;
      flex-shrink: 0;
      border: 2px solid rgba(124, 58, 237, 0.5);
      box-shadow: 0 0 10px rgba(124, 58, 237, 0.35);
    }
    .dropdown-avatar-placeholder {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      background: linear-gradient(135deg, #7c3aed, #06b6d4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: 800;
      color: #fff;
      flex-shrink: 0;
      border: 2px solid rgba(124, 58, 237, 0.5);
      box-shadow: 0 0 10px rgba(124, 58, 237, 0.35);
    }
    .dropdown-user-info {
      flex: 1;
      overflow: hidden;
    }
    .dropdown-user-name {
      font-size: 14px;
      font-weight: 800;
      color: var(--text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .dropdown-user-type {
      font-size: 10px;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-top: 1px;
    }
    .dropdown-item {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 10px 12px;
      border: none;
      border-radius: 12px;
      background: transparent;
      color: var(--text-secondary);
      font-family: 'Outfit', sans-serif;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s ease;
      text-align: left;
    }
    .dropdown-item:hover {
      background: rgba(255, 255, 255, 0.07);
      color: var(--text-primary);
    }
    .dropdown-item:active {
      transform: scale(0.97);
    }
    .dropdown-item .di-icon {
      font-size: 16px;
      width: 22px;
      text-align: center;
      flex-shrink: 0;
    }
    .dropdown-item.logout-item {
      color: #f87171;
      margin-top: 4px;
      border-top: 1px solid rgba(239, 68, 68, 0.15);
      border-radius: 0 0 12px 12px;
    }
    .dropdown-item.logout-item:hover {
      background: rgba(239, 68, 68, 0.1);
      color: #fca5a5;
    }
    .dropdown-item.disabled-item {
      opacity: 0.45;
      cursor: default;
      pointer-events: none;
    }
    /* Player chip — add relative positioning for dropdown anchor */
    .player-chip {
      position: relative;
    }
    .chip-caret {
      font-size: 10px;
      color: var(--text-muted);
      transition: transform 0.2s ease;
    }
    .player-chip.dropdown-open .chip-caret {
      transform: rotate(180deg);
    }
    /* Logout success toast */
    .logout-toast {
      position: fixed;
      bottom: 32px;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      z-index: 600;
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(6, 182, 212, 0.95));
      color: #fff;
      font-family: 'Outfit', sans-serif;
      font-size: 14px;
      font-weight: 700;
      padding: 13px 28px;
      border-radius: 99px;
      box-shadow: 0 6px 28px rgba(16, 185, 129, 0.45);
      opacity: 0;
      transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
      white-space: nowrap;
      pointer-events: none;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .logout-toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    /* Logout confirm modal inside the existing modal-backdrop system */
    #logout-confirm-modal .logout-confirm-icon {
      font-size: 54px;
      display: block;
      margin-bottom: 10px;
    }
    #logout-confirm-modal .modal-title {
      font-size: 22px;
    }
    .btn-danger {
      flex: 1;
      padding: 14px;
      font-size: 15px;
      font-weight: 800;
      font-family: 'Outfit', sans-serif;
      border: none;
      border-radius: 16px;
      cursor: pointer;
      background: linear-gradient(135deg, #b91c1c, #ef4444);
      color: white;
      box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
      transition: all 0.2s ease;
    }
    .btn-danger:active {
      transform: scale(0.97);
    }
    /* ===========================
       PROFILE MODAL
    =========================== */
    .profile-modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 700;
      background: rgba(0, 0, 0, 0.82);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding: 0;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }
    .profile-modal-backdrop.open {
      opacity: 1;
      pointer-events: all;
    }
    @media (min-width: 600px) {
      .profile-modal-backdrop {
        align-items: center;
        padding: 24px;
      }
    }
    .profile-modal {
      width: 100%;
      max-width: 480px;
      max-height: 92vh;
      overflow-y: auto;
      background: linear-gradient(160deg, #1a1547 0%, #12103a 100%);
      border: 1px solid rgba(124, 58, 237, 0.3);
      border-radius: 28px 28px 0 0;
      padding: 0 0 32px;
      box-shadow: 0 -8px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 60px rgba(124, 58, 237, 0.12);
      transform: translateY(40px);
      transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
      -webkit-overflow-scrolling: touch;
    }
    @media (min-width: 600px) {
      .profile-modal {
        border-radius: 28px;
        transform: scale(0.93) translateY(20px);
        max-height: 88vh;
      }
    }
    .profile-modal-backdrop.open .profile-modal {
      transform: translateY(0);
    }
    @media (min-width: 600px) {
      .profile-modal-backdrop.open .profile-modal {
        transform: scale(1) translateY(0);
      }
    }
    /* Modal drag handle (mobile) */
    .pm-handle {
      width: 40px;
      height: 4px;
      background: rgba(255, 255, 255, 0.15);
      border-radius: 99px;
      margin: 12px auto 0;
    }
    /* Modal header */
    .pm-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .pm-header-title {
      font-size: 16px;
      font-weight: 900;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .pm-close-btn {
      width: 32px;
      height: 32px;
      border: 1.5px solid rgba(255, 255, 255, 0.12);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-muted);
      cursor: pointer;
      font-size: 15px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.18s;
      font-family: 'Outfit', sans-serif;
    }
    .pm-close-btn:hover {
      background: rgba(255, 255, 255, 0.1);
      color: var(--text-primary);
    }
    /* Hero section */
    .pm-hero {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 28px 20px 20px;
      gap: 12px;
      position: relative;
    }
    .pm-avatar-wrap {
      position: relative;
      width: 90px;
      height: 90px;
    }
    .pm-avatar-img {
      width: 90px;
      height: 90px;
      border-radius: 50%;
      object-fit: cover;
      border: 3px solid rgba(124, 58, 237, 0.6);
      box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15), 0 0 30px rgba(124, 58, 237, 0.35);
    }
    .pm-avatar-placeholder {
      width: 90px;
      height: 90px;
      border-radius: 50%;
      background: linear-gradient(135deg, #7c3aed, #06b6d4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 36px;
      font-weight: 900;
      color: #fff;
      border: 3px solid rgba(124, 58, 237, 0.6);
      box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15), 0 0 30px rgba(124, 58, 237, 0.35);
    }
    .pm-edit-avatar-btn {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: linear-gradient(135deg, #7c3aed, #06b6d4);
      border: 2px solid #12103a;
      color: #fff;
      font-size: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.18s;
    }
    .pm-edit-avatar-btn:hover {
      transform: scale(1.1);
    }
    /* ── Avatar Picker ─────────────────────────────────────── */
    .pm-avatar-picker-section {
      margin-bottom: 14px;
    }
    .pm-avatar-picker-section label {
      display: block;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 1px;
      text-transform: uppercase;
      color: var(--text-secondary);
      margin-bottom: 10px;
    }
    .pm-avatar-grid {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 8px;
    }
    .pm-avatar-option {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      cursor: pointer;
      border: 2.5px solid transparent;
      transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    }
    .pm-avatar-option:hover { transform: scale(1.12); }
    .pm-avatar-option.selected {
      border-color: #7c3aed;
      box-shadow: 0 0 0 3px rgba(124,58,237,0.35);
      transform: scale(1.08);
    }
    .pm-upload-btn {
      width: 100%;
      padding: 11px;
      background: rgba(255,255,255,0.05);
      border: 1.5px dashed rgba(255,255,255,0.2);
      border-radius: 12px;
      color: var(--text-secondary);
      font-family: 'Outfit', sans-serif;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.18s;
      margin-top: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    .pm-upload-btn:hover {
      background: rgba(124,58,237,0.15);
      border-color: rgba(124,58,237,0.5);
      color: #a78bfa;
    }
    #pm-avatar-upload-input { display: none; }
    .pm-display-name {
      font-size: 22px;
      font-weight: 900;
      color: var(--text-primary);
      text-align: center;
      letter-spacing: -0.3px;
    }
    .pm-username {
      font-size: 13px;
      color: var(--text-muted);
      margin-top: -8px;
    }
    /* Account type badge */
    .pm-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 5px 14px;
      border-radius: 99px;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }
    .pm-badge.google {
      background: rgba(66, 133, 244, 0.15);
      border: 1px solid rgba(66, 133, 244, 0.4);
      color: #93c5fd;
    }
    .pm-badge.local {
      background: rgba(124, 58, 237, 0.15);
      border: 1px solid rgba(124, 58, 237, 0.4);
      color: #c4b5fd;
    }
    .pm-email {
      font-size: 12px;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 5px;
    }
    /* Divider */
    .pm-divider {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 0 20px;
      margin: 4px 0 14px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      color: var(--text-muted);
    }
    .pm-divider::before,
    .pm-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: rgba(255, 255, 255, 0.07);
    }
    /* Stats grid */
    .pm-stats {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      padding: 0 20px;
      margin-bottom: 4px;
    }
    @media (min-width: 420px) {
      .pm-stats {
        grid-template-columns: repeat(3, 1fr);
      }
    }
    .pm-stat-card {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: 14px;
      padding: 12px 10px;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      transition: all 0.18s;
    }
    .pm-stat-card:hover {
      background: rgba(255, 255, 255, 0.07);
      border-color: rgba(124, 58, 237, 0.3);
    }
    .pm-stat-icon {
      font-size: 20px;
    }
    .pm-stat-val {
      font-size: 20px;
      font-weight: 900;
      color: var(--text-primary);
      line-height: 1;
    }
    .pm-stat-label {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 1px;
      text-transform: uppercase;
      color: var(--text-muted);
    }
    /* Achievements row */
    .pm-achievements {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      padding: 0 20px;
      margin-bottom: 4px;
    }
    .pm-achievement {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      background: rgba(245, 158, 11, 0.1);
      border: 1px solid rgba(245, 158, 11, 0.25);
      border-radius: 99px;
      font-size: 11px;
      font-weight: 700;
      color: #fcd34d;
    }
    .pm-achievement.locked {
      background: rgba(255, 255, 255, 0.03);
      border-color: rgba(255, 255, 255, 0.06);
      color: var(--text-muted);
      opacity: 0.5;
    }
    /* Favorite theme */
    .pm-pref-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 11px 16px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: 12px;
      margin: 0 20px 8px;
    }
    .pm-pref-label {
      font-size: 12px;
      color: var(--text-muted);
      font-weight: 700;
      letter-spacing: 0.5px;
    }
    .pm-pref-val {
      font-size: 13px;
      color: var(--text-primary);
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 5px;
    }
    /* Edit panel */
    .pm-edit-panel {
      padding: 0 20px;
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .pm-edit-panel.open {
      max-height: 600px;
    }
    .pm-edit-label {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 1px;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 6px;
      display: block;
    }
    .pm-edit-input {
      width: 100%;
      padding: 11px 14px;
      background: rgba(255, 255, 255, 0.06);
      border: 1.5px solid rgba(255, 255, 255, 0.1);
      border-radius: 10px;
      color: var(--text-primary);
      font-family: 'Outfit', sans-serif;
      font-size: 14px;
      outline: none;
      transition: border-color 0.2s;
      margin-bottom: 14px;
    }
    .pm-edit-input:focus {
      border-color: var(--accent-1);
      background: rgba(124, 58, 237, 0.07);
    }
    .pm-theme-pick {
      display: flex;
      gap: 8px;
      margin-bottom: 14px;
    }
    .pm-theme-option {
      flex: 1;
      padding: 10px 6px;
      border: 2px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.04);
      cursor: pointer;
      font-family: 'Outfit', sans-serif;
      color: var(--text-secondary);
      font-size: 11px;
      font-weight: 700;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      transition: all 0.18s;
    }
    .pm-theme-option:hover {
      background: rgba(255, 255, 255, 0.08);
    }
    .pm-theme-option.active {
      border-color: var(--accent-1);
      background: rgba(124, 58, 237, 0.18);
      color: #a78bfa;
    }
    .pm-theme-option .pto-emoji {
      font-size: 22px;
    }
    /* Action buttons */
    .pm-actions {
      display: flex;
      gap: 10px;
      padding: 16px 20px 0;
    }
    .pm-btn-edit {
      flex: 1;
      padding: 13px;
      font-size: 14px;
      font-weight: 800;
      font-family: 'Outfit', sans-serif;
      border: 1.5px solid rgba(124, 58, 237, 0.5);
      border-radius: 14px;
      background: rgba(124, 58, 237, 0.12);
      color: #a78bfa;
      cursor: pointer;
      transition: all 0.18s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
    }
    .pm-btn-edit:hover {
      background: rgba(124, 58, 237, 0.22);
    }
    .pm-btn-save {
      flex: 1;
      padding: 13px;
      font-size: 14px;
      font-weight: 800;
      font-family: 'Outfit', sans-serif;
      border: none;
      border-radius: 14px;
      background: linear-gradient(135deg, #7c3aed, #06b6d4);
      color: #fff;
      cursor: pointer;
      transition: all 0.18s;
      box-shadow: 0 4px 18px rgba(124, 58, 237, 0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
    }
    .pm-btn-save:active {
      transform: scale(0.97);
    }
    .pm-joined {
      text-align: center;
      font-size: 11px;
      color: var(--text-muted);
      padding: 14px 20px 0;
    }
    /* ===========================
       REDESIGNED HOME SCREEN
    =========================== */
    /* ── Home Top Bar ── */
    .home-top-bar {
      width: 100%;
      max-width: 520px;
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 0 0 6px;
      margin-bottom: 4px;
    }
    .home-top-bar .player-chip {
      flex: 1;
      margin-bottom: 0;
    }
    .home-coins-chip {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.15));
      border: 1px solid rgba(245, 158, 11, 0.5);
      border-radius: 99px;
      font-size: 15px;
      font-weight: 900;
      color: #fcd34d;
      flex-shrink: 0;
      box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25), inset 0 0 10px rgba(245, 158, 11, 0.2);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .home-coins-chip:hover {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.2));
      box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4), inset 0 0 15px rgba(245, 158, 11, 0.3);
      transform: translateY(-2px);
    }
    .home-coins-icon {
      font-size: 18px;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    }
    .home-trophies-chip {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 14px;
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.15));
      border: 1px solid rgba(139, 92, 246, 0.5);
      border-radius: 99px;
      font-size: 15px;
      font-weight: 900;
      color: #ddd6fe;
      flex-shrink: 0;
      box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25), inset 0 0 10px rgba(139, 92, 246, 0.2);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .home-trophies-chip:hover {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(124, 58, 237, 0.2));
      box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4), inset 0 0 15px rgba(139, 92, 246, 0.3);
      transform: translateY(-2px);
    }
    .home-settings-btn {
      width: 44px;
      height: 44px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.15);
      font-size: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-secondary);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      cursor: pointer;
      backdrop-filter: blur(10px);
      flex-shrink: 0;
    }
    .home-settings-btn:hover {
      background: rgba(255, 255, 255, 0.15);
      border-color: rgba(6, 182, 212, 0.5);
      color: #06b6d4;
      transform: translateY(-2px) rotate(45deg);
      box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
    }
    .home-settings-btn:active {
      transform: scale(0.9);
    }
    /* ── Home Hero (compact) ── */
    .home-hero {
      text-align: center;
      margin-bottom: 14px;
      position: relative;
    }
    .home-hero .home-logo {
      margin-bottom: 4px;
    }
    .home-hero .home-title {
      margin-bottom: 2px;
    }
    .home-hero .home-subtitle {
      margin-bottom: 0;
    }
    /* ── Event Banner ── */
    .home-event-banner {
      width: 100%;
      max-width: 520px;
      padding: 16px 20px;
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(6, 182, 212, 0.2));
      border: 2px solid rgba(124, 58, 237, 0.5);
      border-radius: 20px;
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 20px;
      cursor: pointer;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      position: relative;
      overflow: hidden;
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(124, 58, 237, 0.15);
    }
    .home-event-banner::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: radial-gradient(circle at 30% 50%, rgba(124, 58, 237, 0.2) 0%, transparent 40%);
      animation: eventGlow 4s ease-in-out infinite alternate;
    }
    @keyframes eventGlow {
      0% {
        transform: translate(0, 0) scale(1);
      }
      100% {
        transform: translate(10%, 5%) scale(1.2);
      }
    }
    .home-event-banner:hover {
      border-color: rgba(124, 58, 237, 0.8);
      transform: translateY(-3px) scale(1.01);
      box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4), inset 0 0 30px rgba(6, 182, 212, 0.2);
    }
    .event-icon {
      font-size: 32px;
      flex-shrink: 0;
      position: relative;
      z-index: 1;
      animation: eventBounce 2s cubic-bezier(0.28, 0.84, 0.42, 1) infinite;
      filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    }
    @keyframes eventBounce {
      0%,
      100% {
        transform: translateY(0) scale(1);
      }
      50% {
        transform: translateY(-3px) scale(1.08);
      }
    }
    .event-info {
      flex: 1;
      position: relative;
      z-index: 1;
    }
    .event-title {
      font-size: 13px;
      font-weight: 800;
      color: var(--text-primary);
      letter-spacing: 0.3px;
      margin-bottom: 2px;
    }
    .event-desc {
      font-size: 11px;
      color: var(--text-muted);
    }
    .event-badge {
      padding: 4px 10px;
      border-radius: 99px;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      background: linear-gradient(135deg, #7c3aed, #06b6d4);
      color: #fff;
      flex-shrink: 0;
      position: relative;
      z-index: 1;
    }
    /* ── Reward Chest ── */
    .reward-chest-section {
      width: 100%;
      max-width: 520px;
      margin-bottom: 16px;
      z-index: 2;
    }
    .reward-chest-card {
      position: relative;
      display: flex;
      align-items: center;
      gap: 16px;
      padding: 16px 20px;
      border-radius: 20px;
      background: linear-gradient(135deg, rgba(20,12,60,0.95), rgba(10,8,40,0.98));
      border: 2px solid rgba(251,191,36,0.6);
      cursor: pointer;
      transition: all 0.3s ease;
      overflow: hidden;
      user-select: none;
    }
    .reward-chest-card.active {
      border-color: rgba(251,191,36,0.9);
      box-shadow: 0 0 28px rgba(251,191,36,0.35), 0 0 60px rgba(251,191,36,0.1), inset 0 0 20px rgba(251,191,36,0.07);
      animation: chestPulse 2.2s ease-in-out infinite;
    }
    .reward-chest-card.inactive {
      border-color: rgba(100,100,120,0.35);
      opacity: 0.6;
      cursor: default;
      pointer-events: none;
    }
    .reward-chest-card.claimed {
      border-color: rgba(16,185,129,0.5);
      background: linear-gradient(135deg, rgba(10,30,20,0.95), rgba(5,20,15,0.98));
      opacity: 0.75;
      cursor: default;
      pointer-events: none;
    }
    @keyframes chestPulse {
      0%, 100% { box-shadow: 0 0 28px rgba(251,191,36,0.35), 0 0 60px rgba(251,191,36,0.1); transform: scale(1); }
      50%       { box-shadow: 0 0 44px rgba(251,191,36,0.55), 0 0 90px rgba(251,191,36,0.2); transform: scale(1.008); }
    }
    .reward-chest-card::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(251,191,36,0.06), transparent 60%);
      pointer-events: none;
    }
    .reward-chest-icon {
      font-size: 52px;
      flex-shrink: 0;
      filter: drop-shadow(0 4px 12px rgba(251,191,36,0.5));
      transition: transform 0.3s ease;
      position: relative;
      z-index: 1;
    }
    .reward-chest-card.active:hover .reward-chest-icon {
      transform: scale(1.15) rotate(-5deg);
    }
    .reward-chest-card.active .reward-chest-icon {
      animation: chestBob 1.8s ease-in-out infinite;
    }
    @keyframes chestBob {
      0%, 100% { transform: translateY(0) scale(1); }
      45%      { transform: translateY(-6px) scale(1.08) rotate(-4deg); }
      65%      { transform: translateY(-4px) scale(1.05) rotate(3deg); }
    }
    .reward-chest-body {
      flex: 1;
      position: relative;
      z-index: 1;
    }
    .reward-chest-label {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      color: rgba(251,191,36,0.7);
      margin-bottom: 3px;
    }
    .reward-chest-title {
      font-size: 15px;
      font-weight: 900;
      color: #fff;
      margin-bottom: 3px;
      line-height: 1.2;
    }
    .reward-chest-desc {
      font-size: 11px;
      color: rgba(255,255,255,0.5);
      line-height: 1.4;
    }
    .reward-chest-badge {
      flex-shrink: 0;
      background: linear-gradient(135deg, #f59e0b, #fbbf24);
      color: #1a0a00;
      font-size: 11px;
      font-weight: 900;
      padding: 6px 12px;
      border-radius: 99px;
      letter-spacing: 0.3px;
      position: relative;
      z-index: 1;
      box-shadow: 0 4px 12px rgba(251,191,36,0.4);
    }
    .reward-chest-badge.claimed-badge {
      background: linear-gradient(135deg, #10b981, #34d399);
      color: #fff;
      box-shadow: 0 4px 12px rgba(16,185,129,0.4);
    }
    /* Sparkle dots on active chest */
    .reward-chest-card.active::after {
      content: '✨';
      position: absolute;
      top: 8px;
      right: 60px;
      font-size: 16px;
      animation: sparkleFloat 3s ease-in-out infinite 0.5s;
      opacity: 0.8;
    }
    @keyframes sparkleFloat {
      0%, 100% { transform: translateY(0) scale(1); opacity: 0.8; }
      50%       { transform: translateY(-8px) scale(1.2); opacity: 1; }
    }
    /* Claim Popup Overlay */
    #reward-claim-popup {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 99999;
      background: rgba(0,0,0,0.75);
      backdrop-filter: blur(10px);
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    #reward-claim-popup.show { display: flex; }
    .reward-popup-box {
      background: linear-gradient(145deg, #0f0c29, #1a1040, #0a081e);
      border: 2px solid rgba(251,191,36,0.6);
      border-radius: 28px;
      padding: 40px 32px;
      text-align: center;
      max-width: 360px;
      width: 90%;
      box-shadow: 0 0 60px rgba(251,191,36,0.3), 0 30px 80px rgba(0,0,0,0.6);
      animation: popIn 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
      position: relative;
      overflow: hidden;
    }
    @keyframes popIn {
      0%   { transform: scale(0.5) translateY(40px); opacity: 0; }
      100% { transform: scale(1) translateY(0); opacity: 1; }
    }
    .reward-popup-box::before {
      content: '';
      position: absolute;
      top: -40px; left: 50%;
      transform: translateX(-50%);
      width: 200px; height: 200px;
      background: radial-gradient(circle, rgba(251,191,36,0.18), transparent 70%);
      pointer-events: none;
    }
    .reward-popup-emoji {
      font-size: 80px;
      display: block;
      animation: trophyBounce 0.6s cubic-bezier(0.28,0.84,0.42,1) 0.1s both;
      filter: drop-shadow(0 8px 24px rgba(251,191,36,0.7));
    }
    @keyframes trophyBounce {
      0%   { transform: scale(0) rotate(-15deg); }
      60%  { transform: scale(1.25) rotate(5deg); }
      100% { transform: scale(1) rotate(0deg); }
    }
    .reward-popup-title {
      font-size: 26px;
      font-weight: 900;
      background: linear-gradient(135deg, #fbbf24, #f59e0b, #fcd34d);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      margin: 16px 0 8px;
    }
    .reward-popup-amount {
      font-size: 48px;
      font-weight: 900;
      color: #fbbf24;
      line-height: 1;
      margin: 8px 0;
      text-shadow: 0 0 30px rgba(251,191,36,0.8);
      animation: amountPop 0.5s cubic-bezier(0.28,0.84,0.42,1) 0.3s both;
    }
    @keyframes amountPop {
      0% { transform: scale(0); opacity: 0; }
      100% { transform: scale(1); opacity: 1; }
    }
    .reward-popup-subtitle {
      font-size: 13px;
      color: rgba(255,255,255,0.6);
      margin-bottom: 28px;
      line-height: 1.5;
    }
    .reward-popup-confetti {
      position: absolute;
      inset: 0;
      pointer-events: none;
      overflow: hidden;
    }
    .confetti-piece {
      position: absolute;
      width: 8px;
      height: 8px;
      border-radius: 2px;
      animation: confettiFall linear forwards;
    }
    @keyframes confettiFall {
      0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
      100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
    }
    .reward-popup-btn {
      width: 100%;
      padding: 16px;
      background: linear-gradient(135deg, #f59e0b, #fbbf24);
      color: #1a0a00;
      font-size: 15px;
      font-weight: 900;
      border: none;
      border-radius: 14px;
      cursor: pointer;
      letter-spacing: 0.5px;
      transition: transform 0.2s, box-shadow 0.2s;
      box-shadow: 0 6px 20px rgba(251,191,36,0.4);
    }
    .reward-popup-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(251,191,36,0.5); }
    /* ── Chest Opening Animation ── */
    .reward-chest-card.opening {
      animation: chestOpeningShake 0.6s cubic-bezier(.36,.07,.19,.97) both infinite;
      border-color: #fff;
      box-shadow: 0 0 50px rgba(255,255,255,0.4), 0 0 100px rgba(251,191,36,0.3);
      transform: scale(1.05);
      z-index: 100;
    }
    @keyframes chestOpeningShake {
      10%, 90% { transform: translate3d(-1px, 0, 0) scale(1.05); }
      20%, 80% { transform: translate3d(2px, 0, 0) scale(1.05); }
      30%, 50%, 70% { transform: translate3d(-4px, 0, 0) scale(1.05); }
      40%, 60% { transform: translate3d(4px, 0, 0) scale(1.05); }
    }
    .chest-particle {
      position: absolute;
      pointer-events: none;
      font-size: 24px;
      z-index: 1000;
      animation: particleFly 1.2s ease-out forwards;
      filter: drop-shadow(0 4px 8px rgba(251,191,36,0.6));
    }
    @keyframes particleFly {
      0%   { transform: translate(0, 0) scale(0) rotate(0); opacity: 0; }
      20%  { transform: translate(0, 0) scale(1.5) rotate(0); opacity: 1; }
      100% { transform: translate(var(--tx), var(--ty)) scale(1) rotate(var(--tr)); opacity: 0; }
    }
    @keyframes screenShake {
      10%, 90% { transform: translate3d(-1px, 0, 0); }
      20%, 80% { transform: translate3d(2px, 0, 0); }
      30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
      40%, 60% { transform: translate3d(3px, 0, 0); }
    }
    /* ── Quick Stats Row ── */



    .home-quick-stats {
      width: 100%;
      max-width: 520px;
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-bottom: 20px;
      z-index: 2;
    }
    .qs-card {
      background: rgba(20, 16, 58, 0.6);
      border: 1px solid rgba(124, 58, 237, 0.3);
      border-radius: 16px;
      padding: 14px 6px;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 0 15px rgba(124, 58, 237, 0.1);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      position: relative;
      overflow: hidden;
    }
    .qs-card::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: radial-gradient(circle, rgba(124, 58, 237, 0.1) 0%, transparent 60%);
      opacity: 0;
      transition: opacity 0.3s ease;
    }
    .qs-card:hover::before {
      opacity: 1;
    }
    .qs-card:hover {
      background: rgba(30, 27, 75, 0.8);
      border-color: rgba(6, 182, 212, 0.6);
      transform: translateY(-4px) scale(1.02);
      box-shadow: 0 8px 25px rgba(6, 182, 212, 0.3), inset 0 0 20px rgba(124, 58, 237, 0.2);
    }
    .qs-icon {
      font-size: 20px;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    }
    .qs-value {
      font-size: 20px;
      font-weight: 900;
      color: var(--text-primary);
      line-height: 1;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }
    .qs-value.purple {
      color: #a78bfa;
    }
    .qs-value.cyan {
      color: #67e8f9;
    }
    .qs-value.green {
      color: #34d399;
    }
    .qs-value.gold {
      color: #fcd34d;
    }
    .qs-label {
      font-size: 8px;
      font-weight: 700;
      letter-spacing: 1px;
      text-transform: uppercase;
      color: var(--text-muted);
    }
    /* ── Daily Challenge Card ── */
    .home-daily-challenge {
      width: 100%;
      max-width: 520px;
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.1));
      border: 2px solid rgba(16, 185, 129, 0.4);
      border-radius: 20px;
      padding: 18px 20px;
      margin-bottom: 20px;
      display: flex;
      align-items: center;
      gap: 16px;
      cursor: pointer;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(16, 185, 129, 0.1);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      position: relative;
      overflow: hidden;
      z-index: 2;
    }
    .home-daily-challenge::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
      transform: rotate(45deg) translateY(-100%);
      transition: transform 0.6s ease;
    }
    .home-daily-challenge:hover::before {
      transform: rotate(45deg) translateY(100%);
    }
    .home-daily-challenge:hover {
      border-color: rgba(16, 185, 129, 0.8);
      transform: translateY(-3px) scale(1.01);
      box-shadow: 0 8px 30px rgba(16, 185, 129, 0.3), inset 0 0 30px rgba(16, 185, 129, 0.2);
    }
    .dc-icon-wrap {
      width: 56px;
      height: 56px;
      border-radius: 16px;
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.4), rgba(6, 182, 212, 0.3));
      border: 1px solid rgba(16, 185, 129, 0.6);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 28px;
      flex-shrink: 0;
      box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
      animation: pulseDcIcon 2s infinite alternate;
    }
    @keyframes pulseDcIcon {
      from {
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
      }
      to {
        box-shadow: 0 0 25px rgba(16, 185, 129, 0.8);
      }
    }
    .dc-info {
      flex: 1;
    }
    .dc-label {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 1.2px;
      text-transform: uppercase;
      color: #34d399;
      margin-bottom: 3px;
    }
    .dc-title {
      font-size: 14px;
      font-weight: 800;
      color: var(--text-primary);
      line-height: 1.3;
      margin-bottom: 2px;
    }
    .dc-desc {
      font-size: 11px;
      color: var(--text-muted);
    }
    .dc-reward {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      flex-shrink: 0;
    }
    .dc-reward-icon {
      font-size: 22px;
    }
    .dc-reward-text {
      font-size: 10px;
      font-weight: 800;
      color: #fcd34d;
      letter-spacing: 0.5px;
    }
    /* ── Achievements Strip ── */
    .home-achievements {
      width: 100%;
      max-width: 520px;
      margin-bottom: 14px;
    }
    .achievements-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }
    .achievements-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: var(--text-muted);
    }
    .achievements-count {
      font-size: 11px;
      font-weight: 700;
      color: var(--text-muted);
    }
    .achievements-scroll {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding-bottom: 6px;
      scroll-snap-type: x mandatory;
      -webkit-overflow-scrolling: touch;
    }
    .achievements-scroll::-webkit-scrollbar {
      height: 0;
    }
    .achv-badge {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      padding: 12px 14px;
      background: linear-gradient(180deg, rgba(30, 27, 75, 0.8), rgba(15, 12, 41, 0.8));
      border: 1px solid rgba(124, 58, 237, 0.3);
      border-radius: 16px;
      min-width: 86px;
      flex-shrink: 0;
      scroll-snap-align: start;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 2px 5px rgba(255, 255, 255, 0.05);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      cursor: default;
      position: relative;
      overflow: hidden;
    }
    .achv-badge:hover {
      transform: translateY(-4px) scale(1.05);
      background: linear-gradient(180deg, rgba(6, 182, 212, 0.2), rgba(30, 27, 75, 0.9));
      border-color: #06b6d4;
      box-shadow: 0 6px 15px rgba(6, 182, 212, 0.3), inset 0 0 10px rgba(6, 182, 212, 0.2);
    }
    .achv-badge.earned {
      background: linear-gradient(180deg, rgba(245, 158, 11, 0.2), rgba(30, 27, 75, 0.9));
      border-color: #fcd34d;
      box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3), inset 0 0 15px rgba(245, 158, 11, 0.2);
    }
    .achv-badge.earned::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: radial-gradient(circle, rgba(252, 211, 77, 0.2) 0%, transparent 60%);
      animation: rotateGlow 6s linear infinite;
    }
    @keyframes rotateGlow {
      from {
        transform: rotate(0deg);
      }
      to {
        transform: rotate(360deg);
      }
    }
    .achv-badge.earned:hover {
      background: linear-gradient(180deg, rgba(245, 158, 11, 0.3), rgba(30, 27, 75, 0.9));
      border-color: #f59e0b;
      box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5), inset 0 0 20px rgba(245, 158, 11, 0.4);
    }
    .achv-badge.locked {
      opacity: 0.5;
      filter: grayscale(100%);
    }
    .achv-icon {
      font-size: 22px;
    }
    .achv-name {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      color: var(--text-muted);
      text-align: center;
      white-space: nowrap;
    }
    .achv-badge.earned .achv-name {
      color: #fcd34d;
    }
    /* ── Enhanced Theme Cards ── */
    .theme-btn-new {
      border: 2px solid rgba(255, 255, 255, 0.1);
      border-radius: 16px;
      padding: 14px 10px;
      background: rgba(255, 255, 255, 0.04);
      cursor: pointer;
      transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      color: var(--text-secondary);
      position: relative;
      overflow: hidden;
    }
    .theme-btn-new::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at 50% 120%, rgba(124, 58, 237, 0.15) 0%, transparent 60%);
      opacity: 0;
      transition: opacity 0.3s;
    }
    .theme-btn-new:hover::before {
      opacity: 1;
    }
    .theme-btn-new:active {
      transform: scale(0.94);
    }
    .theme-btn-new .t-emoji {
      font-size: 32px;
      filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
      transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .theme-btn-new:hover .t-emoji {
      transform: scale(1.15) translateY(-2px);
    }
    .theme-btn-new .t-name {
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.3px;
    }
    .theme-btn-new .t-cards {
      font-size: 9px;
      color: var(--text-muted);
      font-weight: 600;
    }
    .theme-btn-new.active {
      border-color: var(--accent-1);
      background: rgba(124, 58, 237, 0.18);
      color: #a78bfa;
      box-shadow: 0 0 24px rgba(124, 58, 237, 0.35), inset 0 0 30px rgba(124, 58, 237, 0.08);
    }
    .theme-btn-new.active .t-emoji {
      transform: scale(1.1);
    }
    .theme-check {
      position: absolute;
      top: 6px;
      right: 6px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: linear-gradient(135deg, #7c3aed, #06b6d4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      color: #fff;
      opacity: 0;
      transform: scale(0);
      transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .theme-btn-new.active .theme-check {
      opacity: 1;
      transform: scale(1);
    }
    /* ── Enhanced Stage Cards ── */
    .stage-btn-new {
      border: 2px solid rgba(255, 255, 255, 0.1);
      border-radius: 16px;
      padding: 14px;
      background: rgba(255, 255, 255, 0.04);
      cursor: pointer;
      transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
      color: var(--text-secondary);
      position: relative;
      overflow: hidden;
    }
    .stage-btn-new:active {
      transform: scale(0.94);
    }
    .stage-btn-new .s-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
    }
    .stage-btn-new .s-badge {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 1px;
      text-transform: uppercase;
      padding: 2px 8px;
      border-radius: 99px;
    }
    .stage-btn-new .s-status {
      font-size: 14px;
    }
    .stage-btn-new .s-name {
      font-size: 16px;
      font-weight: 800;
      color: var(--text-primary);
    }
    .stage-btn-new .s-info {
      font-size: 11px;
    }
    .stage-btn-new .s-stars {
      font-size: 10px;
      color: var(--text-muted);
      margin-top: 2px;
    }
    /* Stage active states */
    .stage-btn-new[data-diff="easy"].active {
      border-color: #10b981;
      background: rgba(16, 185, 129, 0.12);
      box-shadow: 0 0 24px rgba(16, 185, 129, 0.3), inset 0 0 30px rgba(16, 185, 129, 0.05);
    }
    .stage-btn-new[data-diff="easy"].active .s-name {
      color: #34d399;
    }
    .stage-btn-new[data-diff="easy"] .s-badge {
      background: rgba(16, 185, 129, 0.2);
      color: #34d399;
    }
    .stage-btn-new[data-diff="medium"].active {
      border-color: var(--accent-2);
      background: rgba(6, 182, 212, 0.12);
      box-shadow: 0 0 24px rgba(6, 182, 212, 0.3), inset 0 0 30px rgba(6, 182, 212, 0.05);
    }
    .stage-btn-new[data-diff="medium"].active .s-name {
      color: #67e8f9;
    }
    .stage-btn-new[data-diff="medium"] .s-badge {
      background: rgba(6, 182, 212, 0.2);
      color: #67e8f9;
    }
    .stage-btn-new[data-diff="hard"].active {
      border-color: var(--accent-4);
      background: rgba(236, 72, 153, 0.12);
      box-shadow: 0 0 24px rgba(236, 72, 153, 0.3), inset 0 0 30px rgba(236, 72, 153, 0.05);
    }
    .stage-btn-new[data-diff="hard"].active .s-name {
      color: #f9a8d4;
    }
    .stage-btn-new[data-diff="hard"] .s-badge {
      background: rgba(236, 72, 153, 0.2);
      color: #f9a8d4;
    }
    .stage-btn-new[data-diff="expert"].active {
      border-color: var(--accent-3);
      background: rgba(245, 158, 11, 0.12);
      box-shadow: 0 0 24px rgba(245, 158, 11, 0.3), inset 0 0 30px rgba(245, 158, 11, 0.05);
    }
    .stage-btn-new[data-diff="expert"].active .s-name {
      color: #fcd34d;
    }
    .stage-btn-new[data-diff="expert"] .s-badge {
      background: rgba(245, 158, 11, 0.2);
      color: #fcd34d;
    }
    .stage-btn-new.locked {
      opacity: 0.4;
      cursor: not-allowed;
    }
    .stage-btn-new.locked .s-name {
      color: var(--text-muted);
    }
    /* ── Floating Card Symbols ── */
    .home-floating-symbols {
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
    }
    .float-symbol {
      position: absolute;
      font-size: 20px;
      opacity: 0.06;
      animation: floatSymbol var(--dur, 18s) linear infinite;
      animation-delay: var(--delay, 0s);
    }
    @keyframes floatSymbol {
      0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
      }
      10% {
        opacity: 0.06;
      }
      90% {
        opacity: 0.06;
      }
      100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
      }
    }
    /* ── Leaderboard Button Enhanced ── */
    .btn-leaderboard {
      display: flex;
      width: 100%;
      max-width: 520px;
      margin-top: 10px;
      padding: 14px;
      font-size: 14px;
      font-weight: 700;
      font-family: 'Outfit', sans-serif;
      letter-spacing: 0.4px;
      border: 1.5px solid rgba(245, 158, 11, 0.5);
      border-radius: 16px;
      cursor: pointer;
      background: rgba(245, 158, 11, 0.1);
      color: #fcd34d;
      transition: all 0.2s ease;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    .btn-leaderboard:hover {
      background: rgba(245, 158, 11, 0.18);
      transform: translateY(-1px);
      box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
    }
    .btn-leaderboard:active {
      transform: scale(0.97);
    }
    /* ── Settings Modal ── */
    .settings-modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 10010;
      background: rgba(0, 0, 0, 0.8);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }
    .settings-modal-backdrop.open {
      opacity: 1;
      pointer-events: all;
    }
    .settings-modal {
      width: 100%;
      max-width: 440px;
      max-height: min(90vh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px));
      background: linear-gradient(160deg, rgba(30, 27, 75, 0.95), rgba(18, 16, 58, 0.98));
      border: 2px solid rgba(124, 58, 237, 0.4);
      border-radius: 24px;
      display: flex;
      flex-direction: column;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), inset 0 0 40px rgba(124, 58, 237, 0.15);
      transform: scale(0.95) translateY(20px);
      transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
      overflow: hidden;
    }
    .settings-modal-backdrop.open .settings-modal {
      transform: scale(1) translateY(0);
    }
    .settings-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px 24px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      background: rgba(0, 0, 0, 0.2);
      position: sticky;
      top: 0;
      z-index: 2;
      flex-shrink: 0;
    }
    .settings-title {
      font-size: 20px;
      font-weight: 900;
      color: var(--text-primary);
      text-transform: uppercase;
      letter-spacing: 1px;
      text-shadow: 0 0 10px rgba(124, 58, 237, 0.6);
      margin: 0;
    }
    .settings-close-btn {
      width: 36px;
      height: 36px;
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-muted);
      cursor: pointer;
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;
      font-family: inherit;
      flex-shrink: 0;
      position: relative;
      z-index: 3;
    }
    .settings-close-btn:hover {
      background: rgba(239, 68, 68, 0.15);
      color: #ef4444;
      border-color: rgba(239, 68, 68, 0.4);
      transform: scale(1.05);
    }
    .settings-body {
      padding: 20px 24px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 20px;
      flex: 1;
      min-height: 0;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      padding-bottom: calc(28px + env(safe-area-inset-bottom));
    }
    .settings-body::-webkit-scrollbar {
      width: 6px;
    }
    .settings-body::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.2);
    }
    .settings-body::-webkit-scrollbar-thumb {
      background: rgba(124, 58, 237, 0.5);
      border-radius: 10px;
    }
    /* Settings Sections */
    .set-section {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.05);
      border-radius: 18px;
      overflow: hidden;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }
    .set-sec-title {
      font-size: 11px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: #a78bfa;
      padding: 14px 16px 6px;
    }
    .set-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      gap: 16px;
      min-height: 64px;
      position: relative;
      z-index: 1;
    }
    .set-row:last-child {
      border-bottom: none;
    }
    .set-row-left {
      display: flex;
      align-items: center;
      gap: 14px;
      min-width: 0;
      flex: 1;
    }
    .set-icon {
      font-size: 20px;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
      width: 24px;
      text-align: center;
    }
    .set-text {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
    }
    .set-label {
      font-size: 14px;
      font-weight: 700;
      color: var(--text-primary);
    }
    .set-desc {
      font-size: 11px;
      color: var(--text-muted);
      line-height: 1.3;
    }
    /* Toggle Switches */
    .set-toggle {
      position: relative;
      display: inline-block;
      width: 48px;
      height: 26px;
      flex-shrink: 0;
      cursor: pointer;
      touch-action: manipulation;
    }
    .set-toggle input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    .set-slider {
      position: absolute;
      cursor: pointer;
      inset: 0;
      background-color: rgba(255, 255, 255, 0.1);
      transition: .3s cubic-bezier(0.34, 1.56, 0.64, 1);
      border-radius: 34px;
      box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    .set-slider:before {
      position: absolute;
      content: "";
      height: 20px;
      width: 20px;
      left: 3px;
      bottom: 3px;
      background-color: white;
      transition: .3s cubic-bezier(0.34, 1.56, 0.64, 1);
      border-radius: 50%;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    }
    input:checked+.set-slider {
      background-color: #7c3aed;
      box-shadow: 0 0 12px rgba(124, 58, 237, 0.6);
    }
    input:checked+.set-slider.cyan {
      background-color: #06b6d4;
      box-shadow: 0 0 12px rgba(6, 182, 212, 0.6);
    }
    input:checked+.set-slider.warning {
      background-color: #f59e0b;
      box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
    }
    input:checked+.set-slider:before {
      transform: translateX(22px);
    }
    /* Range Slider */
    .set-range {
      -webkit-appearance: none;
      width: 100%;
      height: 6px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 5px;
      outline: none;
    }
    .set-range::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: #a78bfa;
      cursor: pointer;
      box-shadow: 0 0 10px #7c3aed;
    }
    /* Segmented Control */
    .set-segmented {
      display: flex;
      background: rgba(0, 0, 0, 0.3);
      border-radius: 12px;
      padding: 4px;
      gap: 4px;
      width: 100%;
      min-height: 48px;
    }
    .seg-btn {
      flex: 1;
      min-height: 40px;
      padding: 8px 10px;
      border: none;
      background: transparent;
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 700;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s;
      font-family: inherit;
      touch-action: manipulation;
    }
    .seg-btn.active {
      background: rgba(124, 58, 237, 0.3);
      color: #fff;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 0 8px rgba(124, 58, 237, 0.3);
    }
    /* Action Rows (Clickable) */
    .set-action-row {
      width: 100%;
      background: transparent;
      border: none;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      color: inherit;
      cursor: pointer;
      font-family: inherit;
      text-align: left;
      transition: background 0.2s;
      min-height: 56px;
      position: relative;
      z-index: 1;
      touch-action: manipulation;
    }
    .set-action-row:last-child {
      border-bottom: none;
    }
    .set-action-row:hover {
      background: rgba(255, 255, 255, 0.05);
    }
    .set-chevron {
      color: var(--text-muted);
      font-size: 18px;
      font-weight: 300;
    }
    .set-row-val {
      font-size: 12px;
      font-weight: 700;
      color: var(--text-muted);
      display: flex;
      gap: 6px;
      align-items: center;
    }
    /* ── Section Divider ── */
    .home-section-divider {
      width: 100%;
      max-width: 520px;
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 4px 0 10px;
    }
    .home-section-divider .hsd-label {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: var(--text-muted);
      white-space: nowrap;
    }
    .home-section-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: rgba(255, 255, 255, 0.07);
    }
    /* ── Start Button Enhanced ── */
    .btn-start-hero {
      width: 100%;
      max-width: 520px;
      padding: 22px;
      font-size: 22px;
      font-weight: 900;
      font-family: 'Outfit', sans-serif;
      letter-spacing: 1px;
      text-transform: uppercase;
      border: 3px solid rgba(124, 58, 237, 0.6);
      border-radius: 20px;
      cursor: pointer;
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.9), rgba(6, 182, 212, 0.9));
      color: white;
      box-shadow: 0 4px 30px rgba(124, 58, 237, 0.6), inset 0 0 15px rgba(6, 182, 212, 0.4);
      transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      position: relative;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      animation: pulseHeroBtn 2s infinite;
    }
    @keyframes pulseHeroBtn {
      0%,
      100% {
        box-shadow: 0 4px 30px rgba(124, 58, 237, 0.6), inset 0 0 15px rgba(6, 182, 212, 0.4);
      }
      50% {
        box-shadow: 0 4px 50px rgba(124, 58, 237, 0.9), inset 0 0 25px rgba(6, 182, 212, 0.7);
      }
    }
    .btn-start-hero::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 100%);
      transform: translateX(-100%);
      transition: transform 0.6s ease;
    }
    .btn-start-hero:hover::after {
      transform: translateX(100%);
    }
    .btn-start-hero:hover {
      transform: translateY(-4px) scale(1.02);
      border-color: rgba(6, 182, 212, 0.8);
    }
    .btn-start-hero:active {
      transform: scale(0.95);
    }
    /* ── Responsive: Quick Stats ── */
    @media (max-width: 360px) {
      .home-quick-stats {
        grid-template-columns: repeat(2, 1fr);
      }
      .qs-value {
        font-size: 15px;
      }
      .home-coins-chip, .home-trophies-chip {
        padding: 4px 10px;
        font-size: 12px;
      }
      .home-event-banner {
        padding: 12px 14px;
      }
      .event-icon {
        font-size: 22px;
      }
      .dc-icon-wrap {
        width: 40px;
        height: 40px;
        font-size: 20px;
      }
      .theme-btn-new .t-emoji {
        font-size: 26px;
      }
      .stage-btn-new {
        padding: 11px;
      }
      .stage-btn-new .s-name {
        font-size: 14px;
      }
      .btn-start-hero {
        padding: 16px;
        font-size: 16px;
      }
    }
    @media (min-width: 480px) {
      .home-quick-stats {
        gap: 10px;
      }
      .qs-value {
        font-size: 19px;
      }
      .theme-btn-new .t-emoji {
        font-size: 36px;
      }
      .theme-btn-new {
        padding: 16px 12px;
      }
      .stage-btn-new {
        padding: 16px;
      }
      .stage-btn-new .s-name {
        font-size: 17px;
      }
    }
    @media (min-width: 600px) {
      .home-quick-stats {
        gap: 12px;
      }
      .settings-modal {
        max-width: 400px;
      }
      .theme-btn-new .t-emoji {
        font-size: 38px;
      }
    }
    @media (min-width: 900px) {
      .btn-start-hero {
        max-width: 520px;
      }
      .btn-leaderboard {
        max-width: 520px;
      }
    }
    /* ============================================================
       COMPREHENSIVE RESPONSIVE OVERRIDES
       Mobile-first media queries covering all screens & orientations
    ============================================================ */
    /* ── AUTH SCREEN ─────────────────────────────────────────── */
    .auth-panel {
      width: 100%;
      max-width: 420px;
    }
    #screen-auth { padding: 20px 16px 80px; overflow-y: auto; justify-content: flex-start; align-items: center; }
    @media (max-width: 420px) {
      .auth-panel { border-radius: 18px; padding: 24px 18px; }
      .auth-title { font-size: 26px; }
      .auth-sub   { font-size: 12px; margin-bottom: 16px; }
      .auth-tab   { font-size: 13px; padding: 9px 12px; }
      .auth-input { font-size: 14px; padding: 13px 40px; }
      .btn-primary { padding: 14px; font-size: 14px; }
    }
    /* Auth landscape — make panel smaller so it fits in screen height */
    @media (max-height: 560px) and (orientation: landscape) {
      #screen-auth { padding: 8px 16px 16px; justify-content: flex-start; }
      .auth-title  { font-size: 20px; margin-bottom: 4px; }
      .auth-sub    { font-size: 11px; margin-bottom: 10px; }
      .auth-panel  { padding: 18px; border-radius: 14px; }
      .auth-tabs   { margin-bottom: 10px; }
      .input-group { margin-bottom: 8px; }
      .auth-input  { padding: 10px 38px; font-size: 13px; }
      .btn-primary { padding: 11px; font-size: 13px; }
      .auth-divider { margin: 8px 0; }
      .btn-google { padding: 11px; font-size: 13px; }
    }
    /* ── GAME SCREEN / CARDS ─────────────────────────────────── */
    @media (max-width: 420px) {
      #screen-game { padding: 8px 8px 70px; }
      .game-header { padding: 8px 10px; border-radius: 12px; gap: 8px; }
      .game-stat-label { font-size: 9px; }
      .game-stat-value { font-size: 15px; }
      .card { border-radius: 10px; font-size: 22px; }
    }
    /* ── MODALS (Settings / Win / etc.) ─────────────────────── */
    .settings-modal {
      width: calc(100% - 24px);
      max-width: 400px;
      max-height: 90vh;
      overflow-y: auto;
      border-radius: 20px;
    }
    @media (max-width: 420px) {
      .settings-modal-backdrop {
        align-items: flex-start;
        padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
      }
      .settings-modal {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
        border-radius: 20px;
      }
      .settings-header {
        padding: 18px 16px 14px;
      }
      .settings-title {
        font-size: 18px;
      }
      .settings-close-btn {
        width: 40px;
        height: 40px;
      }
      .settings-body {
        padding: 14px 14px calc(84px + env(safe-area-inset-bottom));
        gap: 14px;
      }
      .set-section {
        border-radius: 16px;
      }
      .set-sec-title {
        padding: 14px 14px 8px;
      }
      .set-row,
      .set-action-row {
        padding: 14px;
      }
      .settings-section-title { font-size: 12px; }
      .settings-row { gap: 8px; }
    }
    @media (max-height: 560px) and (orientation: landscape) {
      .settings-modal-backdrop {
        align-items: center;
      }
      .settings-modal {
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
      }
      .settings-body {
        padding-bottom: calc(28px + env(safe-area-inset-bottom));
      }
    }
    /* ── PROFILE DROPDOWN ────────────────────────────────────── */
    @media (max-width: 420px) {
      #profile-dropdown {
        right: 4px !important;
        width: calc(100vw - 8px) !important;
        max-width: 320px;
      }
    }
    /* ── LEADERBOARD ─────────────────────────────────────────── */
    @media (max-width: 480px) {
      .lb-row { padding: 10px 12px; gap: 8px; }
      .lb-rank { font-size: 13px; min-width: 22px; }
      .lb-name { font-size: 13px; }
      .lb-score { font-size: 13px; }
      .lb-detail { font-size: 10px; }
    }
    /* ── TOP NAV BAR (Player chip) ───────────────────────────── */
    @media (max-width: 420px) {
      #player-chip { padding: 5px 8px 5px 5px; gap: 6px; }
      .chip-name   { font-size: 12px; max-width: 80px; }
      .chip-avatar { width: 26px; height: 26px; }
    }
    /* ── HOME SCREEN ─────────────────────────────────────────── */
    @media (max-width: 360px) {
      .home-nav { padding: 8px 10px; }
      .home-section-title { font-size: 10px; }
    }
    /* ── TABLET (481px – 768px) ──────────────────────────────── */
    @media (min-width: 481px) and (max-width: 768px) {
      .auth-panel { max-width: 440px; padding: 32px 28px; }
      .settings-modal { max-width: 420px; }
      .home-quick-stats { grid-template-columns: repeat(3, 1fr); }
    }
    /* ── LARGE SCREENS ───────────────────────────────────────── */
    @media (min-width: 1024px) {
      .auth-panel    { max-width: 420px; }
      .settings-modal { max-width: 420px; }
    }
    /* ── LANDSCAPE TABLET ────────────────────────────────────── */
    @media (min-width: 769px) and (max-height: 600px) and (orientation: landscape) {
      #screen-auth { padding: 12px 24px; }
      .auth-panel  { max-width: 380px; padding: 24px; }
    }
      .radar-container {
        position: relative;
        width: 85vw;
        max-width: 320px;
        aspect-ratio: 1;
        border-radius: 50%;
        background: rgba(6, 182, 212, 0.05);
        border: 2px solid rgba(6, 182, 212, 0.3);
        margin: 0 auto 30px;
        overflow: hidden;
        box-shadow: 0 0 40px rgba(6, 182, 212, 0.2), inset 0 0 20px rgba(6, 182, 212, 0.2);
      }
      .radar-grid {
        position: absolute;
        inset: 0;
        border-radius: 50%;
        background-image: 
          radial-gradient(circle, rgba(6, 182, 212, 0.4) 1px, transparent 1px),
          radial-gradient(circle, transparent 33%, rgba(6, 182, 212, 0.2) 33%, transparent 34%, transparent 66%, rgba(6, 182, 212, 0.2) 66%, transparent 67%);
      }
      .radar-grid::before, .radar-grid::after {
        content: '';
        position: absolute;
        background: rgba(6, 182, 212, 0.2);
      }
      .radar-grid::before {
        top: 0; bottom: 0; left: 50%; width: 1px;
      }
      .radar-grid::after {
        left: 0; right: 0; top: 50%; height: 1px;
      }
      .radar-sweep {
        position: absolute;
        inset: 0;
        border-radius: 50%;
        background: conic-gradient(from 0deg, transparent 70%, rgba(6, 182, 212, 0.6) 100%);
        animation: radar-spin 3s linear infinite;
        transform-origin: center;
      }
      @keyframes radar-spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
      }
      .radar-player {
        position: absolute;
        width: 50px;
        height: 50px;
        transform: translate(-50%, -50%);
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        transition: transform 0.2s, filter 0.2s;
        z-index: 10;
        animation: radar-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
      }
      @keyframes radar-pop {
        0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
        100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
      }
      .radar-player:hover {
        transform: translate(-50%, -50%) scale(1.15);
        filter: brightness(1.2);
      }
      .radar-player-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 2px solid #a78bfa;
        background: #1e1b4b;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0,0,0,0.5);
      }
      .radar-player-name {
        font-size: 10px;
        margin-top: 4px;
        text-align: center;
        color: #fff;
        font-weight: bold;
        background: rgba(0,0,0,0.6);
        padding: 2px 6px;
        border-radius: 10px;
        white-space: nowrap;
        pointer-events: none;
      }
      .radar-center-dot {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 12px;
        height: 12px;
        background: #06b6d4;
        border-radius: 50%;
        box-shadow: 0 0 10px #06b6d4;
      }
    /* Install button — always visible */
    #install-btn {
      display: flex;
      position: fixed;
      bottom: 24px;
      right: 16px;
      z-index: 9998;
      align-items: center;
      gap: 8px;
      background: linear-gradient(135deg, #7c3aed, #06b6d4);
      color: #fff;
      font-family: 'Outfit', sans-serif;
      font-size: 13px;
      font-weight: 800;
      border: none;
      border-radius: 50px;
      padding: 12px 20px;
      cursor: pointer;
      box-shadow: 0 6px 24px rgba(124, 58, 237, 0.55);
      animation: installPulse 2.5s ease-in-out infinite;
    }
    /* Hidden state (used after app is installed) */
    #install-btn.hidden-btn {
      display: none;
    }
    @keyframes installPulse {
      0%,
      100% {
        box-shadow: 0 6px 24px rgba(124, 58, 237, 0.55);
      }
      50% {
        box-shadow: 0 6px 32px rgba(6, 182, 212, 0.7);
      }
    }
    /* iOS install popup */
    #ios-install-popup {
      position: fixed;
      bottom: 80px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 9998;
      width: calc(100% - 40px);
      max-width: 340px;
    }
    .ios-popup-inner {
      background: linear-gradient(160deg, #1a1547, #12103a);
      border: 1px solid rgba(167, 139, 250, 0.35);
      border-radius: 20px;
      padding: 18px 20px;
      color: #f8fafc;
      font-family: 'Outfit', sans-serif;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    }
    .ios-popup-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 15px;
      font-weight: 800;
      margin-bottom: 12px;
    }
    .ios-popup-header button {
      background: rgba(255, 255, 255, 0.1);
      border: none;
      color: #94a3b8;
      border-radius: 8px;
      padding: 4px 10px;
      cursor: pointer;
      font-size: 13px;
    }
    #ios-install-popup ol {
      padding-left: 20px;
      font-size: 13px;
      color: #94a3b8;
      line-height: 2;
      margin: 0;
    }
    #ios-install-popup strong {
      color: #a78bfa;
    }

