* { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --ink: #1e293b; --muted: #64748b; --line: #e2e8f0;
    --accent: #f59e0b; --accent2: #e85d3f;
    --success: #16a34a; --danger: #dc2626;
    --bg: #f1f5f9; --surface: #ffffff;
    --r: 10px;
  }

  body {
    font-family: 'Sora', sans-serif;
    background: linear-gradient(135deg, #f1f5f9, #fef3e2, #f1f5f9, #fdece7);
    background-size: 300% 300%;
    animation: bgShift 18s ease infinite;
    color: var(--ink);
    height: 100vh;
    height: 100dvh;
    padding: 10px 12px 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  @keyframes bgShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }

  .wrap { max-width: 480px; width: 100%; margin: 0 auto; flex: 1; min-height: 0; display: flex; flex-direction: column; }

  /* -- Platform logo strip: infinite marquee, ported from POPSHOP's PlatformBanner -- */
  .platform-strip { position: relative; overflow: hidden; padding: 8px 0; flex-shrink: 0; }
  .platform-strip::before, .platform-strip::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 32px; z-index: 2; pointer-events: none;
  }
  .platform-strip::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
  .platform-strip::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
  .platform-track {
    display: flex; align-items: center; gap: 10px; width: max-content;
    animation: platformMarquee 36s linear infinite;
  }
  .platform-strip:hover .platform-track { animation-play-state: paused; }
  @keyframes platformMarquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
  .platform-card {
    flex: 0 0 auto; width: 76px; height: 42px; border-radius: 12px;
    background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.06);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s;
  }
  .platform-card:active { transform: scale(.92); }
  .platform-card img { height: 22px; width: auto; max-width: 90%; object-fit: contain; display: block; }
  @media (prefers-reduced-motion: reduce) { .platform-track { animation: none; } }

  /* ── Header ── */
  .header { position: relative; text-align: center; padding: 6px 0 4px; flex-shrink: 0; }
  .logo-img { max-height: 66px; width: auto; display: inline-block; }
  .howto-btn {
    position: absolute; top: 4px; right: 4px; width: 26px; height: 26px;
    border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line);
    color: var(--muted); font-weight: 800; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.08);
    transition: transform .15s cubic-bezier(.34,1.56,.64,1);
  }
  .howto-btn:active { transform: scale(.88); }

  .header-left { position: absolute; top: 4px; left: 4px; display: flex; align-items: center; gap: 6px; }
  .back-btn {
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; flex-shrink: 0;
    border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line);
    color: var(--muted); font-weight: 800; font-size: 15px; text-decoration: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    transition: transform .15s cubic-bezier(.34,1.56,.64,1);
  }
  .back-btn:active { transform: scale(.88); }

  .score-badge {
    display: flex; align-items: center; gap: 4px;
    background: var(--surface); border: 1.5px solid var(--line);
    border-radius: 999px; padding: 5px 11px 5px 9px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    font-size: 12px;
  }
  .score-badge .stat-val { font-size: 13px; font-weight: 800; letter-spacing: 0; line-height: 1; }

  .howto-overlay {
    display: none; position: fixed; inset: 0; z-index: 300;
    background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
    align-items: center; justify-content: center; padding: 20px;
  }
  .howto-overlay.show { display: flex; }
  .howto-card {
    background: var(--surface); border-radius: 18px; padding: 22px 20px;
    max-width: 380px; width: 100%; max-height: 85vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
  }
  .howto-title { font-size: 19px; font-weight: 800; text-align: center; margin-bottom: 16px; }
  .howto-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
  .howto-emoji { font-size: 24px; flex-shrink: 0; line-height: 1.3; }
  .howto-step b { display: block; font-size: 13px; margin-bottom: 2px; }
  .howto-step p { font-size: 12px; color: var(--muted); line-height: 1.4; }
  .howto-card .result-btn { width: 100%; margin-top: 6px; }

  /* ── Leaderboard ── */
  .leaderboard-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 50vh; overflow-y: auto; }
  .leaderboard-loading, .leaderboard-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 0; }
  .lb-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 10px; background: var(--bg);
  }
  .lb-row.me { background: rgba(245,158,11,.15); border: 1.5px solid var(--accent); }
  .lb-rank { font-weight: 800; font-size: 13px; color: var(--muted); width: 22px; text-align: center; flex-shrink: 0; }
