:root { --accent: #ff6a2b; --ink: #fff7ee; --glass: rgba(18, 14, 30, 0.62); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120f1e; overscroll-behavior: none; touch-action: none; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); display: flex; justify-content: space-between; align-items: flex-start; }
#hud.on { opacity: 1; }
.stat #score { font-size: clamp(34px, 7vw, 56px); font-weight: 800; letter-spacing: 0.02em; line-height: 1; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55); font-variant-numeric: tabular-nums; }
.stat .sub { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.btns { display: flex; gap: 10px; pointer-events: auto; }
.btns button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.18); background: var(--glass); color: var(--ink); font-size: 16px; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

#toast { position: fixed; left: 0; right: 0; top: 24%; text-align: center; pointer-events: none; font-weight: 900; font-size: clamp(22px, 5vw, 34px); letter-spacing: 0.08em; color: #ffd23f; text-shadow: 0 3px 14px rgba(0, 0, 0, 0.7); opacity: 0; }
#toast.pop { animation: pop 1.1s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: translateY(14px) scale(0.85); } 15% { opacity: 1; transform: translateY(0) scale(1.06); } 70% { opacity: 1; transform: translateY(-6px) scale(1); } 100% { opacity: 0; transform: translateY(-20px) scale(1); } }
#hint { position: fixed; left: 50%; bottom: max(14%, env(safe-area-inset-bottom)); transform: translateX(-50%); pointer-events: none; padding: 10px 18px; border-radius: 12px; background: var(--glass); font-weight: 800; letter-spacing: 0.14em; font-size: clamp(13px, 3.4vw, 17px); white-space: nowrap; opacity: 0; transition: opacity 0.2s; }
#hint.on { opacity: 1; animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { from { color: var(--ink); } to { color: var(--accent); } }

.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse at 50% 60%, rgba(10, 8, 20, 0.15), rgba(10, 8, 20, 0.62)); }
.screen.show { display: flex; }
.panel { text-align: center; max-width: 520px; width: 100%; }
.kicker { font-size: 13px; letter-spacing: 0.32em; font-weight: 700; color: var(--accent); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); }
h1 { margin: 10px 0 14px; font-size: clamp(46px, 11vw, 92px); line-height: 0.92; font-weight: 900; letter-spacing: 0.02em; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); }
h1 span { color: var(--accent); }
.how { font-size: 15px; line-height: 1.7; opacity: 0.92; margin: 0 0 22px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
.chars { display: flex; gap: 10px; margin: 0 0 18px; }
@media (max-aspect-ratio: 6/5) { .chars { justify-content: center; } }
.chars button { font: inherit; font-weight: 800; letter-spacing: 0.12em; font-size: 13px; padding: 10px 16px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.25); background: var(--glass); color: var(--ink); cursor: pointer; }
.chars button.on { border-color: var(--accent); color: var(--accent); }
.btn { font: inherit; font-weight: 800; letter-spacing: 0.18em; font-size: 20px; padding: 16px 54px; border-radius: 14px; border: 0; background: var(--accent); color: #1b0f08; cursor: pointer; box-shadow: 0 8px 28px rgba(255, 106, 43, 0.45); min-height: 56px; }
.btn:active { transform: translateY(1px) scale(0.99); }
.best { margin-top: 16px; font-weight: 700; opacity: 0.85; min-height: 22px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
.best.new { color: #ffd23f; opacity: 1; letter-spacing: 0.12em; }
.big { font-size: clamp(64px, 18vw, 120px); font-weight: 900; line-height: 1; margin: 8px 0 4px; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); font-variant-numeric: tabular-nums; }
.detail { font-size: 17px; opacity: 0.9; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
#screen-over .btn { margin-top: 16px; }

#loading { position: fixed; inset: 0; background: #120f1e; display: flex; align-items: center; justify-content: center; font-weight: 800; letter-spacing: 0.3em; color: var(--accent); transition: opacity 0.4s; z-index: 5; }
#loading.gone { opacity: 0; pointer-events: none; }

/* landing: key art + PLAY (src/landing.js) */
#landing { position: fixed; inset: 0; z-index: 6; background: #120f1e; overflow: hidden; transition: opacity 0.6s, transform 0.6s; }
#landing.out { opacity: 0; transform: scale(1.06); pointer-events: none; }
.ld-art { position: absolute; inset: 0 -1.5% -1.5% -1.5%; display: block; transform-origin: 50% 0; animation: ldpush 18s ease-out forwards; transform: translate(var(--px, 0), var(--py, 0)); }
.ld-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; display: block; pointer-events: none; }
@keyframes ldpush { from { scale: 1; } to { scale: 1.035; } }
.ld-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(10, 8, 20, 0.78) 0%, rgba(10, 8, 20, 0) 34%), radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(10, 8, 20, 0.5) 100%); }
.ld-ui { position: absolute; left: 0; right: 0; bottom: max(5vh, env(safe-area-inset-bottom)); text-align: center; padding: 0 16px; }
.ld-play { font: inherit; font-weight: 900; letter-spacing: 0.3em; font-size: clamp(22px, 4.5vw, 30px); padding: 16px 78px 16px 84px; border-radius: 14px; border: 0; background: var(--accent); color: #1b0f08; cursor: pointer; box-shadow: 0 8px 32px rgba(255, 106, 43, 0.55); min-height: 58px; animation: ldglow 1.4s ease-in-out infinite alternate; }
.ld-play:active { transform: translateY(1px) scale(0.99); }
@keyframes ldglow { from { box-shadow: 0 8px 26px rgba(255, 106, 43, 0.4); } to { box-shadow: 0 10px 44px rgba(255, 106, 43, 0.8); } }
.ld-sub { margin-top: 14px; font-size: clamp(11px, 2.8vw, 13px); font-weight: 700; letter-spacing: 0.22em; opacity: 0.9; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9); }
@media (max-aspect-ratio: 56/100) { .ld-art { inset: 0; } .ld-art img { object-fit: contain; object-position: 50% 0%; } .ld-shade { background: linear-gradient(to top, rgba(10, 8, 20, 0.9) 0%, rgba(10, 8, 20, 0) 40%); } }
@media (max-width: 480px) { .ld-sub { letter-spacing: 0.1em; } .ld-play { padding: 16px 56px 16px 62px; } }
@media (prefers-reduced-motion: reduce) { .ld-art { animation: none; } .ld-play { animation: none; } }
@media (min-aspect-ratio: 6/5) { #screen-menu { justify-content: flex-start; padding-left: 7vw; } #screen-menu .panel { text-align: left; max-width: 460px; } }
@media (max-aspect-ratio: 1/1) { #screen-menu { align-items: flex-start; padding-top: 7vh; } }
@media (max-height: 420px) { h1 { font-size: 44px; margin: 4px 0 8px; } .how { margin-bottom: 10px; } .btn { padding: 12px 40px; min-height: 46px; } }

#dogs { position: fixed; left: 50%; bottom: max(7%, env(safe-area-inset-bottom)); transform: translateX(-50%); pointer-events: none; padding: 8px 16px; border-radius: 12px; background: var(--glass); font-weight: 800; letter-spacing: 0.12em; font-size: clamp(15px, 4vw, 20px); color: #ffd23f; opacity: 0; transition: opacity 0.2s; font-variant-numeric: tabular-nums; }
#dogs.on { opacity: 1; }
#dogs.near { color: #ff9a3d; }
#dogs.danger { color: #ff4a3a; animation: dogpulse 0.28s ease-in-out infinite alternate; }
@keyframes dogpulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.14); } }

/* ---- Street Rivals ---- */
#hud { gap: 12px; }
#place { font-size: clamp(38px, 8vw, 62px); font-weight: 900; line-height: 1; text-shadow: 0 2px 12px rgba(0,0,0,.55); }
#place span { font-size: 0.45em; margin-left: 2px; letter-spacing: .04em; }
#place.p1 { color: #ffd23f; } #place.p2 { color: #e8eef6; } #place.p3 { color: #ff9a6a; }
.stat .sub .of { opacity: .6; margin-left: 4px; }
#track { position: relative; flex: 1; max-width: 360px; height: 10px; margin-top: 18px; border-radius: 6px; background: rgba(18,14,30,.62); border: 1px solid rgba(255,255,255,.18); }
#track i { position: absolute; top: -6px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; border: 3px solid #120f1e; transition: left .15s linear; }
#track b { position: absolute; right: -2px; top: -8px; width: 4px; height: 26px; background: repeating-linear-gradient(#fff 0 5px, #111 5px 10px); }
#mk0 { background: #ffb02e; z-index: 3; } #mk1 { background: #36d3ff; z-index: 2; } #mk2 { background: #ff5fd0; z-index: 1; }
#count { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-weight: 900; font-size: clamp(90px, 28vw, 240px); color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.7); opacity: 0; }
#count.pop { animation: countpop .9s ease-out forwards; }
@keyframes countpop { 0% { opacity: 0; transform: scale(1.8); } 20% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(.9); } }
#pad { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: none; grid-template-columns: 1fr 1fr; gap: 10px; touch-action: none; }
#pad.on { display: grid; }
#pad button { position: relative; overflow: hidden; width: clamp(68px, 19vw, 92px); height: clamp(56px, 15vw, 72px); border-radius: 16px; border: 2px solid rgba(255,255,255,.28); background: var(--glass); color: var(--ink); font: inherit; font-weight: 900; font-size: 12px; letter-spacing: .08em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); touch-action: none; }
#pad button:active { transform: scale(.94); background: rgba(255,106,43,.45); }
#pad #b-special { border-color: #ffd23f; color: #ffd23f; }
#spcd { position: absolute; left: 0; bottom: 0; height: 5px; width: 0; background: #ffd23f; }
.pick-title { font-size: 12px; letter-spacing: .3em; font-weight: 800; opacity: .8; margin: 0 0 8px; text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.chars { flex-wrap: wrap; max-width: 520px; }
.chars button { padding: 8px 12px; font-size: 12px; }
.vs { min-height: 34px; margin: 0 0 14px; font-weight: 800; letter-spacing: .1em; font-size: 14px; text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.vs b { color: var(--accent); } .vs i { font-style: normal; opacity: .6; margin: 0 6px; }
.btn.alt { background: var(--glass); color: var(--ink); box-shadow: none; border: 2px solid rgba(255,255,255,.25); margin-top: 12px; font-size: 14px; padding: 12px 34px; min-height: 46px; display: block; margin-left: auto; margin-right: auto; }
@media (min-aspect-ratio: 6/5) { #screen-menu .btn.alt { margin-left: 0; } }
.results { margin: 8px auto 4px; max-width: 420px; text-align: left; }
.results div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 14px; margin: 4px 0; border-radius: 10px; background: var(--glass); font-weight: 700; font-size: 16px; }
.results div.me { border: 2px solid var(--accent); }
.results span:first-child { letter-spacing: .06em; } .results span:last-child { opacity: .85; font-variant-numeric: tabular-nums; }

/* falling: the view goes solid black (the HUD stays on top) and comes back after the respawn */
#blackout { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .3s ease-out; }
#blackout.on { opacity: 1; transition: opacity .15s ease-in; }

/* ---- best of 3 + jacks ---- */
.sub2 { margin-top: 6px; display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 14px; letter-spacing: .08em; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
#series { display: flex; align-items: center; gap: 5px; }
#series i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #120f1e; display: inline-block; }
#jacks i { font-style: normal; font-size: 17px; margin-right: 2px; color: rgba(255,255,255,.22); }
#jacks i.on { color: #ff3b30; text-shadow: 0 0 6px rgba(255,59,48,.6); }
#banner { position: fixed; left: 0; right: 0; top: 17%; text-align: center; pointer-events: none; opacity: 0; transition: opacity .35s; text-shadow: 0 3px 16px rgba(0,0,0,.75); }
#banner.on { opacity: 1; }
#banner small { display: block; font-size: 13px; font-weight: 800; letter-spacing: .34em; color: var(--accent); }
#banner b { display: block; font-size: clamp(30px, 7vw, 54px); font-weight: 900; letter-spacing: .06em; line-height: 1.1; }
#banner em { display: block; font-style: normal; font-weight: 700; font-size: 15px; opacity: .9; }
.fmt { font-size: 12px; letter-spacing: .2em; font-weight: 800; color: #ffd23f; margin: 0 0 12px; text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.big.word { font-size: clamp(40px, 10vw, 72px); margin: 14px 0 10px; }
.results em { font-style: normal; color: #ffd23f; margin-left: 8px; letter-spacing: .05em; }
.series-line { margin-top: 10px; font-weight: 700; font-size: 14px; letter-spacing: .06em; opacity: .85; text-shadow: 0 1px 8px rgba(0,0,0,.8); }
#pad #b-jacks { grid-column: 1 / -1; width: auto; height: clamp(40px, 10vw, 50px); border-color: #ff3b30; color: #ffd9d6; }
#pad #b-jacks b { color: #ff3b30; margin-left: 4px; }
#pad #b-jacks.empty { opacity: .4; }