/* Keyfarer v3: full screen, splash, results, and the navigation console */

html.fs, html.fs body { height: 100%; overflow: hidden; background: #000; }
html.fs #wrap { max-width: none; padding: 0; height: 100vh; display: grid; place-items: center; }
html.fs #stage { width: min(100vw, calc(100vh * 1.6)); border-radius: 0; box-shadow: none; }
html.fs .foot { display: none; }
#overlay > * { zoom: var(--z, 1); }
@media (max-width: 720px) { #overlay > * { zoom: 1; } }

/* boot: black screen, white loading bar, then an Enter button */
#overlay:has(.boot) { background: #000; backdrop-filter: none; }
.boot { margin: auto; width: min(420px, 80%); display: grid; gap: 18px; justify-items: center; }
.bootbar { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.15); border-radius: 3px; overflow: hidden; }
.bootbar i { display: block; height: 100%; width: 0; background: #fff; transition: width 0.2s ease-out; }
.boot p { margin: 0; font: 600 12px var(--mono); letter-spacing: 0.24em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.enterbtn {
  font: 700 15px var(--mono); letter-spacing: 0.4em; text-transform: uppercase; padding: 12px 34px 12px 40px;
  color: #fff; background: transparent; border: 1px solid #fff; border-radius: 4px; animation: fadein 0.6s ease-out;
}
.enterbtn:hover, .enterbtn:focus-visible { background: #fff; color: #000; outline: none; }
@keyframes fadein { from { opacity: 0; } }
.ro b.warn { color: #ff9a8a; text-shadow: 0 0 8px rgba(255, 107, 107, 0.5); }

/* teacher / student */
#overlay.scenic-dim { background: rgba(3, 5, 12, 0.62); backdrop-filter: blur(3px); }
.title-card .who { display: grid; gap: 10px; }
button.big { padding: 16px 18px; font-size: 18px; letter-spacing: 0.02em; }
.note.bad { background: rgba(255, 107, 107, 0.12); color: #ffc2c2 !important; }
.small { font-size: 13px; color: var(--muted); }
button.linkish { background: none; border: 0; padding: 0; color: #7fe3ff; text-decoration: underline; font: inherit; cursor: pointer; }
button.tiny { padding: 4px 9px; font-size: 12px; }
.dim { color: #6f7ca3; }
.pick-room { margin-top: 14px; }
.pick-room h3 { margin: 0 0 8px; font-size: 15px; color: #9fdcff; letter-spacing: 0.04em; }
.pick-room .names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick-room .names button { padding: 12px 10px; font-size: 16px; }
.card.dash { max-width: 1100px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dash-head h2 { margin-bottom: 4px; }
.addrow { display: flex; gap: 8px; margin-top: 12px; }
.addrow input {
  flex: 1; min-width: 0; font: 500 15px var(--ui); color: var(--ink); background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
.addrow input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.room { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.room header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.room header h3 { margin: 0; font-size: 18px; }
.room header span { color: var(--muted); font-size: 13px; }
.room header button { margin-left: auto; }
table.roster { font-size: 13px; min-width: 860px; }
table.roster td, table.roster th { padding: 7px 6px; white-space: nowrap; }
table.roster tbody tr:hover { background: rgba(255, 255, 255, 0.04); }

/* ending screen after the Time Warp */
#overlay.ending-screen { background: radial-gradient(ellipse at 50% 42%, rgba(40, 14, 70, 0.45), rgba(0, 0, 0, 0.97) 70%); backdrop-filter: none; }
@media (max-width: 720px) { #overlay.ending-screen { background: #000; } }
.ending { margin: auto; max-width: 620px; text-align: center; padding: 20px; animation: fadein 2.4s ease-out; }
.ending h1 {
  margin: 4px 0 12px; font-size: clamp(38px, 7vw, 62px); font-weight: 800; letter-spacing: 0.16em;
  background: linear-gradient(180deg, #ffffff, #e2b8ff 55%, #7fe3ff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ending .epilogue { font: italic 17px/1.6 Georgia, "Times New Roman", serif; color: #cfd6ee; margin: 0 auto 18px; max-width: 520px; }
.ending .final { display: grid; gap: 2px; margin: 10px 0 6px; }
.ending .final span { font: 600 12px var(--mono); letter-spacing: 0.3em; text-transform: uppercase; color: #9aa6c8; }
.ending .final b { font: 800 clamp(44px, 8vw, 72px)/1 var(--ui); color: #ffe6a0; text-shadow: 0 0 30px rgba(255, 209, 102, 0.45); font-variant-numeric: tabular-nums; }
.ending .high { color: #e2b8ff; margin: 6px 0 14px; }
.ending .stats { text-align: left; }
.ending .small { color: var(--muted); font-size: 13px; margin-top: 14px; }
.ending .row { justify-content: center; }

/* undiscovered stages on the star map */
svg.map .node.unknown .q { fill: rgba(150, 170, 210, 0.55); font: 700 17px var(--mono); }
svg.map .node.unknown .lbl, svg.map .node.unknown .sub { fill: #3a4660; }
.intel-q { width: 104px; height: 78px; flex: none; display: grid; place-items: center; border-radius: 6px; background: #02060a; color: #3a4a60; font: 700 34px var(--mono); }

/* channel-flip transition: chunky static drawn small and scaled up */
#stage { transform-origin: 50% 50%; }
#fx {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; opacity: 0;
  image-rendering: pixelated; mix-blend-mode: screen;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 3px);
}

/* scenic title screen: the slideshow shows through */
#overlay.scenic { background: linear-gradient(90deg, rgba(0, 0, 0, 0) 55%, rgba(2, 4, 10, 0.55)); backdrop-filter: none; align-items: stretch; padding: 0; }
.title-wrap { width: 100%; height: 100%; display: grid; grid-template-columns: 1fr 300px; gap: 20px; padding: 26px; animation: fadein 1.6s ease-out; }
.title-logo { align-self: start; }
.title-wrap > .title-card { align-self: center; max-height: 100%; overflow: auto; }
.title-card .slots { grid-template-columns: 1fr; gap: 8px; }
.title-card .slot p { font-size: 12px; }
.title-card .title-actions { gap: 6px; }
.title-card .title-actions .vols { margin: 4px 0 0; flex-direction: column; gap: 6px; width: 100%; }
.title-card .vols label { justify-content: space-between; }
@media (max-width: 720px) { .title-wrap { grid-template-columns: 1fr; height: auto; min-height: 100%; } }
.title-logo h1 {
  margin: 4px 0 6px; font-size: clamp(40px, 7vw, 68px); font-weight: 800; letter-spacing: 0.22em;
  background: linear-gradient(180deg, #ffffff, #b9dcff 70%, #7f9cff); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}
.title-logo .tag { max-width: 420px; color: #d7deef; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); margin: 0; }
.card.title-card { max-width: none; width: 100%; padding: 14px 16px; background: rgba(6, 10, 22, 0.62); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-color: rgba(255, 255, 255, 0.1); }
.title-card .slots { margin-top: 0; }
.title-card .slot { background: rgba(255, 255, 255, 0.05); }
.title-actions { align-items: center; margin-top: 12px; }
.title-actions button { padding: 8px 12px; font-size: 14px; }
.vols { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font: 600 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.title-actions .vols { margin: 0 0 0 auto; }
.vols label { display: flex; align-items: center; gap: 8px; }
.vols input[type=range] { width: 110px; accent-color: #7fe3ff; }
@media (max-width: 720px) { .title-wrap { padding: 16px; gap: 16px; } .title-actions .vols { margin: 0; } }

.eyebrow { margin: 0 0 4px !important; font: 600 12px var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: #7fe3ff !important; }
.card h1 { letter-spacing: 0.14em; }
.diffs.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .diffs.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* splash */
.splash { margin: auto; text-align: center; cursor: pointer; padding: 40px 24px; outline: none; }
.splash h1 {
  margin: 6px 0 18px; font-size: clamp(44px, 9vw, 84px); font-weight: 800; letter-spacing: 0.22em;
  background: linear-gradient(180deg, #ffffff, #9fdcff 60%, #6a8cff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.splash .blink { font: 600 15px var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink); animation: blink 1.4s ease-in-out infinite; }
.splash .small { color: var(--muted); font-size: 13px; }
@keyframes blink { 50% { opacity: 0.25; } }

/* results */
.card.results { max-width: 600px; }
.res-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.res-head h2 { font-size: 30px; margin: 0; }
.grade { font: 800 52px/1 var(--ui); width: 76px; height: 76px; display: grid; place-items: center; border-radius: 14px; border: 2px solid currentColor; flex: none; }
.grade.g-S { color: #ffd166; box-shadow: 0 0 24px rgba(255, 209, 102, 0.4); }
.grade.g-A { color: #7fe3ff; }
.grade.g-B { color: #a6ffb8; }
.grade.g-C { color: #c9d2ee; }
.log { margin: 14px 0 4px; padding: 10px 14px; border-left: 3px solid #7fe3ff; background: rgba(127, 227, 255, 0.06); color: #c9d2ee; font: italic 16px/1.5 Georgia, "Times New Roman", serif; border-radius: 0 8px 8px 0; }
.total { font-size: 18px; color: var(--ink) !important; margin-top: 14px !important; }
.note { padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.note.good { background: rgba(126, 224, 129, 0.1); color: #b8f5bb !important; }
.saved { font: 600 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: #6f7ca3 !important; }

/* ---------- navigation console ---------- */
.console {
  --glass: #030b12;
  width: 100%; max-width: 936px; margin: auto;
  background: linear-gradient(180deg, #1d2330, #0f131c);
  border: 1px solid #2c3546; border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -2px 0 rgba(0, 0, 0, 0.5), 0 20px 60px rgba(0, 0, 0, 0.7);
  padding: 10px 12px;
  font-family: var(--mono);
  position: relative;
}
.console::before, .console::after {
  content: ""; position: absolute; top: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #8a94a8, #2a303c 70%);
}
.console::before { left: 8px; }
.console::after { right: 8px; }

.c-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; justify-content: space-between; padding: 0 10px 8px; border-bottom: 1px solid #262e3d; }
.c-brand { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: 0.14em; color: #8fa0c4; }
.c-brand b { color: #e8ecf8; }
.c-brand i { color: #3d4860; font-style: normal; }
.c-readouts { display: flex; gap: 6px; flex-wrap: wrap; }
.ro { display: grid; gap: 1px; padding: 4px 10px; background: var(--glass); border: 1px solid #1e3340; border-radius: 6px; box-shadow: inset 0 0 12px rgba(92, 225, 255, 0.08); min-width: 74px; }
.ro span { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: #4f8aa0; }
.ro b { font-size: 13px; color: #bff4ff; text-shadow: 0 0 8px rgba(92, 225, 255, 0.5); white-space: nowrap; }
.ro b.on { color: #ffe6a0; text-shadow: 0 0 8px rgba(255, 209, 102, 0.6); }
.ro.diff select { font: 600 12px var(--mono); color: #bff4ff; background: transparent; border: 0; padding: 0; cursor: pointer; }
.ro.diff select option { background: #0b1220; }

.c-main { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(230px, 1fr); gap: 10px; padding: 10px 0; }
@media (max-width: 760px) { .c-main { grid-template-columns: 1fr; } }
.screen {
  position: relative; background: radial-gradient(ellipse at 50% 40%, #071a24, var(--glass) 70%);
  border: 1px solid #1e3340; border-radius: 10px; overflow: hidden;
  box-shadow: inset 0 0 0 3px #0a0e15, inset 0 0 30px rgba(92, 225, 255, 0.07), 0 0 0 1px #000;
}
.mapscreen svg.map { display: block; width: 100%; height: auto; margin: 0; background: none; border-radius: 0; }
.scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px); }
.corner { position: absolute; width: 14px; height: 14px; border: 2px solid rgba(92, 225, 255, 0.5); pointer-events: none; }
.corner.tl { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }
.corner.br { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }

svg.map .tick { fill: rgba(92, 225, 255, 0.35); font: 600 10px var(--mono); }
svg.map .sweep { transform-origin: 500px 300px; animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
svg.map .edge { fill: none; stroke: rgba(150, 180, 230, 0.32); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; }
svg.map .edge.lit { stroke: rgba(92, 225, 255, 0.75); stroke-width: 3; stroke-dasharray: none; filter: url(#glow); }
svg.map .edge.open { stroke: #ffd166; stroke-width: 3; stroke-dasharray: 10 8; animation: dash 1.1s linear infinite; filter: url(#glow); }
svg.map .node { cursor: pointer; }
svg.map .node.locked .icon { opacity: 0.6; filter: grayscale(0.45) brightness(0.8); }
svg.map .node .lbl { fill: #8ea6c8; font: 700 17px var(--mono); letter-spacing: 0.08em; paint-order: stroke; stroke: #030b12; stroke-width: 4px; }
svg.map .node .sub { fill: #58789a; font: 600 12px var(--mono); letter-spacing: 0.1em; paint-order: stroke; stroke: #030b12; stroke-width: 3px; }
svg.map .node.cleared .lbl, svg.map .node.current .lbl { fill: #bfe9ff; }
svg.map .node.cleared .sub, svg.map .node.current .sub { fill: #5ce1ff; }
svg.map .node.avail .lbl { fill: #ffe6a0; }
svg.map .node.avail .sub { fill: #ffd166; }
svg.map .node.sel .lbl { fill: #ffffff; }
svg.map .node .ping { fill: none; stroke: #ffd166; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ping 1.6s ease-out infinite; }
@keyframes ping { from { transform: scale(0.7); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
svg.map .reticle { transform-box: fill-box; transform-origin: center; animation: spin 6s linear infinite; }
svg.map .reticle circle { fill: none; stroke: #ffffff; stroke-width: 1.5; stroke-dasharray: 5 5; opacity: 0.85; }
svg.map .reticle path { stroke: #ffffff; stroke-width: 2; }
svg.map .flag path { stroke: #ff8a7a; stroke-width: 1.6; fill: rgba(255, 107, 107, 0.35); }
svg.map .flag.got path { stroke: #7ee081; fill: rgba(126, 224, 129, 0.45); }
svg.map .me path { fill: #ffffff; filter: url(#glow); }
svg.map .me text { fill: #ffffff; font: 700 10px var(--mono); letter-spacing: 0.15em; }
svg.map .me .bob { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
svg.map .node:focus { outline: none; }
svg.map .node:focus-visible .lbl { fill: #fff; text-decoration: underline; }

.navpanel { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; color: #c9d2ee; }
.np-head { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: #4f8aa0; border-bottom: 1px solid #12303c; padding-bottom: 6px; }
.np-head .ok { color: #7ee081; }
.np-head .warn { color: #ff9a8a; }
.np-name { font: 800 24px var(--ui); color: #f3ecd8; letter-spacing: 0.04em; }
.np-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.np-tags .pill { font-style: normal; }
.pill.dim { background: rgba(92, 225, 255, 0.12); color: #7fe3ff; }
.pill.green { background: rgba(126, 224, 129, 0.15); color: #a6f5a9; }
.np-data { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.np-data div { background: rgba(92, 225, 255, 0.04); border: 1px solid #12303c; border-radius: 6px; padding: 5px 8px; }
.np-data dt { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: #4f8aa0; }
.np-data dd { margin: 1px 0 0; font-size: 12px; color: #dff6ff; }
.np-desc { margin: 0; font: italic 14px/1.45 Georgia, "Times New Roman", serif; color: #b6c2df; }
.intel { display: flex; gap: 10px; align-items: center; background: rgba(0, 0, 0, 0.35); border: 1px solid #12303c; border-radius: 8px; padding: 6px; }
.intel canvas { width: 104px; height: 78px; flex: none; border-radius: 6px; background: radial-gradient(circle, #0b2230, #02070b 75%); }
.intel span { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: #4f8aa0; }
.intel b { display: block; font: 700 14px var(--ui); color: #f3ecd8; margin: 1px 0 2px; }
.intel p { margin: 0; font: 12px/1.35 var(--ui); color: #9aa6c8; }
.np-actions { display: flex; gap: 8px; margin-top: auto; }
.np-actions button { font-family: var(--mono); letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
.np-actions .engage { flex: 1; }
.np-actions .engage:disabled { opacity: 0.5; cursor: not-allowed; }
button.engage.primary { background: linear-gradient(180deg, #ffe08a, #f2b84b); box-shadow: 0 0 18px rgba(255, 209, 102, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5); }

.c-bottom { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 8px 10px 2px; border-top: 1px solid #262e3d; font-size: 11px; color: #6f7ca3; }
.lights { display: flex; gap: 12px; flex-wrap: wrap; text-transform: uppercase; letter-spacing: 0.12em; font-size: 10px; }
.lights span { display: flex; align-items: center; gap: 5px; }
.led { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2a313f; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6); }
.led.on { background: #7ee081; box-shadow: 0 0 8px #7ee081; }
.led.amber { background: #ffb35c; box-shadow: 0 0 6px rgba(255, 179, 92, 0.7); }
.led.blink { background: #5ce1ff; box-shadow: 0 0 8px #5ce1ff; animation: blink 1s steps(2) infinite; }
.routes { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.routes > span { text-transform: uppercase; letter-spacing: 0.14em; font-size: 10px; color: #ffd166; }
.routes .chip { font-family: var(--mono); font-size: 11px; padding: 5px 10px; }
.hint kbd { font-size: 10px; }
