:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: rgba(12, 13, 18, .93);
  --text: #f4f0eb;
  --muted: #a5a2a1;
  --red: #ef352f;
  --red-bright: #ff5349;
  --gold: #e4be72;
  --line: rgba(255,255,255,.13);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body { touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
#app { position: fixed; inset: 0; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 50% 42%, #18171a 0%, #090a0e 58%, #030406 100%); }
#cameraFallback { display: none; position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
#cameraFallback.active { display: block; }
#gameRoot { position: absolute; inset: 0; z-index: 1; background: transparent; }
#gameRoot canvas { display: block; width: 100%; height: 100%; touch-action: none; background: transparent !important; }
#uiRoot { position: absolute; inset: 0; z-index: 3; pointer-events: auto; background: transparent; }
.screen, .hud, .level-banner, .screen-flash { pointer-events: auto; }
.hidden { display: none !important; }
.screen { position: absolute; inset: 0; padding: calc(24px + var(--safe-top)) 23px calc(22px + var(--safe-bottom)); background: linear-gradient(180deg, rgba(4,5,8,.62), rgba(6,6,9,.82)); display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.screen-menu { justify-content: space-between; background: radial-gradient(ellipse at 50% 38%, rgba(86,17,20,.31), transparent 46%), linear-gradient(180deg, #08090d 0%, #120b0e 54%, #040508 100%); }
.brand-mark, .screen-topline, .scan-top { display: flex; align-items: center; gap: 9px; font: 700 9px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .21em; color: #b7b2af; }
.brand-dot { width: 7px; height: 7px; background: var(--red); border-radius: 50%; box-shadow: 0 0 12px rgba(239,53,47,.9); }
.brand-line { width: 28px; height: 1px; background: rgba(255,255,255,.28); margin: 0 4px; }
.menu-title-wrap { width: min(100%, 530px); margin: auto; padding: 40px 0 32px; position: relative; }
.overline { color: var(--red-bright); font: 700 9px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .19em; margin: 0 0 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { position: relative; margin: 0; font-size: clamp(54px, 14vw, 96px); line-height: .83; letter-spacing: -.085em; font-weight: 950; text-shadow: 0 5px 35px rgba(0,0,0,.5); }
h1 em, h2 em { color: var(--red); font-style: normal; }
.title-scratch { width: min(78%, 330px); height: 3px; margin: 22px 0 19px; background: linear-gradient(90deg, var(--red) 0 65%, transparent); transform: skewX(-24deg); box-shadow: 0 0 15px rgba(239,53,47,.26); }
.subtitle { color: #d3cdca; font-size: 14px; line-height: 1.55; max-width: 300px; margin: 0; }
.menu-actions { display: grid; gap: 11px; width: min(100%, 430px); margin: 0 auto 30px; }
.btn { border: 1px solid var(--line); border-radius: 3px; min-height: 54px; padding: 14px 17px; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 11px; font-weight: 850; letter-spacing: .12em; transition: transform .13s ease, background .15s ease, border-color .15s ease; user-select: none; }
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 8px 25px rgba(239,53,47,.16); }
.btn-primary:active { background: #cb2722; }
.btn-secondary { color: #e4dfda; background: rgba(255,255,255,.035); border-color: rgba(255,255,255,.18); }
.btn-symbol { font-size: 14px; color: #ffd5b1; }
.menu-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font: 8px/1.4 ui-monospace, monospace; color: #77716f; letter-spacing: .12em; border-top: 1px solid rgba(255,255,255,.1); padding-top: 17px; }
.pulse-label { display: inline-flex; align-items: center; gap: 7px; color: #aaa09d; }
.pulse-label i { width: 5px; height: 5px; background: var(--red); border-radius: 50%; animation: pulse 1.1s infinite; }
.screen-instructions { background: radial-gradient(ellipse at top right, rgba(98,21,22,.2), transparent 45%), #090a0e; }
.screen-topline { margin-bottom: 27px; }
.mini-mark { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid rgba(239,53,47,.65); color: var(--red); font: 800 9px ui-monospace, monospace; letter-spacing: .02em; }
h2 { font-size: clamp(32px, 9vw, 54px); line-height: .92; letter-spacing: -.07em; font-weight: 950; margin-bottom: 25px; }
.instruction-list { display: grid; gap: 0; width: min(100%, 700px); margin: 0 auto 20px; }
.instruction-card { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.instruction-number { color: var(--red); font: 700 11px ui-monospace, monospace; padding-top: 2px; }
.instruction-card h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .09em; }
.instruction-card p { margin: 0; color: #b4acab; font-size: 12px; line-height: 1.58; }
.safety-note { display: flex; gap: 11px; align-items: flex-start; padding: 13px; border: 1px solid rgba(228,190,114,.24); background: rgba(228,190,114,.055); color: #d6c5a4; font-size: 10px; line-height: 1.5; margin: 2px 0 17px; }
.safety-note span { display: grid; place-items: center; flex: 0 0 18px; height: 18px; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold); font-weight: 900; }
.safety-note p { margin: 0; }
.instructions-actions { display: grid; grid-template-columns: .7fr 1.3fr; gap: 9px; margin-top: auto; padding-top: 4px; }
.instructions-actions .btn { font-size: 9px; padding: 12px 8px; min-height: 49px; }
.screen-scan { justify-content: space-between; background: linear-gradient(180deg, rgba(5,6,9,.24), rgba(5,6,9,.1) 34%, rgba(5,6,9,.65)); }
.scan-copy { width: min(100%, 360px); margin: auto; text-align: center; padding: 25px 0; text-shadow: 0 2px 15px #000; }
.scan-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border: 1px solid rgba(228,190,114,.6); color: var(--gold); border-radius: 50%; font-size: 30px; margin-bottom: 26px; box-shadow: 0 0 28px rgba(228,190,114,.08), inset 0 0 23px rgba(228,190,114,.08); }
.scan-copy h2 { margin-bottom: 12px; font-size: clamp(32px, 9vw, 47px); }
.scan-copy p { color: #e2ddda; font-size: 13px; line-height: 1.6; margin: 0; }
.scan-bottom { display: grid; gap: 13px; width: min(100%, 420px); margin: 0 auto; }
.scan-hint { display: flex; align-items: center; justify-content: center; gap: 9px; color: #ded8d5; font: 9px ui-monospace, monospace; letter-spacing: .16em; }
.scan-pulse { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s infinite; }
.text-button { border: 0; background: transparent; color: #ddd1c2; font-size: 11px; text-decoration: underline; text-underline-offset: 4px; padding: 9px; }
.btn:disabled { opacity: .38; cursor: not-allowed; filter: grayscale(.6); }
.hud { position: absolute; inset: 0; padding: calc(10px + var(--safe-top)) 12px calc(12px + var(--safe-bottom)); display: flex; flex-direction: column; pointer-events: none; background: linear-gradient(180deg, rgba(3,4,6,.48), transparent 26%, transparent 64%, rgba(3,4,6,.45)); text-shadow: 0 1px 5px rgba(0,0,0,.8); }
.hud-top, .hud-objectives, .hud-bottom { pointer-events: auto; }
.hud-top { display: flex; align-items: center; gap: 10px; min-height: 51px; }
.level-block { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 3px; }
.level-block span, .timer-block span { color: #e4c6bf; font: 700 8px ui-monospace, monospace; letter-spacing: .15em; }
.level-block strong { font-size: 12px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-block { text-align: right; min-width: 61px; display: flex; flex-direction: column; gap: 2px; }
.timer-block strong { font: 800 20px ui-monospace, monospace; color: #fff4ec; }
.hud-icon-button { flex: 0 0 37px; width: 37px; height: 37px; border: 1px solid rgba(255,255,255,.32); border-radius: 3px; background: rgba(5,6,9,.65); color: white; font-size: 17px; }
.progress-track { height: 3px; background: rgba(255,255,255,.19); margin-top: 6px; overflow: hidden; }
.progress-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--red), #efad70); transform-origin: left center; transition: width .15s linear; }
.hud-objectives { align-self: center; display: flex; align-items: center; gap: 4px; margin-top: 10px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.12); background: rgba(4,5,8,.63); backdrop-filter: blur(7px); border-radius: 3px; }
.objective { display: grid; grid-template-columns: 18px auto; grid-template-rows: auto auto; column-gap: 5px; min-width: 64px; }
.objective-icon { grid-row: 1 / 3; align-self: center; font-size: 19px; text-align: center; }
.key-icon { color: var(--gold); }
.weapon-icon { color: #e8e0dd; }
.ammo-icon { color: #ff756c; }
.objective-label { color: #aaa6a3; font: 700 7px ui-monospace, monospace; letter-spacing: .1em; }
.objective strong { font: 800 12px ui-monospace, monospace; }
.center-reticle { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 20px; height: 20px; border: 1px solid rgba(255,255,255,.74); border-radius: 50%; opacity: .8; box-shadow: 0 0 10px rgba(255,255,255,.16); }
.center-reticle:before, .center-reticle:after { content: ''; position: absolute; background: rgba(255,255,255,.7); }
.center-reticle:before { left: 50%; top: -5px; bottom: -5px; width: 1px; }
.center-reticle:after { top: 50%; left: -5px; right: -5px; height: 1px; }
.center-reticle span { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; transform: translate(-50%,-50%); background: var(--red); border-radius: 50%; }
.game-toast { position: absolute; left: 50%; top: 34%; transform: translate(-50%,-8px); max-width: min(86%, 400px); padding: 10px 13px; color: white; font: 800 10px/1.4 ui-monospace, monospace; letter-spacing: .08em; text-align: center; background: rgba(8,8,11,.84); border: 1px solid rgba(239,53,47,.5); opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; }
.game-toast.show { opacity: 1; transform: translate(-50%,0); }
.hud-bottom { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.movement-pad { display: grid; grid-template-columns: repeat(3, 39px); grid-template-rows: repeat(2, 39px); gap: 4px; opacity: .92; }
.move-button { border: 1px solid rgba(255,255,255,.24); background: rgba(7,8,12,.68); backdrop-filter: blur(5px); border-radius: 4px; color: #fff; font-size: 16px; touch-action: none; user-select: none; }
.move-up { grid-column: 2; grid-row: 1; }
.move-left { grid-column: 1; grid-row: 2; }
.move-down { grid-column: 2; grid-row: 2; }
.move-right { grid-column: 3; grid-row: 2; }
.action-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; max-width: 53%; }
.action-stack p { margin: 0; color: #eee2df; text-align: right; font-size: 9px; line-height: 1.4; text-shadow: 0 1px 6px #000; }
.pickup-button { display: flex; align-items: center; justify-content: center; gap: 7px; width: 142px; min-height: 44px; border-radius: 4px; border: 1px solid rgba(228,190,114,.82); background: rgba(61,43,19,.88); color: #fff1d4; box-shadow: 0 0 18px rgba(228,190,114,.12); font-size: 11px; letter-spacing: .09em; font-weight: 900; touch-action: manipulation; }
.pickup-button span { font-size: 16px; color: var(--gold); }
.pickup-button:active { background: rgba(115,77,25,.95); transform: scale(.98); }
.fire-button { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 5px; width: 142px; min-height: 57px; border-radius: 4px; border: 1px solid rgba(255,89,78,.82); background: rgba(146,26,26,.85); color: white; box-shadow: 0 0 22px rgba(239,53,47,.14); font-size: 11px; letter-spacing: .09em; font-weight: 900; }
.fire-button span { font-size: 20px; }
.fire-button small { flex: 0 0 100%; font: 700 7px ui-monospace, monospace; letter-spacing: .06em; color: #ffd5ce; }
.fire-button:active { background: #d52c27; }
.mode-notice { position: absolute; left: 50%; bottom: calc(93px + var(--safe-bottom)); transform: translateX(-50%); white-space: nowrap; padding: 5px 7px; background: rgba(8,8,11,.62); color: #e8c49b; border: 1px solid rgba(228,190,114,.22); font: 700 7px ui-monospace, monospace; letter-spacing: .09em; }
.screen-modal { justify-content: center; align-items: center; background: rgba(2,3,5,.77); backdrop-filter: blur(8px); }
.modal-card { width: min(100%, 380px); background: linear-gradient(155deg, rgba(28,14,17,.98), rgba(6,7,10,.98)); border: 1px solid rgba(239,53,47,.35); box-shadow: 0 25px 100px rgba(0,0,0,.56); padding: 28px 22px 22px; text-align: center; }
.modal-symbol { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(239,53,47,.6); color: var(--red); font-size: 26px; margin-bottom: 22px; }
.modal-card h2 { font-size: clamp(37px, 10vw, 54px); margin-bottom: 13px; }
.modal-card > p:not(.overline) { color: #bdb5b2; font-size: 12px; line-height: 1.6; margin-bottom: 19px; }
.modal-card .btn { width: 100%; margin-top: 9px; }
.result-card .overline { margin-bottom: 9px; }
.result-symbol { color: #fff; background: rgba(239,53,47,.15); }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 18px 0; padding: 12px 0; }
.result-stats div { display: flex; flex-direction: column; gap: 5px; }
.result-stats div + div { border-left: 1px solid var(--line); }
.result-stats span { color: #8e8582; font: 700 8px ui-monospace, monospace; letter-spacing: .13em; }
.result-stats strong { font: 800 17px ui-monospace, monospace; }
.level-banner { position: absolute; left: 50%; top: 43%; transform: translate(-50%,-50%); width: min(90%, 380px); text-align: center; padding: 21px 14px; border-top: 1px solid rgba(239,53,47,.7); border-bottom: 1px solid rgba(239,53,47,.7); background: rgba(4,5,8,.8); backdrop-filter: blur(4px); animation: bannerIn .3s ease-out; }
.level-banner span { display: block; color: var(--red); font: 700 9px ui-monospace, monospace; letter-spacing: .2em; margin-bottom: 8px; }
.level-banner strong { display: block; font-size: clamp(21px, 7vw, 29px); font-weight: 950; letter-spacing: -.04em; }
.level-banner p { color: #bab1ad; font-size: 10px; margin: 9px 0 0; }
.screen-flash { position: absolute; inset: 0; background: rgba(244,32,32,.36); opacity: 0; pointer-events: none; }
.screen-flash.flash { animation: redFlash .25s ease-out; }
@keyframes pulse { 0%,100% { opacity: .5; transform: scale(.88); } 50% { opacity: 1; transform: scale(1.2); } }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%,-44%); } to { opacity: 1; transform: translate(-50%,-50%); } }
@keyframes redFlash { 0% { opacity: .62; } 100% { opacity: 0; } }
@media (min-width: 700px) {
  .screen-menu { padding: 32px max(32px, calc((100vw - 700px)/2)); }
  .screen-instructions { padding: 32px max(36px, calc((100vw - 700px)/2)); }
  .screen { padding-left: max(23px, calc((100vw - 560px)/2)); padding-right: max(23px, calc((100vw - 560px)/2)); }
  .screen-menu { padding-left: max(32px, calc((100vw - 700px)/2)); padding-right: max(32px, calc((100vw - 700px)/2)); }
  .screen-instructions { padding-left: max(36px, calc((100vw - 700px)/2)); padding-right: max(36px, calc((100vw - 700px)/2)); }
}
@media (max-height: 650px) {
  .menu-title-wrap { padding: 20px 0; }
  h1 { font-size: clamp(45px, 12vh, 68px); }
  .menu-actions { margin-bottom: 13px; }
  .instruction-card { padding: 10px 0; }
  .hud-objectives { margin-top: 5px; }
}
