:root {
  color-scheme: dark;
  --ink: #eefbdc;
  --muted: #91a692;
  --lime: #baff39;
  --lime-soft: #dfff7a;
  --amber: #ffad42;
  --danger: #ff5f57;
  --panel: rgba(8, 20, 16, 0.88);
  --line: rgba(186, 255, 57, 0.18);
  --display: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #050d0a; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(186, 255, 57, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(186, 255, 57, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 70% 28%, #163b21 0, #07110e 34%, #050b09 72%);
  background-size: 48px 48px, 48px 48px, auto;
  font-family: var(--mono);
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
[hidden] { display: none !important; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(100px); opacity: 0.22; pointer-events: none; }
.ambient-a { width: 440px; height: 440px; top: -180px; right: -80px; background: #64aa20; }
.ambient-b { width: 360px; height: 360px; bottom: -150px; left: -140px; background: #1d8073; }

.topbar {
  width: min(1540px, calc(100% - 48px));
  height: 76px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 13px; padding: 0; border: 0; background: transparent; font-family: var(--display); font-size: 1.25rem; letter-spacing: 0.09em; cursor: pointer; }
.brand b { color: var(--lime); font-weight: 400; }
.brand-glyph { position: relative; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--lime); transform: rotate(45deg); }
.brand-glyph i { position: absolute; width: 16px; height: 2px; background: var(--lime); }
.brand-glyph i:nth-child(1) { transform: translateY(-6px); }
.brand-glyph i:nth-child(3) { transform: translateY(6px); }
.signal { margin-right: auto; color: var(--muted); font-size: 0.66rem; letter-spacing: 0.14em; }
.signal i { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.operator { color: var(--muted); font-size: 0.66rem; letter-spacing: 0.1em; }
.operator b { margin-left: 8px; color: var(--ink); }

.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); background: rgba(5, 15, 11, 0.72); cursor: pointer; }
.icon-button:hover { border-color: var(--lime); color: var(--lime); }
.app-shell { width: min(1540px, calc(100% - 48px)); min-height: calc(100vh - 124px); margin: 0 auto; }
.screen { display: none; min-height: calc(100vh - 124px); animation: screen-in 360ms ease both; }
.screen.is-active { display: grid; }

.home-screen { grid-template-columns: 1.08fr 1.35fr 340px; gap: clamp(30px, 4vw, 74px); align-items: center; padding: 64px 0; }
.hero-copy h1 { margin: 16px 0 24px; font-family: var(--display); font-size: clamp(4rem, 6.4vw, 7.4rem); font-weight: 400; line-height: 0.82; letter-spacing: -0.025em; text-transform: uppercase; }
.hero-copy h1 em { color: var(--lime); font-style: normal; text-shadow: 0 0 38px rgba(186, 255, 57, 0.16); }
.hero-lead { max-width: 620px; color: var(--muted); font-family: system-ui, sans-serif; font-size: 1rem; line-height: 1.7; }
.eyebrow { margin: 0; color: var(--muted); font-size: 0.68rem; letter-spacing: 0.14em; }
.eyebrow span { margin-right: 8px; color: var(--lime); }

.identity-form { max-width: 450px; margin-top: 36px; }
.identity-form label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 0.65rem; letter-spacing: 0.14em; }
.input-row { display: flex; height: 52px; }
.input-row input { width: 100%; min-width: 0; border: 1px solid var(--line); border-right: 0; padding: 0 16px; color: var(--ink); background: rgba(3, 12, 8, 0.78); text-transform: uppercase; }
.input-row button { width: 54px; border: 1px solid var(--lime); color: var(--lime); background: rgba(186, 255, 57, 0.08); cursor: pointer; }
.field-error { display: block; min-height: 18px; padding-top: 6px; color: var(--danger); font-size: 0.64rem; }

.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; max-width: 560px; margin-top: 34px; background: var(--line); border: 1px solid var(--line); }
.hero-stats div { padding: 15px; background: rgba(6, 17, 13, 0.9); }
.hero-stats small, .hero-stats span { display: block; color: var(--muted); font-size: 0.55rem; letter-spacing: 0.1em; }
.hero-stats strong { display: block; margin: 6px 0 3px; font-family: var(--display); font-size: 1.7rem; font-weight: 400; }

.mode-zone { align-self: center; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading h2 { margin: 7px 0 0; font-family: var(--display); font-size: 2rem; font-weight: 400; text-transform: uppercase; }
.text-button { padding: 8px 0; border: 0; color: var(--muted); background: transparent; font-size: 0.65rem; letter-spacing: 0.12em; cursor: pointer; }
.text-button:hover { color: var(--lime); }
.text-button span { color: var(--lime); }
.text-button.centered { display: block; margin: 13px auto 0; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-card { position: relative; min-height: 440px; overflow: hidden; border: 1px solid var(--line); padding: 22px; text-align: left; background: linear-gradient(155deg, rgba(13, 37, 25, 0.96), rgba(5, 15, 11, 0.96)); cursor: pointer; transition: transform 180ms ease, border-color 180ms ease; }
.mode-card::after { content: ""; position: absolute; inset: 0; border: 1px solid transparent; background: linear-gradient(135deg, transparent 58%, rgba(186, 255, 57, 0.08)); pointer-events: none; }
.mode-card:hover { transform: translateY(-7px); border-color: var(--lime); }
.mode-card:hover .mode-visual img { transform: translateY(-5px) rotate(-2deg); }
.mode-code { color: var(--lime); font-size: 0.64rem; letter-spacing: 0.15em; }
.mode-visual { height: 230px; display: grid; place-items: center; margin: 8px -10px; background: radial-gradient(circle, rgba(186, 255, 57, 0.1), transparent 66%); }
.mode-visual img { width: 94%; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.45)); transition: transform 180ms ease; }
.mode-visual.twin { position: relative; }
.mode-visual.twin img { position: absolute; width: 74%; }
.mode-visual.twin img:first-child { transform: translate(-28px, -30px); }
.mode-visual.twin img:last-child { transform: translate(38px, 45px) scale(0.82); }
.mode-card strong { display: block; font-family: var(--display); font-size: 1.7rem; font-weight: 400; letter-spacing: 0.04em; }
.mode-card > span:not(.mode-code, .mode-visual) { display: block; margin-top: 8px; color: var(--muted); font-family: system-ui, sans-serif; font-size: 0.82rem; line-height: 1.5; }
.mode-card small { position: absolute; right: 20px; bottom: 20px; color: var(--lime); font-size: 0.58rem; letter-spacing: 0.12em; }

.panel { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 28px 80px rgba(0, 0, 0, 0.22); }
.home-ranking { align-self: center; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 15px 17px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 0.63rem; letter-spacing: 0.1em; }
.panel-heading small { color: var(--lime); font-size: 0.52rem; }
.ranking-list { margin: 0; padding: 0; list-style: none; }
.ranking-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 13px 16px; border-bottom: 1px solid rgba(186, 255, 57, 0.08); }
.ranking-list .rank { color: var(--muted); font-size: 0.68rem; }
.ranking-list .hunter { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-size: 0.72rem; white-space: nowrap; }
.ranking-list .hunter small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.52rem; }
.ranking-list .points { color: var(--lime); font-size: 0.69rem; }

.briefing-screen { grid-template-columns: 1fr 520px; gap: 80px; align-items: center; max-width: 1180px; margin: auto; }
.briefing-art { position: relative; min-height: 520px; display: grid; place-items: center; }
.briefing-art img { position: relative; z-index: 2; width: 88%; filter: drop-shadow(0 30px 45px rgba(0,0,0,.5)); }
.briefing-art span { position: absolute; z-index: 3; right: 10%; bottom: 18%; padding: 8px 12px; border-left: 2px solid var(--lime); color: var(--lime); background: rgba(2, 12, 7, 0.82); font-size: 0.62rem; letter-spacing: 0.13em; }
.radar-ring { position: absolute; width: 420px; height: 420px; border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 0 0 70px rgba(186,255,57,.02), inset 0 0 80px rgba(186,255,57,.06); }
.radar-ring::before, .radar-ring::after { content: ""; position: absolute; inset: 50% 0 auto; border-top: 1px solid var(--line); }
.radar-ring::after { transform: rotate(90deg); }
.briefing-card { padding: 44px; }
.briefing-card h2 { margin: 15px 0 10px; font-family: var(--display); font-size: 3.6rem; font-weight: 400; text-transform: uppercase; }
.briefing-card > p:not(.eyebrow) { color: var(--muted); font-family: system-ui, sans-serif; line-height: 1.65; }
.briefing-rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 30px 0; background: var(--line); }
.briefing-rules div { padding: 18px; background: #07120e; }
.briefing-rules small { display: block; color: var(--muted); font-size: 0.55rem; }
.briefing-rules strong { display: block; margin-top: 8px; font-family: var(--display); font-size: 1.5rem; font-weight: 400; }
.primary-button { width: 100%; min-height: 56px; border: 1px solid var(--lime); padding: 0 20px; display: flex; align-items: center; justify-content: space-between; color: #07110e; background: var(--lime); font-family: var(--display); font-size: 1.05rem; letter-spacing: 0.08em; cursor: pointer; }
.primary-button:hover { background: var(--lime-soft); }

.game-screen { grid-template-columns: 235px minmax(0, 960px) 180px; gap: 20px; justify-content: center; align-items: center; padding: 34px 0; }
.mission-panel, .score-panel { align-self: stretch; max-height: 600px; }
.round-lock { padding: 26px 20px; border-bottom: 1px solid var(--line); }
.round-lock small { display: block; color: var(--muted); font-size: .58rem; }
.round-lock strong { font-family: var(--display); font-size: 4.5rem; font-weight: 400; line-height: 1; }
.round-lock span { color: var(--muted); }
.target-progress { padding: 22px 20px; }
.target-progress > span { color: var(--muted); font-size: .57rem; }
.target-progress strong { display: block; margin: 10px 0; font-family: var(--display); font-size: 2rem; font-weight: 400; }
.target-progress > i, .timer i { display: block; height: 3px; background: rgba(255,255,255,.08); }
.target-progress > i b, .timer i b { display: block; width: 0; height: 100%; background: var(--lime); transition: width 180ms ease; }
.mission-tip { display: flex; gap: 12px; margin: 16px; padding: 14px; border: 1px solid var(--line); color: var(--muted); font-size: .55rem; line-height: 1.55; }
.mission-tip > span { color: var(--lime); font-size: 1.4rem; }
.mission-tip p { margin: 0; }
.mission-tip strong { color: var(--ink); }

.arena-column { min-width: 0; }
.arena-hud { height: 62px; display: grid; grid-template-columns: 110px 1fr 150px; align-items: center; border: 1px solid var(--line); border-bottom: 0; background: rgba(5, 15, 11, 0.94); }
.arena-hud > div { height: 100%; padding: 10px 16px; border-right: 1px solid var(--line); }
.arena-hud small, .arena-hud .timer span { display: block; color: var(--muted); font-size: .54rem; letter-spacing: .1em; }
.arena-hud strong { font-family: var(--display); font-size: 1.35rem; font-weight: 400; }
.timer i { margin-top: 10px; }
.timer i b { width: 100%; }
.ammo { display: flex; align-items: center; gap: 10px; }
.ammo small { margin-right: auto; }
.ammo span { display: flex; gap: 5px; }
.ammo span i { width: 8px; height: 22px; border-radius: 5px 5px 2px 2px; background: var(--amber); box-shadow: 0 0 10px rgba(255,173,66,.28); }
.ammo span i.is-spent { opacity: .18; box-shadow: none; }
.canvas-frame { position: relative; overflow: hidden; border: 1px solid var(--line); background: #07110e; cursor: none; }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; touch-action: none; }
.frame-corners { position: absolute; inset: 10px; pointer-events: none; background: linear-gradient(var(--lime),var(--lime)) left top/24px 1px no-repeat,linear-gradient(var(--lime),var(--lime)) left top/1px 24px no-repeat,linear-gradient(var(--lime),var(--lime)) right top/24px 1px no-repeat,linear-gradient(var(--lime),var(--lime)) right top/1px 24px no-repeat,linear-gradient(var(--lime),var(--lime)) left bottom/24px 1px no-repeat,linear-gradient(var(--lime),var(--lime)) left bottom/1px 24px no-repeat,linear-gradient(var(--lime),var(--lime)) right bottom/24px 1px no-repeat,linear-gradient(var(--lime),var(--lime)) right bottom/1px 24px no-repeat; opacity: .58; }
.wave-callout { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 9px 14px; border: 1px solid var(--lime); background: rgba(3,15,10,.9); color: var(--lime); font-size: .65rem; letter-spacing: .13em; }
.companion-event { position: absolute; z-index: 4; left: 50%; bottom: -6px; transform: translateX(-50%); text-align: center; animation: scout-up 1.3s ease both; }
.companion-event img { display: block; width: 150px; margin: auto; filter: drop-shadow(0 12px 18px rgba(0,0,0,.5)); }
.companion-event strong { display: inline-block; padding: 7px 10px; background: #06120d; color: var(--lime); font-size: .62rem; letter-spacing: .1em; }
.pause-overlay { position: absolute; z-index: 8; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; background: rgba(2,8,6,.86); backdrop-filter: blur(5px); }
.pause-overlay span { font-family: var(--display); font-size: 2.7rem; }
.pause-overlay small { color: var(--muted); }
.pause-overlay button { margin-top: 12px; border: 1px solid var(--lime); padding: 10px; color: #07110e; background: var(--lime); cursor: pointer; }

.score-panel { position: relative; }
.score-block, .combo-block, .accuracy-block { padding: 20px; border-bottom: 1px solid var(--line); }
.score-panel small { display: block; color: var(--muted); font-size: .54rem; }
.score-panel strong { display: block; margin-top: 7px; font-family: var(--display); font-size: 1.75rem; font-weight: 400; }
.score-block strong { color: var(--lime); }
.pause-button { position: absolute; left: 20px; bottom: 20px; }

.result-screen { place-items: center; }
.result-card { width: min(560px, 100%); padding: 48px; text-align: center; }
.result-mark { width: 66px; height: 66px; margin: 0 auto 24px; display: grid; place-items: center; border: 1px solid var(--lime); color: var(--lime); font-family: var(--display); font-size: 2.6rem; transform: rotate(45deg); }
.result-mark::first-letter { display: block; transform: rotate(-45deg); }
.result-card.danger .result-mark { border-color: var(--danger); color: var(--danger); }
.result-card h2 { margin: 14px 0 10px; font-family: var(--display); font-size: 3.2rem; font-weight: 400; text-transform: uppercase; }
.result-card > p:not(.eyebrow, .submission-status) { color: var(--muted); font-family: system-ui, sans-serif; line-height: 1.6; }
.result-score { margin: 28px 0; padding: 22px; border: 1px solid var(--line); }
.result-score small, .result-grid span { display: block; color: var(--muted); font-size: .55rem; }
.result-score strong { display: block; margin-top: 6px; color: var(--lime); font-family: var(--display); font-size: 3rem; font-weight: 400; }
.result-grid { display: grid; grid-template-columns: repeat(3,1fr); margin-bottom: 28px; }
.result-grid div { border-right: 1px solid var(--line); }
.result-grid div:last-child { border: 0; }
.result-grid strong { display: block; margin-top: 7px; font-family: var(--display); font-size: 1.35rem; font-weight: 400; }
.submission-status { min-height: 20px; color: var(--lime); font-size: .63rem; }

.leaderboard-screen { place-items: center; padding: 40px 0; }
.leaderboard-card { width: min(900px, 100%); }
.leaderboard-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 30px; border-bottom: 1px solid var(--line); }
.leaderboard-header h2 { margin: 10px 0 6px; font-family: var(--display); font-size: 3rem; font-weight: 400; text-transform: uppercase; }
.leaderboard-header > div > p:last-child { margin: 0; color: var(--muted); font-size: .6rem; }
.filter-row { display: flex; justify-content: space-between; gap: 20px; padding: 16px 30px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; }
.tabs button { border: 1px solid var(--line); padding: 8px 12px; color: var(--muted); background: transparent; font-size: .58rem; cursor: pointer; }
.tabs button.is-active { border-color: var(--lime); color: #07110e; background: var(--lime); }
.full-ranking { max-height: 56vh; overflow: auto; }
.full-ranking li { grid-template-columns: 50px 1fr 120px; padding: 17px 30px; }

footer { width: min(1540px, calc(100% - 48px)); height: 48px; margin: auto; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .54rem; letter-spacing: .1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes scout-up { 0% { transform: translate(-50%, 110%); } 25%,75% { transform: translate(-50%, 0); } 100% { transform: translate(-50%, 110%); } }

@media (max-width: 1260px) {
  .home-screen { grid-template-columns: 1fr 1.15fr; }
  .home-ranking { display: none; }
  .game-screen { grid-template-columns: 190px minmax(0, 1fr); }
  .score-panel { display: none; }
}

@media (max-width: 820px) {
  .topbar, .app-shell, footer { width: min(100% - 24px, 720px); }
  .topbar { height: 64px; }
  .signal, .operator { display: none; }
  .home-screen { grid-template-columns: 1fr; align-items: start; padding: 42px 0; }
  .hero-copy h1 { font-size: clamp(4rem, 18vw, 6rem); }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 350px; }
  .mode-visual { height: 170px; }
  .briefing-screen { grid-template-columns: 1fr; gap: 0; padding: 30px 0; }
  .briefing-art { min-height: 300px; }
  .briefing-art img { width: min(80%, 420px); }
  .radar-ring { width: 280px; height: 280px; }
  .game-screen { display: none; grid-template-columns: 1fr; align-content: center; padding: 18px 0; }
  .game-screen.is-active { display: grid; }
  .mission-panel { display: none; }
  .arena-hud { grid-template-columns: 75px 1fr 120px; }
  .arena-hud > div { padding: 9px 10px; }
  .canvas-frame { cursor: crosshair; }
  .result-card { padding: 32px 20px; }
  .leaderboard-header, .filter-row { padding: 20px; }
  .filter-row { flex-direction: column; }
}

@media (max-width: 480px) {
  .brand { font-size: .95rem; }
  .brand-glyph { width: 28px; height: 28px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .hero-stats div:last-child { grid-column: 1 / -1; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .briefing-card { padding: 28px 20px; }
  .briefing-card h2, .result-card h2 { font-size: 2.5rem; }
  .briefing-rules { grid-template-columns: 1fr; }
  .arena-hud { height: 56px; grid-template-columns: 65px 1fr 102px; }
  .ammo { gap: 6px; }
  .ammo span i { width: 6px; height: 17px; }
  .companion-event img { width: 100px; }
  .result-grid { grid-template-columns: 1fr; gap: 12px; }
  .result-grid div { border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
  .full-ranking li { grid-template-columns: 34px 1fr auto; padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ambient { display: none; }
}
