/* =====================================================================
   Bubble-Shooter.org theme — shared by the game (bs.css = theme.css + game styles) and the site.
   Owner: game engineer (part B). Variable names (--bs-*) and the classes below are a stable contract.

   Look: "bright lagoon". Site light by default with a dark theme; the game shell is a deep lagoon blue in both
   themes, the playfield has its own selectable themes (drawn on the canvas).

   Theme switching (attribute on <html>; the game's Settings toggle sets it at runtime):
     data-theme="dark" | "light"   absent = follow prefers-color-scheme   (localStorage bs_theme)
   Pre-paint (site <head>, avoids a flash of the wrong theme):
     <script>try{var t=localStorage.getItem('bs_theme');if(t)document.documentElement.dataset.theme=t}catch(e){}</script>

   Fonts (self-hosted, SIL OFL; URLs relative to this file, keep fonts/ next to bs.css / theme.css = /game/fonts/):
     --bs-font     Geologica (variable 100–900): latin, latin-ext, cyrillic, cyrillic-ext, greek
     --bs-display  Fredoka (variable 300–700, latin + latin-ext): logo, score digits, short Latin labels.
                   For headings in other scripts the stack falls back to Geologica automatically.
     ja, ko, zh: system stacks (rules at the end).

   Static art for site illustrations (same colours as the game):
     <i class="bs-mb bs-c1"></i>          bubble; bs-c1 … bs-c6 = yellow red turquoise purple blue green
                                          size via --bs-mb (default 28px); add bs-mb--sym for the colour-blind symbol
     <i class="bs-mb bs-p-bomb"></i>      special bubble: bs-p-bomb | bs-p-rainbow | bs-p-fire | bs-p-bolt | bs-p-stone
     /game/art/*.svg                      bubble-<colour>.svg, bubble-<colour>-sym.svg, special-<type>.svg (64×64)
   ===================================================================== */

@font-face { font-family: 'Geologica'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/geologica-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geologica'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/geologica-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Geologica'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/geologica-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Geologica'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/geologica-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Geologica'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/geologica-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(fonts/fredoka-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(fonts/fredoka-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  --bs-font: 'Geologica', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --bs-display: 'Fredoka', 'Geologica', system-ui, sans-serif;

  /* brand */
  --bs-lagoon: #14c6d0;
  --bs-aqua: #5ff0e4;
  --bs-coral: #ff6b5e;
  --bs-sun: #ffcf3f;
  --bs-violet: #9a6bff;
  --bs-deep: #062c47;
  --bs-deep-2: #0b3d5e;
  --bs-deep-3: #125279;

  --bs-radius-sm: 10px;
  --bs-radius: 16px;
  --bs-radius-lg: 24px;

  /* site surfaces (light) */
  --bs-ink: #0d2338;
  --bs-soft: #4b6278;
  --bs-line: rgba(13, 35, 56, .12);
  --bs-bg: #f2f9fc;
  --bs-bg-image: radial-gradient(1100px 520px at 50% -220px, #d4f4f6 0%, rgba(212, 244, 246, 0) 70%), linear-gradient(180deg, #f6fcfe 0%, #ecf5f9 100%);
  --bs-card: #ffffff;
  --bs-card-2: #e9f5f8;
  --bs-link: #0a6fb8;
  --bs-accent: #d8463a;           /* coral, darkened for text contrast on light */
  --bs-accent-2: #0a8f98;         /* lagoon, darkened */
  --bs-on-accent: #ffffff;
  --bs-btn: #ffffff;
  --bs-btn-ink: #0f2a40;
  --bs-btn-border: rgba(13, 35, 56, .14);
  --bs-focus: 0 0 0 3px rgba(20, 198, 208, .65);
  --bs-shadow: 0 10px 30px rgba(6, 44, 71, .12);
  --bs-shadow-lg: 0 30px 80px rgba(2, 16, 30, .45);
  --bs-danger: #cc2f3f;
  --bs-ok: #14895a;
  --sb-thumb: rgba(10, 143, 152, .55);
  --sb-thumb-hover: rgba(10, 143, 152, .8);
  --sb-track: transparent;

  /* game shell (same in both themes) */
  --bs-shell: #062c47;
  --bs-shell-edge: #1a5a80;
  --bs-hud-ink: #effcff;
  --bs-hud-soft: #9cc6da;
  --bs-hud-btn: rgba(255, 255, 255, .08);
  --bs-hud-btn-hover: rgba(255, 255, 255, .17);
  --bs-panel: #0a3150;
  --bs-panel-2: #104269;
  --bs-panel-line: rgba(255, 255, 255, .11);
  --bs-panel-ink: #effcff;
  --bs-panel-soft: #a7cadb;
  --bs-overlay: rgba(2, 18, 32, .62);

  /* bubble colours: main / light / dark (order = game colour ids 0…5) */
  --bs-c1: #ffcc2e; --bs-c1l: #fff3b0; --bs-c1d: #d48a00;   /* yellow */
  --bs-c2: #ff4b55; --bs-c2l: #ffb3b3; --bs-c2d: #b8162b;   /* red */
  --bs-c3: #1fdcc8; --bs-c3l: #b5fff4; --bs-c3d: #07928f;   /* turquoise */
  --bs-c4: #a463ff; --bs-c4l: #e1c9ff; --bs-c4d: #6224c4;   /* purple */
  --bs-c5: #3a86ff; --bs-c5l: #b8d6ff; --bs-c5d: #1446b8;   /* blue */
  --bs-c6: #4fd85a; --bs-c6l: #c6ffbf; --bs-c6d: #158a2c;   /* green */

  /* special bubbles */
  --bs-p-bomb: #2b3446; --bs-p-rainbow: #ffffff; --bs-p-fire: #ff7a1a; --bs-p-bolt: #ffe14d; --bs-p-stone: #8c97a8;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bs-ink: #eaf8ff;
  --bs-soft: #a5c3d4;
  --bs-line: rgba(255, 255, 255, .1);
  --bs-bg: #04192b;
  --bs-bg-image: radial-gradient(1100px 520px at 50% -220px, #0d4566 0%, rgba(13, 69, 102, 0) 70%), linear-gradient(180deg, #051e33 0%, #031322 100%);
  --bs-card: #0a2a43;
  --bs-card-2: #0e3552;
  --bs-link: #6fd9ff;
  --bs-accent: #ff7d70;
  --bs-accent-2: #3fe3e0;
  --bs-btn: #0e3552;
  --bs-btn-ink: #e3f6ff;
  --bs-btn-border: rgba(255, 255, 255, .13);
  --bs-shadow: 0 12px 34px rgba(0, 0, 0, .5);
  --bs-danger: #ff7b86;
  --bs-ok: #52d99a;
  --sb-thumb: rgba(255, 255, 255, .28);
  --sb-thumb-hover: rgba(255, 255, 255, .45);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bs-ink: #eaf8ff;
    --bs-soft: #a5c3d4;
    --bs-line: rgba(255, 255, 255, .1);
    --bs-bg: #04192b;
    --bs-bg-image: radial-gradient(1100px 520px at 50% -220px, #0d4566 0%, rgba(13, 69, 102, 0) 70%), linear-gradient(180deg, #051e33 0%, #031322 100%);
    --bs-card: #0a2a43;
    --bs-card-2: #0e3552;
    --bs-link: #6fd9ff;
    --bs-accent: #ff7d70;
    --bs-accent-2: #3fe3e0;
    --bs-btn: #0e3552;
    --bs-btn-ink: #e3f6ff;
    --bs-btn-border: rgba(255, 255, 255, .13);
    --bs-shadow: 0 12px 34px rgba(0, 0, 0, .5);
    --bs-danger: #ff7b86;
    --bs-ok: #52d99a;
    --sb-thumb: rgba(255, 255, 255, .28);
    --sb-thumb-hover: rgba(255, 255, 255, .45);
  }
}

/* ---- static art for site illustrations ---- */
.bs-c1 { --c: var(--bs-c1); --cl: var(--bs-c1l); --cd: var(--bs-c1d); }
.bs-c2 { --c: var(--bs-c2); --cl: var(--bs-c2l); --cd: var(--bs-c2d); }
.bs-c3 { --c: var(--bs-c3); --cl: var(--bs-c3l); --cd: var(--bs-c3d); }
.bs-c4 { --c: var(--bs-c4); --cl: var(--bs-c4l); --cd: var(--bs-c4d); }
.bs-c5 { --c: var(--bs-c5); --cl: var(--bs-c5l); --cd: var(--bs-c5d); }
.bs-c6 { --c: var(--bs-c6); --cl: var(--bs-c6l); --cd: var(--bs-c6d); }
.bs-p-bomb { --c: #3a4560; --cl: #8a97b8; --cd: #121826; }
.bs-p-fire { --c: #ff7a1a; --cl: #ffd29a; --cd: #b83a00; }
.bs-p-bolt { --c: #ffd83a; --cl: #fff6c2; --cd: #c08a00; }
.bs-p-stone { --c: #8c97a8; --cl: #d5dbe4; --cd: #4c5566; }
.bs-p-rainbow { --c: #fff; --cl: #fff; --cd: #9aa; }
.bs-mb {
  --w: var(--bs-mb, 28px);
  position: relative; display: inline-block; box-sizing: border-box; width: var(--w); height: var(--w); vertical-align: middle;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0 9%, var(--cl) 16%, var(--c) 52%, var(--cd) 100%);
  box-shadow: inset 0 calc(var(--w) * -.06) calc(var(--w) * .12) rgba(0, 0, 0, .25), 0 calc(var(--w) * .04) calc(var(--w) * .1) rgba(0, 0, 0, .18);
}
.bs-mb.bs-p-rainbow { background: radial-gradient(circle at 34% 30%, #fff 0 10%, rgba(255, 255, 255, 0) 30%), conic-gradient(#ff4b55, #ffcc2e, #4fd85a, #1fdcc8, #3a86ff, #a463ff, #ff4b55); }
.bs-mb.bs-p-bomb::after, .bs-mb.bs-p-fire::after, .bs-mb.bs-p-bolt::after, .bs-mb.bs-p-stone::after, .bs-mb--sym::after {
  content: ''; position: absolute; inset: 22%; background: rgba(255, 255, 255, .92);
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.bs-mb.bs-p-bolt::after { background: rgba(80, 50, 0, .85); }
.bs-mb.bs-p-bomb { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='14' r='7'/%3E%3Cpath d='M15 8l3-3M18 3v2M21 5h-2' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.bs-mb.bs-p-fire { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c1 4 6 6 6 12a6 6 0 0 1-12 0c0-3 2-5 3-6 0 2 1 3 2 3 0-3-1-6 1-9z'/%3E%3C/svg%3E"); }
.bs-mb.bs-p-bolt { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2L4 14h7l-1 8 9-12h-7z'/%3E%3C/svg%3E"); }
.bs-mb.bs-p-stone { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5h14v14H5z' fill='none' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E"); }
.bs-mb--sym.bs-c1 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 6.6 7.1.6-5.4 4.7 1.6 7.1L12 17.3 5.8 21l1.6-7.1L2 9.2l7.1-.6z'/%3E%3C/svg%3E"); }
.bs-mb--sym.bs-c2 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l10 18H2z'/%3E%3C/svg%3E"); }
.bs-mb--sym.bs-c3 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1l11 11-11 11L1 12z'/%3E%3C/svg%3E"); }
.bs-mb--sym.bs-c4 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 2h6v7h7v6h-7v7H9v-7H2V9h7z'/%3E%3C/svg%3E"); }
.bs-mb--sym.bs-c5 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h18v18H3z'/%3E%3C/svg%3E"); }
.bs-mb--sym.bs-c6 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 5a5 5 0 1 1 0 10 5 5 0 0 1 0-10z'/%3E%3C/svg%3E"); }

/* system fonts where Geologica has no glyphs */
:lang(zh), :lang(zh-Hans) { --bs-font: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif; --bs-display: 'Fredoka', system-ui, 'PingFang SC', 'Microsoft YaHei', sans-serif; }
:lang(ja) { --bs-font: system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', Meiryo, 'Noto Sans JP', sans-serif; --bs-display: 'Fredoka', system-ui, 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif; }
:lang(ko) { --bs-font: system-ui, -apple-system, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif; --bs-display: 'Fredoka', system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; }

/* =====================================================================
   Game UI styles (theme.css is prepended by build.mjs). Everything is scoped under .bs-game / .bs-backdrop / .bs-tip.
   Layout contract with the site (as arkanoid.org):
     #bs-game height = clamp(440px, var(--bs-game-h, 100dvh - var(--bs-header-h, 0px)), 900px)
     -> set --bs-header-h on :root (sticky header height) or --bs-game-h on #bs-game.
     HUD + playfield are centred; the playfield is at most 560 px wide and between 9:16 and 2:3 (portrait).
     Under the frame: the version switch bar (New / Original version).
   ===================================================================== */
.bs-game, .bs-game *, .bs-backdrop, .bs-backdrop *, .bs-tip { box-sizing: border-box; }
.bs-game {
  --bs-hud-h: 48px; --bs-ver-h: 38px; --bs-pad: 6px;
  --bs-h: clamp(440px, var(--bs-game-h, calc(100vh - var(--bs-header-h, 0px))), 900px);
  --bs-stage-h: calc(var(--bs-h) - var(--bs-hud-h) - var(--bs-ver-h) - var(--bs-pad) * 2);
  --bs-fw: min(100%, 560px, calc(var(--bs-stage-h) * .67));
  position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; height: var(--bs-h);
  padding: var(--bs-pad) max(var(--bs-pad), env(safe-area-inset-right)) var(--bs-pad) max(var(--bs-pad), env(safe-area-inset-left));
  overflow: hidden; isolation: isolate; background: radial-gradient(120% 70% at 50% 0%, #0f5a85 0%, rgba(15, 90, 133, 0) 60%), var(--bs-shell);
  border-radius: var(--bs-game-radius, clamp(0px, calc((100vw - 600px) * 999), 22px));
  font-family: var(--bs-font); color: var(--bs-hud-ink); -webkit-tap-highlight-color: transparent; text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
}
@supports (height: 100dvh) { .bs-game { --bs-h: clamp(440px, var(--bs-game-h, calc(100dvh - var(--bs-header-h, 0px))), 900px); } }
.bs-game:empty::before { content: ''; display: block; width: var(--bs-fw); height: 100%; border-radius: 12px; background: linear-gradient(180deg, #0e6f9a, #06304f); }
.bs-game:lang(ko) { word-break: keep-all; }
:where(.bs-game, .bs-backdrop) :is(button, input, select, textarea) { font-family: inherit; }
.bs-game :focus-visible, .bs-backdrop :focus-visible { outline: none; box-shadow: var(--bs-focus) !important; }
.bs-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bs-ico { width: 20px; height: 20px; flex: 0 0 auto; }
.bs-num { font-family: var(--bs-display); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.bs-error { margin: auto; max-width: 320px; padding: 20px; text-align: center; font: 600 16px/1.4 var(--bs-font); color: #fff; }
[hidden] { display: none !important; }

/* frame + stage */
.bs-game .bs-frame { position: relative; display: flex; flex-direction: column; width: var(--bs-fw); min-width: 280px; max-width: 100%; height: calc(var(--bs-h) - var(--bs-ver-h) - var(--bs-pad) * 2);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.bs-game .bs-stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; border-radius: 14px; box-shadow: 0 0 0 1px var(--bs-shell-edge), 0 12px 30px rgba(0, 0, 0, .25); background: #06304f; }
.bs-game .bs-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

/* HUD */
.bs-game .bs-hud { display: flex; align-items: center; gap: 8px; height: var(--bs-hud-h); padding: 0 2px 6px; min-width: 0; }
.bs-hud__score { display: flex; flex-direction: column; flex: 0 0 auto; line-height: 1.05; min-width: 64px; }
.bs-hud__score .bs-hud__v { font-size: 22px; font-weight: 700; color: #fff; text-shadow: 0 0 12px rgba(95, 240, 228, .45); white-space: nowrap; }
.bs-hud__best { font-size: 11px; color: var(--bs-hud-soft); white-space: nowrap; }
.bs-hud__mid { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; line-height: 1.1; }
.bs-hud__row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bs-hud__l { flex: 0 1 auto; min-width: 3em; font: 600 13px/1.1 var(--bs-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-hud--narrow .bs-hud__tag { max-width: 4.5em; overflow: hidden; text-overflow: ellipsis; }
.bs-hud__i { font-size: 11px; color: var(--bs-hud-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-hud__tag { font-size: 10px; padding: 1px 6px; border-radius: 99px; background: rgba(255, 207, 63, .18); color: var(--bs-sun); white-space: nowrap; }
.bs-miss { display: inline-flex; align-items: center; gap: 3px; }
.bs-miss__d { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.bs-miss__d.is-on { background: radial-gradient(circle at 35% 35%, #fff, #bfe8f7 60%, #7fb6cf); box-shadow: 0 0 4px rgba(255, 255, 255, .5); }
.bs-pw { position: relative; width: 34px; height: 6px; margin-left: 4px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.bs-pw::after { content: ''; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--pw, 0)); background: linear-gradient(90deg, var(--bs-sun), var(--bs-coral), var(--bs-violet)); transition: transform .3s; }
.bs-hud__btns { display: flex; gap: 4px; flex: 0 0 auto; }
.bs-game .bs-hbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px;
  background: var(--bs-hud-btn); color: var(--bs-hud-ink); cursor: pointer; transition: background .15s, transform .1s; }
.bs-game .bs-hbtn:hover { background: var(--bs-hud-btn-hover); }
.bs-game .bs-hbtn:active { transform: scale(.94); }
.bs-hud--narrow { gap: 5px; }
.bs-hud--narrow .bs-hbtn { width: 32px; height: 32px; border-radius: 10px; }
.bs-hud--narrow .bs-hbtn .bs-ico { width: 18px; height: 18px; }
.bs-hud--narrow .bs-hud__btns { gap: 2px; }
.bs-hud--narrow .bs-hud__score { min-width: 0; }
.bs-hud--narrow .bs-hud__score .bs-hud__v { font-size: 19px; }
.bs-hud--narrow .bs-hbtn--x { display: none; }
.bs-hud__i--c { flex: 0 0 auto; overflow: visible; font-weight: 700; color: var(--bs-hud-ink); }
.bs-hud__i--shots::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 3px; border-radius: 50%; vertical-align: -1px;
  background: radial-gradient(circle at 35% 35%, #fff, #bfe8f7 60%, #7fb6cf); }
.bs-hud__i--timer { order: 1; }

/* version switch + original iframe */
.bs-game .bs-ver { display: flex; gap: 4px; height: calc(var(--bs-ver-h) - 6px); margin-top: 6px; padding: 3px; border-radius: 99px; background: rgba(255, 255, 255, .08); }
.bs-game .bs-ver__b { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border: 0; border-radius: 99px; background: transparent; color: var(--bs-hud-soft);
  font: 600 13px/1 var(--bs-font); cursor: pointer; white-space: nowrap; }
.bs-game .bs-ver__b .bs-ico { width: 16px; height: 16px; }
.bs-game .bs-ver__b[aria-pressed="true"] { background: var(--bs-hud-ink); color: var(--bs-deep); }
.bs-game .bs-ver__b:not([aria-pressed="true"]):hover { color: #fff; background: rgba(255, 255, 255, .1); }
.bs-game .bs-orig { display: block; width: var(--bs-fw); min-width: 280px; max-width: 100%; height: calc(var(--bs-h) - var(--bs-ver-h) - var(--bs-pad) * 2); border: 0; border-radius: 14px; background: #000; }

/* overlays (pause / end cards) */
.bs-game .bs-ov { position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; padding: 14px; background: var(--bs-overlay);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.bs-game .bs-ov.is-on { display: flex; animation: bs-fade .2s ease-out; }
.bs-game .bs-card { width: min(100%, 330px); max-height: 100%; overflow: auto; padding: 18px 16px 16px; border-radius: var(--bs-radius-lg); text-align: center;
  background: linear-gradient(180deg, var(--bs-panel-2), var(--bs-panel)); box-shadow: 0 0 0 1px var(--bs-panel-line), var(--bs-shadow-lg); color: var(--bs-panel-ink); animation: bs-pop .25s cubic-bezier(.2, 1.4, .4, 1); }
.bs-card__t { margin: 0 0 6px; font: 700 26px/1.15 var(--bs-display); }
.bs-card--end.is-won .bs-card__t { color: var(--bs-sun); }
.bs-card__score { font-size: 40px; font-weight: 700; line-height: 1.1; color: #fff; text-shadow: 0 0 18px rgba(95, 240, 228, .5); }
.bs-card__sub, .bs-card__hint { margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--bs-panel-soft); }
.bs-card__hint { font-size: 12px; }
.bs-card__btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.bs-card__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.bs-card__row > :nth-child(3):last-child { grid-column: 1 / -1; }
.bs-hud__row .bs-miss { order: 2; }
.bs-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 12px; border-radius: 99px; background: rgba(255, 207, 63, .16); color: var(--bs-sun); font-weight: 700; font-size: 13px; }
.bs-badge .bs-ico { width: 16px; height: 16px; }

/* buttons */
:is(.bs-game, .bs-backdrop) .bs-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 14px;
  background: rgba(255, 255, 255, .12); color: var(--bs-panel-ink); font: 600 15px/1.1 var(--bs-font); cursor: pointer; transition: background .15s, transform .1s, opacity .15s; text-decoration: none; }
:is(.bs-game, .bs-backdrop) .bs-btn:hover { background: rgba(255, 255, 255, .2); }
:is(.bs-game, .bs-backdrop) .bs-btn:active { transform: scale(.97); }
:is(.bs-game, .bs-backdrop) .bs-btn--primary { background: linear-gradient(180deg, #5ff0e4, #14c6d0); color: #04293f; box-shadow: 0 4px 0 #0a8f98; }
:is(.bs-game, .bs-backdrop) .bs-btn--primary:hover { background: linear-gradient(180deg, #84fff4, #2ad6df); }
:is(.bs-game, .bs-backdrop) .bs-btn--ad { flex-wrap: wrap; row-gap: 0; padding-block: 6px; background: linear-gradient(180deg, #ffe07a, #ffcf3f); color: #3b2a00; box-shadow: 0 4px 0 #c99a12; }
.bs-btn--ad small { flex-basis: 100%; font-size: 11px; font-weight: 500; opacity: .8; }
:is(.bs-game, .bs-backdrop) .bs-btn--ghost { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .22); }
:is(.bs-game, .bs-backdrop) .bs-btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
:is(.bs-game, .bs-backdrop) .bs-btn:disabled { opacity: .55; cursor: default; transform: none; }
.bs-btn.is-busy { position: relative; color: transparent !important; }
.bs-btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #3b2a00; border-right-color: transparent; animation: bs-spin .8s linear infinite; }
.bs-btn .bs-ico { width: 18px; height: 18px; }

/* tutorial coach card (never blocks the playfield above it) */
.bs-game .bs-tut { position: absolute; left: 8px; right: 8px; top: 46%; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 16px;
  background: rgba(6, 44, 71, .9); box-shadow: 0 0 0 1px var(--bs-panel-line), 0 10px 26px rgba(0, 0, 0, .35); color: var(--bs-panel-ink); animation: bs-up .3s ease-out; pointer-events: auto; }
.bs-tut__n { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--bs-lagoon); color: #04293f; font-weight: 700; font-size: 13px; }
.bs-tut__body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; font-size: 13px; line-height: 1.3; }
.bs-tut__t { font: 700 15px/1.2 var(--bs-display); }
.bs-tut__p { color: var(--bs-panel-soft); }
.bs-tut__btns { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.bs-tut__btns .bs-btn { min-height: 30px; padding: 0 10px; font-size: 12px; }

/* language banner */
.bs-game .bs-banner { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px;
  background: rgba(6, 44, 71, .92); box-shadow: 0 0 0 1px var(--bs-panel-line); color: var(--bs-panel-ink); font-size: 13px; animation: bs-up .3s ease-out; }
.bs-banner__text { flex: 1 1 140px; margin: 0; }
.bs-banner__btns { display: flex; gap: 6px; }
.bs-banner--out { opacity: 0; transition: opacity .2s; }

@keyframes bs-fade { from { opacity: 0; } }
@keyframes bs-pop { from { opacity: 0; transform: scale(.92); } }
@keyframes bs-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes bs-spin { to { transform: rotate(360deg); } }

/* modals (appended to <body> or the fullscreen element) */
html.bs-modal-open { overflow: hidden; padding-right: var(--bs-sbw, 0px); }
.bs-backdrop { position: fixed; inset: 0; z-index: 2147483100; display: flex; align-items: center; justify-content: center; padding: 12px; background: var(--bs-overlay);
  font-family: var(--bs-font); color: var(--bs-panel-ink); animation: bs-fade .16s ease-out; -webkit-tap-highlight-color: transparent; }
.bs-backdrop--out { opacity: 0; transition: opacity .15s; }
.bs-modal { --sb-thumb: rgba(255, 255, 255, .3); --sb-thumb-hover: rgba(255, 255, 255, .5);
  display: flex; flex-direction: column; width: min(100%, 440px); max-height: min(100%, 680px); overflow: hidden; border-radius: var(--bs-radius-lg);
  background: linear-gradient(180deg, var(--bs-panel-2), var(--bs-panel)); box-shadow: 0 0 0 1px var(--bs-panel-line), var(--bs-shadow-lg); animation: bs-pop .22s cubic-bezier(.2, 1.3, .4, 1); outline: none; }
.bs-modal__head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 8px 18px; }
.bs-modal__title { flex: 1 1 auto; margin: 0; font: 700 20px/1.2 var(--bs-display); }
.bs-modal__close { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 11px; background: rgba(255, 255, 255, .08); color: inherit; cursor: pointer; }
.bs-modal__close:hover { background: rgba(255, 255, 255, .16); }
.bs-modal__body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 18px 18px; font-size: 14px; line-height: 1.45; }
.bs-modal__lead { margin: 0 0 8px; color: var(--bs-panel-soft); font-size: 13px; }
.bs-backdrop :focus-visible { outline: none; box-shadow: var(--bs-focus); }

/* scrollbars: pill thumb inside the block, no track background */
.bs-modal__body::-webkit-scrollbar, .bs-dd__list::-webkit-scrollbar, .bs-game .bs-card::-webkit-scrollbar { width: 14px; }
.bs-modal__body::-webkit-scrollbar-track, .bs-dd__list::-webkit-scrollbar-track, .bs-game .bs-card::-webkit-scrollbar-track { background: var(--sb-track, transparent); margin: 14px 0; }
.bs-modal__body::-webkit-scrollbar-thumb, .bs-dd__list::-webkit-scrollbar-thumb, .bs-game .bs-card::-webkit-scrollbar-thumb { background: var(--sb-thumb); border: solid transparent; border-width: 3px 6px 3px 3px; background-clip: padding-box; border-radius: 99px; }
.bs-modal__body::-webkit-scrollbar-thumb:hover, .bs-dd__list::-webkit-scrollbar-thumb:hover, .bs-game .bs-card::-webkit-scrollbar-thumb:hover { background: var(--sb-thumb-hover); background-clip: padding-box; border: solid transparent; border-width: 3px 6px 3px 3px; }
.bs-modal__body::-webkit-scrollbar-corner, .bs-dd__list::-webkit-scrollbar-corner { background: transparent; }
@supports not selector(::-webkit-scrollbar) { .bs-modal__body, .bs-dd__list, .bs-game .bs-card { scrollbar-width: thin; scrollbar-color: var(--sb-thumb) transparent; } }

/* option rows */
.bs-opts { display: flex; flex-direction: column; }
.bs-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--bs-panel-line); }
.bs-row:first-of-type { border-top: 0; }
.bs-row__l { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.bs-row__t { font-weight: 600; }
.bs-row__h { font-size: 12px; line-height: 1.35; color: var(--bs-panel-soft); }
.bs-row__c { flex: 0 0 auto; }
.bs-opts__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--bs-panel-line); }
.bs-opts__foot .bs-row__h { flex: 1 1 180px; margin: 0; }
.bs-btn.is-done { background: rgba(82, 217, 154, .16); color: #8ff0c0; opacity: 1 !important; }

/* switch */
.bs-sw { position: relative; width: 48px; height: 28px; padding: 0; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .18); cursor: pointer; transition: background .18s; }
.bs-sw__knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); transition: transform .18s; }
.bs-sw[aria-checked="true"] { background: var(--bs-lagoon); }
.bs-sw[aria-checked="true"] .bs-sw__knob { transform: translateX(20px); }

/* dropdown */
.bs-dd { position: relative; }
.bs-dd__btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 132px; min-height: 38px; padding: 0 10px 0 14px; border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); color: inherit; font: 600 14px/1 var(--bs-font); cursor: pointer; }
.bs-dd__btn:hover { background: rgba(255, 255, 255, .16); }
.bs-dd__arrow { width: 18px; height: 18px; transition: transform .18s; }
.bs-dd--open .bs-dd__arrow { transform: rotate(180deg); }
.bs-dd__list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; display: none; min-width: 100%; max-height: 240px; overflow: auto; margin: 0; padding: 6px; list-style: none;
  border-radius: 14px; background: #0d3a5e; box-shadow: 0 0 0 1px var(--bs-panel-line), 0 14px 32px rgba(0, 0, 0, .45); }
.bs-dd--open .bs-dd__list { display: block; animation: bs-pop .14s ease-out; }
.bs-dd__opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; white-space: nowrap; outline: none; }
.bs-dd__opt:hover, .bs-dd__opt:focus { background: rgba(255, 255, 255, .1); }
.bs-dd__opt.is-sel { color: var(--bs-aqua); font-weight: 600; }
.bs-dd__tick { width: 16px; height: 16px; visibility: hidden; }
.bs-dd__opt.is-sel .bs-dd__tick { visibility: visible; }

/* help */
.bs-help__s h3, .bs-stats h3 { margin: 14px 0 6px; font: 700 15px/1.2 var(--bs-display); }
.bs-help__s:first-child h3 { margin-top: 0; }
.bs-help ul { margin: 0; padding-left: 18px; }
.bs-help li { margin: 4px 0; }
.bs-help p { margin: 4px 0 8px; color: var(--bs-panel-soft); }
.bs-help__pu { list-style: none; padding-left: 0 !important; }
.bs-help__pu li { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.bs-help__pu .bs-mb { --bs-mb: 18px; align-self: center; }
.bs-help__links { display: flex; gap: 16px; flex-wrap: wrap; }
.bs-backdrop .bs-link { color: var(--bs-aqua); font-weight: 600; }

/* stats */
.bs-stats__pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bs-stats__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bs-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-radius: 12px; background: rgba(255, 255, 255, .06); text-align: center; }
.bs-stat b { font-size: 18px; }
.bs-stat span { font-size: 11px; line-height: 1.25; color: var(--bs-panel-soft); }
.bs-stats__cols { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding: 0 4px; }
.bs-stats__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; flex: 1 1 0; height: 100%; font-size: 11px; }
.bs-stats__col i { display: block; width: 100%; min-height: 3px; border-radius: 6px 6px 3px 3px; }

/* tooltip */
.bs-tip { position: fixed; z-index: 2147483200; padding: 5px 9px; border-radius: 8px; background: #021a2c; color: #effcff; font: 600 12px/1.2 var(--bs-font); pointer-events: none; opacity: 0; transition: opacity .12s; white-space: nowrap; }
.bs-tip--on { opacity: 1; }

/* fullscreen (real or the iOS fallback class) */
.bs-game.bs-game--fs { position: fixed; inset: 0; z-index: 2147483000; --bs-h: 100vh; height: 100%; border-radius: 0; padding-top: max(6px, env(safe-area-inset-top)); }
@supports (height: 100dvh) { .bs-game.bs-game--fs { --bs-h: 100dvh; } }
.bs-game:fullscreen { --bs-h: 100vh; height: 100%; border-radius: 0; }
html.bs-fs-lock, html.bs-fs-lock body { overflow: hidden; }

/* reduced motion */
.bs-reduced *, .bs-reduced *::before, .bs-reduced *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .bs-game *, .bs-backdrop, .bs-backdrop * { animation: none !important; transition: none !important; } }

/* level / puzzle select */
.bs-lvls h3 { margin: 14px 0 8px; font: 700 15px/1.2 var(--bs-display); }
.bs-lvls__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.bs-lvl { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 2px; border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .08); color: inherit; cursor: pointer; }
.bs-lvl:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.bs-lvl:disabled { opacity: .45; cursor: default; }
.bs-lvl.is-cur { box-shadow: inset 0 0 0 2px var(--bs-aqua); }
.bs-lvl__n { font-size: 17px; font-weight: 700; }
.bs-lvl__n .bs-ico { width: 16px; height: 16px; }
.bs-lvl__s { display: flex; gap: 1px; }
.bs-lvl__s .bs-ico { width: 11px; height: 11px; color: rgba(255, 255, 255, .22); }
.bs-lvl__s .bs-ico.is-on { color: var(--bs-sun); }

/* puzzle queue strip, arcade timer bar */
.bs-q { display: inline-flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.bs-q__b { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; box-shadow: inset -1px -1px 0 rgba(0, 0, 0, .25); }
.bs-q__b:first-child { width: 11px; height: 11px; box-shadow: 0 0 0 1.5px #fff; }
.bs-q__more { font-size: 10px; color: var(--bs-hud-soft); margin-left: 2px; }
.bs-timer { position: relative; flex: 0 0 auto; width: 44px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.bs-timer i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--t, 1)); background: var(--bs-aqua); border-radius: inherit; }
.bs-timer.is-warn i { background: var(--bs-coral); animation: bs-blink .5s steps(2) infinite; }
@keyframes bs-blink { 50% { opacity: .35; } }

/* level select */
.bs-lvls h3 { margin: 12px 0 8px; font: 700 15px/1.2 var(--bs-display); }
.bs-lvls__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.bs-lvl { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 60px; padding: 0; border: 0; border-radius: 14px;
  background: rgba(255, 255, 255, .08); color: inherit; cursor: pointer; transition: background .15s, transform .1s; }
.bs-lvl:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.bs-lvl:active:not(:disabled) { transform: scale(.95); }
.bs-lvl.is-done { background: rgba(20, 198, 208, .16); }
.bs-lvl.is-cur { box-shadow: inset 0 0 0 2px var(--bs-aqua); }
.bs-lvl:disabled { opacity: .45; cursor: default; }
.bs-lvl__n { font-size: 17px; font-weight: 700; line-height: 1; }
.bs-lvl__n .bs-ico { width: 16px; height: 16px; }
.bs-lvl__s { display: flex; gap: 1px; }
.bs-lvl__s .bs-ico { width: 11px; height: 11px; color: rgba(255, 255, 255, .2); }
.bs-lvl__s .bs-ico.is-on { color: var(--bs-sun); }
