:root {
  color-scheme: dark;
  --ink: #f5f4ff; --muted: #b9b6da; --cyan: #7ce9ff; --gold: #ffd35c; --pink: #ff79e5; --green: #5eeab4; --violet: #b191ff; --red: #ff5d73;
  --line: #ffffff22; --panel: #221c46; --panel-2: #2d2557; --glass: #1a153ab8;
  font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: radial-gradient(ellipse at 15% 20%,#4a3a8a99,transparent 60%),radial-gradient(ellipse at 90% 80%,#173f6d,transparent 60%),linear-gradient(#141238,#0b0a1f 70%); color: var(--ink); }
.ambient { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: 0; transition: opacity .8s ease; }
body[data-screen="menu"] .ambient, body[data-screen="progress"] .ambient, body[data-screen="leaderboard"] .ambient { opacity: 1; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; color: inherit; border: 1px solid var(--line); transition: transform .15s ease, box-shadow .2s ease, filter .2s ease; }
button:active { transform: scale(.96); }
button:focus-visible, a:focus-visible, canvas:focus-visible, input:focus-visible { outline: 3px solid var(--cyan); outline-offset: -3px; }
button:disabled { cursor: default; opacity: .45; }
svg { fill: none; flex: 0 0 auto; }
[hidden] { display: none !important; }
.shell {
  position: relative; z-index: 1; width: 100%; height: 100vh; height: 100dvh; height: var(--app-height,100dvh);
  padding: env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);
  display: flex; flex-direction: column; overflow: hidden;
}
.top { flex: 0 0 52px; min-height: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; gap: 8px; }
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 8px; font-weight: 900; letter-spacing: .06em; font-size: 13px; white-space: nowrap; }
.brand b { color: var(--cyan); }.brand img { width: 30px; height: 30px; transition: transform .3s ease; }.brand:hover img { transform: rotate(-12deg) scale(1.08); }
.stage-label { color: #aca3d0; font-size: 9px; letter-spacing: .18em; }
.round-button { width: 44px; height: 44px; border-radius: 50%; background: #ffffff10; display: grid; place-items: center; color: white; }
.round-button:hover { background: #ffffff22; }
.screen { display: none; flex: 1 1 0; min-height: 0; min-width: 0; }
body[data-screen="menu"] #menu { display: flex; }
body[data-screen="game"] #game { display: grid; }
body[data-screen="progress"] #progress-screen, body[data-screen="leaderboard"] #leaderboard-screen { display: flex; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .16em; color: var(--cyan); margin: 0; display: inline-flex; align-items: center; gap: 6px; }

/* ── Menu ─────────────────────────────────────────────────────────────── */
.menu { justify-content: center; align-items: center; padding: 8px 20px 16px; }
.hero { width: min(100%,520px); max-height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes float { 50% { transform: translateY(-8px) rotate(-6deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 50% { transform: scale(1.5); opacity: .6; } }
@keyframes shimmer { to { background-position: 200% center; } }
@keyframes sheen { 0%, 60% { transform: translateX(-140%) skewX(-20deg); } 100% { transform: translateX(240%) skewX(-20deg); } }
@keyframes breathe { 50% { box-shadow: 0 6px 0 #366c61, 0 14px 40px #6cf0b366; } }
.hero > * { animation: rise .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i,0) * 70ms + 40ms); }
.hero-mark { --i: 0; position: relative; height: 104px; width: 130px; display: grid; place-items: center; }
.hero-mark img { filter: drop-shadow(0 12px 28px #68caff88); transform: rotate(-9deg); animation: float 3.4s ease-in-out infinite; }
.orbit { position: absolute; inset: 4px 15px; border-radius: 50%; border: 1px dashed #7ce9ff33; animation: spin 14s linear infinite; }
.orbit i { position: absolute; width: 12px; height: 12px; border-radius: 4px; background: #fc94c1; box-shadow: 0 0 18px #fc94c1aa; top: -6px; left: 50%; animation: twinkle 2.4s ease-in-out infinite; }
.orbit i:nth-child(2) { background: var(--cyan); box-shadow: 0 0 18px var(--cyan); top: 60%; left: -6px; animation-delay: .8s; }
.orbit i:nth-child(3) { background: var(--gold); box-shadow: 0 0 14px var(--gold); width: 8px; height: 8px; top: 78%; left: auto; right: -2px; animation-delay: 1.6s; }
.hero > .eyebrow { --i: 1; }
.hero h1 { --i: 2; font-size: clamp(36px,7vw,64px); line-height: 1; margin: 0; letter-spacing: -.045em; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg,#7ce9ff,#c8f7ff 40%,#7ce9ff 60%,#b191ff); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 4s linear infinite; }
.intro { --i: 3; color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.play-button { --i: 4; position: relative; overflow: hidden; width: 100%; min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 10px 22px; border-radius: 24px; color: #14283a; background: linear-gradient(160deg,#d5ffbc,#82e8bd); border: 2px solid #e8ffd4; box-shadow: 0 6px 0 #366c61,0 14px 32px #0004; animation: rise .55s cubic-bezier(.2,.8,.2,1) both, breathe 3s ease-in-out 1s infinite; }
.play-button::after { content: ""; position: absolute; top: -20%; bottom: -20%; width: 34%; background: linear-gradient(90deg,transparent,#ffffff77,transparent); animation: sheen 3.6s ease-in-out infinite; pointer-events: none; }
.play-button:hover { transform: translateY(-2px); filter: brightness(1.04); }.play-button:active { transform: translateY(2px) scale(.99); box-shadow: 0 2px 0 #366c61; }
.play-button strong { font-size: 27px; }.play-button small { display: block; font-size: 12px; margin-top: 3px; font-weight: 600; }
.play-icon, .play-arrow { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #14283a18; }
.menu-grid { --i: 5; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 8px; }
.mode { --accent: var(--cyan); position: relative; min-height: 78px; border-radius: 19px; padding: 12px 12px 12px 14px; background: linear-gradient(150deg,#463b6c,#241d47); box-shadow: 0 4px 0 #0d0b24, inset 0 1px 0 #ffffff18; text-align: left; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; animation: rise .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i,0) * 70ms + 40ms); overflow: hidden; }
.mode::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 55%); opacity: .7; transition: opacity .25s; }
.mode:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #0d0b24, 0 12px 30px #0006; }.mode:hover::before { opacity: 1; }.mode:hover .mode-icon { transform: rotate(-10deg) scale(1.12); }
.mode-icon { grid-row: span 2; color: var(--accent); transition: transform .3s cubic-bezier(.3,1.5,.5,1); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 70%, transparent)); }
.mode strong, .mode span { display: block; position: relative; }.mode strong { font-size: 15px; }.mode span { font-size: 11px; color: var(--muted); }
.mode-campaign { --accent: var(--gold); }.mode-daily { --accent: var(--cyan); }.mode-endless { --accent: var(--pink); }.mode-board { --accent: var(--green); }
.mode.done span { color: var(--green); }
.menu-tools { --i: 6; display: flex; gap: 8px; align-items: center; justify-content: center; width: 100%; }
.menu-tools button, .menu-tools a { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; color: var(--muted); min-height: 44px; padding: 10px 6px; font-size: 12px; text-decoration: none; transition: color .2s; }
.menu-tools button:hover, .menu-tools a:hover { color: white; }

/* ── Game ─────────────────────────────────────────────────────────────── */
.game { grid-template-columns: 250px minmax(0,1fr) 230px; grid-template-rows: minmax(0,1fr) 76px; gap: 0 20px; padding: 0 24px; }
.hud-panel { align-self: center; min-width: 0; background: var(--glass); border: 1px solid var(--line); border-radius: 26px; padding: 18px; backdrop-filter: blur(10px); }
.level-heading h2 { font-size: 22px; margin: 5px 0 14px; }.hud-stats { display: grid; grid-template-columns: 66px 1fr; gap: 12px; align-items: center; }
.hud-stats small { display: block; font-size: 9px; letter-spacing: .12em; color: var(--muted); }.hud-stats b { font-size: 23px; display: block; font-variant-numeric: tabular-nums; }
.moves-stat { border: 2px solid #ffd9fb; border-radius: 22px; text-align: center; background: linear-gradient(140deg,#b262c0,#6a3f9c); padding: 8px; box-shadow: 0 4px 0 #311e5a, 0 0 24px #b262c055; transition: box-shadow .3s; }
.moves-stat b { font-size: 30px; line-height: 1.1; }.moves-stat small { color: white; }.combo-stat { grid-column: span 2; }
@keyframes bump { 30% { transform: scale(1.18); } }
@keyframes alarm { 50% { box-shadow: 0 4px 0 #5a1e2e, 0 0 30px #ff5d73aa; border-color: #ffb3c0; } }
.moves-stat.bump b { animation: bump .35s ease; display: block; }
.moves-stat.low { background: linear-gradient(140deg,#d2496a,#8a2f52); animation: alarm 1s ease-in-out infinite; }
.combo-stat b { transition: color .2s; }.combo-stat.hot b { color: var(--gold); text-shadow: 0 0 14px var(--gold); }.combo-stat.bump b { animation: bump .4s ease; display: inline-block; }
.score-track { position: relative; margin-top: 6px; padding-top: 10px; }
.score-track progress { width: 100%; height: 6px; accent-color: var(--gold); display: block; border-radius: 3px; overflow: hidden; }
.star-marks { position: absolute; left: 0; right: 0; top: 0; height: 12px; pointer-events: none; }
.star-marks svg { position: absolute; top: -3px; width: 13px; height: 13px; margin-left: -6px; color: #ffffff3a; transition: color .3s, transform .3s; }
.star-marks svg.lit { color: var(--gold); filter: drop-shadow(0 0 6px var(--gold)); animation: bump .5s ease; }
.goals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.goal { flex: 1 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #08072366; padding: 5px 10px 5px 5px; border: 1px solid #ffffff15; border-radius: 14px; font-size: 12px; transition: background .3s, border-color .3s; }
.goal b { display: flex; align-items: center; gap: 5px; }.goal canvas { width: 30px; height: 30px; display: block; }
.goal span { color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal.bump { animation: bump .35s ease; }
.goal.done { background: #2b7c5c55; border-color: #95f4bb; }.goal.done span { color: #baffcf; display: inline-flex; align-items: center; gap: 4px; }
.board-wrap { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; align-self: stretch; overflow: hidden; }
.board-aura { position: absolute; inset: 8% 0; background: radial-gradient(ellipse,#826bed3a,transparent 70%); pointer-events: none; }
#board { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-5px,3px); } 40% { transform: translate(5px,-3px); } 60% { transform: translate(-4px,-2px); } 80% { transform: translate(3px,2px); } }
.board-wrap.shake { animation: shake .4s ease; }
.banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; opacity: 0; font-weight: 900; font-size: clamp(26px,6vw,44px); letter-spacing: -.02em; color: white; text-shadow: 0 4px 18px #0009, 0 0 24px var(--banner-glow,#7ce9ff); }
.banner b { display: block; font-size: .42em; letter-spacing: .3em; color: var(--banner-glow,#7ce9ff); }
@keyframes bannerIn { 0% { opacity: 0; transform: scale(.4) rotate(-6deg); } 18% { opacity: 1; transform: scale(1.08) rotate(1deg); } 30% { transform: scale(1); } 75% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-30px) scale(1.05); } }
.banner.show { animation: bannerIn 1.1s cubic-bezier(.2,.8,.2,1) forwards; }
.level-intro { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(88%,360px); background: #16123bf0; border: 1px solid #b2a2d855; border-radius: 24px; padding: 18px 20px; text-align: center; box-shadow: 0 24px 70px #000a; pointer-events: none; }
.level-intro h3 { margin: 6px 0 4px; font-size: 26px; }.level-intro p { margin: 0; color: var(--muted); font-size: 13px; }
.intro-goals { display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.intro-goals span { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--gold); font-size: 14px; }.intro-goals canvas { width: 34px; height: 34px; }
@keyframes introIn { from { opacity: 0; transform: translate(-50%,-50%) scale(.7); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
@keyframes introOut { to { opacity: 0; transform: translate(-50%,-60%) scale(.92); } }
.level-intro.show { animation: introIn .4s cubic-bezier(.3,1.4,.5,1) both; }.level-intro.leave { animation: introOut .35s ease forwards; }
.side-card { align-self: center; color: var(--muted); font-size: 14px; line-height: 1.7; }.side-card h2 { color: white; line-height: 1.3; }
.legend { display: grid; gap: 8px; color: var(--gold); }.legend span { display: flex; align-items: center; gap: 8px; }.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.game-dock { grid-column: 2; display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
.dock-button { flex: 0 0 60px; min-width: 44px; min-height: 56px; border-radius: 18px; background: linear-gradient(#454066,#282143); box-shadow: 0 3px 0 #0d0a21; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: white; }
.dock-button:hover { filter: brightness(1.15); }.dock-button small { display: block; font-size: 9px; color: #d7d0ed; }
.dock-button.pulse { animation: breathe-dock 1.2s ease-in-out infinite; }
@keyframes breathe-dock { 50% { box-shadow: 0 3px 0 #0d0a21, 0 0 22px var(--gold); } }
.feedback { flex: 1; max-width: 230px; text-align: center; font-size: 12px; color: var(--gold); min-width: 0; transition: transform .2s; }
.feedback.bump { animation: bump .3s ease; }

/* ── Lists ────────────────────────────────────────────────────────────── */
.screen-list { flex-direction: column; width: min(100%,940px); align-self: center; padding: 8px 18px 14px; }
.list-head { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.screen-list h1 { font-size: clamp(26px,4vw,44px); margin: 6px 0 4px; }.list-summary { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.list-subhead { font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.list-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 4px 12px; }
.level-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 10px; }
.level-card { --i: 0; min-height: 88px; border-radius: 18px; padding: 12px; text-align: left; background: linear-gradient(150deg,#3b3160,#221c46); display: grid; grid-template-columns: 36px 1fr; gap: 2px 8px; align-items: center; animation: rise .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 40ms); box-shadow: 0 3px 0 #0d0b24; }
.level-card:hover:not(:disabled) { transform: translateY(-2px); }
.level-card strong { color: var(--cyan); font-size: 24px; grid-row: span 2; }.level-card span { font-size: 13px; font-weight: 700; }
.level-card em { font-style: normal; display: flex; gap: 2px; align-items: center; font-size: 11px; color: var(--muted); }
.level-card em svg { width: 15px; height: 15px; color: #ffffff30; }.level-card em svg.lit { color: var(--gold); filter: drop-shadow(0 0 4px var(--gold)); }
.level-card.current { border-color: var(--gold); box-shadow: 0 3px 0 #0d0b24, 0 0 22px #ffd35c55; }
.level-card.locked strong { color: #ffffff40; }.level-card.locked svg.lock { color: #ffffff50; }
.achievements { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 8px; }
.ach { --i: 0; display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); font-size: 12px; animation: rise .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 40ms + 200ms); }
.ach i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #ffffff0c; color: #ffffff50; }
.ach b { display: block; color: #ffffffb0; }.ach.earned { color: var(--ink); border-color: #ffd35c66; background: #ffd35c12; }.ach.earned i { background: #ffd35c22; color: var(--gold); box-shadow: 0 0 16px #ffd35c66; }.ach.earned b { color: var(--gold); }
.board-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.board-tabs button { flex: 1 1 0; min-width: 0; padding: 8px 6px; min-height: 44px; border-radius: 15px; background: var(--panel); font-size: 12px; font-weight: 700; }
.board-tabs .active { color: #161132; background: var(--cyan); box-shadow: 0 0 18px #7ce9ff66; }
.leader-list .row { --i: 0; display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; background: var(--panel); border-radius: 14px; margin-bottom: 8px; animation: rise .4s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 30ms); }
.leader-list .row.me { background: linear-gradient(90deg,#2f6a5a,#221c46); border: 1px solid #95f4bb88; }
.leader-list .rank { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 900; background: #ffffff10; font-size: 13px; }
.rank.r1 { background: linear-gradient(#ffe8a3,#e0a41f); color: #4a3100; box-shadow: 0 0 14px #ffd35c88; }.rank.r2 { background: linear-gradient(#f4f4f4,#a9adb8); color: #2c2f38; }.rank.r3 { background: linear-gradient(#f5c29c,#b26a3a); color: #3e1f08; }
.leader-list .who { min-width: 0; }.leader-list .who b { display: block; overflow-wrap: anywhere; }.leader-list .who small { color: var(--muted); font-size: 11px; }
.leader-list .pts { color: var(--gold); font-weight: 900; font-variant-numeric: tabular-nums; text-align: right; }.leader-list .pts small { display: block; color: var(--muted); font-weight: 400; font-size: 10px; }
.leader-list p { color: var(--muted); }
.tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--cyan); font-size: 12px; letter-spacing: .08em; }
.board-me { flex: 0 0 auto; margin-top: 8px; padding: 10px 14px; border-radius: 14px; background: #1a153ad0; border: 1px solid #95f4bb55; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.board-me b { color: var(--green); }.board-me .code-row { flex: 1; }

/* ── Dialogs ──────────────────────────────────────────────────────────── */
dialog { width: min(92vw,460px); max-height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; border: 1px solid #b2a2d866; border-radius: 26px; padding: 24px; background: #221c46; color: var(--ink); box-shadow: 0 24px 90px #0008; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(30px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } }
dialog[open] { animation: sheetIn .35s cubic-bezier(.2,.9,.3,1.1); }
dialog::backdrop { background: #08051bb8; backdrop-filter: blur(10px); animation: fadeIn .3s ease; }
dialog h2 { font-size: 30px; margin: 10px 0 20px; }dialog p, dialog li { color: var(--muted); line-height: 1.6; }dialog li { margin-bottom: 10px; }dialog li b { color: var(--ink); }
.primary, .wide { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 12px; border-radius: 16px; margin-top: 10px; background: #44375e; }
.primary { background: linear-gradient(#acffd0,#7bd7b6); color: #17263c; font-weight: 800; border-color: #d6ffe8; box-shadow: 0 4px 0 #366c61; }
.primary:active { box-shadow: 0 1px 0 #366c61; }.wide:hover { background: #55467a; }.danger { color: #ffb3c0; background: transparent; border-color: #ff5d7344; font-size: 12px; min-height: 40px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; }
.name-field { display: flex; align-items: center; gap: 8px; width: 60%; }
input[type=text], input:not([type]) { min-width: 0; width: 100%; padding: 10px; background: #100e29; color: white; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.switch { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 14px; background: #3a325d; position: relative; cursor: pointer; transition: background .25s; margin: 0; flex: 0 0 auto; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: white; transition: transform .25s cubic-bezier(.3,1.4,.5,1); box-shadow: 0 2px 6px #0006; }
.switch:checked { background: var(--cyan); }.switch:checked::before { transform: translateX(20px); }
.device-box { margin: 14px 0 6px; padding: 14px; border-radius: 16px; background: #100e2999; border: 1px solid var(--line); }
.device-box p { font-size: 12px; margin: 6px 0 10px; }
.code-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.code-row code { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: .1em; padding: 10px; background: #0b0a1f; border-radius: 10px; color: var(--cyan); text-align: center; user-select: all; -webkit-user-select: all; }
.mini { min-height: 44px; min-width: 44px; padding: 8px 12px; border-radius: 12px; background: #44375e; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 700; }
.import-status { font-size: 12px; min-height: 1em; margin: 0; }.import-status.ok { color: var(--green); }.import-status.error { color: #ffb3c0; }
.help-modules { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 6px 0 14px; }
.help-modules div { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }.help-modules canvas { width: 40px; height: 40px; }

/* ── Result ───────────────────────────────────────────────────────────── */
.result { width: 100%; height: 100%; max-width: 100vw; max-height: 100vh; max-height: 100dvh; margin: 0; padding: 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; display: none; place-items: center; overflow: hidden; }
.result[open] { display: grid; animation: none; }
.result-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@keyframes resultIn { from { opacity: 0; transform: translateY(40px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes stampIn { from { opacity: 0; transform: scale(2.4) rotate(-8deg); } 60% { opacity: 1; transform: scale(.94) rotate(2deg); } to { transform: scale(1) rotate(-2deg); } }
@keyframes starPop { 0% { transform: scale(0) rotate(-40deg); } 60% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes glow { 50% { filter: drop-shadow(0 0 16px var(--gold)) brightness(1.2); } }
.result-card { position: relative; width: min(92vw,440px); max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; border: 1px solid #b2a2d866; border-radius: 28px; padding: 24px; background: linear-gradient(#2a2358,#1a153a); color: var(--ink); box-shadow: 0 24px 90px #000a; text-align: center; animation: resultIn .5s cubic-bezier(.2,.9,.3,1.15) both; }
.stamp { display: inline-block; margin: 0; padding: 6px 14px; border: 3px solid var(--green); border-radius: 10px; color: var(--green); font-weight: 900; letter-spacing: .2em; font-size: 12px; transform: rotate(-2deg); animation: stampIn .55s cubic-bezier(.2,.9,.3,1) .25s both; }
.result.lose .stamp { color: var(--red); border-color: var(--red); }
.result h2 { font-size: 30px; margin: 12px 0 6px; }
.result-stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; min-height: 60px; margin: 6px 0 2px; }
.result-stars .star { color: #ffffff22; transform: scale(.9); }
.result-stars .star.lit { color: var(--gold); animation: starPop .55s cubic-bezier(.3,1.4,.5,1) var(--d,0s) both, glow 2s ease-in-out calc(var(--d,0s) + .6s) infinite; }
.result-score-label { margin: 0; font-size: 10px; letter-spacing: .2em; color: var(--muted); }
.result-score { margin: 0 0 8px; font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.03em; background: linear-gradient(#fff,#ffd35c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 6px 0; }
.result-stats div { background: #ffffff0c; border-radius: 12px; padding: 8px 4px; }.result-stats b { display: block; font-size: 18px; }.result-stats small { font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.result-rank { margin: 10px 0 0; padding: 10px; border-radius: 12px; background: #2f6a5a55; border: 1px solid #95f4bb66; color: var(--ink); font-size: 14px; animation: rise .4s ease both; }
.result-rank b { color: var(--green); font-size: 18px; }.result-rank small { display: block; color: var(--muted); font-size: 11px; }
.result-name { margin: 10px 0 0; text-align: left; }.result-name label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.result-actions { margin-top: 8px; }
.result.lose .result-card { animation: resultIn .5s cubic-bezier(.2,.9,.3,1.15) both, shake .5s ease .5s; }
.splash.leaving { opacity: 0; transition: opacity .28s ease; pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: #1a153af0; border: 1px solid var(--line); padding: 10px 16px; border-radius: 14px; font-size: 13px; animation: rise .3s ease both; pointer-events: none; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media(max-width:1000px) {
  .game { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) 72px; padding: 0; gap: 0; }
  .hud-panel { align-self: stretch; padding: 2px 12px 8px; border: 0; border-radius: 0; background: linear-gradient(#201b4088,transparent); backdrop-filter: none; }
  .level-heading { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 4px; }.level-heading h2 { font-size: 12px; margin: 0; font-weight: 600; }.level-heading .eyebrow { font-size: 8px; }
  .hud-stats { grid-template-columns: 64px minmax(0,1fr) 64px; gap: 14px; max-width: 500px; margin: auto; }
  .moves-stat { padding: 4px; border-radius: 18px; }.moves-stat b { font-size: 28px; }.score-stat b { font-size: 24px; }.combo-stat { grid-column: auto; text-align: right; }.combo-stat b { font-size: 20px; }
  .goals { justify-content: center; margin: 8px auto 0; max-width: 580px; }.goal { flex: 0 1 auto; padding: 3px 10px 3px 3px; font-size: 11px; }.goal canvas { width: 28px; height: 28px; }
  .side-card { display: none; }.board-wrap { padding: 0 4px; }.game-dock { grid-column: 1; padding: 4px 12px 8px; gap: 8px; }.feedback { max-width: none; }
}
@media(max-width:380px) {
  .top { padding: 0 10px; }.stage-label { display: none; }
  .menu { padding: 4px 14px 8px; }.hero { gap: 9px; }.hero-mark { height: 72px; }.hero-mark img { width: 60px; height: 60px; }
  .intro { font-size: 11px; }.mode { min-height: 66px; padding: 8px 10px; }.mode strong { font-size: 13px; }.play-button { min-height: 66px; }
  .game-dock { padding-left: 8px; padding-right: 8px; }.dock-button { flex-basis: 50px; }.feedback { font-size: 11px; }.result-card { padding: 18px; }
}
@media(max-height:650px) and (orientation:portrait) {
  .hero { gap: 8px; }.hero-mark { height: 58px; }.hero-mark img { width: 50px; height: 50px; }.orbit { display: none; }.hero>.eyebrow { display: none; }.hero h1 { font-size: 36px; }
  .mode { min-height: 60px; }.play-button { min-height: 62px; }.game { grid-template-rows: auto minmax(0,1fr) 62px; }.level-heading { display: none; }
  .result-stars { min-height: 48px; }.result h2 { font-size: 24px; }.result-score { font-size: 34px; }
}
@media(orientation:landscape) and (max-height:600px) {
  .top { flex-basis: 40px; }.brand img { width: 26px; height: 26px; }.round-button { width: 44px; height: 36px; }
  .game { grid-template-columns: 150px minmax(0,1fr) 64px; grid-template-rows: minmax(0,1fr); padding: 0 8px 8px; gap: 6px; }
  .hud-panel { align-self: center; padding: 6px; }.hud-stats { grid-template-columns: 52px 1fr; gap: 8px; }.combo-stat { grid-column: span 2; text-align: center; }.level-heading { display: block; margin-bottom: 8px; }.level-heading h2 { margin-top: 4px; }
  .goals { margin-top: 8px; }.goal { width: 100%; padding: 3px 6px 3px 3px; }.game-dock { grid-column: 3; flex-direction: column; padding: 0; justify-content: center; gap: 12px; }.dock-button { flex: 0 0 auto; width: 54px; min-height: 50px; }.feedback { display: none; }.side-card { display: none; }
  .menu { padding: 4px 24px 10px; }.hero { width: min(100%,760px); display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px 24px; }
  .hero-mark { display: none; }.hero>.eyebrow { grid-column: 1; }.hero h1 { grid-column: 1; font-size: 38px; }.intro { grid-column: 1; font-size: 12px; }
  .play-button { grid-column: 1; min-height: 64px; }.menu-grid { grid-column: 2; grid-row: 1 / 5; margin: 0; }.mode { min-height: 70px; }.menu-tools { grid-column: span 2; }
  .result-card { width: min(94vw,680px); padding: 14px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: center; }.result-main { text-align: center; }
  .result-stars { min-height: 44px; margin: 2px 0; }.result h2 { font-size: 22px; margin: 6px 0 2px; }.result-score { font-size: 30px; margin-bottom: 0; }.result-stats { margin: 0; }.result-stats b { font-size: 15px; }.result-rank { margin-top: 6px; padding: 6px 10px; font-size: 12px; }.result-actions { margin-top: 4px; }.result-actions .primary, .result-actions .wide { min-height: 40px; margin-top: 6px; padding: 6px; }
}
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body.reduced *, body.reduced *::before, body.reduced *::after { animation: none !important; transition: none !important; }
