:root {
  --bg: #0A0D12;
  --panel: rgba(16, 22, 32, 0.72);
  --card: rgba(22, 30, 42, 0.6);
  --line: rgba(61, 232, 255, 0.16);
  --line-bright: rgba(61, 232, 255, 0.4);
  --hair: rgba(255, 255, 255, 0.07);
  --text: #E8F1F6;
  --dim: #8FA0AE;
  --faint: #5A6875;
  --cyan: #3DE8FF;
  --amber: #FFB020;
  --cyan-glow: rgba(61, 232, 255, 0.35);
  --amber-glow: rgba(255, 176, 32, 0.3);
  --r: 10px;
  --display: "Outfit", system-ui, sans-serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 600px at 50% -15%, rgba(61, 232, 255, 0.09), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(255, 176, 32, 0.05), transparent 55%),
    linear-gradient(rgba(61, 232, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 232, 255, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); }

/* ---------- GATE ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-inner {
  text-align: center;
  width: 100%;
  max-width: 370px;
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: var(--r);
  padding: 46px 34px 40px;
  backdrop-filter: blur(16px);
  box-shadow: 0 0 40px rgba(61, 232, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
}
.gate-inner::before, .gate-inner::after {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  border-color: var(--cyan);
  border-style: solid;
  border-width: 0;
  filter: drop-shadow(0 0 6px var(--cyan-glow));
}
.gate-inner::before { top: -2px; left: -2px; border-top-width: 2px; border-left-width: 2px; }
.gate-inner::after { bottom: -2px; right: -2px; border-bottom-width: 2px; border-right-width: 2px; }
.gate-logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 22px var(--cyan-glow);
  margin-bottom: 8px;
}
.gate-sub { color: var(--dim); font-size: 13.5px; letter-spacing: 0.04em; margin: 0 0 28px; }
.gate-form { display: grid; gap: 12px; }
.gate-form input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14.5px;
  padding: 13px 16px;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gate-form input::placeholder { color: var(--faint); }
.gate-form input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 18px var(--cyan-glow); }
.gate-form button {
  background: rgba(61, 232, 255, 0.1);
  border: 1px solid var(--cyan);
  border-radius: var(--r);
  color: var(--cyan);
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 14px 16px;
  box-shadow: 0 0 20px rgba(61, 232, 255, 0.15), inset 0 0 14px rgba(61, 232, 255, 0.08);
  transition: background 0.15s, box-shadow 0.15s;
}
.gate-form button:hover { background: rgba(61, 232, 255, 0.18); box-shadow: 0 0 28px var(--cyan-glow), inset 0 0 18px rgba(61, 232, 255, 0.12); }
.gate-form button:active { transform: translateY(1px); }
.gate-form button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.gate-err { color: var(--amber); font-size: 13px; font-weight: 500; margin: 4px 0 0; }

/* ---------- HQ SHELL ---------- */
.hq { max-width: 780px; margin: 0 auto; padding: 28px 18px 64px; display: grid; gap: 16px; }

/* ---------- HERO ---------- */
.hud {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: var(--r);
  padding: 26px 26px 28px;
  backdrop-filter: blur(16px);
  box-shadow: 0 0 46px rgba(61, 232, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.hud::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(61, 232, 255, 0.014) 3px 4px);
  pointer-events: none;
}
.hud::after {
  content: "";
  position: absolute;
  top: -2px; left: -2px;
  width: 22px; height: 22px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
  filter: drop-shadow(0 0 6px var(--cyan-glow));
}
.hud-corner-br {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 22px; height: 22px;
  border-bottom: 2px solid var(--cyan);
  border-right: 2px solid var(--cyan);
  filter: drop-shadow(0 0 6px var(--cyan-glow));
}
.hud-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; position: relative; }
.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
  border: 1px solid var(--line-bright);
  border-radius: 6px;
  padding: 5px 12px;
  background: rgba(61, 232, 255, 0.06);
  box-shadow: 0 0 14px rgba(61, 232, 255, 0.12);
}
.live-dot { width: 6px; height: 6px; background: var(--cyan); border-radius: 50%; box-shadow: 0 0 8px var(--cyan); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.hud-stamp { color: var(--faint); font-size: 11.5px; letter-spacing: 0.14em; }

.hud-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(34px, 7.5vw, 48px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 8px;
  color: var(--text);
  text-shadow: 0 0 30px var(--cyan-glow);
  position: relative;
}
.hud-level {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
  border-bottom: 1px solid var(--line-bright);
  padding: 0 2px 7px;
  margin: 0 0 24px;
  text-shadow: 0 0 12px var(--cyan-glow);
}
.hud-counters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; position: relative; }
.counter {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--hair);
  border-top: 1px solid var(--line-bright);
  border-radius: var(--r);
  padding: 14px 16px;
  display: grid;
  gap: 3px;
}
.counter-label { color: var(--faint); font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.22em; }
.counter-value { font-family: var(--display); font-weight: 700; font-size: 27px; letter-spacing: 0.04em; color: var(--text); text-shadow: 0 0 16px var(--cyan-glow); }
.counter-sub { color: var(--dim); font-size: 12.5px; }

.hud-players { display: flex; gap: 10px; position: relative; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.chip.p1 { color: var(--amber); border-color: rgba(255, 176, 32, 0.5); background: rgba(255, 176, 32, 0.07); box-shadow: 0 0 14px rgba(255, 176, 32, 0.12); }
.chip.p2 { color: var(--cyan); border-color: var(--line-bright); background: rgba(61, 232, 255, 0.07); box-shadow: 0 0 14px rgba(61, 232, 255, 0.12); }
.chip.cpu { color: var(--dim); border-color: var(--hair); background: rgba(255, 255, 255, 0.03); }
.chip.both { color: var(--text); border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.05); }

/* ---------- PANELS ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--r);
  padding: 22px 22px 24px;
  backdrop-filter: blur(14px);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 18px;
  text-shadow: 0 0 10px var(--cyan-glow);
}
.eyebrow::before { content: ""; width: 7px; height: 7px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); flex: none; }
.eyebrow::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, var(--line-bright), transparent); }

/* ---------- MISSIONS ---------- */
.missions { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.mission {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r);
  padding: 14px 16px;
}
.mission.active {
  border-color: var(--line-bright);
  box-shadow: 0 0 24px rgba(61, 232, 255, 0.12), inset 0 0 20px rgba(61, 232, 255, 0.04);
}
.mission.done { opacity: 0.45; }
.mission-day { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--faint); white-space: nowrap; padding-top: 4px; }
.mission-body { display: grid; gap: 9px; }
.mission-text { margin: 0; font-size: 14.5px; font-weight: 450; line-height: 1.5; }
.mission-meta { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.mission .chip { font-size: 10.5px; padding: 4px 10px; }
.mission-status {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 6px;
  border: 1px solid;
}
.mission-status.done { color: var(--dim); border-color: var(--hair); background: rgba(255, 255, 255, 0.03); }
.mission-status.active { color: #051318; border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 16px var(--cyan-glow); }
.mission-status.up { color: var(--faint); border-color: var(--hair); background: transparent; }

/* ---------- GEAR ---------- */
.gear { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.gear-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r);
  padding: 14px 16px;
}
.gear-item.empty { border-style: dashed; background: transparent; }
.gear-name { font-weight: 500; font-size: 14.5px; }
.gear-item.empty .gear-name { color: var(--faint); font-weight: 400; }
.gear-note { color: var(--dim); font-size: 13px; margin: 3px 0 0; }
.gear-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid;
  white-space: nowrap;
}
.gear-tag.owned { color: var(--cyan); border-color: var(--line-bright); background: rgba(61, 232, 255, 0.07); box-shadow: 0 0 12px rgba(61, 232, 255, 0.15); }
.gear-tag.empty { color: var(--faint); border-color: var(--hair); background: transparent; }
.gear-tag.proposed { color: var(--cyan); border-color: var(--line-bright); background: rgba(61, 232, 255, 0.07); }
.gear-tag.approved { color: var(--amber); border-color: rgba(255, 176, 32, 0.5); background: rgba(255, 176, 32, 0.07); }
.gear-tag.ordered { color: var(--amber); border-color: rgba(255, 176, 32, 0.5); background: rgba(255, 176, 32, 0.07); }
.gear-tag.delivered { color: #051318; border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 14px var(--cyan-glow); }

/* ---------- LEDGER ---------- */
.ledger { display: grid; gap: 20px; }
.meter { display: grid; gap: 9px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--dim); }
.meter-head span:first-child {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.2em;
  font-size: 11px;
  color: var(--text);
  text-transform: uppercase;
}
.meter-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--hair);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.meter-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(255, 255, 255, 0.1) calc(10% - 1px) 10%);
  pointer-events: none;
}
.meter-fill {
  background: linear-gradient(90deg, rgba(255, 176, 32, 0.7), var(--amber));
  height: 100%;
  min-width: 0;
  box-shadow: 0 0 14px var(--amber-glow);
  transition: width 0.6s ease;
}
.meter-fill.green {
  background: linear-gradient(90deg, rgba(61, 232, 255, 0.7), var(--cyan));
  box-shadow: 0 0 14px var(--cyan-glow);
}
.ledger-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--hair);
  border-top: 1px solid var(--line-bright);
  border-radius: var(--r);
  padding: 13px 15px;
  display: grid;
  gap: 3px;
}
.stat-label { color: var(--faint); font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em; }
.stat-value { font-family: var(--display); font-weight: 700; font-size: 23px; color: var(--text); text-shadow: 0 0 14px rgba(61, 232, 255, 0.2); }
.ledger-note { color: var(--dim); font-size: 13.5px; margin: 0; line-height: 1.55; }

/* ---------- CONTENT ---------- */
.content { display: grid; gap: 16px; }
.cadence { font-family: var(--mono); font-size: 13.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--amber); margin: 0; text-shadow: 0 0 12px var(--amber-glow); }
.channels { display: flex; flex-wrap: wrap; gap: 8px; }
.channel {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--cyan);
  padding: 6px 13px;
  background: rgba(61, 232, 255, 0.05);
}
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.queue li {
  background: transparent;
  border: 1px dashed var(--hair);
  border-radius: var(--r);
  padding: 12px 16px;
  color: var(--dim);
  font-size: 14px;
}
.queue strong { color: var(--text); font-weight: 500; }

/* ---------- STRATEGY ---------- */
.strategy { margin: 0; display: grid; gap: 14px; }
.strategy-row { display: grid; grid-template-columns: 96px 1fr; gap: 14px; }
.strategy dt {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  padding-top: 3px;
}
.strategy dd { margin: 0; font-size: 14px; color: var(--text); line-height: 1.55; }

/* ---------- AGREEMENT ---------- */
.agreement { display: grid; gap: 10px; }
.agreement-status { display: flex; align-items: center; gap: 10px; }
.agreement-light {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber);
}
.agreement-light.signed { background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.agreement-status span { font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; }
.agreement-terms { color: var(--dim); font-size: 14px; margin: 0; line-height: 1.55; }

/* ---------- WIN ---------- */
.win { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.win li { display: flex; align-items: center; gap: 13px; font-size: 14px; font-weight: 450; }
.win li::before {
  content: "";
  width: 16px; height: 16px;
  border: 1.5px solid var(--line-bright);
  border-radius: 3px;
  flex: none;
  box-shadow: 0 0 8px rgba(61, 232, 255, 0.18), inset 0 0 6px rgba(61, 232, 255, 0.08);
}

.foot { text-align: center; color: var(--faint); font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; margin-top: 12px; }

@media (max-width: 520px) {
  .hud { padding: 22px 18px 24px; }
  .hud-counters { grid-template-columns: 1fr; }
  .ledger-stats { grid-template-columns: 1fr; }
  .strategy-row { grid-template-columns: 1fr; gap: 3px; }
  .mission { grid-template-columns: 1fr; gap: 8px; }
}

/* ---------- DESKTOP 2-COLUMN GRID ---------- */
@media (min-width: 880px) {
  .hq {
    max-width: 1100px;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 18px;
  }
  .hq > .hud { grid-column: 1 / -1; }
  .hq > .foot { grid-column: 1 / -1; }
  .hq {
    grid-template-areas:
      "hero hero"
      "missions gear"
      "missions ledger"
      "content strategy"
      "agreement win"
      "foot foot";
  }
  .hq > .hud { grid-area: hero; }
  section[aria-labelledby="h-missions"] { grid-area: missions; }
  section[aria-labelledby="h-gear"] { grid-area: gear; }
  section[aria-labelledby="h-ledger"] { grid-area: ledger; }
  section[aria-labelledby="h-content"] { grid-area: content; }
  section[aria-labelledby="h-strategy"] { grid-area: strategy; }
  section[aria-labelledby="h-agreement"] { grid-area: agreement; }
  section[aria-labelledby="h-win"] { grid-area: win; }
  .hq > .foot { grid-area: foot; }
}

/* Side quests */
.sidequest { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); padding: 15px 17px; text-decoration: none; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
.sidequest:hover { border-color: var(--line-bright); box-shadow: 0 0 18px rgba(61, 232, 255, 0.14); }
.sidequest-name { font-weight: 500; font-size: 14.5px; }
.sidequest-note { margin: 5px 0 0; color: var(--dim); font-size: 13px; line-height: 1.5; }
.sidequest-go { color: var(--cyan); font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; white-space: nowrap; text-shadow: 0 0 10px var(--cyan-glow); }
