/* =====================================================================
   MENU — visual language from the LaserArena UI redesign.
   Tokens lifted from the design file rather than re-guessed: cyan #4ee2f5
   leads, red #f43f5e is the opposing accent, Chakra Petch sets headings and
   IBM Plex Mono carries every label and stat.
   Screens are declared in index.html and driven by Ui.show(); see UI.md.
   ===================================================================== */

:root {
  --cy: #4ee2f5;
  --rd: #f43f5e;
  --rd-soft: #ff6b83;
  --ink: #e9edf6;
  --ink-2: #c6cee2;
  --mute: #9aa6c2;
  --mute-2: #6d7d9c;
  --mute-3: #55637f;
  --line: rgba(233,237,246,.1);
  --line-soft: rgba(233,237,246,.06);
  --panel: rgba(12,11,22,.8);
  --panel-2: #0b0a16;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- shared chrome ------------------------------------------------- */
.mscreen {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  color: var(--ink); font-family: 'Chakra Petch', system-ui, sans-serif;
  background: radial-gradient(1000px 560px at 30% -18%, #23113a 0%, #130c22 42%, #08060f 74%, #05040a 100%);
}
/* The home screen lets the 3D stage behind it show through on the right,
   where the two fighters stand. Everything else is opaque. */
#homeScreen {
  background:
    linear-gradient(100deg, #08060f 0%, rgba(11,10,22,.92) 38%, rgba(8,6,15,.55) 58%, rgba(5,4,10,0) 78%),
    radial-gradient(1000px 560px at 30% -18%, rgba(35,17,58,.9) 0%, rgba(19,12,34,.75) 42%, rgba(8,6,15,.4) 74%, rgba(5,4,10,0) 100%);
}
.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.014) 0 1px, transparent 1px 4px);
}
.floorfade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 46%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(4,3,8,.85));
}

.mono { font-family: var(--mono); }
.kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: .26em;
  color: var(--mute-2); text-transform: uppercase;
}
.wordmark {
  font-size: 18px; font-weight: 700; letter-spacing: .04em; cursor: pointer;
  text-transform: uppercase; user-select: none;
}
.wordmark span { color: var(--cy); }

#menuChrome { z-index: 21; }
/* In normal flow rather than absolutely placed: the back button used to be
   positioned by a magic offset and landed on top of the bar whenever the bar
   was a few pixels taller than guessed. Stacked in flow, they cannot overlap. */
.topbar {
  position: relative; display: flex; align-items: center; height: 58px;
  gap: 18px; padding: 0 26px; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(5,4,10,.9), rgba(5,4,10,0));
  pointer-events: auto;
}
.topbar .spacer { flex: 1; }
.liveline {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  color: var(--mute-2); text-transform: uppercase; display: flex; align-items: center; gap: 8px;
}
.blip {
  width: 6px; height: 6px; border-radius: 50%; background: var(--cy);
  box-shadow: 0 0 8px var(--cy); animation: blip 2s infinite;
}
@keyframes blip { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
.callsignBtn {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px; cursor: pointer;
  padding: 7px 14px; border-radius: 4px; border: 1px solid var(--line);
  background: rgba(11,10,22,.7); color: var(--ink); font-family: inherit;
}
.callsignBtn:hover { border-color: rgba(78,226,245,.45); }
.callsignBtn .lbl { font-family: var(--mono); font-size: 9px; letter-spacing: .26em; color: var(--mute-3); text-transform: uppercase; }
.callsignBtn .val { font-weight: 700; font-size: 14px; }

.backBtn {
  display: inline-block; margin: 0 0 14px; cursor: pointer; pointer-events: auto;
  padding: 8px 16px; border-radius: 4px; border: 1px solid var(--line);
  background: rgba(11,10,22,.7); color: var(--ink-2);
  font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
}
.backBtn:hover { border-color: rgba(78,226,245,.45); color: var(--ink); }

.footbar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 16px;
  padding: 14px 26px; border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  color: var(--mute-3); text-transform: uppercase;
}
.footbar .spacer { flex: 1; }

/* ---- page frame ---------------------------------------------------- */
.page { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 118px 26px 62px; }
.page h1 {
  margin: 0; font-size: 40px; line-height: 1; font-weight: 700;
  letter-spacing: -.01em; text-transform: uppercase;
}

/* ---- callsign gate ------------------------------------------------- */
.gate { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0 24px; }
.gate .brand { font-size: 44px; font-weight: 700; letter-spacing: .05em; line-height: 1; text-transform: uppercase; }
.gate .brand span { color: var(--cy); }
.gate .sub { font-family: var(--mono); font-size: 10px; letter-spacing: .34em; color: var(--mute-2); text-transform: uppercase; margin-top: 8px; }
.gateCard {
  margin-top: 34px; width: min(420px, 92vw); padding: 22px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
}
.gateCard .kicker { margin-bottom: 10px; }
.field {
  width: 100%; padding: 13px 14px; border-radius: 4px; border: 1px solid var(--line);
  background: #0a0913; color: var(--ink); font-family: inherit; font-size: 15px; outline: none;
}
.field:focus { border-color: var(--cy); }
.fieldNote { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--mute-3); }
.btnPrimary {
  width: 100%; margin-top: 16px; padding: 13px; cursor: pointer; border: none; border-radius: 4px;
  background: var(--cy); color: #04121a; font-family: inherit; font-weight: 700;
  font-size: 14px; letter-spacing: .1em; text-transform: uppercase;
}
.btnPrimary:hover { filter: brightness(1.08); }
.btnPrimary:disabled { opacity: .35; cursor: not-allowed; filter: none; }
.btnGhost {
  padding: 11px 16px; cursor: pointer; border-radius: 4px; border: 1px solid var(--line);
  background: rgba(11,10,22,.7); color: var(--ink-2);
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
}
.btnGhost:hover { border-color: rgba(78,226,245,.45); color: var(--ink); }
.btnRed { background: var(--rd); color: #1a0209; }

/* ---- home ---------------------------------------------------------- */
#homeScreen .page { display: flex; flex-direction: column; justify-content: center; }
.home-tag { margin-top: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .22em; color: var(--mute-2); text-transform: uppercase; }
.home-cards { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 34px; max-width: 860px; }
.bigCard {
  position: relative; text-align: left; cursor: pointer; padding: 24px 24px 20px;
  border-radius: 4px; border: 1px solid rgba(78,226,245,.3); color: var(--ink); font-family: inherit;
  background: linear-gradient(150deg, rgba(78,226,245,.18), rgba(78,226,245,.02) 65%), #0a1220;
  transition: border-color .12s, box-shadow .12s;
}
.bigCard:hover { border-color: var(--cy); box-shadow: 0 0 34px rgba(78,226,245,.22); }
.bigCard.red { border-color: rgba(244,63,94,.3); background: linear-gradient(150deg, rgba(244,63,94,.18), rgba(244,63,94,.02) 65%), #1a0a12; }
.bigCard.red:hover { border-color: var(--rd); box-shadow: 0 0 34px rgba(244,63,94,.2); }
.bigCard .title { font-size: 26px; font-weight: 700; letter-spacing: .01em; margin: 6px 0 4px; text-transform: uppercase; }
.bigCard .blurb { color: var(--mute); font-size: 13px; }
.bigCard .meta { margin-top: 14px; font-family: var(--mono); font-size: 10px; letter-spacing: .18em; color: var(--cy); text-transform: uppercase; }
.bigCard.red .meta { color: var(--rd-soft); }
.home-tiles { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; max-width: 860px; }
.tile {
  cursor: pointer; padding: 14px 16px; border-radius: 4px; border: 1px solid var(--line);
  background: rgba(11,10,22,.7); color: var(--ink); font-family: inherit; text-align: left;
  font-weight: 700; letter-spacing: .02em;
}
.tile:hover { border-color: rgba(78,226,245,.45); }
.tile div { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--mute-3); text-transform: uppercase; margin-top: 4px; font-weight: 400; }

/* The stage sits behind the menu; these are just the ground glows that sell
   the two fighters standing on something. */
.stageGlows { position: absolute; right: 0; bottom: 42px; width: 46vw; max-width: 780px; height: 74vh; pointer-events: none; display: flex; align-items: flex-end; }
.stageGlows > div { position: relative; flex: 1; height: 100%; }
.stageGlows i {
  position: absolute; bottom: 4%; left: 11%; width: 78%; height: 16%; border-radius: 50%;
  filter: blur(6px); display: block;
}
.stageGlows .b i { background: radial-gradient(closest-side, rgba(78,226,245,.28), transparent 72%); }
.stageGlows .r i { background: radial-gradient(closest-side, rgba(244,63,94,.28), transparent 72%); }

/* ---- tables / lists ------------------------------------------------ */
.panel { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); overflow: hidden; }
.rowHead, .row {
  display: grid; grid-template-columns: 2fr 1.2fr .8fr .8fr 1fr 1.4fr; gap: 10px;
  align-items: center; padding: 11px 16px;
}
.rowHead {
  font-family: var(--mono); font-size: 9px; letter-spacing: .24em; color: var(--mute-3);
  text-transform: uppercase; border-bottom: 1px solid var(--line-soft);
}
.row { border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.row:last-child { border-bottom: none; }
.row:hover { background: rgba(78,226,245,.04); }
.row .sname { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.row .num { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.row .acts { display: flex; gap: 8px; justify-content: flex-end; }
.rowFoot { display: flex; padding: 11px 16px; font-family: var(--mono); font-size: 10px; letter-spacing: .18em; color: var(--mute-3); text-transform: uppercase; }
.rowFoot .spacer { flex: 1; }
.rowFoot a { cursor: pointer; color: var(--cy); }
.emptyRow { padding: 26px 16px; text-align: center; color: var(--mute-3); font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }

/* ---- create -------------------------------------------------------- */
.createGrid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 20px; align-items: start; max-width: 1180px; }
.secLabel2 { font-family: var(--mono); font-size: 10px; letter-spacing: .26em; color: var(--mute-2); text-transform: uppercase; margin: 22px 0 10px; }
.optRow { display: grid; gap: 10px; grid-auto-flow: column; grid-auto-columns: 1fr; }
.opt {
  cursor: pointer; text-align: left; padding: 13px 14px; border-radius: 4px;
  border: 1px solid var(--line); background: rgba(11,10,22,.7); color: var(--ink); font-family: inherit;
}
.opt:hover { border-color: rgba(78,226,245,.45); }
.opt.active { border-color: var(--cy); background: linear-gradient(150deg, rgba(78,226,245,.16), rgba(78,226,245,.02) 70%), #0a1220; }
.opt .n { font-weight: 700; font-size: 15px; text-transform: uppercase; }
.opt .d { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--mute-3); margin-top: 4px; }
.mapRow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.numRow { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.numOpt {
  cursor: pointer; padding: 10px 4px; text-align: center; border-radius: 4px;
  border: 1px solid var(--line); background: rgba(11,10,22,.7); color: var(--ink); font-family: inherit;
}
.numOpt:hover { border-color: rgba(78,226,245,.45); }
.numOpt.active { border-color: var(--cy); background: rgba(78,226,245,.12); }
.numOpt b { display: block; font-size: 17px; }
.numOpt small { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--mute-3); }
.slotCols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* Yes/No pair: same shape as .numOpt, but the answer carries the colour —
   grey while unchosen, green on a chosen Yes, red on a chosen No, so the
   setting reads at a glance without having to parse a tick box. */
.yesNo { display: grid; grid-auto-flow: column; justify-content: start; gap: 10px; }
.ynOpt {
  cursor: pointer; min-width: 96px; padding: 11px 22px; border-radius: 4px;
  border: 1px solid var(--line); background: rgba(11,10,22,.7); color: var(--mute-2);
  font-family: var(--mono); font-size: 13px; letter-spacing: .18em; text-transform: uppercase;
}
.ynOpt:hover { border-color: rgba(255,255,255,.28); color: var(--ink); }
.ynOpt.yes.active {
  border-color: #35ff9e; color: #9dffcf; background: rgba(53,255,158,.12);
  box-shadow: inset 0 0 0 1px rgba(53,255,158,.25);
}
.ynOpt.no.active {
  border-color: var(--rd); color: #ffb3c0; background: rgba(244,63,94,.12);
  box-shadow: inset 0 0 0 1px rgba(244,63,94,.25);
}
.checkRow { display: flex; align-items: center; gap: 9px; margin-top: 18px; color: var(--ink-2); font-size: 14px; cursor: pointer; }
aside.brief { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 18px; position: sticky; top: 0; }
aside.brief .sum { font-size: 15px; font-weight: 700; margin: 8px 0 14px; }
aside.brief .kv { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line-soft); font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
aside.brief .kv span:first-child { color: var(--mute-3); }
aside.brief .kv span:last-child { color: var(--ink-2); }
aside.brief .field { margin-top: 16px; }
aside.brief .btnPrimary { margin-top: 12px; }
aside.brief .btnGhost { width: 100%; margin-top: 8px; text-align: center; }

/* ---- settings (styled; content lands in its own change) ------------- */
.setGrid { display: grid; grid-template-columns: 320px minmax(0,1fr); gap: 20px; align-items: start; max-width: 1180px; }

/* ---- settings ------------------------------------------------------ */
.setRow { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; font-size: 14px; }
.setRow label { flex: 1; }
.setVal { font-family: var(--mono); font-size: 12px; color: var(--cy); }
.setHint { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--mute-3); text-transform: uppercase; margin-top: 6px; }
.slider { width: 100%; margin-top: 8px; accent-color: var(--cy); }

.bindGroup { font-family: var(--mono); font-size: 10px; letter-spacing: .24em; color: var(--cy); text-transform: uppercase; margin: 20px 0 8px; }
.bindGroup.red { color: var(--rd-soft); }
.bindHead { display: grid; grid-template-columns: 1fr 96px 96px; gap: 8px; font-family: var(--mono); font-size: 9px; letter-spacing: .22em; color: var(--mute-3); text-transform: uppercase; padding: 0 12px 6px; }
.bindRow {
  display: grid; grid-template-columns: 1fr 96px 96px; gap: 8px; align-items: center;
  padding: 7px 12px; border-radius: 4px; background: rgba(11,10,22,.55); margin-bottom: 6px;
}
.bindRow > span { font-size: 14px; }
.bindKey {
  cursor: pointer; padding: 7px 4px; text-align: center; border-radius: 3px;
  border: 1px solid var(--line); background: #0a0913; color: var(--ink);
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
}
.bindKey:hover { border-color: rgba(78,226,245,.45); }
.bindKey.empty { color: var(--mute-3); }
.bindKey.listening { border-color: var(--cy); color: var(--cy); animation: blip 1s infinite; }
.bindKey.fixed { cursor: default; opacity: .55; }
.bindKey.clash { border-color: var(--rd); color: var(--rd-soft); }
