/* Space Avengers web client. Two fonts (Orbitron for titles, Inter for UI); 60-30-10 colour:
   deep navy 60 %, slate panels 30 %, cyan accent 10 % (amber / red only for warnings). */
:root {
  --bg: #05070d; --bg2: #0a1020; --panel: rgba(12, 18, 33, .92); --panel-solid: #0c1221; --line: #1d2a44;
  --text: #dbe5f5; --dim: #8593ae; --cyan: #3fd0ff; --cyan2: #0f3a55; --green: #4fe08a; --amber: #ffb238;
  --red: #ff5f5f; --violet: #a98bff; --radius: 12px;
  --title: "Orbitron", "Segoe UI", sans-serif; --ui: "Inter", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--ui); overflow: hidden; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.screen { position: fixed; inset: 0; }

/* ---------------------------------------------------------------- auth + menu */
.space-bg { background: radial-gradient(1200px 700px at 75% 10%, #15264a 0%, transparent 60%),
                       radial-gradient(900px 600px at 10% 90%, #1a1238 0%, transparent 55%), var(--bg); }
.stars::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: radial-gradient(1px 1px at 20% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 70% 20%, #cfe 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 80%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 85% 60%, #9df 50%, transparent 51%),
    radial-gradient(1px 1px at 10% 60%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 55% 45%, #fff 50%, transparent 51%);
  background-size: 420px 420px; }
.brand .title { font-family: var(--title); font-weight: 800; letter-spacing: 6px; margin: 0; font-size: clamp(30px, 6vw, 54px); }
.brand .sub { margin: 6px 0 0; letter-spacing: 5px; color: var(--dim); font-size: 12px; font-weight: 600; }
.auth-wrap { display: grid; place-items: center; height: 100%; padding: 16px; position: relative; }
.auth-card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); position: relative; }
.auth-card .brand { text-align: center; margin-bottom: 22px; }
.auth-card .brand .title { font-size: 34px; letter-spacing: 4px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg2); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tabs button { border: 0; background: transparent; padding: 9px; border-radius: 8px; color: var(--dim); font-weight: 600; }
.tabs button.on { background: var(--cyan2); color: var(--text); }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 4px; letter-spacing: .5px; }
label.field input { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; outline: none; }
label.field input:focus { border-color: var(--cyan); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #2b3c5e; background: #111b30;
  border-radius: 9px; padding: 10px 14px; font-weight: 600; transition: border-color .15s, background .15s, transform .05s; }
.btn:hover:not(:disabled) { border-color: var(--cyan); background: #142542; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #1a6f95, #10506f); border-color: var(--cyan); color: #fff; }
.btn.danger { border-color: #6b2b2b; color: #ffb4b4; }
.btn.done { border-color: #1f5a3a; color: var(--green); }
.btn.block { width: 100%; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.msg { min-height: 20px; margin: 12px 0 0; font-size: 13px; }
.msg.err { color: var(--red); } .msg.ok { color: var(--green); }
.fine { color: var(--dim); font-size: 12px; text-align: center; margin: 14px 0 0; }

.menu { display: grid; grid-template-rows: auto 1fr; height: 100%; position: relative; }
.menu header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 18px 28px; border-bottom: 1px solid var(--line); }
.menu header .brand .title { font-size: 28px; letter-spacing: 4px; }
.grow { flex: 1; }
.who { color: var(--dim); }
.who b { color: var(--text); }
.menu main { overflow: auto; padding: 24px 28px 40px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-content: start; }
@media (max-width: 900px) { .menu main { grid-template-columns: minmax(0, 1fr); padding: 16px; } .menu header { padding: 14px 16px; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin: 0 0 12px; font: 700 13px/1 var(--title); letter-spacing: 3px; color: var(--dim); text-transform: uppercase; }
.camp { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; padding: 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg2); margin-top: 10px; }
.camp .id { font-family: var(--title); font-size: 13px; letter-spacing: 2px; }
.camp .meta { color: var(--dim); font-size: 12.5px; }
.prog { height: 4px; background: #1a2338; border-radius: 3px; overflow: hidden; margin-top: 6px; grid-column: 1 / -1; }
.prog i { display: block; height: 100%; background: var(--cyan); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
kbd { display: inline-block; min-width: 26px; text-align: center; padding: 2px 7px; border-radius: 6px; border: 1px solid #33456b; background: #0f1830;
  font: 600 12px var(--ui); color: var(--text); }
.story p { color: #b9c6dd; margin: 0 0 10px; }

/* ------------------------------------------------------------------- game */
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; touch-action: none; }
.hud.cine > :not(.intro) { opacity: 0; transition: opacity .4s; }
.next { margin-top: 8px; color: #ffd27a; font-weight: 700; font-size: 13px; }
.intro { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto;
  background: linear-gradient(180deg, #000 0 11%, rgba(0, 0, 0, .55) 11% 89%, #000 89% 100%); }
.intro-lines { max-width: min(860px, 88vw); text-align: center; }
.intro-line { font-size: clamp(18px, 2.6vw, 28px); line-height: 1.45; color: #e8f0ff; animation: fadeline 3.6s ease both; text-shadow: 0 2px 18px #000; }
.intro-line.big { font: 800 clamp(26px, 5vw, 56px) var(--title); letter-spacing: 6px; animation-duration: 2.6s; }
@keyframes fadeline { 0% { opacity: 0; transform: translateY(8px); } 15%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.intro-skip { position: absolute; right: 18px; bottom: 7%; }
.hint { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); font-size: 12.5px; color: #c8d6ee; text-shadow: 0 1px 3px #000;
  white-space: nowrap; opacity: .9; }
.touch { position: absolute; inset: auto 0 56px 0; height: 0; pointer-events: none; }
.touch button { pointer-events: auto; touch-action: none; -webkit-user-select: none; user-select: none; border: 1px solid rgba(63, 208, 255, .45);
  background: rgba(8, 16, 30, .62); color: #e8f4ff; font-size: 20px; border-radius: 14px; backdrop-filter: blur(4px); }
.touch button.on, .touch button:active { background: rgba(63, 208, 255, .35); }
.dpad { position: absolute; left: 18px; bottom: 10px; width: 168px; height: 168px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 6px; }
.dpad .up { grid-area: 1 / 2; } .dpad .left { grid-area: 2 / 1; } .dpad .right { grid-area: 2 / 3; } .dpad .down { grid-area: 3 / 2; }
.touch .use { position: absolute; right: 22px; bottom: 34px; width: 96px; height: 96px; border-radius: 50%; font: 800 17px var(--title); letter-spacing: 2px;
  border-color: var(--cyan); box-shadow: 0 0 24px rgba(63, 208, 255, .35); }
@media (pointer: fine) and (min-width: 900px) { .touch { display: none; } }
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: none; }
.hud-tl { position: absolute; left: 16px; top: 14px; max-width: min(520px, 60vw); padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(8, 14, 28, .78), rgba(8, 14, 28, .5)); border: 1px solid rgba(63, 208, 255, .18); }
.hud-tl .t { font: 800 15px var(--title); letter-spacing: 3px; }
.hud-tl .loc { color: var(--cyan); font: 700 12px var(--title); letter-spacing: 2px; margin-top: 4px; }
.hud-tl .mis { margin-top: 8px; font-weight: 600; }
.hud-tl .obj { color: #c8d6ee; font-size: 13px; }
.paused { margin-top: 8px; color: var(--amber); font-weight: 700; font-size: 12.5px; }
.hud-tr { position: absolute; right: 16px; top: 14px; width: 250px; padding: 10px 12px; border-radius: 12px;
  background: rgba(8, 14, 28, .62); border: 1px solid rgba(63, 208, 255, .15); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.m .k { font-size: 10.5px; letter-spacing: 1.5px; color: var(--dim); font-weight: 700; }
.m .v { font: 700 16px var(--ui); font-variant-numeric: tabular-nums; }
.m .bar { height: 3px; background: #1a2338; border-radius: 3px; overflow: hidden; margin-top: 3px; }
.m .bar i { display: block; height: 100%; background: var(--cyan); }
.m.wide { grid-column: 1 / -1; }
.GREEN { color: var(--green); } .AMBER { color: var(--amber); } .RED { color: var(--red); }
.cross { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; }
.cross::before, .cross::after { content: ""; position: absolute; background: rgba(220, 240, 255, .85); }
.cross::before { left: 10px; top: 3px; width: 2px; height: 16px; } .cross::after { top: 10px; left: 3px; height: 2px; width: 16px; }
.cross.hot::before, .cross.hot::after { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.prompt { position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); padding: 7px 12px; border-radius: 9px;
  background: rgba(6, 12, 24, .82); border: 1px solid rgba(63, 208, 255, .35); font-weight: 600; white-space: nowrap; max-width: 90vw;
  overflow: hidden; text-overflow: ellipsis; }
.log { position: absolute; left: 16px; bottom: 58px; width: min(560px, 70vw); max-height: 30vh; overflow: hidden; display: flex; flex-direction: column-reverse;
  font-size: 12.5px; text-shadow: 0 1px 2px #000; }
.log div { padding: 2px 0; opacity: .92; }
.log .err { color: #ff9a9a; } .log .signal { color: #c8b6ff; } .log .emergency { color: var(--amber); } .log .act { color: #8fdcff; }
.keybar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; padding: 10px 12px;
  background: linear-gradient(0deg, rgba(4, 7, 14, .85), transparent); font-size: 12px; color: #b9c6dd; pointer-events: auto; }
.keybar button { pointer-events: auto; background: none; border: 0; color: inherit; padding: 2px 4px; border-radius: 6px; }
.keybar button:hover { background: rgba(63, 208, 255, .12); }
.toasts { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(560px, 92vw); }
.toast { padding: 10px 14px; border-radius: 10px; background: rgba(10, 18, 34, .93); border: 1px solid var(--line); animation: pop .25s ease-out; }
.toast.emergency { border-color: var(--amber); color: var(--amber); } .toast.signal { border-color: var(--violet); }
.toast.err { border-color: var(--red); color: #ffb4b4; } .toast.good { border-color: var(--green); }
@keyframes pop { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(3, 6, 12, .55); pointer-events: auto; }
.overlay .box { text-align: center; padding: 24px 28px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); max-width: 520px; }
.overlay h3 { font: 800 20px var(--title); letter-spacing: 3px; margin: 0 0 10px; }
.loading .bar { width: 260px; height: 4px; background: #1a2338; border-radius: 3px; overflow: hidden; margin: 12px auto 0; }
.loading .bar i { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .2s; }

/* panel */
.panel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(860px, 94vw); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid #23365a; border-radius: 16px; box-shadow: 0 40px 100px rgba(0,0,0,.6); pointer-events: auto; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font: 800 15px var(--title); letter-spacing: 3px; flex: 1; }
.panel-body { padding: 16px 18px 20px; overflow: auto; }
.sec { margin-bottom: 18px; }
.sec > h3 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: 2px; color: var(--dim); text-transform: uppercase; }
.grid-btn { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item { border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.item .hd { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 4px; }
.item .nm { font-weight: 700; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: 1px; border: 1px solid currentColor; }
.muted { color: var(--dim); }
.quote { font-style: italic; color: #cbd7ee; margin: 4px 0 6px; }
.objs div { padding: 2px 0; color: var(--dim); }
.objs .done { color: var(--green); }
.objs .act { color: var(--text); font-weight: 600; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t td, table.t th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.t th { color: var(--dim); font-weight: 600; font-size: 11.5px; letter-spacing: 1px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kv .m { background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
select, .inp { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }

/* ------------------------------------------------------------------- home */
.home { overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; background: var(--bg); }
.hnav { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 12px 28px;
  background: rgba(5, 7, 13, .78); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(63, 208, 255, .12); }
.hlogo { font: 800 16px var(--title); letter-spacing: 4px; color: var(--text); text-decoration: none; }
.hlinks { display: flex; gap: 20px; margin-left: auto; }
.hlinks a { color: var(--dim); text-decoration: none; font-weight: 600; font-size: 14px; }
.hlinks a:hover { color: var(--text); }
.hero { position: relative; min-height: 88vh; display: grid; align-items: center; padding: 60px 28px 80px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background: url(/web/img/hero.jpg) center 70% / cover no-repeat; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 7, 13, .2) 0%, rgba(5, 7, 13, .35) 55%, var(--bg) 100%),
  radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 72% 12%, #cfe 50%, transparent 51%),
  radial-gradient(1.5px 1.5px at 48% 26%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 88% 30%, #9df 50%, transparent 51%),
  radial-gradient(1px 1px at 30% 8%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 60% 40%, #fff 50%, transparent 51%); }
.hero-in { position: relative; max-width: 760px; margin-left: 4vw; animation: rise .9s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.kicker { letter-spacing: 6px; color: var(--cyan); font: 700 12px var(--title); margin: 0 0 14px; }
.hero h1 { font: 800 clamp(40px, 8vw, 92px)/1 var(--title); letter-spacing: 6px; margin: 0; text-shadow: 0 6px 40px rgba(63, 208, 255, .25); }
.lead { font-size: clamp(17px, 2.2vw, 22px); color: #d0dcf0; max-width: 620px; margin: 18px 0 26px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn.big { padding: 14px 26px; font-size: 16px; border-radius: 12px; }
.btn.ghost { background: transparent; text-decoration: none; color: var(--text); }
.home .fine { text-align: left; margin-top: 14px; }
.hsec { max-width: 1180px; margin: 0 auto; padding: 70px 28px 10px; }
.hsec h2, .final-cta h2 { font: 800 clamp(24px, 3.4vw, 36px) var(--title); letter-spacing: 3px; margin: 0 0 10px; }
.hsec .sub { color: var(--dim); margin: 0 0 22px; }
.story-grid, .how-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.scard, .hcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.scard h3, .hcard h3, .split h3 { margin: 6px 0 8px; font-size: 18px; }
.scard p, .split p { color: #b9c6dd; margin: 0; }
.snum, .wnum { font: 800 13px var(--title); color: var(--cyan); letter-spacing: 2px; }
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; margin-top: 36px; }
.split img { width: 100%; border-radius: 14px; border: 1px solid var(--line); display: block; }
.wgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.wcard { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; aspect-ratio: 800 / 372; }
.wcard img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.wcard:hover img { transform: scale(1.05); }
.wtxt { position: absolute; inset: auto 0 0 0; padding: 30px 14px 12px; background: linear-gradient(0deg, rgba(3, 5, 10, .92), transparent); }
.wtxt h3 { margin: 2px 0 2px; font-size: 18px; } .wtxt p { margin: 0; color: #c2cee4; font-size: 13px; }
.cgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ccard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0 0 16px; overflow: hidden; text-align: center; }
.ccard img { width: 100%; aspect-ratio: 340 / 560; object-fit: cover; object-position: center 20%; display: block; background: #23262e; }
.ccard h3 { margin: 12px 12px 2px; font-size: 16px; } .ccard .tag { color: var(--cyan); font-weight: 700; margin: 0 0 6px; font-size: 13px; }
.ccard p { margin: 0 14px; color: #b9c6dd; font-size: 13.5px; }
.hcard ul { margin: 0; padding-left: 18px; color: #c8d4ea; } .hcard li { margin: 6px 0; }
.final-cta { text-align: center; padding: 90px 28px 60px; }
.final-cta .fine { text-align: center; }
.hfoot { text-align: center; color: var(--dim); font-size: 12px; padding: 20px 20px 40px; border-top: 1px solid var(--line); }
.back-home { position: absolute; top: 14px; left: 16px; z-index: 2; }
@media (max-width: 900px) {
  .hlinks { display: none; } .hnav { padding: 10px 16px; } .hnav .btn { margin-left: auto; }
  .hero { min-height: 78vh; padding: 40px 16px 60px; } .hero-in { margin-left: 0; }
  .hsec { padding: 50px 16px 6px; }
  .story-grid, .how-grid, .split { grid-template-columns: minmax(0, 1fr); }
  .wgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .cgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 480px) { .wgrid { grid-template-columns: minmax(0, 1fr); } }

.ending h1 { font: 800 28px var(--title); letter-spacing: 4px; margin: 0 0 8px; }
@media (max-width: 700px) {
  .hud-tl { left: 8px; top: 8px; padding: 8px 10px; max-width: 56vw; } .hud-tl .t { font-size: 12px; } .hud-tl .obj, .hud-tl .mis { font-size: 12px; }
  .hud-tr { right: 8px; top: 8px; width: 150px; padding: 8px; gap: 5px 8px; } .hud-tr .m.wide { display: none; } .m .v { font-size: 13px; }
  .log { display: none; } .keybar { font-size: 10.5px; gap: 2px 8px; padding: 6px; } .keybar kbd { display: none; }
  .hint { bottom: 40px; font-size: 11px; } .touch { bottom: 44px; } .dpad { width: 150px; height: 150px; }
  .prompt { top: calc(50% + 20px); font-size: 12.5px; }
}
