/* Game-page styles, separated from shared portal styles. */
:root {
      color-scheme: dark;
      --bg: #080c18;
      --panel: rgba(17, 23, 42, .88);
      --panel-strong: #121a30;
      --line: rgba(173, 192, 255, .13);
      --text: #f5f7ff;
      --muted: #94a0bd;
      --blue: #55a7ff;
      --cyan: #63e5ee;
      --violet: #aa8dff;
      --green: #6be5b0;
      --shadow: 0 24px 70px rgba(0, 0, 0, .36);
      font-family: "Outfit", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      font-size: 16px;
      line-height: 1.5;
    }
    html { background: var(--bg); }
    * { box-sizing: border-box; }
    body {
      position: relative;
      isolation: isolate;
      min-width: 320px;
      min-height: 100vh;
      margin: 0;
      color: var(--text);
      background: transparent;
    }
    body::before {
      position: fixed; z-index: -1; inset: 0; content: ""; pointer-events: none;
      background:
        radial-gradient(ellipse at 50% -15%, rgba(69, 102, 200, .18), transparent 45%),
        linear-gradient(180deg, rgba(5, 10, 23, .13), rgba(5, 10, 23, .52)),
        url("/assets/block-breaker-background.webp") center / cover no-repeat;
    }
    button { font: inherit; }
    .shell { width: min(1200px, calc(100% - 36px)); margin: 0 auto; padding: 14px 0 44px; }
    .top-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
    .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(107, 229, 176, .9); }
    h1 { margin: 0; font-size: clamp(30px, 4vw, 42px); line-height: 1.08; letter-spacing: -.04em; }
    .game-layout { display: block; width: 100%; }
    .game-card {
      position: relative; width: 100%; min-width: 0; padding: 0; overflow: hidden;
      border: 1px solid rgba(164,185,216,.34); border-radius: 16px;
      background: #f0f4fc; color: #17243d;
      box-shadow: 0 22px 58px rgba(0,0,0,.32), 0 1px 0 rgba(255,255,255,.5) inset;
    }
    .side-card {
      overflow: hidden; border: 1px solid var(--line); border-radius: 20px;
      background: linear-gradient(145deg, rgba(17,31,58,.94), rgba(22,39,72,.85));
      box-shadow: 0 18px 55px rgba(0,0,0,.2), inset 0 1px rgba(255,255,255,.06);
    }
    .hud {
      display: grid; min-height: 78px; grid-template-columns: repeat(5, minmax(0,1fr)) auto;
      gap: 12px; align-items: stretch; margin: 0; padding: 12px 15px;
      background: linear-gradient(180deg,#f8faff,#edf2fb); color: #17233b;
    }
    .stat {
      min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 7px 10px;
      border: 1px solid #dbe3ef; border-radius: 12px; background: #fff;
      box-shadow: 0 3px 10px rgba(28,53,82,.06), inset 0 1px #fff;
    }
    .stat-label { display: block; margin-bottom: 1px; color: #73819a; font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
    .stat-value { display: flex; align-items: center; min-height: 22px; margin-top: 1px; color: #17243d; font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; font-weight: 850; }
    .lives { gap: 4px; color: #e34b68; letter-spacing: .04em; }
    #bestValue { color: #0b9b80; }
    .hud-actions { display: flex; gap: 8px; align-items: stretch; justify-content: flex-end; margin-left: 3px; }
    .icon-btn {
      display: grid; width: 48px; min-height: 48px; flex: 0 0 auto; place-items: center; padding: 0;
      border: 1px solid #d7e0ed; border-radius: 12px; color: #425b7d;
      background: linear-gradient(180deg,#fff,#f8faff); box-shadow: 0 3px 10px rgba(32,54,87,.07);
      cursor: pointer; transition: border-color .16s, color .16s, transform .16s, box-shadow .16s;
    }
    .icon-btn:hover { border-color: #73c5ed; color: #147ea0; transform: translateY(-2px); box-shadow: 0 7px 18px rgba(53,135,176,.16); }
    .icon-btn:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(32,54,87,.1); }
    .icon-btn:focus-visible, .primary-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
    .icon-btn svg { width: 17px; height: 17px; }
    .arena-wrap { position: relative; width: 100%; min-height: 360px; height: auto; aspect-ratio: 16 / 9; overflow: hidden; border: 0; border-top: 1px solid #d9e2f0; border-radius: 0; background: #081225; box-shadow: inset 0 0 32px rgba(2,8,23,.28); touch-action: none; }
    #arenaWrap:fullscreen,
    #arenaWrap:-webkit-full-screen,
    #arenaWrap.is-fullscreen-fallback {
      position: fixed; inset: 0; z-index: 10000; width: 100vw;
      height: 100vh; height: 100dvh; min-height: 100vh; min-height: 100dvh;
      max-height: none; border: 0; border-radius: 0; box-shadow: none;
    }
    html.game-fullscreen-active,
    body.game-fullscreen-active { overflow: hidden; overscroll-behavior: none; }
    body.game-fullscreen-active { position: fixed; left: 0; right: 0; width: 100%; }
    .arena-exit-fullscreen {
      position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: calc(env(safe-area-inset-right, 0px) + 12px);
      z-index: 10; display: none; width: 44px; height: 44px; place-items: center; padding: 0;
      border: 1px solid rgba(210,230,255,.28); border-radius: 13px; color: #eff7ff;
      background: rgba(7,15,30,.82); box-shadow: 0 6px 20px rgba(0,0,0,.34); backdrop-filter: blur(12px);
      cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .arena-exit-fullscreen:focus-visible { outline: 2px solid #70e7f5; outline-offset: 3px; }
    #arenaWrap.is-fullscreen-fallback .arena-exit-fullscreen,
    #arenaWrap:fullscreen .arena-exit-fullscreen,
    #arenaWrap:-webkit-full-screen .arena-exit-fullscreen { display: grid; }
    canvas { display: block; width: 100%; height: 100%; }
    .arena-overlay {
      position: absolute; inset: 0; display: grid; place-items: center; padding: 22px; text-align: center;
      background: radial-gradient(ellipse at center, rgba(7, 11, 24, .72), rgba(7, 11, 24, .28) 75%); backdrop-filter: blur(4px);
      transition: opacity .2s ease, visibility .2s ease;
    }
    .arena-overlay.is-hidden { visibility: hidden; opacity: 0; pointer-events: none; }
    .overlay-card { width: min(390px, 100%); padding: 28px 27px 25px; border: 1px solid rgba(255,255,255,.9); border-radius: 22px; color: #15233c; background: rgba(246,249,255,.97); box-shadow: 0 22px 70px rgba(2,8,23,.5), 0 0 32px rgba(85,167,255,.13), inset 0 1px #fff; }
    .overlay-kicker { color: #087f95; font-size: 11px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
    .overlay-card h2 { margin: 9px 0 7px; color: #15233c; font-size: clamp(27px, 4vw, 36px); font-weight: 850; letter-spacing: -.04em; line-height: 1.1; }
    .overlay-card p { margin: 0 auto 20px; max-width: 310px; color: #64728a; font-size: 15px; line-height: 1.65; }
    .primary-btn {
      display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 9px; padding: 0 22px; border: 0; border-radius: 13px;
      color: #06111e; background: linear-gradient(100deg, #74eff0, #8bbdff 53%, #b49bff); box-shadow: 0 8px 26px rgba(86, 181, 237, .25);
      font-size: 15px; font-weight: 850; cursor: pointer; transition: transform .18s ease, filter .18s ease;
    }
    .primary-btn:hover { filter: brightness(1.08); transform: translateY(-2px); }
    .primary-btn svg { width: 15px; height: 15px; }
    .start-hint { margin-top: 13px; color: #75829a; font-size: 12px; }
    .result-stats { display: none; grid-template-columns: 1fr 1fr; gap: 9px; margin: -3px 0 16px; }
    .result-stats.visible { display: grid; }
    .result-stat { padding: 9px; border: 1px solid rgba(112, 132, 166, .2); border-radius: 11px; background: rgba(255,255,255,.72); }
    .result-stat span { display: block; color: #64728a; font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
    .result-stat strong { display: block; margin-top: 4px; color: #17243d; font-size: 19px; font-variant-numeric: tabular-nums; }
    .save-score-panel { display: none; margin: -3px 0 14px; text-align: left; }
    .save-score-panel.visible { display: block; }
    .save-score-panel label { display: block; margin-bottom: 6px; color: #37465e; font-size: 13px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
    .save-score-row { display: flex; gap: 7px; }
    .save-score-row input { width: 100%; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid #d6e0ed; border-radius: 11px; color: #17243d; background: #fff; font: inherit; font-size: 15px; }
    .save-score-row input:focus { outline: 2px solid rgba(99,229,238,.7); outline-offset: 1px; }
    .save-score-row .primary-btn { min-height: 42px; flex: 0 0 auto; padding: 0 13px; border-radius: 11px; font-size: 11px; }
    .save-score-row .primary-btn:disabled { cursor: default; filter: saturate(.55); opacity: .7; }
    .save-status { min-height: 20px; margin: 8px 2px 0; color: #66748d; font-size: 13px; line-height: 1.5; }
    .secondary-btn { display: none; margin: 9px auto 0; padding: 8px 10px; border: 0; color: #586a84; background: transparent; font-size: 12px; cursor: pointer; }
    .secondary-btn.visible { display: block; }
    .game-foot { display: flex; min-height: 49px; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 20px; border-top: 1px solid #e0e6ef; color: #53647f; background: #f4f7fd; font-size: 13px; }
    .game-foot span { display: inline-flex; align-items: center; gap: 6px; }
    kbd { min-width: 22px; height: 23px; display: inline-grid; place-items: center; margin-right: 2px; padding: 0 5px; border: 1px solid rgba(82,99,127,.4); border-bottom-width: 2px; border-radius: 6px; color: #ecf2ff; background: #182641; font: inherit; font-size: 11px; font-weight: 750; line-height: 1; }
    .home-leaderboard { margin: 34px auto 0; }
    .home-leaderboard .side-card { position: relative; padding: 25px 28px 20px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, rgba(17,31,58,.94), rgba(22,39,72,.85)); box-shadow: 0 18px 55px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.06); backdrop-filter: blur(18px); }
    .side-heading { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; color: #f1f4ff; font-size: clamp(26px, 3vw, 34px); font-weight: 800; line-height: 1.15; letter-spacing: -.035em; }
    .side-heading svg { width: 21px; height: 21px; color: var(--cyan); }
    .leader-tabs { width: min(100%, 430px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 0 0 12px auto; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,18,37,.44); }
    .leader-tab { min-width: 0; min-height: 38px; padding: 0 8px; border: 0; border-radius: 9px; color: #a5b1cd; background: transparent; font-size: 14px; font-weight: 750; cursor: pointer; transition: .18s ease; }
    .leader-tab.active { color: #081321; background: linear-gradient(100deg,#74eff0,#9bcaff); box-shadow: 0 3px 10px rgba(100,205,231,.2), inset 0 1px rgba(255,255,255,.6); }
    .leaderboard-list { display: grid; gap: 7px; min-height: 48px; margin: 0; padding: 0; list-style: none; }
    .leaderboard-row { display: grid; min-height: 62px; grid-template-columns: 36px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 8px 11px; border: 1px solid var(--line); border-radius: 12px; color: #c4cfe7; background: rgba(22,39,72,.72); box-shadow: inset 0 1px rgba(255,255,255,.035); font-size: 15px; }
    .leaderboard-row:nth-child(1) { border-color: rgba(255,199,94,.34); background: linear-gradient(100deg,rgba(255,199,94,.12),rgba(22,39,72,.72)); }
    .leader-rank { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #d5e1f6; background: #324668; font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 850; }
    .leaderboard-row:nth-child(1) .leader-rank { color: #34230b; background: #ffc75e; }
    .leaderboard-row:nth-child(2) .leader-rank { color: #263851; background: #d7e4f3; }
    .leaderboard-row:nth-child(3) .leader-rank { color: #412318; background: #d39477; }
    .leader-name { overflow: hidden; color: #e4eafa; font-size: 15px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
    .leader-score { color: #78ead2; font-size: 18px; font-variant-numeric: tabular-nums; font-weight: 850; }
    .leaderboard-status { min-height: 28px; margin-top: 10px; color: #93a0bc; font-size: 14px; line-height: 1.5; }
    .below-note { margin: 14px 4px 0; color: #66728e; font-size: 10px; text-align: center; }
    .toast { position: absolute; top: 16px; left: 50%; z-index: 3; padding: 9px 13px; border: 1px solid rgba(101, 221, 226, .3); border-radius: 999px; color: #dfffff; background: rgba(11, 28, 43, .9); box-shadow: 0 9px 25px rgba(0,0,0,.25); font-size: 11px; font-weight: 800; opacity: 0; pointer-events: none; transform: translate(-50%, -8px); transition: .24s ease; white-space: nowrap; }
    .toast.show { opacity: 1; transform: translate(-50%, 0); }
    @media (max-width: 720px) {
      .shell { width: calc(100% - 24px); padding-top: 11px; }
      .game-card { border-radius: 13px; padding: 0; }
      .hud { grid-template-columns: repeat(5, minmax(0,1fr)); gap: 6px; margin-bottom: 0; padding: 9px 8px; }
      .stat { min-width: 0; padding: 7px 5px; border-radius: 9px; }
      .stat-label { font-size: 9px; letter-spacing: .06em; }
      .stat-value { min-height: 19px; font-size: 16px; }
      .hud-actions { grid-column: 1 / -1; justify-content: flex-end; margin-top: 1px; }
      .icon-btn { width: 40px; min-height: 40px; border-radius: 10px; }
      .arena-wrap { min-height: 390px; height: min(58svh, 500px); aspect-ratio: auto; border-radius: 0; }
      .game-foot { min-height: 44px; padding: 8px 12px; font-size: 12px; }
      .home-leaderboard { margin-top: 28px; }
      .home-leaderboard .side-card { padding: 20px 15px 16px; border-radius: 16px; }
      .side-heading { margin-bottom: 15px; font-size: 26px; }
      .leader-tabs { margin: 0 0 11px; }
      .leader-tab { min-height: 34px; padding: 0 3px; font-size: 12px; }
      .leaderboard-row { min-height: 56px; grid-template-columns: 32px minmax(0,1fr) auto; gap: 8px; padding: 7px 8px; font-size: 14px; }
      .leader-rank { width: 27px; height: 27px; font-size: 11px; }
      .leader-name { font-size: 14px; }
      .leader-score { font-size: 16px; }
      .below-note { margin-top: 11px; }
    }
    @media (max-width: 390px) {
      .arena-wrap { min-height: 370px; }
      .game-foot { flex-direction: column; gap: 5px; }
    }
    html[data-theme="light"] {
      color-scheme: light;
      --bg: #eef3fb;
      --panel: rgba(255, 255, 255, .94);
      --panel-strong: #ffffff;
      --line: rgba(72, 94, 132, .18);
      --text: #17243d;
      --muted: #5e6e89;
      --shadow: 0 22px 50px rgba(47, 67, 103, .13);
    }
    html[data-theme="light"] body {
      color: var(--text);
      background: transparent;
    }
    html[data-theme="light"] body::before {
      background:
        linear-gradient(180deg, rgba(241, 246, 253, .81), rgba(238, 243, 251, .88)),
        url("/assets/block-breaker-background.webp") center / cover no-repeat;
    }
    html[data-theme="light"] .side-heading,
    html[data-theme="light"] .stat-value,
    html[data-theme="light"] .leader-name { color: #192844; }
    html[data-theme="light"] .stat-label,
    html[data-theme="light"] .game-foot,
    html[data-theme="light"] .leaderboard-status { color: #62718a; }
    html[data-theme="light"] .game-card,
    html[data-theme="light"] .home-leaderboard .side-card {
      border-color: rgba(78, 101, 143, .2);
      background: linear-gradient(150deg, rgba(255,255,255,.98), rgba(235,241,250,.98));
      box-shadow: 0 24px 50px rgba(47,67,103,.14), 0 3px 0 rgba(255,255,255,.9), inset 0 1px #fff;
    }
    html[data-theme="light"] .stat {
      border-color: rgba(86, 108, 148, .17);
      background: linear-gradient(180deg, #ffffff, #edf2f9);
      box-shadow: 0 4px 0 rgba(48,66,101,.1), inset 0 1px #fff;
    }
    html[data-theme="light"] .stat-value { color: #1d2c49; }
    html[data-theme="light"] .lives { color: #e34668; }
    html[data-theme="light"] .icon-btn {
      border-color: rgba(81,104,146,.2);
      color: #435571;
      background: linear-gradient(180deg, #fff, #e9eff8);
      box-shadow: inset 0 1px #fff, 0 3px 0 rgba(48,66,101,.12);
    }
    html[data-theme="light"] .icon-btn:hover { border-color: rgba(49, 154, 176, .55); color: #102746; }
    html[data-theme="light"] .game-foot kbd { color: #344661; border-color: rgba(77,99,138,.23); background: #f9fbff; }
    html[data-theme="light"] .leader-tabs { border-color: rgba(79,101,141,.15); background: rgba(220,228,241,.72); }
    html[data-theme="light"] .leader-tab { color: #566783; }
    html[data-theme="light"] .leaderboard-row {
      border-color: rgba(83,105,145,.14);
      color: #384a67;
      background: linear-gradient(115deg, rgba(255,255,255,.96), rgba(233,239,248,.9));
      box-shadow: inset 0 1px #fff, 0 2px 5px rgba(58,77,113,.06);
    }
    html[data-theme="light"] .leaderboard-row:nth-child(1) { border-color: rgba(199,142,43,.28); background: linear-gradient(110deg,#fff6df,#f4f6fb); }
    html[data-theme="light"] .leader-rank { color: #287c90; }
    html[data-theme="light"] .leader-score { color: #244e84; }
    @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
