/* Quantum Expedition — the Learn path drawn as a place.
   Natural scientific realism: a quiet research campus in daylight (light
   theme) or at dusk (dark theme). Muted land, glass exhibit panels, one
   restrained hue per region. No neon, no glow-heavy effects.
   Every colour below is a token so both themes use the same drawing code. */

:root {
  --xp-sky-top: #c9d6df;
  --xp-sky-bot: #eceeeb;
  --xp-land: #d9ddd0;
  --xp-far: #b9c5ca;
  --xp-mid: #aebba9;
  --xp-near: #c5cdbb;
  --xp-band: #cfd6c6;
  --xp-band-b: #c9d1c0;
  --xp-trail: #ece6d6;
  --xp-trail-edge: #bdb5a0;
  --xp-tree: #8fa08a;
  --xp-trunk: #7a6e5d;
  --xp-wall: #e8e5de;
  --xp-wall-2: #d3cfc6;
  --xp-roof: #88959e;
  --xp-glass: #a9bcc7;
  --xp-win: #7d8f9b;
  --xp-panel: rgba(255, 255, 255, 0.62);
  --xp-panel-edge: #8e9aa2;
  --xp-post: #6f7a82;
  --xp-mute: #6a7a81;
  --xp-ink: #27313a;
  --xp-skin: #c89f80;
  --xp-hair: #2f2a26;
  --xp-coat: #4d6275;
  --xp-pants: #2e3640;
  --xp-pack: #8a6f4e;
  --xp-shoe: #1f2328;
  --xp-tablet: #1e2a33;
  --xp-shadow: rgba(30, 36, 40, 0.22);
  --xp-amb: rgba(255, 255, 255, 0.9);
  --xp-card: var(--surface, #fff);
  --xp-rule: var(--rule, #d8dadc);
  --hue: #7fa3b5;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --xp-sky-top: #131a25;
    --xp-sky-bot: #28323f;
    --xp-land: #2b3431;
    --xp-far: #26303b;
    --xp-mid: #2c3a38;
    --xp-near: #2f3834;
    --xp-band: #303a36;
    --xp-band-b: #2c3632;
    --xp-trail: #4a4a44;
    --xp-trail-edge: #23231f;
    --xp-tree: #3c4c42;
    --xp-trunk: #3a342c;
    --xp-wall: #3b4450;
    --xp-wall-2: #323a45;
    --xp-roof: #58636e;
    --xp-glass: #4b5d6b;
    --xp-win: #c9a45e;
    --xp-panel: rgba(20, 28, 36, 0.62);
    --xp-panel-edge: #6f7d88;
    --xp-post: #8a96a0;
    --xp-mute: #9aa9b0;
    --xp-ink: #dfe5ea;
    --xp-coat: #6f8599;
    --xp-pants: #1c2228;
    --xp-pack: #7b6448;
    --xp-tablet: #0e141a;
    --xp-shadow: rgba(0, 0, 0, 0.4);
    --xp-amb: rgba(230, 236, 255, 0.75);
  }
}
:root[data-theme="dark"] {
  --xp-sky-top: #131a25;
  --xp-sky-bot: #28323f;
  --xp-land: #2b3431;
  --xp-far: #26303b;
  --xp-mid: #2c3a38;
  --xp-near: #2f3834;
  --xp-band: #303a36;
  --xp-band-b: #2c3632;
  --xp-trail: #4a4a44;
  --xp-trail-edge: #23231f;
  --xp-tree: #3c4c42;
  --xp-trunk: #3a342c;
  --xp-wall: #3b4450;
  --xp-wall-2: #323a45;
  --xp-roof: #58636e;
  --xp-glass: #4b5d6b;
  --xp-win: #c9a45e;
  --xp-panel: rgba(20, 28, 36, 0.62);
  --xp-panel-edge: #6f7d88;
  --xp-post: #8a96a0;
  --xp-mute: #9aa9b0;
  --xp-ink: #dfe5ea;
  --xp-coat: #6f8599;
  --xp-pants: #1c2228;
  --xp-pack: #7b6448;
  --xp-tablet: #0e141a;
  --xp-shadow: rgba(0, 0, 0, 0.4);
  --xp-amb: rgba(230, 236, 255, 0.75);
}

/* ------------------------------------------------------------ page layout */

.xp {
  --xp-tone: color-mix(in oklab, var(--hue) 55%, var(--xp-ink));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
  padding-block: 8px 40px;
  color: var(--ink);
}
.xp-bar { grid-column: 1 / -1; }
.xp-main { display: grid; gap: 16px; min-width: 0; }
.xp-rail { display: grid; gap: 12px; position: sticky; top: 12px; }

.xp-card {
  background: var(--xp-card);
  border: 1px solid var(--xp-rule);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}
.xp-card-h {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  align-items: flex-end; justify-content: space-between;
  margin-bottom: 12px;
}
.xp-card-h h2, .xp-detail-body h2 {
  margin: 0; font-size: 1.25rem; line-height: 1.25; text-wrap: balance;
}
.xp-lede { margin: 4px 0 0; color: var(--ink-2); font-size: 0.9rem; max-width: 62ch; }
.xp-eyebrow {
  display: block; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.xp-small { font-size: 0.8rem; color: var(--ink-3); margin: 6px 0 0; }
.xp-muted { opacity: 0.75; }
.xp-scroll { overflow-x: auto; border-radius: 8px; }
.xp-scroll > svg { display: block; width: 100%; height: auto; }

/* --------------------------------------------------------- journey bar */

.xp-bar {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--xp-card); border: 1px solid var(--xp-rule); border-radius: 12px;
  overflow: hidden;
}
.xp-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; min-width: 0;
  border-left: 1px solid var(--xp-rule);
}
.xp-cell:first-child { border-left: 0; }
.xp-cell-now { background: color-mix(in oklab, var(--accent) 7%, transparent); }
.xp-k { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.xp-v { font-size: 0.92rem; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }
.xp-sub { font-size: 0.76rem; color: var(--ink-3); line-height: 1.3; }

/* --------------------------------------------------------------- legend */

.xp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 0.78rem; color: var(--ink-2); }
.xp-legend li { display: flex; align-items: center; gap: 6px; }
.xp-lg { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.xp-lg-done { background: var(--good); }
.xp-lg-here { background: var(--xp-coat); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 30%, transparent); }
.xp-lg-ahead { background: transparent; border: 1.5px solid var(--xp-mute); border-radius: 3px; }

/* =================================================== landscape layers */

.xp-far { fill: var(--xp-far); }
.xp-mid { fill: var(--xp-mid); }
.xp-near { fill: var(--xp-near); }
.xp-band { fill: var(--xp-band); }
.xp-band-b { fill: var(--xp-band-b); }
.xp-amb { fill: var(--xp-amb); opacity: 0.55; }
.xp-ambient { animation: xp-drift 9s ease-in-out infinite alternate; }
@keyframes xp-drift { from { transform: translateY(0); opacity: 0.8; } to { transform: translateY(-3px); opacity: 1; } }
.xp-tree { fill: var(--xp-tree); }
.xp-tree-trunk { stroke: var(--xp-trunk); stroke-width: 1.4; }
.xp-trail { fill: none; stroke: var(--xp-trail); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.xp-trail-edge { fill: none; stroke: var(--xp-trail-edge); stroke-width: 9.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; }
.xp-trail-done { fill: none; stroke: color-mix(in oklab, var(--good) 55%, var(--xp-trail)); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 7; }
.xp-scene .xp-trail { stroke-width: 10; }
.xp-plinth { fill: var(--xp-shadow); opacity: 0.6; }

/* ------------------------------------------------------------ buildings */

.xs-bld { fill: var(--xp-wall); stroke: color-mix(in oklab, var(--xp-wall) 70%, var(--xp-ink)); stroke-width: 0.8; }
.xs-bld2 { fill: var(--xp-wall-2); stroke: color-mix(in oklab, var(--xp-wall-2) 70%, var(--xp-ink)); stroke-width: 0.8; }
.xs-roof { fill: var(--xp-roof); }
.xs-rooflinefill { fill: none; stroke: var(--xp-roof); stroke-width: 4; }
.xs-glass { fill: var(--xp-glass); opacity: 0.9; }
.xs-glassline { stroke: var(--xp-glass); stroke-width: 2; }
.xs-win { fill: var(--xp-win); opacity: 0.85; }
.xs-shade { fill: var(--xp-ink); opacity: 0.06; }
.xs-rib { stroke: var(--xp-wall-2); stroke-width: 2; fill: none; }
.xs-mast { stroke: var(--xp-post); stroke-width: 1.4; fill: none; }
.xs-beacon { fill: color-mix(in oklab, var(--hue) 70%, var(--xp-ink)); }
.xs-pipe { fill: none; stroke: var(--xp-roof); stroke-width: 2.2; }
.xs-link { fill: none; stroke: color-mix(in oklab, var(--hue) 60%, var(--xp-mute)); stroke-width: 1.2; stroke-dasharray: 3 3; }
.xs-beamline { stroke: color-mix(in oklab, var(--hue) 70%, var(--xp-ink)); stroke-width: 1.4; opacity: 0.8; }

/* ------------------------------------------------------- exhibit panel */

.xp-panel { fill: var(--xp-panel); stroke: var(--xp-panel-edge); stroke-width: 1; }
.xp-panel-glint { stroke: var(--xp-amb); stroke-width: 1.2; opacity: 0.6; }
.xp-post { stroke: var(--xp-post); stroke-width: 2.4; }

/* The installation drawing — one region hue mixed into ink, never pure. */
.xp-scene, .xp-chaptermap, .xp-worldmap { --tone: color-mix(in oklab, var(--hue) 58%, var(--xp-ink)); }
.xv-line { fill: none; stroke: var(--tone); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.xv-strong { stroke-width: 2.3; }
.xv-accent { stroke: color-mix(in oklab, var(--hue) 85%, var(--xp-ink)); stroke-width: 2.2; }
.xv-soft { fill: none; stroke: var(--xp-mute); stroke-width: 1.1; stroke-linecap: round; opacity: 0.8; }
.xv-dash { stroke-dasharray: 3 3; }
.xv-grid { stroke: var(--xp-mute); stroke-width: 0.6; opacity: 0.3; }
.xv-head { fill: var(--tone); }
.xv-softhead { fill: var(--xp-mute); opacity: 0.8; }
.xv-dot { fill: var(--tone); }
.xv-dot-hi { fill: color-mix(in oklab, var(--hue) 85%, var(--xp-ink)); }
.xv-softdot { fill: var(--xp-mute); opacity: 0.7; }
.xv-qubit { opacity: 0.9; }
.xv-fill { fill: color-mix(in oklab, var(--hue) 22%, transparent); stroke: none; }
.xv-sphere { fill: color-mix(in oklab, var(--hue) 10%, transparent); }
.xv-cell { fill: color-mix(in oklab, var(--xp-panel-edge) 12%, transparent); stroke: var(--xp-mute); stroke-width: 1; }
.xv-cell-pair { fill: color-mix(in oklab, var(--hue) 18%, transparent); }
.xv-cell-diag { fill: color-mix(in oklab, var(--hue) 34%, transparent); }
.xv-cell-on { fill: color-mix(in oklab, var(--hue) 45%, transparent); stroke: var(--tone); }
.xv-bar { fill: color-mix(in oklab, var(--hue) 45%, var(--xp-mute)); }
.xv-bar-hi { fill: color-mix(in oklab, var(--hue) 80%, var(--xp-ink)); }
.xv-band { fill: color-mix(in oklab, var(--hue) 10%, transparent); stroke: none; }
.xv-gate { fill: var(--xp-panel); stroke: var(--tone); stroke-width: 1.4; }
.xv-gate-hi { fill: color-mix(in oklab, var(--hue) 22%, var(--xp-panel)); }
.xv-gate-faint { opacity: 0.45; }
.xv-sealed { fill: color-mix(in oklab, var(--xp-ink) 14%, transparent); stroke: var(--xp-mute); stroke-width: 1.2; }
.xv-chamber { fill: color-mix(in oklab, var(--xp-ink) 8%, transparent); stroke: var(--tone); stroke-width: 1.4; }
.xv-magnet { fill: var(--xp-roof); stroke: var(--xp-ink); stroke-width: 0.6; opacity: 0.85; }
.xv-lamp { fill: var(--xp-panel); stroke: var(--xp-mute); stroke-width: 1.1; }
.xv-lamp-on { fill: color-mix(in oklab, #e6b85c 75%, var(--hue)); stroke: color-mix(in oklab, #b6862c 70%, var(--xp-ink)); }
.xv-beam { fill: none; stroke: color-mix(in oklab, #d24b3e 55%, var(--hue)); stroke-width: 1.4; opacity: 0.8; }
.xv-beam-strong { stroke-width: 2.2; opacity: 1; }
.xv-beam-faint { opacity: 0.2; stroke-dasharray: 2 3; }
.xv-glass { stroke: color-mix(in oklab, var(--xp-glass) 70%, var(--xp-ink)); stroke-width: 2.6; opacity: 0.85; }
.xv-mirror { stroke: var(--xp-ink); stroke-width: 2.6; opacity: 0.75; }
.xv-ghost { fill: color-mix(in oklab, #d24b3e 45%, transparent); }
.xv-field { fill: none; stroke: color-mix(in oklab, var(--hue) 60%, var(--xp-mute)); stroke-width: 0.9; stroke-dasharray: 2 4; opacity: 0.8; }
.xv-check { fill: color-mix(in oklab, var(--hue) 14%, transparent); stroke: var(--xp-mute); stroke-width: 0.9; }
.xv-check-hi { fill: color-mix(in oklab, var(--hue) 45%, transparent); stroke: var(--tone); }
.xv-ink { fill: var(--xp-ink); font: 600 12px "IBM Plex Mono", ui-monospace, monospace; text-anchor: middle; }
.xv-mid { font-size: 10px; }
.xv-small { font-size: 8.5px; }
.xv-big { font-size: 17px; }
.xv-muted { fill: var(--xp-mute); font-weight: 500; }
.xv-gatelabel { font-family: "IBM Plex Sans Condensed", system-ui, sans-serif; font-size: 18px; }
.xv-gatelabel.xv-mid { font-size: 12px; }
.xv-gatelabel.xv-small { font-size: 10px; }
.xv-note { fill: var(--tone); font: italic 500 11px "Source Serif 4", Georgia, serif; text-anchor: start; }
.xv-note.xv-small { font-size: 9.5px; }
.xv-note.xv-big { font-size: 16px; }

/* ================================================================ avatar */

.xa-leg { stroke: var(--xp-pants); stroke-width: 2.8; stroke-linecap: round; }
.xa-shoe { fill: var(--xp-shoe); }
.xa-coat { fill: var(--xp-coat); }
.xa-seam { stroke: color-mix(in oklab, var(--xp-coat) 60%, #000); stroke-width: 0.5; }
.xa-arm { fill: none; stroke: var(--xp-coat); stroke-width: 2.6; stroke-linecap: round; }
.xa-arm-back { stroke: color-mix(in oklab, var(--xp-coat) 78%, #000); }
.xa-skin { fill: var(--xp-skin); }
.xa-hair { fill: var(--xp-hair); }
.xa-pack { fill: var(--xp-pack); }
.xa-tablet { fill: var(--xp-tablet); stroke: color-mix(in oklab, var(--xp-tablet) 60%, #9aa); stroke-width: 0.4; }
.xa-stylus { stroke: var(--xp-ink); stroke-width: 0.8; stroke-linecap: round; }
.xa-shadow { fill: var(--xp-shadow); }
.xa-upper { transform-box: fill-box; transform-origin: 50% 100%; }
.xa-breathe { animation: xa-breathe 4.2s ease-in-out infinite; }
@keyframes xa-breathe { 50% { transform: translateY(-0.35px) scaleY(1.008); } }
.xa-arrived .xa-upper { animation: xa-hop 0.5s ease-out 1; }
@keyframes xa-hop { 40% { transform: translateY(-1.6px); } }
.xp-here-ring { fill: none; stroke: color-mix(in oklab, var(--accent) 70%, transparent); stroke-width: 1.4; }

/* ============================================================ world map */

.xp-node { cursor: pointer; outline: none; }
.xp-plate { fill: var(--xp-shadow); opacity: 0.35; }
.xp-plate-sel { fill: none; opacity: 1; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 4 3; }
.xp-node-name, .xp-st-name { fill: var(--xp-ink); font: 600 12.5px "IBM Plex Sans Condensed", system-ui, sans-serif; text-anchor: middle; }
.xp-node-region { fill: var(--xp-mute); font: 500 10.5px "IBM Plex Sans Condensed", system-ui, sans-serif; text-anchor: middle; }
.xp-node-count { fill: var(--xp-mute); font: 500 10px "IBM Plex Mono", ui-monospace, monospace; }
.xp-left { text-anchor: start; }
/* a ground-coloured halo keeps labels readable where the trail passes behind them */
.xp-node-name, .xp-node-region, .xp-node-count, .xp-st-name, .xp-st-num {
  paint-order: stroke; stroke: color-mix(in oklab, var(--xp-land) 88%, transparent);
  stroke-width: 3.5px; stroke-linejoin: round;
}
.xp-meter { fill: color-mix(in oklab, var(--xp-mute) 30%, transparent); }
.xp-meter-fill { fill: var(--good); }
.xp-badge-done { fill: var(--good); stroke: var(--xp-card); stroke-width: 1.6; }
.xp-badge-tick { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.xp-badge-ahead { fill: var(--xp-card); stroke: var(--xp-mute); stroke-width: 1.1; }
.xp-gate-arch { fill: none; stroke: var(--xp-mute); stroke-width: 1.3; }
.xp-node-ahead .xs { opacity: 0.62; }
.xp-node-ahead .xp-node-name { fill: var(--xp-mute); }
.xp-node:hover .xp-plate, .xp-station:hover .xp-plate { opacity: 0.6; }
.xp-node:focus-visible .xp-plate, .xp-station:focus-visible .xp-medal {
  stroke: var(--accent); stroke-width: 2.2; opacity: 1;
}

/* ========================================================== chapter map */

.xp-chapter-ground { fill: color-mix(in oklab, var(--xp-land) 70%, var(--xp-card)); }
.xp-station { cursor: pointer; outline: none; }
.xp-plinth-block { fill: color-mix(in oklab, var(--xp-wall-2) 80%, var(--xp-land)); }
.xp-medal { fill: var(--xp-panel); stroke: var(--xp-panel-edge); stroke-width: 1.2; }
.xp-station-done .xp-medal { stroke: color-mix(in oklab, var(--good) 70%, var(--xp-panel-edge)); }
.xp-station-current .xp-medal { stroke: var(--accent); stroke-width: 2; }
.xp-medal-sel { stroke-dasharray: 4 3; stroke: var(--accent); stroke-width: 1.8; }
.xp-station-todo .xp-medal-viz { opacity: 0.7; }
.xp-station.is-ahead .xp-medal-viz { opacity: 0.5; }
.xp-medal-viz .xv-line, .xp-medal-viz .xv-accent { stroke-width: 3.4; }
.xp-medal-viz .xv-soft, .xp-medal-viz .xv-grid { opacity: 0.35; }
.xp-medal-viz text { display: none; }
.xp-st-num { fill: var(--xp-mute); font: 600 10.5px "IBM Plex Mono", ui-monospace, monospace; text-anchor: middle; }
.xp-st-name { font-size: 11.5px; font-weight: 500; }
.xp-station-current .xp-st-name { font-weight: 700; }
.xp-gatepost { fill: var(--xp-roof); }
.xp-gatebar { stroke: var(--xp-post); stroke-width: 2; }
.xp-gate.is-open .xp-gatepost { fill: color-mix(in oklab, var(--good) 45%, var(--xp-roof)); }

/* ================================================================ detail */

.xp-detail { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.xp-hero { border-radius: 10px; overflow: hidden; border: 1px solid var(--xp-rule); }
.xp-hero svg { display: block; width: 100%; height: auto; }
.xp-detail-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.xp-icon { font-size: 1.05em; }
.xp-hook { margin: 0; color: var(--ink-2); font-family: "Source Serif 4", Georgia, serif; font-size: 1rem; line-height: 1.5; max-width: 60ch; }
.xp-facts { display: grid; gap: 6px; margin: 4px 0; }
.xp-facts div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 0.84rem; }
.xp-facts dt { color: var(--ink-3); }
.xp-facts dd { margin: 0; color: var(--ink); }
.xp-state { margin: 2px 0; font-size: 0.85rem; color: var(--ink-2); padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.xp-state-here { background: color-mix(in oklab, var(--accent) 10%, var(--surface-2)); color: var(--ink); }
.xp-state-done { background: var(--good-soft, color-mix(in oklab, var(--good) 12%, transparent)); color: var(--ink); }
.xp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ================================================================== rail */

.xp-rail .xp-card { padding: 14px 16px; }
.xp-rail-h { margin: 0 0 8px; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.xp-mission-title { margin: 0 0 10px; display: flex; flex-direction: column; gap: 2px; }
.xp-mission-title b { font-size: 1rem; line-height: 1.3; }
.xp-mission-title span { font-size: 0.8rem; color: var(--ink-3); }
/* one connected mission line: each stage's dot joined to the next */
.xp-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.xp-ck { position: relative; display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: start; padding: 6px 4px; border-radius: 6px; }
.xp-ck:not(:last-child)::before {
  content: ""; position: absolute; left: 11px; width: 2px; top: 24px; bottom: -7px;
  border-radius: 1px; background: var(--rule-2, var(--xp-rule));
}
.xp-ck-done:not(:last-child)::before { background: var(--x3-done); }
.xp-ck-mark {
  position: relative; z-index: 1;
  width: 16px; height: 16px; margin-top: 1px; border-radius: 50%;
  border: 1.5px solid var(--rule-2, var(--xp-rule)); background: var(--xp-card); display: grid; place-items: center;
  font-size: 10px; line-height: 1; color: #fff;
}
.xp-ck-done .xp-ck-mark { background: var(--x3-done); border-color: var(--x3-done); color: var(--x3-on-done); }
.xp-ck-current { background: color-mix(in oklab, var(--x3-violet) 9%, transparent); }
.xp-ck-current .xp-ck-mark { border-color: var(--x3-violet); box-shadow: inset 0 0 0 3px var(--xp-card), 0 0 0 3px color-mix(in oklab, var(--x3-violet) 25%, transparent); background: var(--x3-violet); }
.xp-ck-text { display: flex; flex-direction: column; min-width: 0; }
.xp-ck-text b { font-size: 0.86rem; }
.xp-ck-text span { font-size: 0.76rem; color: var(--ink-3); line-height: 1.3; }
.xp-ck-done .xp-ck-text b { color: var(--ink-2); }
.xp-ck-n { font: 500 0.72rem "IBM Plex Mono", ui-monospace, monospace; color: var(--ink-3); padding-top: 2px; }
.xp-progress { height: 6px; border-radius: 3px; background: var(--surface-3, var(--surface-2)); overflow: hidden; margin-top: 10px; }
.xp-progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.xp-go { width: 100%; margin-top: 10px; }
.xp-unlock { display: flex; gap: 10px; align-items: center; }
.xp-unlock-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--xp-rule); }
.xp-unlock div { display: flex; flex-direction: column; min-width: 0; }
.xp-unlock b { font-size: 0.88rem; line-height: 1.3; }
.xp-unlock span { font-size: 0.78rem; color: var(--ink-3); }
.xp-gate-note { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; font-size: 0.8rem; color: var(--ink-2); }
.xp-gate-glyph {
  flex: none; width: 14px; height: 14px; margin-top: 1px;
  border: 1.5px solid var(--xp-mute); border-bottom: 0; border-radius: 7px 7px 0 0;
}
.xp-level { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.xp-level b { font-size: 1rem; }
.xp-level span { font-size: 0.82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.xp-reward-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.xp-reward-list li { display: flex; gap: 8px; align-items: baseline; font-size: 0.8rem; color: var(--ink-2); }
.xp-reward-list b { color: var(--ink); min-width: 58px; font-variant-numeric: tabular-nums; }

/* ============================================================ module strip */

.xp-strip {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  align-items: center; gap: 12px;
  margin: 10px 0 4px; padding: 0 0 0 14px;
  border: 1px solid var(--xp-rule); border-radius: 10px;
  background: var(--xp-card); overflow: hidden;
}
.xp-strip-text { display: flex; flex-direction: column; gap: 3px; padding-block: 10px; min-width: 0; }
.xp-strip-text b { font-size: 0.95rem; line-height: 1.25; }
.xp-strip-text .xp-small { margin: 0; }
.xp-strip-map { align-self: flex-start; margin-top: 4px; font-size: 0.75rem; padding: 4px 9px; }
.xp-strip-scene svg { display: block; width: 100%; height: 100%; max-height: 116px; }

/* ============================================================ 3D island map
   The canvas draws the island; everything readable (region names, station
   numbers, the tooltip, the controls) is real DOM on top of it, so it stays
   crisp, focusable and screen-reader visible. State is never colour-only:
   every mark also carries a glyph (✓ ◉ ○ ·) or a shape. */

:root {
  --x3-violet: #7055d9;
  --x3-done: #24845b;
  --x3-sel: #c9820f;
  --x3-on-done: #fff;
  --x3-on-violet: #fff;
  --x3-sky-top: #a9d8f2;
  --x3-sky-bot: #e4f3ea;
  --x3-panel: rgba(255, 255, 255, 0.92);
  --x3-panel-edge: rgba(40, 44, 80, 0.14);
  --x3-shadow: 0 2px 8px rgba(30, 34, 70, 0.16);
  --x3-h: clamp(420px, 62vh, 640px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x3-violet: #a191f2;
    --x3-done: #45c48d;
    --x3-sel: #f2b84b;
    --x3-on-done: #06231a;
    --x3-on-violet: #17123a;
    --x3-sky-top: #121330;
    --x3-sky-bot: #332f5e;
    --x3-panel: rgba(26, 27, 48, 0.9);
    --x3-panel-edge: rgba(200, 200, 255, 0.16);
    --x3-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme="dark"] {
  --x3-violet: #a191f2;
  --x3-done: #45c48d;
  --x3-sel: #f2b84b;
  --x3-on-done: #06231a;
  --x3-on-violet: #17123a;
  --x3-sky-top: #121330;
  --x3-sky-bot: #332f5e;
  --x3-panel: rgba(26, 27, 48, 0.9);
  --x3-panel-edge: rgba(200, 200, 255, 0.16);
  --x3-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.xp-card-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }

/* 3D island / Flat map switch */
.xp-seg {
  display: inline-flex; padding: 2px; gap: 2px;
  border: 1px solid var(--xp-rule); border-radius: 9px; background: var(--surface-2);
}
.xp-seg-b {
  min-height: 32px; padding: 4px 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-2); font: inherit; font-size: 0.8rem; cursor: pointer;
}
.xp-seg-b:hover { color: var(--ink); }
.xp-seg-b.is-on { background: var(--xp-card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.x3 { position: relative; }
.x3-viewport, .x3-loading {
  position: relative; height: var(--x3-h); border-radius: 10px; overflow: hidden;
  background: linear-gradient(180deg, var(--x3-sky-top), var(--x3-sky-bot));
}
.x3-viewport canvas { display: block; width: 100%; height: 100%; outline: none; }
.x3-loading { margin: 0; display: grid; place-items: center; color: var(--ink-2); font-size: 0.9rem; }

.x3-labels {
  position: absolute; left: 0; top: 0; right: 0; height: var(--x3-h);
  overflow: hidden; pointer-events: none; border-radius: 10px;
}
.x3-labels > * { position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; }

/* region labels — one per landmark */
.x3-rl {
  --rl: var(--hue);
  display: flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px; max-width: 190px;
  border: 1px solid var(--x3-panel-edge); border-radius: 999px;
  background: var(--x3-panel); color: var(--ink); box-shadow: var(--x3-shadow);
  font: inherit; text-align: left; cursor: pointer;
  backdrop-filter: blur(6px);
}
.x3-rl-n {
  flex: none; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--rl); color: #fff; font-size: 0.72rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.x3-rl-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.x3-rl-t b { font-size: 0.74rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x3-rl-meter { display: block; width: 64px; height: 3px; border-radius: 2px; background: color-mix(in oklab, var(--rl) 22%, transparent); overflow: hidden; }
.x3-rl-meter i { display: block; height: 100%; background: var(--rl); border-radius: 2px; }
.x3-rl-complete { --rl: var(--x3-done); }
.x3-rl-current { border-color: var(--x3-violet); box-shadow: 0 0 0 2px color-mix(in oklab, var(--x3-violet) 35%, transparent), var(--x3-shadow); }
.x3-rl-current .x3-rl-n { background: var(--x3-violet); color: var(--x3-on-violet); }
.x3-rl-complete .x3-rl-n { color: var(--x3-on-done); }
.x3-rl-ahead { --rl: color-mix(in oklab, var(--hue) 45%, #8a8f99); }
.x3-rl-ahead .x3-rl-t b { color: var(--ink-2); }
.x3-rl.is-hover, .x3-rl:hover { z-index: 2; border-color: var(--rl); }
.x3-rl.is-sel { z-index: 3; border-color: var(--x3-sel); box-shadow: 0 0 0 2px var(--x3-sel), var(--x3-shadow); }
.x3-rl.is-compact { padding: 1px; gap: 0; }
.x3-rl.is-compact .x3-rl-t { display: none; }

/* station numbers — shown for the selected region only */
.x3-sl {
  min-width: 34px; height: 28px; padding: 0 8px;
  border: 1px solid var(--x3-panel-edge); border-radius: 14px;
  background: var(--x3-panel); color: var(--ink); box-shadow: var(--x3-shadow);
  font: 600 0.72rem "IBM Plex Mono", ui-monospace, monospace; cursor: pointer;
}
.x3-sl-done { background: var(--x3-done); border-color: var(--x3-done); color: var(--x3-on-done); }
.x3-sl-current { background: var(--x3-violet); border-color: var(--x3-violet); color: var(--x3-on-violet); }
.x3-sl-ahead { border-style: dashed; color: var(--ink-2); }
.x3-sl:hover { z-index: 2; }
.x3-sl.is-sel { z-index: 3; box-shadow: 0 0 0 2px var(--xp-card), 0 0 0 4px var(--x3-sel); }

.x3-here {
  pointer-events: none !important;
  padding: 3px 8px; border-radius: 6px;
  background: var(--x3-violet); color: var(--x3-on-violet); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap; box-shadow: var(--x3-shadow);
}
.x3-here::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px;
  border: 5px solid transparent; border-bottom: 0; border-top-color: var(--x3-violet);
}

.x3-tip {
  position: absolute; left: 0; top: 0; z-index: 5; width: 220px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 8px; border-left: 4px solid var(--xp-mute);
  background: var(--x3-panel); color: var(--ink); box-shadow: var(--x3-shadow);
  pointer-events: none; font-size: 0.8rem; line-height: 1.3;
}
.x3-tip b { font-size: 0.84rem; }
.x3-tip span { color: var(--ink-2); font-size: 0.74rem; }
.x3-tip[data-status="done"] { border-left-color: var(--x3-done); }
.x3-tip[data-status="current"] { border-left-color: var(--x3-violet); }

.x3-ctl {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: calc(100% - 20px);
}
.x3-btn {
  min-height: 34px; padding: 0 12px;
  border: 1px solid var(--x3-panel-edge); border-radius: 8px;
  background: var(--x3-panel); color: var(--ink); box-shadow: var(--x3-shadow);
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  backdrop-filter: blur(6px);
}
.x3-btn:hover { border-color: var(--x3-violet); }
.x3-btn-home { color: var(--x3-violet); }
.x3-btn-sq { width: 34px; padding: 0; font-size: 1.05rem; line-height: 1; }
.x3-btn-q[aria-pressed="true"] { border-color: color-mix(in oklab, var(--x3-violet) 55%, var(--x3-panel-edge)); }
.x3-btn-walk { color: var(--x3-violet); }
.x3-btn-walk[aria-pressed="true"] { background: var(--x3-violet); border-color: var(--x3-violet); color: var(--x3-on-violet); }
.x3-walking .x3-viewport canvas { cursor: crosshair; }

/* walk mode: the pedestal you are standing at, one tap or Enter from opening */
.x3-cue {
  z-index: 3; max-width: min(340px, calc(100% - 24px)); min-height: 32px; padding: 6px 14px;
  border: 0; border-radius: 999px;
  background: var(--x3-violet); color: var(--x3-on-violet); box-shadow: var(--x3-shadow);
  font: inherit; font-size: 0.74rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.x3-cue:focus-visible { outline: 2px solid var(--x3-sel); outline-offset: 2px; }

/* while the textures and models download: the plain island is already usable */
.x3-load {
  position: absolute; top: 10px; left: 10px; z-index: 4;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px; border-radius: 999px;
  background: var(--x3-panel); color: var(--ink-2); box-shadow: var(--x3-shadow);
  font-size: 0.74rem; font-weight: 600; font-variant-numeric: tabular-nums;
  pointer-events: none; backdrop-filter: blur(6px);
}
.x3-load i {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--x3-violet) 25%, transparent); border-top-color: var(--x3-violet);
  animation: x3-spin 0.9s linear infinite;
}
@keyframes x3-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .x3-load i { animation: none; } }

.x3-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none;
  font-size: 0.78rem; color: var(--ink-2);
}
.x3-legend li { display: flex; align-items: center; gap: 6px; }
.x3-lg { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.x3-lg-done { background: var(--x3-done); }
.x3-lg-here { background: var(--x3-violet); box-shadow: 0 0 0 3px color-mix(in oklab, var(--x3-violet) 30%, transparent); }
.x3-lg-todo { border: 2px solid var(--hue, var(--xp-mute)); }
.x3-lg-ahead { width: 12px; height: 6px; border-radius: 2px; background: color-mix(in oklab, var(--xp-mute) 60%, transparent); }
.x3-hint { margin: 6px 0 0; font-size: 0.74rem; color: var(--ink-3); }
.x3-hint.is-nudge { animation: x3-nudge 1.6s ease-out; }
@keyframes x3-nudge {
  0%, 60% { color: var(--x3-violet); }
  100% { color: var(--ink-3); }
}

/* the picked station, right under the map */
.x3-peek {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--xp-rule); border-left: 4px solid var(--hue); border-radius: 10px;
  background: color-mix(in oklab, var(--hue) 6%, var(--xp-card));
}
.x3-peek:empty { display: none; }
.x3-peek-mark {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--hue); color: var(--ink); font-size: 0.95rem; font-weight: 700;
}
.x3-peek-done { background: var(--x3-done); border-color: var(--x3-done); color: var(--x3-on-done); }
.x3-peek-current { background: var(--x3-violet); border-color: var(--x3-violet); color: var(--x3-on-violet); }
.x3-peek-ahead { border-style: dashed; border-color: var(--xp-mute); color: var(--ink-3); }
.x3-peek-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 220px; }
.x3-peek-k { font-size: 0.72rem; color: var(--ink-3); font-weight: 600; letter-spacing: 0.02em; }
.x3-peek-t { font-size: 1rem; line-height: 1.3; }
.x3-peek-sub { font-size: 0.78rem; color: var(--ink-2); }
.x3-peek-sub:empty { display: none; }
.x3-peek-act { display: flex; gap: 8px; flex-wrap: wrap; }
.x3-peek-act .btn { min-height: 36px; }

/* the selected region's stations as a list (3D mode) */
.xp-chips {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.xp-chip {
  width: 100%; min-height: 48px; padding: 8px 10px;
  display: grid; grid-template-columns: 24px auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  border: 1px solid var(--xp-rule); border-radius: 10px; background: var(--xp-card);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.xp-chip:hover { border-color: var(--hue); }
.xp-chip-mark {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--hue); font-size: 0.7rem; font-weight: 700; line-height: 1;
}
.xp-chip-n { font: 500 0.72rem "IBM Plex Mono", ui-monospace, monospace; color: var(--ink-3); }
.xp-chip-t {
  font-size: 0.84rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.xp-chip-m { font-size: 0.72rem; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.xp-chip-done .xp-chip-mark { background: var(--x3-done); border-color: var(--x3-done); color: var(--x3-on-done); }
.xp-chip-done .xp-chip-t { color: var(--ink-2); }
.xp-chip-current { border-color: var(--x3-violet); background: color-mix(in oklab, var(--x3-violet) 8%, var(--xp-card)); }
.xp-chip-current .xp-chip-mark { background: var(--x3-violet); border-color: var(--x3-violet); color: var(--x3-on-violet); }
.xp-chip-ahead .xp-chip-mark { border-style: dashed; border-color: var(--xp-mute); color: var(--ink-3); }
.xp-chip-ahead .xp-chip-t { color: var(--ink-2); }
.xp-chip-current .xp-chip-mark::after, .x3-peek-current::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--x3-on-violet);
}
.x3-peek-current::after { width: 10px; height: 10px; }
.xp-chip.is-sel { box-shadow: 0 0 0 2px var(--x3-sel); border-color: var(--x3-sel); }

/* ============================================================ ranks + gear */

/* the emblem carries its own metal in both themes */
.xr-emblem { flex: none; display: block; overflow: visible; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)); }
.xr-rim { fill: var(--xr-rim); }
.xr-face { fill: var(--xr-face); }
.xr-shine { fill: #fff; opacity: 0.22; }
.xr-mark { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.xr-star { fill: #ffd45a; stroke: #fff4c9; stroke-width: 0.8; stroke-linejoin: round; }
.xr-bronze { --xr-face: #c07a45; --xr-rim: #7a4524; }
.xr-silver { --xr-face: #aab5c0; --xr-rim: #5f6a76; }
.xr-gold { --xr-face: #e2ae1c; --xr-rim: #946a08; }
.xr-platinum { --xr-face: #3fbcae; --xr-rim: #1c7268; }
.xr-diamond { --xr-face: #6b8cff; --xr-rim: #3043b0; }
.xr-heroic { --xr-face: #cf3f5b; --xr-rim: #62207a; }

.xr-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.xr-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.xr-k { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.xr-k-level { display: block; margin-bottom: 2px; }
.xr-name { font-size: 1.15rem; line-height: 1.2; }
.xr-row .xp-progress { margin: 2px 0 0; }
.xr-row.is-up .xr-emblem { animation: xr-up 0.9s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes xr-up {
  0% { transform: scale(0.4) rotate(-12deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

/* the same rank, in the map's corner */
.x3 { container-type: inline-size; }
.x3-labels > .x3-rank {
  top: auto; left: 10px; bottom: 10px; z-index: 1;
  display: flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 8px; border-radius: 12px;
  border: 1px solid var(--x3-panel-edge); background: var(--x3-panel); color: var(--ink); box-shadow: var(--x3-shadow);
  pointer-events: none; backdrop-filter: blur(6px); will-change: auto;
}
.x3-rank[hidden] { display: none; }
.x3-rank-t { display: flex; flex-direction: column; gap: 2px; min-width: 116px; }
.x3-rank-k { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.x3-rank-t b { font-size: 0.9rem; line-height: 1.1; }
.x3-rank-meter { display: block; height: 4px; border-radius: 2px; background: color-mix(in oklab, var(--x3-violet) 18%, transparent); overflow: hidden; }
.x3-rank-meter i { display: block; height: 100%; border-radius: 2px; background: var(--x3-violet); }
.x3-rank-sub { font-size: 0.66rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* on a narrow map it would sit under the walk prompt; the rail still shows it */
@container (max-width: 700px) { .x3-labels > .x3-rank { display: none; } }

/* the explorer locker */
.xl-grid { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.xl-item {
  position: relative; width: 100%; height: 100%; min-height: 56px; padding: 8px;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--xp-rule); border-radius: 10px; background: var(--xp-card);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.xl-item:hover:not(:disabled) { border-color: var(--x3-violet); }
.xl-item.is-on { border-color: var(--x3-violet); background: color-mix(in oklab, var(--x3-violet) 9%, var(--xp-card)); box-shadow: 0 0 0 1px var(--x3-violet); }
.xl-item.is-locked { cursor: default; background: var(--surface-2); }
.xl-item:focus-visible { outline: 2px solid var(--x3-violet); outline-offset: 2px; }
.xl-fig { flex: none; width: 34px; height: 34px; border-radius: 50%; }
.xl-bg { fill: var(--b); opacity: 0.35; }
.xl-body { fill: var(--a); }
.xl-head { fill: #e0b48c; }
.is-locked .xl-fig { filter: grayscale(1); opacity: 0.45; }
.xl-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.xl-t b { font-size: 0.8rem; line-height: 1.2; }
.xl-st { font-size: 0.7rem; color: var(--ink-3); line-height: 1.25; }
.is-on .xl-st { color: var(--x3-violet); font-weight: 700; }
.is-locked .xl-t b { color: var(--ink-2); }
.xl-new {
  position: absolute; top: -7px; right: 6px;
  padding: 1px 7px; border-radius: 999px;
  background: var(--x3-sel); color: #2a1d00; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
}

.xp-gate-line { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; font-size: 0.82rem; color: var(--ink-2); }
.xp-gate-line.is-open .xp-gate-glyph { border-color: var(--x3-done); }

.x3-rl:focus-visible, .x3-sl:focus-visible, .x3-btn:focus-visible, .xp-chip:focus-visible, .xp-seg-b:focus-visible {
  outline: 2px solid var(--x3-violet); outline-offset: 2px;
}

/* ================================================================ responsive */

@media (max-width: 980px) {
  .xp { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
  .xp > * { width: 100%; }
  .xp-main, .xp-rail { display: contents; }
  .xp-bar { order: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .xp-cell:nth-child(4) { border-left: 0; }
  .xp-cell:nth-child(n + 4) { border-top: 1px solid var(--xp-rule); }
  .xp-mission { order: 1; }
  .xp-world { order: 2; }
  .xp-chapter { order: 3; }
  .xp-detail { order: 4; grid-template-columns: 1fr; }
  .xp-next { order: 5; }
  .xp-rewards { order: 6; }
  .xp-locker { order: 7; }
}
@media (max-width: 560px) {
  .xp-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xp-cell:nth-child(n) { border-left: 1px solid var(--xp-rule); border-top: 1px solid var(--xp-rule); }
  .xp-cell:nth-child(odd) { border-left: 0; }
  .xp-cell:nth-child(-n + 2) { border-top: 0; }
  .xp-card { padding: 12px; }
  .xp-facts div { grid-template-columns: 1fr; gap: 0; }
  .xp-strip { grid-template-columns: 1fr; padding: 0; }
  .xp-strip-text { padding: 10px 12px 0; }
  .x3 { --x3-h: 440px; }
  .x3-btn { min-height: 32px; padding: 0 9px; font-size: 0.76rem; }
  .x3-btn-sq { width: 32px; padding: 0; }
  .x3-peek-act { width: 100%; }
  .x3-peek-act .btn { flex: 1; }
  .xp-chips { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .xp-ambient, .xa-breathe, .xa-arrived .xa-upper, .x3-hint.is-nudge, .xr-row.is-up .xr-emblem { animation: none; }
}

/* ================================================= gate guardians (boss.js) */
/* the tag over a guardian that is awake and waiting */
.x3-bl {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 8px; min-height: 26px;
  border: 1px solid color-mix(in oklab, #ff5a4f 55%, transparent); border-radius: 999px;
  background: var(--x3-panel); color: var(--ink); box-shadow: var(--x3-shadow);
  font: inherit; font-size: 0.72rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  backdrop-filter: blur(6px);
}
.x3-bl i { width: 9px; height: 9px; border-radius: 2px; background: #ff5a4f; transform: rotate(45deg); flex: none; }
.x3-bl:hover, .x3-bl:focus-visible { border-color: #ff5a4f; outline: none; box-shadow: 0 0 0 2px color-mix(in oklab, #ff5a4f 40%, transparent), var(--x3-shadow); }
.x3-cue.is-boss { background: var(--signal); color: #fff; }

/* the map card keeps its place while its live view is in the trial's arena */
.x3.x3-in-trial { border-radius: 10px; background: linear-gradient(180deg, var(--x3-sky-top), var(--x3-sky-bot)); }
.x3.x3-in-trial > * { visibility: hidden; }

/* the chapter card's gate-trial row */
.xp-trial {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: 10px; background: var(--surface-2);
}
.xp-trial.is-ready { border-color: color-mix(in oklab, var(--signal) 55%, var(--rule)); }
.xp-trial.is-beaten { border-color: color-mix(in oklab, var(--good) 45%, var(--rule)); }
.xp-trial-t { margin: 0; flex: 1 1 240px; font-size: 0.84rem; line-height: 1.45; color: var(--ink-2); }
.xp-trial-t b { color: var(--ink); }
.xp-trial-mark { width: 12px; height: 12px; border-radius: 3px; transform: rotate(45deg); flex: none; background: #8d939c; }
.xp-trial-mark.is-ready { background: #ff5a4f; animation: xp-trial-pulse 1.6s ease-in-out infinite; }
.xp-trial-mark.is-beaten { background: var(--good); }
@keyframes xp-trial-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in oklab, #ff5a4f 25%, transparent); } }

/* ---- the trial dialog ---- */
.bt-scrim {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 16px;
  background: rgb(6 8 14 / 0.64);
  opacity: 0; transition: opacity 180ms ease-out;
}
.bt-scrim.is-in { opacity: 1; }
.bt {
  --bt-hp: #ff5a4f; --bt-shield: #58a6ff;
  width: min(760px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 14px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.35);
  transform: translateY(10px) scale(0.985); transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}
.bt-scrim.is-in .bt { transform: none; }
.bt-stage { position: relative; flex: none; }
.bt-arena {
  position: relative; height: clamp(200px, 40vh, 360px); pointer-events: none;
  background: linear-gradient(180deg, var(--x3-sky-top), var(--x3-sky-bot));
}
.bt-arena .x3-viewport { height: 100%; border-radius: 0; }

/* the fighters' status: over the arena as a game HUD, or a plain band without one */
.bt-hud {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 12px;
  padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--rule);
}
.bt.has-arena .bt-hud {
  position: absolute; left: 0; right: 0; top: 0; padding-bottom: 28px;
  background: linear-gradient(180deg, rgb(8 10 18 / 0.72), rgb(8 10 18 / 0));
  border: 0; color: #fff;
}
.bt-side { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bt-foe { align-items: flex-end; text-align: right; }
.bt-who { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bt-cap { font-size: 0.68rem; font-weight: 600; opacity: 0.75; font-variant-numeric: tabular-nums; }
.bt-vs { align-self: center; font-weight: 900; font-style: italic; font-size: 1rem; letter-spacing: 0.06em; color: var(--bt-hp); }
.bt-pips { display: flex; gap: 5px; }
.bt-pips i {
  width: 16px; height: 18px; border: 2px solid var(--bt-shield);
  border-radius: 3px 3px 9px 9px; background: transparent;
  transition: background 200ms, opacity 200ms;
}
.bt-pips i.is-on { background: var(--bt-shield); }
.bt-pips i:not(.is-on) { opacity: 0.45; }
.bt-hp { display: flex; gap: 3px; width: min(180px, 100%); }
.bt-hp i {
  flex: 1; height: 11px; border-radius: 3px;
  background: color-mix(in oklab, currentColor 18%, transparent);
  transition: background 260ms;
}
.bt-hp i.is-on { background: linear-gradient(180deg, #ff7a6f, var(--bt-hp)); }

.bt-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; }
.bt-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.bt-title { margin: 0; font-size: 1.35rem; line-height: 1.2; text-wrap: balance; }
.bt-title.is-won { color: var(--good); }
.bt-title.is-lost { color: var(--signal); }
.bt-lede, .bt-score { margin: 0; color: var(--ink-2); font-size: 0.9rem; line-height: 1.5; }
.bt-score { font-variant-numeric: tabular-nums; }
.bt-rules { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; font-size: 0.88rem; color: var(--ink-2); line-height: 1.45; }
.bt-rules b { color: var(--ink); }
.bt-opt { display: inline-flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--ink-2); cursor: pointer; width: fit-content; }
.bt-reward { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--good-soft); color: var(--good); font-size: 0.86rem; font-weight: 700; }
.bt-reward.is-practice { background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.bt-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.bt-qhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bt-count { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.bt-tag { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.bt-clock { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 0.74rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bt-clock-track { width: 120px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bt-clock-fill { display: block; height: 100%; background: var(--x3-violet); transform-origin: left center; }
.bt-clock-fill.is-low { background: var(--signal); }
.bt-clock.is-stopped { opacity: 0.45; }
.bt-q { margin: 0; font-size: 1.08rem; line-height: 1.45; font-weight: 650; text-wrap: pretty; }
.bt-blank { display: inline-block; min-width: 3em; padding: 0 4px; border-bottom: 2px solid var(--x3-violet); }
.bt-blank.is-filled { color: var(--good); font-weight: 800; }
.bt-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 8px; }
.bt-choice {
  display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: 10px; background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 0.92rem; line-height: 1.4; text-align: left; cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.bt-choice:hover:not(:disabled) { border-color: var(--x3-violet); }
.bt-choice:focus-visible { outline: 2px solid var(--x3-violet); outline-offset: 2px; }
.bt-choice:disabled { cursor: default; }
.bt-choice:disabled:not(.is-right):not(.is-wrong) { opacity: 0.55; }
.bt-choice.is-right { border-color: var(--good); background: var(--good-soft); }
.bt-choice.is-wrong { border-color: var(--signal); background: var(--signal-soft); }
.bt-key {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 0.72rem; font-weight: 800;
}
.bt-fb { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-left: 4px solid; border-radius: 8px; background: var(--surface-2); }
.bt-fb.is-right { border-color: var(--good); }
.bt-fb.is-wrong { border-color: var(--signal); }
.bt-fb-h { font-size: 1rem; }
.bt-fb.is-right .bt-fb-h { color: var(--good); }
.bt-fb.is-wrong .bt-fb-h { color: var(--signal); }
.bt-fb-sub { font-size: 0.86rem; color: var(--ink); }
.bt-why { margin: 2px 0 0; font-size: 0.86rem; line-height: 1.5; color: var(--ink-2); }
.bt-from { font-size: 0.76rem; color: var(--ink-3); }
.bt-fb .bt-actions { margin-top: 6px; }

@media (max-width: 560px) {
  .bt-scrim { padding: 0; place-items: stretch; }
  .bt { width: 100%; max-height: none; height: 100dvh; border-radius: 0; border: 0; }
  .bt-arena { height: clamp(170px, 32vh, 260px); }
  .bt-hud { gap: 8px; padding: 10px 12px; }
  .bt.has-arena .bt-hud { padding-bottom: 22px; }
  .bt-pips i { width: 13px; height: 15px; }
  .bt-body { padding: 14px 16px 18px; }
  .bt-clock-track { width: 80px; }
  .bt-actions .btn { flex: 1 1 auto; }
}
[data-reduced-motion="true"] .bt-scrim, [data-reduced-motion="true"] .bt { transition: none; }
[data-reduced-motion="true"] .xp-trial-mark.is-ready { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .bt-scrim, .bt { transition: none; }
  .xp-trial-mark.is-ready { animation: none; }
}

/* ======================================================= daily quest board */
.xp-quests:focus { outline: none; }
.xp-quests:focus-visible { outline: 2px solid var(--x3-violet); outline-offset: 2px; }
.xq-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.xq-tally { font-size: 0.78rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.xq-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.xq {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface-2);
}
.xq.is-ready { border-color: color-mix(in oklab, var(--x3-violet) 60%, var(--rule)); grid-template-columns: auto minmax(0, 1fr); }
.xq.is-ready .xq-claim { grid-column: 2; justify-self: start; }
.xq.is-claimed { background: transparent; }
.xq-mark {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--rule); font-size: 0.72rem; font-weight: 900; color: #fff;
}
.xq.is-ready .xq-mark { border-color: var(--x3-violet); box-shadow: inset 0 0 0 4px var(--surface-2); background: var(--x3-violet); }
.xq.is-claimed .xq-mark { border-color: var(--good); background: var(--good); }
.xq-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.xq-t { font-size: 0.84rem; line-height: 1.3; }
.xq.is-claimed .xq-t { color: var(--ink-2); }
.xq-hint { font-size: 0.72rem; line-height: 1.35; color: var(--ink-3); }
.xq-bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 3px; }
.xq-bar i { display: block; height: 100%; background: var(--x3-violet); border-radius: inherit; transition: width 300ms ease-out; }
.xq.is-claimed .xq-bar i { background: var(--good); }
.xq-n { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.xq-n b { font-size: 0.8rem; color: var(--ink); }
.xq.is-claimed .xq-n b { color: var(--good); }
.xq-claim { min-height: 36px; padding: 6px 10px; font-size: 0.76rem; white-space: nowrap; }
@media (max-width: 980px) { .xp-quests { order: 5; } }
@media (max-width: 380px) {
  .xq { grid-template-columns: auto minmax(0, 1fr); }
  .xq-claim, .xq-n { grid-column: 2; justify-self: start; align-items: flex-start; }
}
[data-reduced-motion="true"] .xq-bar i { transition: none; }
@media (prefers-reduced-motion: reduce) { .xq-bar i { transition: none; } }

/* ---- station projections: the concept a station teaches, projected off its
   pedestal as the explorer reaches it. One look in day and dusk alike: a
   hologram is its own light, so it keeps its colours explicit. */
.x3-holo {
  pointer-events: none !important;
  z-index: 4;
  padding-bottom: 18px;          /* the stem; HOLO_STEM in expedition3d.js */
}
.x3-holo::after {
  content: ""; position: absolute; left: var(--stem, 50%); bottom: 0; width: 2px; height: 18px; margin-left: -1px;
  background: linear-gradient(to bottom, rgba(127, 233, 255, 0.9), rgba(127, 233, 255, 0));
  opacity: 0; transition: opacity 260ms ease 120ms;
}
.x3-holo.is-on::after { opacity: 1; }
.x3-holo-p {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 150px; max-width: 250px; padding: 7px 14px 8px;
  border: 1px solid rgba(127, 233, 255, 0.7); border-radius: 8px;
  background:
    repeating-linear-gradient(to bottom, rgba(127, 233, 255, 0.07) 0 1px, transparent 1px 3px),
    linear-gradient(to bottom, rgba(10, 44, 60, 0.82), rgba(6, 30, 44, 0.72));
  box-shadow: 0 0 18px rgba(127, 233, 255, 0.35), inset 0 0 14px rgba(127, 233, 255, 0.14);
  color: #ffffff; text-align: center; text-shadow: 0 0 8px rgba(127, 233, 255, 0.55);
  opacity: 0; transform: translateY(14px) scaleY(0.2); transform-origin: 50% 100%;
  clip-path: inset(100% 0 0 0);
  transition: opacity 260ms ease, transform 420ms cubic-bezier(.2, .9, .25, 1.15), clip-path 420ms ease;
}
.x3-holo.is-on .x3-holo-p { opacity: 1; transform: none; clip-path: inset(0); }
/* the region's own colour along the top edge */
.x3-holo-p::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--hue, #7fe9ff); box-shadow: 0 0 10px var(--hue, #7fe9ff);
}
/* a scan line sweeping down the glass */
.x3-holo-p::after {
  content: ""; position: absolute; left: 0; right: 0; top: -30%; height: 30%;
  background: linear-gradient(to bottom, transparent, rgba(127, 233, 255, 0.22), transparent);
  animation: x3-holo-scan 2.4s linear infinite;
}
@keyframes x3-holo-scan { to { transform: translateY(440%); } }
.x3-holo-k {
  font: 700 0.64rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em; text-transform: uppercase; color: #9befff;
}
.x3-holo[data-status="done"] .x3-holo-k { color: #8ff0bf; }
.x3-holo-c { font-size: 0.98rem; font-weight: 800; line-height: 1.2; text-wrap: balance; color: #ffffff; }
.x3-holo-t { font-size: 0.72rem; line-height: 1.25; color: #bfeaf5; text-wrap: balance; }
@media (max-width: 480px) {
  .x3-holo-p { min-width: 120px; max-width: 190px; padding: 6px 10px 7px; }
  .x3-holo-c { font-size: 0.86rem; }
  .x3-holo-t { font-size: 0.66rem; }
}
[data-reduced-motion="true"] .x3-holo-p, [data-reduced-motion="true"] .x3-holo::after { transition: none; }
[data-reduced-motion="true"] .x3-holo-p::after { animation: none; opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .x3-holo-p, .x3-holo::after { transition: none; }
  .x3-holo-p::after { animation: none; opacity: 0; }
}
