:root { --bg: #101018; --panel: #1a1a26; --fg: #f3f3f3; --muted: #9a9a9e; --border: #3a3a40; --accent: #8f5cff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { display: flex; flex-direction: column; min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; }
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); min-height: 52px; }
.top .left, .top .right { display: flex; gap: 8px; align-items: center; }
.top .right { justify-content: flex-end; }
.top h1 { margin: 0; font-size: 20px; letter-spacing: .04em; font-weight: 800; }
.top h1 b { color: var(--accent); }
.icon { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: transparent; font-weight: 700; display: grid; place-items: center; padding: 0; }
.chip { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 6px 12px; font-size: 13px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.active, .chip.primary { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--panel)); color: var(--fg); }
main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 8px max(10px, env(safe-area-inset-bottom)); gap: 10px; min-height: 0; }
.toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); background: #f3f3f3; color: #121213; font-weight: 700; padding: 10px 16px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 5; }
.toast.show { opacity: 1; }
.dlg { background: var(--panel); color: var(--fg); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; width: min(92vw, 420px); }
.dlg::backdrop { background: rgba(0,0,0,.6); }
.dlg h2 { margin: 0 0 10px; }
.dlg p, .dlg li { color: #d6d6d8; font-size: 15px; line-height: 1.45; }
.dlg .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.dlg .big { font-size: 40px; font-weight: 800; text-align: center; margin: 8px 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 8px 0; }
.stats b { display: block; font-size: 24px; }
.stats span { color: var(--muted); font-size: 12px; }
.hud { display: flex; gap: 14px; justify-content: center; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.hud b { color: var(--fg); }
.pad { display: grid; gap: 6px; width: min(100vw - 16px, 520px); user-select: none; }
.pad button { height: 48px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); font-weight: 700; font-size: 18px; touch-action: manipulation; }
.pad button:active, .pad button.on { background: color-mix(in srgb, var(--accent) 30%, var(--panel)); }

main { justify-content: flex-start; gap: 6px; }
.arena { display: grid; grid-template-columns: 76px auto 76px; gap: 8px; align-items: start; justify-content: center; flex: 1; min-height: 0; }
.side { display: flex; flex-direction: column; gap: 6px; }
.box { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; text-align: center; }
.box span { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.box b { font-size: 16px; font-variant-numeric: tabular-nums; }
.box canvas { width: 100%; height: auto; display: block; }
.well { position: relative; }
#cv { display: block; border: 2px solid var(--border); border-radius: 6px; background: #0a0a12; touch-action: none; }
.banner { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-weight: 800; font-size: 22px; color: #fff; text-shadow: 0 2px 12px #000; opacity: 0; transition: opacity .3s; pointer-events: none; }
.banner.show { opacity: 1; }
.banner small { display: block; font-size: 14px; color: var(--accent); }
.touch { grid-template-columns: repeat(4, 1fr); max-width: 420px; }
.touch button { height: 52px; font-size: 20px; }
.touch .wide { grid-column: span 2; }
@media (min-width: 900px) and (hover: hover) { .touch { display: none; } }
@media (max-width: 400px) { .arena { grid-template-columns: 64px auto 64px; gap: 5px; } }
