:root { --bg: #0b1220; --panel: rgba(18, 26, 42, 0.94); --line: #2a3650; --text: #e8edf5; --muted: #8d9ab0; --accent: #f2b134; --good: #52e07a; --bad: #ff5a5a; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: var(--text); background: #1c2639; border: 2px solid var(--line); border-radius: 14px; padding: 13px 16px; min-height: 48px; cursor: pointer; touch-action: manipulation; }
button:active { transform: translateY(1px); filter: brightness(1.2); }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.primary { background: linear-gradient(#f7c34f, #e09a1c); color: #241500; border-color: #ffd77a; font-weight: 800; font-size: 20px; letter-spacing: 0.04em; }
button.danger { border-color: #6b2a2a; color: #ffb0b0; }
button.ghost { background: transparent; }
button.icon { min-width: 44px; min-height: 44px; padding: 0 10px; border-radius: 12px; font-weight: 800; }
button:disabled { opacity: 0.45; cursor: default; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: calc(env(safe-area-inset-top) + 16px) calc(env(safe-area-inset-right) + 18px) calc(env(safe-area-inset-bottom) + 16px) calc(env(safe-area-inset-left) + 18px); background: rgba(8, 12, 22, 0.88); overflow-y: auto; touch-action: pan-y; max-width: 560px; margin: 0 auto; }
#screen-home, .screen.dim { justify-content: center; }
.screen.dim { background: rgba(6, 10, 18, 0.78); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); text-align: center; }
#screen-home { background: linear-gradient(rgba(8, 12, 22, 0.55), rgba(8, 12, 22, 0.92)); }
.logo { text-align: center; }
.logo canvas { width: 160px; height: 120px; }
h1 { margin: 0; font-size: 46px; line-height: 0.95; letter-spacing: 0.08em; font-weight: 900; color: var(--accent); text-shadow: 0 3px 0 #7a4f00, 0 0 24px rgba(242, 177, 52, 0.35); }
h2 { margin: 0; font-size: 24px; }
.best-line { text-align: center; color: var(--muted); margin: 4px 0 8px; }
.best-line b { color: var(--text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 6px; }
.bolts { color: #ffcf4a; font-weight: 700; white-space: nowrap; }
.bolts::before { content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.3em; vertical-align: -0.05em; background: #ffcf4a; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.badge { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 11px; background: var(--bad); color: white; font-size: 13px; font-weight: 800; margin-left: 4px; }
header.bar { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; position: sticky; top: calc(-16px - env(safe-area-inset-top)); margin: calc(-16px - env(safe-area-inset-top)) -18px 0; padding: calc(env(safe-area-inset-top) + 12px) 18px 10px; background: #0b1220; z-index: 2; border-bottom: 1px solid var(--line); }
header.bar h2 { text-align: center; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tab.active { border-color: var(--accent); color: var(--accent); }
.list { display: flex; flex-direction: column; gap: 10px; }
.sub { color: var(--muted); margin: 0; text-align: center; }
.item { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.item canvas { width: 52px; height: 52px; }
.item .name { font-weight: 700; }
.item .desc { color: var(--muted); font-size: 13px; }
.item button { min-width: 92px; padding: 10px; }
.pips { display: flex; gap: 4px; margin-top: 5px; }
.pips i { width: 16px; height: 6px; border-radius: 3px; background: #2a3650; }
.pips i.on { background: var(--accent); }
.mission { grid-template-columns: 1fr auto; }
.mission.claimed { opacity: 0.55; }
.progress { height: 8px; background: #22304a; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--good); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 52px; }
.row input[type=range] { width: 55%; accent-color: var(--accent); }
.row input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--accent); }
.prose p { margin: 0; color: #cdd5e2; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 8px; display: grid; grid-template-columns: 40px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.card canvas { width: 40px; height: 40px; }
.card b { display: block; font-size: 14px; }
#hud { position: fixed; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 14px) 0 calc(env(safe-area-inset-left) + 14px); pointer-events: none; max-width: 560px; margin: 0 auto; }
.hud-row { display: flex; justify-content: space-between; align-items: flex-start; }
.hud-right { display: flex; align-items: center; gap: 10px; font-size: 18px; }
#hud button { pointer-events: auto; background: rgba(28, 38, 57, 0.8); }
.big { font-size: 34px; font-weight: 900; text-shadow: 0 2px 0 #000; font-variant-numeric: tabular-nums; }
.small { font-size: 13px; color: var(--muted); }
#hud-powers { display: flex; gap: 6px; margin-top: 6px; }
.pw { font-size: 13px; font-weight: 800; padding: 3px 8px; border-radius: 10px; background: rgba(10, 16, 28, 0.8); border: 2px solid currentColor; }
#tutorial { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 92px); width: min(92vw, 420px); background: var(--panel); border: 2px solid var(--accent); border-radius: 16px; padding: 14px 16px 10px; text-align: center; }
#tutorial p { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.small-btn { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.score-big { font-size: 64px; font-weight: 900; color: var(--accent); line-height: 1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.stats div { background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 8px; }
.stats b { display: block; font-size: 20px; }
.stats span { color: var(--muted); font-size: 13px; }
.stats div:last-child:nth-child(odd) { grid-column: span 2; }
#over-missions { color: var(--good); font-weight: 700; font-size: 14px; }
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); background: #1c2639; border: 2px solid var(--accent); padding: 10px 16px; border-radius: 12px; font-weight: 700; z-index: 10; max-width: 90vw; text-align: center; }
@media (min-height: 760px) { #screen-home { gap: 12px; } h1 { font-size: 54px; } }
@media (prefers-reduced-motion: reduce) { button:active { transform: none; } }
