:root { --safe-x: max(5vw, env(safe-area-inset-left), env(safe-area-inset-right)); --safe-y: max(5vh, env(safe-area-inset-top));
  --fs: clamp(14px, 2.2vmin + 6px, 40px); --ink: #fff; --accent: #7cf7ff; --hot: #ff3355; --panel: rgba(14, 10, 34, 0.92);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; background: #07040f; color: var(--ink); }
body { -webkit-text-size-adjust: 100%; }
#stage { position: relative; width: 100%; height: 100vh; height: 100svh; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.safe { padding: var(--safe-y) var(--safe-x); }
button { font: inherit; color: inherit; }
/* HUD */
#hud { position: absolute; inset: 0 0 auto 0; display: grid; grid-template-columns: auto 1fr auto; gap: 2vmin; align-items: start; pointer-events: none; font-size: var(--fs); font-weight: 800; text-shadow: 0 2px 0 rgba(0,0,0,.5); padding-bottom: 0; }
#hud[hidden] { display: none; }
#hud button { pointer-events: auto; }
.hud-left .day { letter-spacing: .04em; }
.sub { font-size: .7em; opacity: .8; font-weight: 700; }
.hud-mid { padding-top: .25em; }
.track { position: relative; height: .55em; background: rgba(0,0,0,.45); border-radius: 1em; overflow: visible; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
.fill { height: 100%; width: 0; background: var(--accent); border-radius: 1em; }
.bestmark { position: absolute; top: -.25em; width: 4px; height: 1.05em; background: #ffe14d; border-radius: 2px; left: 0; box-shadow: 0 0 6px #ffe14d; }
.pct { margin-top: .3em; text-align: center; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: .4em; }
.deaths { display: flex; align-items: center; gap: .3em; color: #ffd1dc; }
.deaths svg { width: 1.1em; height: 1.1em; }
.deaths.bump { animation: bump .35s ease-out; }
@keyframes bump { 0% { transform: scale(1.6); color: var(--hot); } 100% { transform: scale(1); } }
.btns { display: flex; gap: .4em; }
.icon { width: max(44px, 2.1em); height: max(44px, 2.1em); border-radius: .5em; border: 2px solid rgba(255,255,255,.25); background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 0; cursor: pointer; }
.icon svg { width: 60%; height: 60%; }
.icon:focus-visible, .btn:focus-visible, .btn.focus, .icon.focus, .credit:focus-visible { outline: 4px solid #ffe14d; outline-offset: 3px; }
.icon.off { opacity: .5; }
/* messages */
.msg { position: absolute; left: 0; right: 0; top: 26%; text-align: center; font-weight: 900; font-size: calc(var(--fs) * 1.25); pointer-events: none; text-shadow: 0 3px 0 rgba(0,0,0,.55); opacity: 0; transition: opacity .15s; padding: 0 var(--safe-x); }
.msg.show { opacity: 1; }
.msg small { display: block; font-size: .65em; font-weight: 700; color: #ffe14d; margin-top: .3em; }
.hint { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-y) + 1vh); text-align: center; font-weight: 800; font-size: var(--fs); opacity: 0; transition: opacity .3s; pointer-events: none; text-shadow: 0 2px 0 rgba(0,0,0,.6); }
.hint.show { opacity: .9; }
/* overlays */
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.overlay[hidden] { display: none; }
.title { background: radial-gradient(ellipse at center, rgba(10,6,28,.55), rgba(10,6,28,.85)); font-size: var(--fs); }
.logo { display: flex; gap: .25em; font-weight: 900; font-size: calc(var(--fs) * 3.4); line-height: 1; letter-spacing: -.02em; text-shadow: 0 .08em 0 rgba(0,0,0,.6); flex-wrap: wrap; justify-content: center; }
.logo .trap { color: var(--hot); display: inline-block; transform: rotate(-4deg); }
.tag { font-size: 1.15em; margin: .6em 0 .2em; }
.dayline { color: var(--accent); font-weight: 800; margin: .3em 0; }
.challenge { background: #ffe14d; color: #1b1036; font-weight: 900; padding: .45em .9em; border-radius: .6em; margin: .4em 0; }
.start { font-weight: 800; font-size: 1.2em; margin: 1em 0 .5em; }
.start small { font-weight: 600; font-size: .7em; opacity: .85; }
.key { display: inline-block; border: 2px solid #fff; border-radius: .35em; padding: .05em .45em; margin: 0 .1em; background: rgba(255,255,255,.1); }
.key.pad { border-radius: 50%; width: 1.7em; padding: .05em 0; background: #107c10; border-color: #5fd35f; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.stats { opacity: .85; font-size: .9em; }
.credit { color: #fff; opacity: .8; font-size: max(14px, .8em); margin-top: 1em; text-decoration: underline; text-underline-offset: 3px; padding: .5em; }
.panel-wrap { background: rgba(5, 3, 15, .55); font-size: var(--fs); }
.panel { background: var(--panel); border: 2px solid rgba(255,255,255,.15); border-radius: 1em; padding: 1.2em 1.4em; width: min(30em, 100%); max-height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: stretch; gap: .5em; box-shadow: 0 1em 3em rgba(0,0,0,.5); }
.panel h2 { margin: 0 0 .2em; font-size: 1.6em; }
.panel .big { font-size: 2.4em; font-weight: 900; margin: 0; color: var(--accent); }
.panel p { margin: .2em 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .5em; }
.btn { min-height: max(48px, 2.4em); border-radius: .6em; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); font-weight: 800; cursor: pointer; padding: .3em .6em; }
.btn.primary { background: #ffe14d; color: #1b1036; border-color: #ffe14d; }
.btn:active { transform: translateY(1px); }
.small { font-size: .75em; opacity: .8; }
.sharetext { text-align: left; background: rgba(0,0,0,.35); border-radius: .5em; padding: .6em .8em; font: 600 .8em/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; white-space: pre-wrap; margin: .3em 0; }
.toast { position: absolute; left: 50%; bottom: calc(var(--safe-y) + 6vh); transform: translateX(-50%) translateY(20px); background: #fff; color: #1b1036; font-weight: 900; padding: .6em 1.1em; border-radius: .6em; opacity: 0; transition: all .2s; pointer-events: none; font-size: var(--fs); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* TV / Xbox: bigger everything (10-foot UI) */
html.tv { --fs: clamp(22px, 3.2vmin, 54px); }
html.tv .icon { width: 2.2em; height: 2.2em; }
html:not(.pad) .key.pad { display: none; }
/* about section */
#about { max-width: 46rem; margin: 0 auto; padding: 3rem 1.25rem 4rem; line-height: 1.6; color: #e9e6ff; }
#about h1 { font-size: 1.7rem; line-height: 1.25; }
#about h2 { font-size: 1.2rem; margin-top: 2rem; }
#about a { color: var(--accent); }
@media (max-aspect-ratio: 1/1) { #hud { grid-template-columns: 1fr auto; } .hud-mid { grid-column: 1 / -1; grid-row: 2; } .logo { font-size: calc(var(--fs) * 2.8); } }
