/* BlockFusions — screens, HUD and visual language. No external fonts or assets. */
:root {
  --font: -apple-system, "SF Pro Rounded", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text: #f3f1ff;
  --muted: #b3acd9;
  --glass: rgba(34, 26, 84, 0.52);
  --glass-solid: rgba(34, 26, 84, 0.94);
  --glass-border: rgba(255, 255, 255, 0.14);
  --accent: #7c6bff;
  --accent2: #ff6fc8;
  --gold: #ffd36b;
  --good: #5ef0a5;
  --danger: #ff5b7a;
  --radius: 20px;
  --t-in: 250ms;
  --t-out: 150ms;
  /* @spec SHELL-PAGE-003 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; width: 100%; overflow: hidden; position: fixed; inset: 0;
  height: 100vh; height: 100dvh;
  /* @spec SHELL-PAGE-002 */
  overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  font-family: var(--font); color: var(--text); background: #120c30;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- animated background ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: radial-gradient(120% 80% at 20% 0%, #3a1f7a 0%, transparent 60%), radial-gradient(100% 70% at 100% 100%, #0f2a6b 0%, transparent 60%), linear-gradient(160deg, #241458 0%, #120c30 55%, #0a1236 100%); }
body[data-board="dusk"] .bg { background: radial-gradient(120% 80% at 10% 0%, #6b2a5a 0%, transparent 60%), radial-gradient(100% 70% at 100% 100%, #7a3a1f 0%, transparent 60%), linear-gradient(160deg, #3a1840 0%, #1a0c24 60%, #2a1020 100%); }
body[data-board="deepsea"] .bg { background: radial-gradient(120% 80% at 20% 0%, #0f5a6b 0%, transparent 60%), radial-gradient(100% 70% at 100% 100%, #0a2a5a 0%, transparent 60%), linear-gradient(160deg, #06303a 0%, #041820 60%, #061a30 100%); }
body[data-board="paper"] .bg { background: radial-gradient(120% 80% at 20% 0%, #fff6e0 0%, transparent 60%), linear-gradient(160deg, #f4e8cf 0%, #e8d9bb 60%, #dccaa6 100%); }
body[data-board="paper"] { --text: #2b2140; --muted: #6b5e7d; --glass: rgba(255, 250, 238, 0.62); --glass-solid: rgba(255, 250, 238, 0.96); --glass-border: rgba(80, 60, 30, 0.14); }
/* @spec UI-011: each blob is a disc with a 120 px soft edge drawn as a radial gradient, the look of a blurred
   circle without a blur filter; the box is 240 px larger than the disc and offset by 120 px to hold the edge. */
.blob { position: absolute; --d: 60vmax; width: calc(var(--d) + 240px); height: calc(var(--d) + 240px); border-radius: 50%; opacity: 0.32;
  background: radial-gradient(closest-side, var(--blob-c) calc(100% - 240px), color-mix(in srgb, var(--blob-c) 50%, transparent) calc(100% - 120px), transparent 100%);
  animation: drift 26s ease-in-out infinite alternate; }
body:not(.in-menu) .blob { animation-play-state: paused; }
.b1 { --blob-c: #7c4dff; top: calc(-20vmax - 120px); left: calc(-15vmax - 120px); }
.b2 { --blob-c: #ff4fb0; bottom: calc(-25vmax - 120px); right: calc(-20vmax - 120px); animation-duration: 32s; opacity: 0.22; }
.b3 { --blob-c: #2fb8ff; top: calc(30% - 120px); left: calc(40% - 120px); --d: 40vmax; animation-duration: 38s; opacity: 0.18; }
body[data-board="paper"] .blob { opacity: 0.12; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vmax, 4vmax) scale(1.12); } }

#stage { position: fixed; inset: 0; z-index: 1; touch-action: none; }
#stage canvas { display: block; touch-action: none; }

/* ---------- glass ---------- */
.glass { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(5, 0, 30, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); }
/* @spec UI-008 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--glass-solid); } }

/* ---------- screens & transitions ---------- */
.screen { position: fixed; inset: 0; z-index: 3; display: flex; flex-direction: column; opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(12px); transition: opacity var(--t-out) ease, transform var(--t-out) ease, visibility 0s linear var(--t-out);
  padding: calc(var(--safe-top) + 14px) calc(var(--safe-right) + 16px) calc(var(--safe-bottom) + 14px) calc(var(--safe-left) + 16px); }
.screen.active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition: opacity var(--t-in) ease, transform var(--t-in) cubic-bezier(.2,.8,.2,1), visibility 0s; }
.screen.secondary, .screen.menu, .screen.welcome { background: transparent; z-index: 4; }
/* @spec UI-009: Settings / How to play opened over a game */
body.over-game .screen.secondary.active { background: rgba(10, 6, 30, 0.72); -webkit-backdrop-filter: blur(18px) saturate(1.1); backdrop-filter: blur(18px) saturate(1.1); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { body.over-game .screen.secondary.active { background: rgba(14, 9, 38, 0.95); } }
.screen.overlay { z-index: 5; align-items: center; justify-content: center; background: rgba(10, 6, 30, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.screen.game { pointer-events: none; z-index: 2; padding: 0; }
.screen.game.active > * { pointer-events: auto; }
.screen.game .hud-strip, .screen.game .hud-bottom { pointer-events: none; }
.screen.game .hud-strip > *, .screen.game .hud-bottom > * { pointer-events: auto; }
body.in-menu #stage { opacity: 0; pointer-events: none; }
#stage { transition: opacity 250ms ease; }

/* ---------- buttons ---------- */
/* @spec UI-003 */
.btn { min-width: 44px; min-height: 44px; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.08); border-radius: 14px;
  padding: 10px 18px; font-weight: 700; font-size: 16px; cursor: pointer; transition: transform 120ms ease, background 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.14); box-shadow: 0 8px 20px rgba(10, 0, 40, 0.3); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary, .btn-play { background: linear-gradient(135deg, #8f6bff 0%, #ff6fc8 100%); border-color: rgba(255, 255, 255, 0.3); color: #fff; box-shadow: 0 8px 24px rgba(160, 80, 255, 0.4); }
.btn-primary:hover, .btn-play:hover { filter: brightness(1.08); background: linear-gradient(135deg, #8f6bff 0%, #ff6fc8 100%); }
.btn-danger { background: rgba(255, 91, 122, 0.16); border-color: rgba(255, 91, 122, 0.5); color: #ffd0da; }
body[data-board="paper"] .btn-danger { color: #a0203a; }
.btn-ghost { background: transparent; }
.icon-btn { width: 46px; height: 46px; padding: 0; border-radius: 14px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- icons (pure CSS) ---------- */
.ico { width: 22px; height: 22px; display: inline-block; position: relative; flex: none; }
.ico::before, .ico::after { content: ""; position: absolute; }
.ico-pause::before, .ico-pause::after { width: 6px; height: 18px; top: 2px; background: currentColor; border-radius: 2px; }
.ico-pause::before { left: 4px; } .ico-pause::after { right: 4px; }
.ico-back::before { width: 12px; height: 12px; border-left: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg); left: 7px; top: 5px; border-radius: 2px; }
.ico-gear::before { inset: 3px; border: 3px dotted currentColor; border-radius: 50%; }
.ico-gear::after { inset: 7px; border: 3px solid currentColor; border-radius: 50%; }
.ico-sound::before { left: 2px; top: 7px; width: 6px; height: 8px; background: currentColor; border-radius: 1px; box-shadow: 4px 0 0 0 currentColor; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
.ico-sound::after { left: 10px; top: 3px; width: 10px; height: 16px; border: 3px solid currentColor; border-left: 0; border-radius: 0 12px 12px 0; }
body.muted .ico-sound::after { border: 0; width: 14px; height: 3px; top: 10px; left: 8px; background: currentColor; transform: rotate(45deg); border-radius: 2px; box-shadow: none; }
.ico-modes::before { inset: 2px; background: conic-gradient(#7cf7ff 0 25%, #ff9ad8 0 50%, #ffe27a 0 75%, #8affdf 0); border-radius: 6px; }
.ico-daily::before { inset: 3px 2px 2px; border: 3px solid currentColor; border-radius: 4px; border-top-width: 6px; }
.ico-themes::before { inset: 2px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ff9ad8 0 22%, transparent 23%), radial-gradient(circle at 70% 35%, #7cf7ff 0 20%, transparent 21%), radial-gradient(circle at 45% 72%, #ffe27a 0 20%, transparent 21%), rgba(255,255,255,0.25); }
.ico-trophy::before { left: 4px; right: 4px; top: 2px; height: 12px; border: 3px solid var(--gold); border-top-width: 3px; border-radius: 0 0 8px 8px; }
.ico-trophy::after { left: 8px; right: 8px; bottom: 2px; height: 4px; background: var(--gold); border-radius: 2px; }
.ico-stats::before { left: 3px; bottom: 3px; width: 4px; height: 8px; background: currentColor; box-shadow: 6px -5px 0 0 currentColor, 12px -10px 0 0 currentColor; border-radius: 2px; }
.coin-icon { width: 18px; height: 18px; border-radius: 50%; display: inline-block; background: radial-gradient(circle at 35% 30%, #fff6c2, #ffd36b 45%, #e09a1a); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2), 0 0 10px rgba(255, 200, 80, 0.5); vertical-align: -3px; }

/* ---------- wordmark ---------- */
.wordmark { display: flex; align-items: center; gap: 14px; justify-content: center; }
h1.wordmark { margin: 0; font-size: inherit; font-weight: inherit; line-height: inherit; }
.wordmark svg { width: 54px; height: 54px; filter: drop-shadow(0 0 14px rgba(140, 120, 255, 0.7)); }
.wordmark .word { font-size: clamp(38px, 9vw, 64px); font-weight: 900; letter-spacing: -0.02em; background: linear-gradient(120deg, #9ff3ff 0%, #c9a6ff 40%, #ff9ad8 75%, #ffe27a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 18px rgba(150, 100, 255, 0.45)); }

/* ---------- welcome ---------- */
.welcome { align-items: center; justify-content: center; cursor: pointer; }
.welcome-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.mark-anim { display: grid; grid-template-columns: repeat(2, 54px); gap: 8px; }
.mark-anim i { width: 54px; height: 54px; border-radius: 13px; animation: pulse 2.4s ease-in-out infinite; box-shadow: inset 0 6px 10px rgba(255,255,255,0.35), 0 8px 22px rgba(0,0,0,0.35); }
.mark-anim i:nth-child(1) { background: linear-gradient(#6ff3ff, #1f8fff); }
.mark-anim i:nth-child(2) { background: linear-gradient(#ff9ad8, #c43cff); animation-delay: .3s; }
.mark-anim i:nth-child(3) { background: linear-gradient(#ffe27a, #ff8830); animation-delay: .6s; }
.mark-anim i:nth-child(4) { background: linear-gradient(#a8ff8a, #26c478); animation-delay: .9s; }
@keyframes pulse { 0%, 100% { transform: translateY(0) scale(1); filter: brightness(1); } 50% { transform: translateY(-6px) scale(1.05); filter: brightness(1.2); } }
.tap-hint { color: var(--muted); font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; font-size: 13px; animation: blink 1.8s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* ---------- menu ---------- */
.menu-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.level-badge { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 16px; min-width: 150px; }
.lvl-label { font-size: 11px; font-weight: 800; color: var(--muted); }
.lvl { font-size: 20px; font-weight: 900; }
.xp { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.12); border-radius: 6px; overflow: hidden; min-width: 70px; }
.xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7cf7ff, #c9a6ff); border-radius: 6px; transition: width 400ms ease; }
.coins { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.menu-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; width: min(460px, 100%); margin: 0 auto; }
.btn-play { width: 100%; padding: 18px; border-radius: 22px; font-size: 26px; font-weight: 900; flex-direction: column; gap: 2px; }
.btn-play small { font-size: 13px; font-weight: 700; opacity: 0.85; }
.btn-reward { width: 100%; border-radius: 16px; color: var(--muted); }
.btn-reward.claimable { color: #fff; background: linear-gradient(135deg, rgba(255, 211, 107, 0.35), rgba(255, 111, 200, 0.3)); border-color: rgba(255, 211, 107, 0.7); animation: glowPulse 1.8s ease-in-out infinite; }
@keyframes glowPulse { 50% { box-shadow: 0 0 26px rgba(255, 211, 107, 0.55); } }
.gift { width: 18px; height: 16px; border-radius: 4px; background: linear-gradient(90deg, transparent 42%, #fff 42% 58%, transparent 58%), linear-gradient(#ff6fc8, #c43cff); display: inline-block; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.tile { flex-direction: column; gap: 6px; padding: 14px 6px; border-radius: 18px; font-size: 14px; background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.no-save { color: var(--muted); font-size: 12px; text-align: center; max-width: 340px; }

/* ---------- secondary screens ---------- */
.sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { margin: 0; font-size: 22px; font-weight: 900; flex: 1; text-align: center; }
.spacer { min-width: 46px; text-align: end; color: var(--muted); font-weight: 700; }
.coins-mini { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.sec-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; width: min(760px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; }
.fine { color: var(--muted); font-size: 12px; text-align: center; }
.list { padding: 6px 16px; }
.setting { display: flex; align-items: center; justify-content: space-between; min-height: 58px; border-bottom: 1px solid var(--glass-border); font-weight: 700; }
.setting:last-child { border-bottom: 0; }
.toggle { width: 60px; height: 44px; border-radius: 22px; padding: 0; position: relative; background: rgba(255, 255, 255, 0.12); }
.toggle i { position: absolute; top: 9px; left: 8px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform 180ms ease; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.toggle[aria-pressed="true"] { background: linear-gradient(135deg, #8f6bff, #ff6fc8); }
.toggle[aria-pressed="true"] i { transform: translateX(18px); }
.toggle:hover { transform: none; }

.mode-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mode-card { position: relative; flex-direction: column; align-items: flex-start; text-align: left; padding: 18px; border-radius: 20px; gap: 6px; min-height: 130px; background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.mode-card h3 { margin: 0; font-size: 20px; font-weight: 900; }
.mode-card p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.mode-card .mode-best { margin-top: auto; font-size: 13px; color: var(--muted); }
.mode-card .mode-best b { color: var(--text); font-variant-numeric: tabular-nums; }
.mode-card::after { content: ""; position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 10px; opacity: 0.9; }
.mode-card[data-mode="classic"]::after, .help-mode[data-mode="classic"] i { background: linear-gradient(#6ff3ff, #1f8fff); }
.mode-card[data-mode="timeAttack"]::after, .help-mode[data-mode="timeAttack"] i { background: linear-gradient(#ffe27a, #ff8830); border-radius: 50%; }
.mode-card[data-mode="challenge"]::after, .help-mode[data-mode="challenge"] i { background: linear-gradient(#ff9ad8, #c43cff); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.mode-card[data-mode="daily"]::after, .help-mode[data-mode="daily"] i { background: linear-gradient(#a8ff8a, #26c478); }
.resume-tag { position: absolute; right: 60px; top: 20px; font-size: 11px; font-weight: 900; letter-spacing: 0.08em; padding: 4px 8px; border-radius: 8px; background: rgba(94, 240, 165, 0.2); color: var(--good); }
.level-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.level-item { flex-direction: column; align-items: flex-start; text-align: left; border-radius: 16px; padding: 14px; gap: 4px; }
.level-item b { font-size: 18px; }
.level-item .objective { color: var(--muted); font-size: 12px; font-weight: 600; }
.level-item.done b::after { content: " ✓"; color: var(--good); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-content: start; }
.stat-card { padding: 16px; }
.stat-card h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat-card dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.stat-card dd { margin: 0; font-weight: 800; text-align: end; font-variant-numeric: tabular-nums; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-content: start; }
.ach { display: flex; gap: 12px; align-items: center; padding: 12px; }
.ach .medal { width: 42px; height: 42px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #fff6c2, #ffd36b 45%, #e09a1a); box-shadow: 0 0 16px rgba(255, 200, 80, 0.5); }
.ach.locked { opacity: 0.55; }
.ach.locked .medal { background: rgba(255, 255, 255, 0.12); box-shadow: none; }
.ach h4 { margin: 0; font-size: 15px; }
.ach p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.tab[aria-pressed="true"] { background: linear-gradient(135deg, #8f6bff, #ff6fc8); color: #fff; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; }
.theme-item { padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.theme-item canvas { width: 100%; aspect-ratio: 1; border-radius: 14px; }
.theme-item h4 { margin: 0; font-size: 15px; }
.theme-item .state { font-size: 12px; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
.theme-item .equipped { color: var(--good); font-weight: 800; }

.daily-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
.daily-date { font-size: 15px; color: var(--muted); font-weight: 700; }
.daily-target { font-size: 22px; font-weight: 800; }
.daily-status { font-weight: 800; color: var(--good); min-height: 20px; }
.daily-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.daily-stats div { display: flex; flex-direction: column; gap: 4px; }
.daily-stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 800; }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; width: 100%; }
.day-dot { aspect-ratio: 1; border-radius: 6px; background: rgba(255, 255, 255, 0.1); }
.day-dot.done { background: linear-gradient(#a8ff8a, #26c478); box-shadow: 0 0 8px rgba(94, 240, 165, 0.5); }
.day-dot.today { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 1px; }

/* ---------- game HUD ---------- */
.hud-top { position: absolute; top: calc(var(--safe-top) + 10px); left: calc(var(--safe-left) + 10px); right: calc(var(--safe-right) + 10px); display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 18px; max-width: 720px; margin: 0 auto; }
.score-block, .best-block { display: flex; flex-direction: column; align-items: center; flex: 1; line-height: 1.05; }
.score { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.best { font-size: 18px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.hud-strip { position: absolute; left: 0; right: 0; top: calc(var(--safe-top) + 76px); display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 36px; flex-wrap: wrap; padding: 0 12px; }
.hud-bottom { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 10px); display: flex; justify-content: center; }
.side { position: absolute; top: 50%; transform: translateY(-50%); width: 220px; padding: 16px; display: none; flex-direction: column; gap: 14px; }
.side-left { left: calc(var(--safe-left) + 20px); }
.side-right { right: calc(var(--safe-right) + 20px); }
body.wide .side { display: flex; }
body.wide .hud-strip, body.wide .hud-bottom { display: none; }
body.wide .side-right.compact { display: none; }
.side-mode { font-size: 13px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.side .best-block { align-items: flex-start; }
.combo-ind { padding: 6px 14px; border-radius: 999px; font-weight: 900; background: linear-gradient(135deg, rgba(255, 111, 200, 0.35), rgba(143, 107, 255, 0.35)); border: 1px solid rgba(255, 154, 216, 0.6); box-shadow: 0 0 18px rgba(255, 111, 200, 0.4); animation: comboPop 300ms cubic-bezier(.2, 1.6, .4, 1); }
@keyframes comboPop { from { transform: scale(0.6); } to { transform: scale(1); } }
.timer { display: flex; align-items: center; gap: 10px; font-weight: 900; font-variant-numeric: tabular-nums; font-size: 20px; }
.timer-track { width: 140px; height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.timer-track i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ffe27a, #ff8830); border-radius: 6px; transition: width 120ms linear; }
.timer.low { color: #ff8a9a; }
.timer.low .timer-track i { background: linear-gradient(90deg, #ff5b7a, #ff2d55); }
.objective, .target { padding: 6px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-border); font-weight: 700; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.obj-progress { color: var(--gold); font-variant-numeric: tabular-nums; }
.target-done { color: var(--good); font-weight: 900; }
.powerbar { display: flex; gap: 8px; padding: 6px; border-radius: 20px; background: var(--glass); border: 1px solid var(--glass-border); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.side .powerbar { flex-direction: column; background: transparent; border: 0; padding: 0; }
.power { position: relative; width: 58px; height: 54px; padding: 0; border-radius: 14px; flex-direction: column; gap: 0; font-size: 11px; }
.side .power { width: 100%; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 12px; font-size: 14px; }
.power .pi { width: 24px; height: 24px; border-radius: 7px; }
.power[data-power="hammer"] .pi, .help-pu[data-power="hammer"] .pi { background: linear-gradient(135deg, #ffd36b, #ff8830); clip-path: polygon(0 20%, 70% 20%, 70% 0, 100% 0, 100% 45%, 70% 45%, 70% 30%, 45% 30%, 45% 100%, 25% 100%, 25% 30%, 0 30%); }
.power[data-power="row"] .pi, .help-pu[data-power="row"] .pi { background: linear-gradient(90deg, #7cf7ff, #1f8fff); height: 10px; margin: 7px 0; }
.power[data-power="col"] .pi, .help-pu[data-power="col"] .pi { background: linear-gradient(#ff9ad8, #c43cff); width: 10px; margin: 0 7px; }
.power[data-power="shuffle"] .pi, .help-pu[data-power="shuffle"] .pi { background: conic-gradient(#a8ff8a, #7cf7ff, #c9a6ff, #ff9ad8, #a8ff8a); border-radius: 50%; }
.power[data-power="undo"] .pi, .help-pu[data-power="undo"] .pi { border: 4px solid #c9a6ff; border-right-color: transparent; border-radius: 50%; }
.power .badge { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; border-radius: 11px; font-size: 12px; font-weight: 900; background: #fff; color: #2a1b66; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.side .power .badge { position: static; margin-inline-start: auto; }
.power .badge.price { background: linear-gradient(135deg, #ffe27a, #ffb030); color: #3a2400; }
.power.active { outline: 2px solid #fff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
.targeting-hint { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 120px); padding: 8px 16px; border-radius: 999px; background: var(--glass-solid); border: 1px solid var(--glass-border); font-weight: 800; font-size: 14px; pointer-events: none; }

/* ---------- overlays ---------- */
.panel { width: min(400px, 100%); padding: 26px 22px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.panel h2 { margin: 0 0 8px; font-size: 28px; font-weight: 900; }
.panel > .btn { width: 100%; }
.over-panel { gap: 10px; }
.screen.overlay.enter .panel { animation: overIn 520ms cubic-bezier(.2, 1.4, .4, 1); }
@keyframes overIn { from { transform: translateY(30px) scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.new-best { align-self: center; padding: 4px 14px; border-radius: 999px; font-weight: 900; color: #3a2400; background: linear-gradient(135deg, #fff2a8, #ffc23a); box-shadow: 0 0 22px rgba(255, 200, 80, 0.6); animation: comboPop 500ms cubic-bezier(.2, 1.6, .4, 1); }
.over-score { font-size: 56px; font-weight: 900; font-variant-numeric: tabular-nums; background: linear-gradient(120deg, #9ff3ff, #ff9ad8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.over-best { color: var(--muted); font-weight: 700; }
.over-best b { color: var(--gold); }
.breakdown { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.breakdown li { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.breakdown b { font-variant-numeric: tabular-nums; }
.earned { display: flex; justify-content: center; gap: 20px; font-weight: 800; }
.levelup { font-weight: 900; color: var(--good); }

/* @spec UI-010 */
.dialog-wrap { position: fixed; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; background: rgba(10, 6, 30, 0.5); padding: 20px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.dialog { width: min(380px, 100%); padding: 22px; display: flex; flex-direction: column; gap: 10px; text-align: center; animation: overIn 300ms cubic-bezier(.2, 1.4, .4, 1); }
.dialog h3 { margin: 0; font-size: 20px; }
.dialog p { margin: 0; color: var(--muted); }
.dialog .row .btn { flex: 1; }
.stuck-options { display: flex; flex-direction: column; gap: 8px; }
.stuck-options .btn { justify-content: space-between; }

.toasts { position: fixed; z-index: 9; top: calc(var(--safe-top) + 10px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100% - 24px)); pointer-events: none; }
.toast { pointer-events: none; padding: 10px 14px; border-radius: 16px; background: var(--glass-solid); border: 1px solid rgba(255, 211, 107, 0.5); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 20px rgba(255, 200, 80, 0.25); display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; animation: toastIn 300ms cubic-bezier(.2, 1.4, .4, 1); }
.toast.out { animation: toastOut 250ms ease forwards; }
.toast .medal { width: 28px; height: 28px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #fff6c2, #ffd36b 45%, #e09a1a); }
@keyframes toastIn { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }

@media (max-height: 640px) { .hud-strip { top: calc(var(--safe-top) + 66px); } .score { font-size: 24px; } .menu-center { gap: 10px; } .btn-play { padding: 12px; font-size: 22px; } }
/* @spec UI-012: decorative loops run only on the screen being shown */
.screen:not(.active), .screen:not(.active) * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) { .blob, .mark-anim i, .tap-hint { animation: none; } }

/* ---------- how to play ---------- */
.help-open { width: 100%; }
.help-skip { padding: 0 16px; }
.help-body { align-items: stretch; }
.help-pages { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.help-page { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 22px 20px 24px; border-radius: 22px; }
.help-page[hidden] { display: none; }
.help-page h3 { margin: 6px 0 0; font-size: 22px; font-weight: 900; }
.help-page p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; max-width: 460px; }
.help-nav { display: flex; align-items: center; gap: 10px; }
.help-nav .btn { flex: 1; }
.help-dots { display: flex; gap: 7px; justify-content: center; }
.help-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); transition: transform 0.2s, background 0.2s; }
.help-dot.current { background: #c9a6ff; transform: scale(1.35); }

.help-art { position: relative; min-height: 150px; display: flex; align-items: center; justify-content: center; gap: 18px; }
.mini { --cell: 22px; display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell); gap: 3px;
  padding: 6px; border-radius: 12px; background: rgba(20, 16, 60, 0.6); border: 1px solid rgba(160, 140, 255, 0.25); }
.mini i { border-radius: 5px; background: rgba(90, 80, 170, 0.25); }
.mini b { border-radius: 5px; background: linear-gradient(var(--t), var(--b)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), inset 0 -3px 4px rgba(0, 0, 0, 0.18); }
.mini .c0 { --t: #6ff3ff; --b: #1f8fff; } .mini .c1 { --t: #c79bff; --b: #7b3dff; } .mini .c2 { --t: #ff9ad8; --b: #ff3d9a; } .mini .c3 { --t: #ffe27a; --b: #ffa21f; }
.mini .c4 { --t: #a8ff8a; --b: #2fcf5f; } .mini .c5 { --t: #ffad8a; --b: #ff5a3d; } .mini .c6 { --t: #8ad6ff; --b: #3d6bff; } .mini .c7 { --t: #8affdf; --b: #1fbf9c; }
.mini.overlay { position: absolute; background: transparent; border-color: transparent; }
.mini.overlay .ghost { background: transparent; }

/* The resting (non-animated) state of every illustration is its final, complete frame. */
.art-drag .mover { animation: help-drag 3.2s ease-in-out infinite; }
@keyframes help-drag { 0% { transform: translate(30px, 95px) scale(0.6); opacity: 0; } 12% { opacity: 1; } 45%, 100% { transform: none; opacity: 1; } }
.art-clear .drop b { animation: help-drop 3.2s ease-in infinite; }
@keyframes help-drop { 0% { transform: translateY(-60px); opacity: 0; } 25% { transform: none; opacity: 1; } 100% { transform: none; } }
.art-clear .clr, .art-clear .drop b.clr, .art-clear .drop .c2 { animation-name: help-clear; animation-duration: 3.2s; animation-iteration-count: infinite; }
.art-clear .drop .c2 { animation-name: help-drop-clear; }
@keyframes help-clear { 0%, 30% { filter: none; opacity: 1; } 40% { filter: brightness(2.4); box-shadow: 0 0 14px #fff; } 55%, 85% { opacity: 0; transform: scale(0.4); } 100% { opacity: 1; transform: none; } }
@keyframes help-drop-clear { 0% { transform: translateY(-60px); opacity: 0; } 25%, 30% { transform: none; opacity: 1; filter: none; } 40% { filter: brightness(2.4); } 55%, 85% { opacity: 0; transform: scale(0.4); } 100% { opacity: 0; } }
.art-combo .flash1 { animation: help-flash1 3.6s infinite; }
.art-combo .flash2 { animation: help-flash2 3.6s infinite; }
@keyframes help-flash1 { 0%, 10% { opacity: 1; filter: none; } 18% { filter: brightness(2.4); } 28%, 100% { opacity: 0.15; filter: none; } }
@keyframes help-flash2 { 0%, 40% { opacity: 1; filter: none; } 48% { filter: brightness(2.4); } 58%, 100% { opacity: 0.15; filter: none; } }
.combo-badge { position: absolute; top: 6px; right: calc(50% - 120px); padding: 6px 12px; border-radius: 999px; font-weight: 900; font-size: 15px;
  color: #2a1050; background: linear-gradient(120deg, #ffe27a, #ff9ad8); box-shadow: 0 6px 18px rgba(255, 120, 200, 0.4); animation: help-badge 3.6s infinite; }
@keyframes help-badge { 0%, 45% { transform: scale(0); } 55% { transform: scale(1.25); } 62%, 100% { transform: scale(1); } }
.stuck-piece { position: relative; }
.stuck-piece .piece { background: transparent; border-color: transparent; animation: help-shake 2.4s infinite; }
.nofit { position: absolute; right: -8px; top: -10px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #ff4f6d; color: #fff; font-weight: 900; font-size: 14px; box-shadow: 0 4px 12px rgba(255, 79, 109, 0.5); }
@keyframes help-shake { 0%, 60%, 100% { transform: none; } 66% { transform: translateX(-6px); } 72% { transform: translateX(6px); } 78% { transform: translateX(-4px); } 84% { transform: translateX(4px); } }
.art-powers, .art-modes { flex-wrap: wrap; gap: 8px; }
.help-pu, .help-mode { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 50px; font-size: 12px; font-weight: 800; color: var(--text); }
.help-pu .pi { display: block; width: 26px; height: 26px; border-radius: 7px; }
.help-mode i { display: block; width: 34px; height: 34px; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { .help-art, .help-art * { animation: none !important; } }

/* ---------- install card ---------- */
.install-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 8px 8px 12px; border-radius: 18px; }
.install-card[hidden] { display: none; }
.install-card p { flex: 1; margin: 0; font-size: 13px; font-weight: 700; line-height: 1.3; text-align: start; }
.install-card .btn-primary { padding: 0 16px; }
.install-close { font-size: 16px; color: var(--muted); }
.install-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #6ff3ff 0 48%, transparent 48% 52%, #ff9ad8 52%);
  box-shadow: 0 0 12px rgba(140, 120, 255, 0.5); }

/* ---------- Localization (I18N) ---------- */
/* Language list */
.lang-btn { gap: 8px; padding: 0 12px; font-weight: 700; max-width: 60%; }
.lang-btn .chev { color: var(--muted); font-size: 20px; line-height: 1; }
[dir="rtl"] .lang-btn .chev { transform: scaleX(-1); }
.lang-list { padding: 6px 10px; display: flex; flex-direction: column; }
.lang-item { justify-content: space-between; min-height: 52px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--glass-border); border-radius: 0; background: transparent; font-weight: 700; font-size: 16px; text-align: start; }
.lang-item:last-child { border-bottom: 0; }
.lang-item .check { opacity: 0; color: #c9a6ff; font-weight: 900; }
.lang-item[aria-pressed="true"] .check { opacity: 1; }
.lang-item:hover { transform: none; background: rgba(255, 255, 255, 0.06); }
/* Longer translations wrap instead of overflowing */
.btn, .tile, .setting > span:first-child { overflow-wrap: anywhere; }
.tile span { line-height: 1.15; text-align: center; }
.power .pn { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* @spec I18N-RTL-001: the playing field and numbers keep left-to-right layout */
#stage, .powerbar, .hud-bottom, [data-bind="score"], [data-bind="best"], [data-bind="timer"], .timer, .over-score, .obj-progress { direction: ltr; }
[data-bind="score"], [data-bind="best"], [data-bind="timer"], .over-score, .obj-progress { unicode-bidi: isolate; }
[dir="rtl"] .ico-back { transform: scaleX(-1); }
/* Scripts where spacing letters apart breaks words or joins */
html:is([lang="ar"], [lang="fa"], [lang="hi"], [lang="bn"], [lang="th"]) .label,
html:is([lang="ar"], [lang="fa"], [lang="hi"], [lang="bn"], [lang="th"]) .tap-hint,
html:is([lang="ar"], [lang="fa"], [lang="hi"], [lang="bn"], [lang="th"]) .side-mode,
html:is([lang="ar"], [lang="fa"], [lang="hi"], [lang="bn"], [lang="th"]) .stat-card h3 { letter-spacing: normal; }
html:is([lang="hi"], [lang="bn"], [lang="th"]) body { line-height: 1.45; }
