:root { --ink: #fff; --panel: #26346a; --panel-2: #1c2750; --accent: #ffc22e; --font: "Lilita One", "Arial Black", system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; background: #2c3f7b; color: var(--ink); font-family: system-ui, sans-serif; }
.game { position: relative; height: 100vh; height: 100svh; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#bg-canvas { position: absolute; inset: 0; display: block; touch-action: none; }
.topbar { position: absolute; display: flex; gap: 6px; z-index: 2; }
.ibtn { width: 46px; height: 46px; border-radius: 12px; border: 0; background: rgba(20, 30, 75, 0.45); color: #dfe6ff; display: grid; place-items: center; cursor: pointer; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.ibtn:hover { background: rgba(20, 30, 75, 0.7); }
.ibtn:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ibtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: min(92vw, 380px); width: 100%; }
dialog::backdrop { background: rgba(10, 16, 45, 0.6); backdrop-filter: blur(3px); }
dialog[open] .panel { animation: pop 0.32s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }
.panel { background: linear-gradient(#3550a0, var(--panel)); border-radius: 22px; padding: 22px 22px 20px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.15); text-align: center; }
.panel h2 { font: 30px var(--font); margin: 0 0 12px; letter-spacing: 0.5px; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.panel p { color: #d6def8; line-height: 1.45; margin: 0 0 12px; text-align: left; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; font-size: 17px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.switch { appearance: none; width: 48px; height: 28px; border-radius: 14px; background: #1a2350; position: relative; cursor: pointer; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch:checked { background: #4fcb47; }
.switch:checked::after { transform: translateX(20px); }
.btn { font: 20px var(--font); color: #fff; border: 0; border-radius: 14px; padding: 12px 22px; margin-top: 14px; cursor: pointer; background: linear-gradient(#5fd85a, #35a83a); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.25); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.btn.ghost { background: rgba(255, 255, 255, 0.12); }
.btn.big { width: 100%; font-size: 26px; padding: 14px; }
.actions { display: flex; gap: 10px; justify-content: center; }
.over .panel { padding-top: 28px; }
.over h2 { font-size: 36px; color: #ffd84a; }
.stat { display: flex; flex-direction: column; margin: 8px 0; }
.stat span { font: 18px var(--font); color: #aebbe8; letter-spacing: 1px; }
.stat strong { font: 54px/1.1 var(--font); text-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); }
.stat.best strong { font-size: 30px; color: #ffd84a; }
.new-best { font: 22px var(--font); color: #ffd84a; margin: 0 0 4px !important; text-align: center !important; animation: glow 1s ease-in-out infinite alternate; }
@keyframes glow { to { text-shadow: 0 0 14px #ffcf2e; transform: scale(1.06); } }

.about { max-width: 720px; margin: 0 auto; padding: 18px 20px 40px; color: #cfd8f6; line-height: 1.55; }
.about summary { cursor: pointer; font-weight: 600; }
.about h2 { font-size: 19px; color: #fff; margin: 18px 0 6px; }
.about a { color: #ffd84a; }
@media (prefers-reduced-motion: reduce) { dialog[open] .panel, .new-best { animation: none; } }
