:root { --bg: #15171b; --fg: #e9ebee; --mute: #9aa0a8; --accent: #a8402f; --ok: #9be28c; --warn: #f2c14e; --bad: #ef6b5a; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body { position: fixed; inset: 0; touch-action: none; -webkit-user-select: none; user-select: none; }
canvas#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.35) 100%); }
#ui.menu { pointer-events: auto; }
#ui.menu::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(21,23,27,0.25), rgba(21,23,27,0.55) 60%, rgba(21,23,27,0.85)); }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--sat) + 20px) 20px calc(var(--sab) + 24px); text-align: center; }
.screen.on { display: flex; }
.logo { font-weight: 800; font-size: clamp(34px, 9vw, 74px); letter-spacing: 0.08em; line-height: 1; text-shadow: 0 6px 30px rgba(0,0,0,0.5); }
.sub { color: var(--mute); margin-top: 10px; font-size: 15px; }
.sub.unlock { color: var(--warn); }
.big { font-size: clamp(40px, 10vw, 72px); font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 6px; }
h1 { margin: 0; font-size: clamp(30px, 7vw, 52px); font-weight: 800; letter-spacing: 0.02em; }
h1.ok { color: var(--ok); } h1.fail { color: var(--bad); }
h2 { margin: 0; font-size: 20px; font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 34px; width: min(420px, 100%); }
.row { display: flex; gap: 10px; }
.row > button { flex: 1; }
button { font: inherit; color: var(--fg); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; padding: 13px 18px; cursor: pointer; backdrop-filter: blur(6px); transition: background .15s, transform .08s; }
button:hover { background: rgba(255,255,255,0.14); }
button:active { transform: scale(0.98); }
button.primary { background: var(--accent); border-color: transparent; font-weight: 700; font-size: 18px; padding: 16px 22px; }
button.primary:hover { background: #bb4a37; }
.foot { position: absolute; bottom: calc(var(--sab) + 18px); color: var(--mute); font-size: 13px; max-width: 90%; }
/* panels */
.panel { justify-content: flex-start; align-items: stretch; text-align: left; max-width: 560px; margin: 0 auto; }
.panel header { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; }
.back { padding: 6px 14px; font-size: 22px; line-height: 1; }
.list { overflow: auto; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding-bottom: 20px; }
.route { display: grid; grid-template-columns: 14px 1fr auto; gap: 14px; align-items: center; text-align: left; padding: 12px 14px; }
.route .sw { width: 14px; height: 36px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.route .rn b { display: block; font-size: 16px; }
.route small { display: block; color: var(--mute); font-size: 12px; margin-top: 3px; }
.route .rs { text-align: right; font-variant-numeric: tabular-nums; }
.route.done .rs b { color: var(--ok); }
.settings .opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: rgba(255,255,255,0.05); border-radius: 12px; }
.settings .opt.col { flex-direction: column; align-items: stretch; }
.settings .opt span small { display: block; color: var(--mute); font-size: 12px; font-weight: 400; margin-top: 2px; }
.settings .opt.small { color: var(--mute); font-size: 12px; justify-content: center; }
.tog { min-width: 68px; }
.tog.on { background: var(--ok); color: #10251a; border-color: transparent; font-weight: 700; }
.danger { border-color: rgba(239,107,90,0.5); color: var(--bad); }
.seg { display: flex; gap: 6px; margin-top: 10px; }
.seg button { flex: 1; padding: 10px; }
.seg button.on { background: var(--fg); color: #16181c; font-weight: 700; }
.lbl { color: var(--mute); font-size: 12px; margin: 10px 0 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 38px; height: 38px; border-radius: 50%; padding: 0; border: 2px solid rgba(255,255,255,0.15); }
.swatch.on { border-color: var(--fg); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }
.swatch.locked { opacity: 0.35; }
.help ul { margin: 8px 0 0; padding-left: 18px; color: var(--mute); font-size: 13px; line-height: 1.5; }
.help li b { color: var(--fg); }
/* HUD */
.hud { justify-content: flex-start; padding: calc(var(--sat) + 12px) 14px 0; pointer-events: none; }
.hud-top { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.hud-left { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.grade { font-size: 12px; font-weight: 800; padding: 3px 7px; border-radius: 6px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
#btn-pause { pointer-events: auto; justify-self: end; padding: 6px 12px; font-weight: 800; letter-spacing: -2px; background: rgba(0,0,0,0.3); }
.caption { position: absolute; left: 50%; bottom: calc(var(--sab) + 24px); transform: translate(-50%, 10px); background: rgba(21,23,27,0.72); border: 1px solid rgba(255,255,255,0.1); padding: 10px 16px; border-radius: 12px; font-size: 15px; opacity: 0; transition: opacity .25s, transform .25s; max-width: 90%; }
.caption.on { opacity: 1; transform: translate(-50%, 0); }
.grip { position: absolute; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; opacity: 0; transition: opacity .3s; pointer-events: none; }
.grip #grip-arc { width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(var(--fg) 360deg, transparent 0); -webkit-mask: radial-gradient(circle, transparent 10px, #000 11px); mask: radial-gradient(circle, transparent 10px, #000 11px); filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6)); }
.grip.low #grip-arc { animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.55; } to { opacity: 1; } }
.pump { position: absolute; left: 0; top: 0; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; border: 3px solid var(--warn); opacity: 0; pointer-events: none; transition: opacity .15s, border-color .1s; }
.pump.on { opacity: 0.95; }
.pump.go { border-color: var(--ok); box-shadow: 0 0 18px rgba(155,226,140,0.7); }
.finish { position: absolute; left: 0; top: 0; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; opacity: 0; pointer-events: none; -webkit-mask: radial-gradient(circle, transparent 17px, #000 18px); mask: radial-gradient(circle, transparent 17px, #000 18px); transition: opacity .2s; }
.finish.on { opacity: 1; }
.toast { position: absolute; left: 50%; top: calc(var(--sat) + 64px); transform: translate(-50%, -8px); background: rgba(21,23,27,0.8); border: 1px solid rgba(255,255,255,0.1); padding: 8px 14px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .caption, .toast, button { transition: none; } .grip.low #grip-arc { animation: none; } }
@media (max-height: 480px) and (orientation: landscape) { .logo { font-size: 36px; } .stack { margin-top: 16px; } .big { font-size: 40px; } }
