:root { --ink: #f2ede3; --bg: #14161b; --panel: rgba(24,26,32,.92); --red: #e0233a; --gold: #ffd23f; --line: rgba(255,255,255,.14);
  --heavy: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif; --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--ui); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: inherit; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud .top { position: absolute; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 8px) 8px 0; display: flex; gap: 8px; align-items: flex-start; }
.card { flex: 1; min-width: 0; background: rgba(10,11,14,.55); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; backdrop-filter: blur(4px); }
.card.flash { animation: flash .4s; }
@keyframes flash { 30% { border-color: var(--red); background: rgba(224,35,58,.35); } }
.card .nm { font: 800 11px var(--ui); letter-spacing: .08em; }
.card.r { text-align: right; }
.meter { display: flex; align-items: center; gap: 6px; margin-top: 3px; font: 600 10px var(--ui); opacity: .9; }
.card.r .meter { flex-direction: row-reverse; }
.meter span { width: 30px; }
.meter .bar { flex: 1; height: 6px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--red)); }
.card.r .meter .bar i { margin-left: auto; }
.inj { font: 700 10px var(--ui); color: #ff6b7d; min-height: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mid { text-align: center; flex: none; padding-top: 4px; min-width: 64px; }
#clock { font: 900 17px var(--heavy); font-variant-numeric: tabular-nums; }
#speed { font: 700 10px var(--ui); color: var(--gold); letter-spacing: .06em; text-transform: uppercase; }
.balance { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 70px); width: min(240px, 60vw); text-align: center; font: 700 9px var(--ui); letter-spacing: .12em; opacity: .85; }
.balance .track { position: relative; height: 8px; margin-top: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(224,35,58,.6), rgba(255,255,255,.15) 25%, rgba(120,255,160,.35) 50%, rgba(255,255,255,.15) 75%, rgba(224,35,58,.6)); }
.balance i { position: absolute; top: -3px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.6); transition: left .1s; left: 50%; }
.balance i.bad { background: var(--red); }
.tools { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px); display: flex; gap: 6px; justify-content: center; pointer-events: auto; }
.tools button { min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 10px; background: rgba(10,11,14,.7); border: 1px solid var(--line); font: 700 13px var(--ui); }
.tools button.off, .b-mute.off { opacity: .45; text-decoration: line-through; }
#hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 108px); max-width: calc(100% - 32px); background: rgba(0,0,0,.7); border: 1px solid var(--line); padding: 9px 14px; border-radius: 12px; font: 600 13px/1.35 var(--ui); text-align: center; pointer-events: none; }
#toast { position: fixed; left: 50%; top: 40%; transform: translate(-50%, 10px); opacity: 0; transition: .25s; background: var(--red); color: #fff; padding: 10px 16px; border-radius: 10px; font: 800 15px var(--ui); pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.stamp { position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%) rotate(-6deg); opacity: 0; pointer-events: none; font: 900 clamp(40px, 13vw, 110px)/1 var(--heavy); color: #fff; background: var(--red); padding: .12em .3em .08em; border-radius: 6px; white-space: nowrap; }
.stamp.show { animation: stamp 2s cubic-bezier(.2,1.6,.4,1) forwards; }
.stamp.lose { background: #333; }
@keyframes stamp { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-6deg) scale(2.2); } 10% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }
#replay { position: fixed; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; display: flex; justify-content: space-between; font: 800 13px var(--ui); background: linear-gradient(rgba(0,0,0,.8), transparent); pointer-events: none; }
#replay .skip { opacity: .6; font-weight: 600; }
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: calc(env(safe-area-inset-top) + 12px) 14px calc(env(safe-area-inset-bottom) + 12px); overflow-y: auto; background: rgba(10,11,14,.35); }
.panel { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 18px 14px; text-align: center; margin: auto; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.panel.small { max-width: 300px; }
.logo { margin: 0; font: 900 clamp(38px, 12vw, 58px)/1 var(--heavy); display: flex; justify-content: center; align-items: center; gap: 8px; }
.logo b { background: var(--red); color: #fff; padding: 4px 10px 0; border-radius: 4px; transform: rotate(-4deg); }
.logo em { font-style: normal; font-size: .45em; color: var(--gold); align-self: flex-start; }
.tag { font: 600 15px/1.35 var(--ui); margin: 12px 0 14px; opacity: .9; }
.opt { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
.opt label { flex: 0 0 96px; text-align: left; font: 700 13px var(--ui); opacity: .8; }
.opt button { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.04); font: 700 14px var(--ui); }
.opt button.on { background: var(--gold); color: #111; border-color: var(--gold); }
button.big { display: block; width: 100%; min-height: 54px; margin-top: 12px; background: var(--red); color: #fff; font: 900 24px var(--heavy); letter-spacing: .04em; border-radius: 12px; }
button.plain { flex: 1; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; font: 700 14px var(--ui); margin-top: 8px; width: 100%; }
.row { display: flex; gap: 8px; }
.how { font: 500 13px/1.45 var(--ui); opacity: .8; margin: 12px 0 6px; text-align: left; }
.panel footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font: 600 12px var(--ui); opacity: .7; margin-top: 10px; }
.panel h2 { font: 900 38px var(--heavy); margin: 2px 0 8px; }
#r-title.win { color: var(--gold); }
#r-why { font: 800 17px var(--ui); margin: 0 0 6px; }
#r-time, #r-inj { font: 500 14px/1.4 var(--ui); opacity: .85; margin: 0 0 10px; }
#r-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
#r-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 6px 2px; }
#r-stats b { display: block; font: 900 17px var(--heavy); }
#r-stats span { font: 600 11px var(--ui); opacity: .7; }
@media (max-height: 640px) { .how { display: none; } .tag { margin: 8px 0; } }
.clip-canvas { position: fixed; left: -10000px; top: 0; width: 72px; height: 128px; pointer-events: none; }
