:root {
  --bg: #020611;
  --bg2: #070f21;
  --panel: rgba(8, 16, 32, 0.74);
  --line: rgba(95, 186, 255, 0.34);
  --text: #edf7ff;
  --muted: #9ec2df;
  --blue: #39b5ff;
  --green: #63ffb2;
  --red: #ff4f74;
  --gold: #f4ff74;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Inter, system-ui, sans-serif; background: radial-gradient(circle at 50% -20%, #1a315d, var(--bg) 45%, #01030a 100%); color: var(--text); min-height: 100vh; overflow-x: hidden; }
.bg-noise, .cyber-grid, .network-lines, .scanline-overlay { position: fixed; inset: 0; pointer-events: none; }
.bg-noise { background: radial-gradient(circle at 20% 20%, rgba(57,181,255,.1), transparent 40%), radial-gradient(circle at 80% 10%, rgba(99,255,178,.08), transparent 30%); }
.cyber-grid { background-image: linear-gradient(rgba(57,181,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(57,181,255,.12) 1px, transparent 1px); background-size: 42px 42px; animation: drift 18s linear infinite; }
.network-lines {
  background:
    radial-gradient(circle at 20% 30%, rgba(57,181,255,.12) 0 3px, transparent 4px),
    radial-gradient(circle at 80% 20%, rgba(99,255,178,.12) 0 3px, transparent 4px),
    radial-gradient(circle at 30% 80%, rgba(255,79,116,.1) 0 3px, transparent 4px),
    repeating-linear-gradient(120deg, transparent 0 145px, rgba(57,181,255,.045) 146px 147px, transparent 148px 220px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 180% 180%;
  mix-blend-mode: screen;
  opacity: .8;
  animation: networkFlow 30s linear infinite;
}
.scanline-overlay {
  z-index: 3;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.04) 0 1px, rgba(0,0,0,0) 2px 4px);
  opacity: .14;
  animation: scanShift 6s linear infinite;
}
@keyframes drift { from { transform: translateY(0); } to { transform: translateY(42px); } }
@keyframes networkFlow { from { background-position: 0 0, 0 0, 0 0, 0 0; } to { background-position: 0 0, 0 0, 0 0, 0 240px; } }
@keyframes scanShift { from { transform: translateY(0); } to { transform: translateY(10px); } }
.app-shell { max-width: 1100px; margin: 0 auto; padding: 18px; position: relative; z-index: 4; }

body.start-mode .app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 24px;
  padding-bottom: 24px;
}

body.start-mode main {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  position: relative;
}

body.start-mode .title-panel,
body.start-mode #startScreen {
  width: min(100%, 920px);
}

body.start-mode #startScreen {
  margin-left: auto;
  margin-right: auto;
  position: relative;
  overflow: hidden;
}

body.start-mode main::before {
  content: "";
  position: absolute;
  width: min(820px, 88vw);
  height: min(560px, 62vh);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(57, 181, 255, 0.2) 0%, rgba(57, 181, 255, 0.08) 42%, rgba(2, 8, 18, 0) 78%);
  filter: blur(6px);
  z-index: -1;
  animation: ambientGlow 9s ease-in-out infinite;
}
.glass { backdrop-filter: blur(9px); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 0 28px rgba(57,181,255,.18), inset 0 0 24px rgba(57,181,255,.04); border-radius: 16px; }
.title-panel { text-align: center; padding: 20px 22px 14px; margin-bottom: 18px; position: relative; overflow: hidden; }
.title-panel::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 32%, rgba(57,181,255,.08) 49%, transparent 66%); animation: sheen 8s ease-in-out infinite; }
.eyebrow { margin: 0 0 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); }
.title-panel h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 3rem); letter-spacing: .7px; color: #9be5ff; text-shadow: 0 0 12px rgba(57,181,255,.45); animation: titlePulse 5s ease-in-out infinite; }
.subtitle { color: var(--green); text-shadow: 0 0 14px rgba(99,255,178,.6); }
.title-copy { margin: 8px auto 2px; color: var(--muted); max-width: 760px; }
@keyframes titlePulse { 50% { text-shadow: 0 0 22px rgba(57,181,255,.62); } }
@keyframes sheen { 0%, 65%, 100% { transform: translateX(-125%); } 75%, 85% { transform: translateX(125%); } }
.screen { display: none; padding: 16px; }
.screen.active { display: block; }
.center { text-align: center; }
.console-strip {
  margin: 0 auto 14px;
  max-width: 720px;
  padding: 7px 12px;
  text-align: left;
  border: 1px solid rgba(99, 255, 178, 0.22);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(5, 17, 31, 0.88), rgba(9, 26, 44, 0.72));
  color: #9ad5f4;
  font-size: 0.73rem;
  letter-spacing: 1.05px;
  text-transform: uppercase;
}
.briefing-head { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 10px; position: relative; }
.briefing-head h2 { margin: 0; }
.briefing-head::before,
.briefing-head::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(57, 181, 255, 0.4);
  opacity: 0.6;
  animation: cornerPulse 3.2s ease-in-out infinite;
}
.briefing-head::before {
  left: 14px;
  top: 14px;
  border-right: 0;
  border-bottom: 0;
}
.briefing-head::after {
  right: 14px;
  top: 14px;
  border-left: 0;
  border-bottom: 0;
  animation-delay: 1.6s;
}
.status-pill { font-size: .72rem; text-transform: uppercase; letter-spacing: 1.4px; padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(255,79,116,.55); color: #ffc2cf; background: rgba(255,79,116,.15); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 14px rgba(255,79,116,.55); } }
.startup-bootline { margin: 0 auto 12px; padding: 8px 12px; max-width: 720px; text-align: left; border: 1px solid rgba(57,181,255,.28); border-radius: 10px; background: rgba(8, 19, 36, .76); color: #bde8ff; font-size: .78rem; letter-spacing: 1.2px; text-transform: uppercase; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 auto 12px; max-width: 720px; }
.status-card { text-align: left; padding: 10px; border: 1px solid rgba(57,181,255,.18); border-radius: 10px; background: rgba(8, 17, 32, .78); }
.status-card span { display: block; color: #8eb5d3; font-size: .73rem; text-transform: uppercase; letter-spacing: 1.1px; margin-bottom: 4px; }
.status-card strong { font-size: .9rem; }
.status-card .ok { color: #72ffbf; }
.status-card .warn { color: #ffd67e; }
.status-card .alert { color: #ff859f; }
.briefing-copy { margin: 8px auto 12px; max-width: 720px; color: var(--muted); line-height: 1.45; }
.terminal-log { max-width: 720px; margin: 0 auto 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(99,255,178,.26); background: rgba(3, 10, 21, .8); text-align: left; font-family: Consolas, "Courier New", monospace; }
.terminal-log p { margin: 0 0 5px; color: #bdd9ee; font-size: .84rem; }
.terminal-log p:last-child { margin-bottom: 0; }
.tag { font-weight: 700; margin-right: 6px; }
.tag.time { color: #6da8ca; font-weight: 500; margin-right: 9px; }
.tag.ok { color: #72ffbf; }
.tag.warn { color: #ffd67e; }
.tag.lock { color: #ff95aa; }
.tag.info { color: #82d6ff; }
.cursor { display: inline-block; margin-left: 3px; color: #82d6ff; animation: blink 1.05s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.briefing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.briefing-card { text-align: left; padding: 12px; border: 1px solid rgba(99,255,178,.22); border-radius: 12px; background: rgba(8,18,34,.8); display: flex; flex-direction: column; gap: 4px; }
.briefing-card strong { color: #d7f4ff; font-size: .9rem; }
.briefing-card span { color: #9dc1dc; font-size: .85rem; }
.hud { display: grid; grid-template-columns: 1fr 2fr 1fr 1fr 1fr auto; gap: 8px; padding: 9px; margin-bottom: 10px; align-items: stretch; }
.hud-cell, .hud > button { padding: 8px 10px; border: 1px solid rgba(99,255,178,.24); border-radius: 10px; background: rgba(4,10,20,.82); display: flex; flex-direction: column; justify-content: center; min-height: 54px; }
.hud-cell.objective { border-color: rgba(57,181,255,.35); }
.hud-label { color: #8db1cd; font-size: .69rem; text-transform: uppercase; letter-spacing: 1.1px; }
.hud-value { font-weight: 700; font-size: 1rem; color: #e6f6ff; }
#gameCanvas { width: 100%; max-height: 70vh; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: #020a14; display: block; }
.btn { border: 1px solid rgba(255,255,255,.28); color: #fff; background: linear-gradient(135deg, #1766ff, #3fd4ff); border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, filter .2s ease; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 18px rgba(57,181,255,.5); filter: brightness(1.06); }
.btn.cta {
  position: relative;
  padding: 12px 28px;
  font-size: 1rem;
  letter-spacing: .6px;
  background: linear-gradient(135deg, #0b6cff 0%, #29ceff 48%, #5cffc0 100%);
  box-shadow: 0 0 20px rgba(57,181,255,.45), 0 0 32px rgba(57,181,255,.3);
  animation: ctaPulse 2.2s ease-in-out infinite;
}
.btn.cta::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 1px solid rgba(125, 226, 255, 0.45);
  box-shadow: 0 0 12px rgba(57, 181, 255, 0.42);
  opacity: 0.65;
  animation: borderOrbit 2.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ctaPulse { 50% { box-shadow: 0 0 24px rgba(57,181,255,.68), 0 0 40px rgba(57,181,255,.35); } }
@keyframes borderOrbit {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.015); }
}
@keyframes ambientGlow {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50% { opacity: 0.85; transform: translateY(-8px); }
}
@keyframes cornerPulse {
  0%, 100% { opacity: 0.35; box-shadow: 0 0 4px rgba(57, 181, 255, 0.2); }
  50% { opacity: 0.85; box-shadow: 0 0 10px rgba(57, 181, 255, 0.45); }
}
.tiny { padding: 8px 10px; font-size: .86rem; }
.overlay { position: fixed; inset: 0; background: rgba(1,5,12,.76); display: flex; align-items: center; justify-content: center; z-index: 10; }
.hidden { display: none; }
.overlay-card { max-width: 560px; padding: 24px; }
.overlay-card h2 { margin-top: 0; font-size: clamp(1.4rem, 3vw, 2rem); }
.overlay-card p { color: var(--muted); }
.damage-flash { animation: hit .28s ease; }
@keyframes hit { 0%, 100% { filter: saturate(1); box-shadow: 0 0 0 rgba(255,79,116,0); } 40% { filter: saturate(1.8); box-shadow: 0 0 35px rgba(255,79,116,.9); } }
@media (max-width: 900px) {
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .briefing-grid { grid-template-columns: 1fr; }
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .status-grid { grid-template-columns: 1fr; }
}
