.ui-icon {
  width: 1.15em;
  height: 1.15em;
  display: block;
  flex: none;
  overflow: visible;
}

.ambient-ui {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-ui::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(47, 137, 169, 0.08), transparent 38%),
    radial-gradient(circle at 17% 18%, rgba(68, 195, 232, 0.05), transparent 24%),
    linear-gradient(180deg, rgba(1, 6, 10, 0.08), rgba(1, 5, 9, 0.38));
}

.ambient-ui__glow {
  position: absolute;
  width: min(44vw, 720px);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.13;
}

.ambient-ui__glow--a {
  inset-inline-start: -14vw;
  top: 7vh;
  background: var(--cyan);
}

.ambient-ui__glow--b {
  inset-inline-end: -18vw;
  bottom: -24vh;
  background: #1c72a2;
  opacity: 0.08;
}

.ambient-ui__trajectory {
  position: absolute;
  width: min(68vw, 1180px);
  height: 42vh;
  left: 50%;
  top: 24%;
  translate: -50% -50%;
  opacity: 0.08;
  border: 1px solid rgba(105, 215, 244, 0.15);
  border-inline-start-color: transparent;
  border-block-end-color: transparent;
  border-radius: 50%;
  rotate: -7deg;
}

.ambient-ui__grain {
  position: absolute;
  inset: 0;
  opacity: 0.026;
  background-image:
    repeating-radial-gradient(circle at 30% 20%, rgba(255,255,255,.45) 0 .35px, transparent .5px 3px);
  background-size: 7px 7px;
  mix-blend-mode: soft-light;
}

.surface {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.022), transparent 35%),
    var(--surface-1);
  box-shadow: var(--shadow-contact), var(--inset-highlight);
  overflow: hidden;
}

.surface::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(100deg, rgba(124, 218, 246, 0.03), transparent 25%, transparent 70%, rgba(231, 184, 77, 0.025));
}

.surface--hero {
  background:
    radial-gradient(circle at 45% 42%, rgba(51, 133, 163, 0.11), transparent 36%),
    linear-gradient(150deg, rgba(255,255,255,0.026), transparent 28%),
    rgba(5, 17, 26, 0.86);
  box-shadow: var(--shadow-ambient), var(--inset-highlight);
}

.surface--elevated {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.035), transparent 32%),
    var(--surface-elevated);
  box-shadow: var(--shadow-float), var(--inset-highlight);
  backdrop-filter: blur(18px) saturate(118%);
}

.surface--flat {
  background: rgba(5, 17, 26, 0.66);
  box-shadow: var(--inset-highlight);
}

.eyebrow {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

html[dir="rtl"] .eyebrow {
  letter-spacing: 0;
}

.eyebrow--accent { color: var(--amber-strong); }
.eyebrow--danger { color: #ef8995; }

.game-ui-toolbar {
  position: absolute;
  z-index: 20;
  top: max(20px, env(safe-area-inset-top));
  inset-inline-end: max(28px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  pointer-events: none;
}

.utility-group {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(3, 12, 19, 0.72);
  box-shadow: var(--shadow-contact), var(--inset-highlight);
  backdrop-filter: blur(14px) saturate(116%);
  pointer-events: auto;
}

.utility-button,
.language-control {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: transparent;
}

.utility-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 11px;
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease-premium), color var(--motion-fast) var(--ease-premium), background var(--motion-fast) var(--ease-premium);
}

.utility-button:hover,
.utility-button:focus-visible,
.utility-button.is-active {
  color: var(--text-strong);
  background: rgba(109, 215, 242, 0.075);
}

.utility-button:hover { transform: translateY(-1px); }
.utility-button:active { transform: translateY(0) scale(0.985); }
.utility-button__icon { color: var(--cyan); font-size: 1rem; }
.utility-button__label { font-size: var(--text-xs); font-weight: 730; white-space: nowrap; }

.language-control {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px 4px 9px;
}

html[dir="rtl"] .language-control { padding: 4px 9px 4px 5px; }
.language-control__icon { color: var(--cyan); font-size: 1rem; }
.language-control__label { margin-inline-end: 3px; font-size: var(--text-xs); font-weight: 730; }

.language-segment {
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-ui-latin);
  font-size: 0.72rem;
  font-weight: 850;
  transition: color var(--motion-fast) var(--ease-premium), background var(--motion-fast) var(--ease-premium), border-color var(--motion-fast) var(--ease-premium);
}

.language-segment:hover,
.language-segment:focus-visible { color: var(--text); background: rgba(255,255,255,0.035); }
.language-segment.is-active { color: var(--cyan-strong); border-color: rgba(109, 215, 242, 0.24); background: var(--cyan-soft); }

.settings-popover {
  position: absolute;
  top: 50px;
  inset-inline-end: 0;
  width: 236px;
  padding: 14px;
  pointer-events: auto;
}

.settings-popover__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
  color: var(--text-soft);
  font-size: var(--text-xs);
}
.settings-popover__row strong { color: var(--text); font-weight: 800; }
.settings-popover__render { margin-block-start: 8px; padding-block-start: 10px; border-block-start: 1px solid var(--line-soft); color: var(--text-muted); font-family: var(--font-ui-latin); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

.ui-screen { position: absolute; inset: 0; pointer-events: none; }
.dashboard-screen { overflow: auto; scrollbar-width: none; }
.dashboard-screen::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------------ *
 * Dashboard — the arena command deck.
 *
 * Palette, backdrop, and motifs are lifted from the running game rather
 * than invented: the floor gradient matches the arena floor drawn in
 * world-2d-runtime, cyan/gold match the ART constants used on canvas, and
 * gold is reserved exclusively for the bullet — the trajectory, the sector
 * bullet head, and the primary action. Nothing else is gold.
 * ------------------------------------------------------------------ */

.arena-backdrop { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.arena-backdrop__floor {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(118% 74% at 50% 6%, rgba(98, 213, 243, 0.1), transparent 58%),
    linear-gradient(180deg, #121e35 0%, #0b1428 52%, #060c1a 100%);
}

/* The arena's own floor grid, top-down like the play field. */
.arena-backdrop__grid {
  position: absolute;
  inset: -2px;
  opacity: 0.5;
  background-image:
    linear-gradient(to right, rgba(120, 196, 232, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120, 196, 232, 0.055) 1px, transparent 1px);
  background-size: clamp(46px, 4.6vw, 72px) clamp(46px, 4.6vw, 72px);
  mask-image: radial-gradient(120% 92% at 50% 34%, #000 30%, transparent 78%);
}

.arena-backdrop__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(96% 78% at 50% 44%, transparent 42%, rgba(2, 6, 14, 0.62) 100%),
    linear-gradient(180deg, rgba(3, 8, 18, 0.5), transparent 26%, rgba(2, 5, 12, 0.72));
}

/* Content-sized rows, centred as one block. A 1fr middle row would stretch the
   composition to the viewport and leave a dead band between the figures and
   the sector track on tall screens. */
.dashboard {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100vw - clamp(32px, 5vw, 88px)));
  min-height: 100%;
  margin-inline: auto;
  padding-block: clamp(18px, 3vh, 40px);
  display: grid;
  grid-template-rows: auto auto auto;
  gap: clamp(22px, 4.2vh, 46px);
  align-content: center;
}

/* Brand lockup ------------------------------------------------------ */

.brand-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(12px, 1.4vw, 20px);
  padding-inline-end: min(430px, 36vw);
}

.brand-mark { grid-row: span 2; width: clamp(38px, 3.4vw, 52px); color: var(--cyan); }
.brand-mark svg { display: block; width: 100%; height: auto; }
.brand-mark__shot { stroke: var(--bullet); }

.brand-title {
  margin: 0;
  display: grid;
  color: var(--text-strong);
  font-size: clamp(1.9rem, 1.1rem + 2.9vw, 4.05rem);
  line-height: 0.86;
  font-weight: 800;
  letter-spacing: -0.052em;
  text-transform: uppercase;
}

.brand-title__line--accent { color: var(--cyan); }

.brand-mantra {
  grid-column: 2;
  margin: clamp(8px, 1vh, 14px) 0 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

html[lang="ar"] .brand-title { letter-spacing: 0; line-height: 1.08; text-transform: none; font-size: clamp(1.65rem, 1rem + 2.3vw, 3.3rem); }
html[lang="ar"] .brand-mantra { letter-spacing: 0; text-transform: none; font-size: var(--text-sm); }

/* Deck: run readout + launch ---------------------------------------- */

.deck {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
  gap: clamp(20px, 3.4vw, 56px);
  align-items: center;
}

.run-readout { min-width: 0; display: grid; gap: clamp(12px, 1.8vh, 20px); }

/* The pill belongs beside the run label, not pushed to the far edge where it
   would float in the middle of the screen. */
.run-readout__head { display: flex; align-items: center; gap: clamp(10px, 1.2vw, 16px); flex-wrap: wrap; }

.checkpoint-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding-inline: 11px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: var(--text-xs);
  font-weight: 700;
  transition: color var(--motion-normal), border-color var(--motion-normal), background var(--motion-normal);
}

.checkpoint-pill .ui-icon { color: var(--text-muted); }
.checkpoint-pill.is-active { color: #a8e8c9; border-color: rgba(88, 215, 156, 0.26); background: var(--green-soft); }
.checkpoint-pill.is-active .ui-icon { color: var(--green); }

/* The two figures that define a run. No card, no border — scale alone
   carries the hierarchy, with a single hairline as the divider. */
.figures { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: clamp(18px, 2.6vw, 40px); align-items: end; }

.figure { min-width: 0; display: grid; gap: clamp(2px, 0.6vh, 7px); }
.figure--score { padding-inline-start: clamp(18px, 2.6vw, 40px); border-inline-start: 1px solid var(--line-soft); }

.figure__label { color: var(--text-muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }
html[lang="ar"] .figure__label { letter-spacing: 0; text-transform: none; }

.figure__value {
  color: var(--text-strong);
  font-family: var(--font-ui-latin);
  font-size: clamp(2.9rem, 1.5rem + 5.4vw, 6.1rem);
  line-height: 0.82;
  font-weight: 780;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.figure--score .figure__value { color: var(--cyan-strong); }

.ledger { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.ledger__item { min-width: 0; display: grid; gap: 5px; padding-inline: clamp(10px, 1.2vw, 18px); border-inline-start: 1px solid var(--line-soft); }
.ledger__item:first-child { padding-inline-start: 0; border-inline-start: 0; }

.ledger dt { color: var(--text-muted); font-size: var(--text-xs); font-weight: 660; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger dd { margin: 0; color: var(--text); font-family: var(--font-ui-latin); font-size: var(--text-md); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Launch ------------------------------------------------------------ */

.launch { min-width: 0; display: grid; gap: clamp(9px, 1.4vh, 14px); align-content: center; }

.launch__primary {
  position: relative;
  min-height: clamp(72px, 9.5vh, 96px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 1.4vw, 18px);
  padding: 16px clamp(16px, 1.6vw, 22px);
  border: 1px solid rgba(255, 212, 65, 0.34);
  border-radius: var(--radius-md);
  outline: 0;
  color: var(--text-strong);
  background:
    linear-gradient(100deg, rgba(255, 212, 65, 0.14), rgba(255, 212, 65, 0.02) 42%),
    rgba(7, 20, 34, 0.92);
  box-shadow: inset 3px 0 0 var(--bullet), 0 16px 40px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  text-align: start;
  transition: transform var(--motion-fast) var(--ease-premium), border-color var(--motion-fast) var(--ease-premium),
    background var(--motion-fast) var(--ease-premium), box-shadow var(--motion-fast) var(--ease-premium);
}

html[dir="rtl"] .launch__primary { box-shadow: inset -3px 0 0 var(--bullet), 0 16px 40px rgba(0, 0, 0, 0.3); }

.launch__primary:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 212, 65, 0.6);
  background: linear-gradient(100deg, rgba(255, 212, 65, 0.2), rgba(255, 212, 65, 0.03) 46%), rgba(9, 25, 40, 0.95);
  box-shadow: inset 3px 0 0 var(--bullet), 0 22px 52px rgba(0, 0, 0, 0.38);
}

html[dir="rtl"] .launch__primary:hover { box-shadow: inset -3px 0 0 var(--bullet), 0 22px 52px rgba(0, 0, 0, 0.38); }
.launch__primary:active { transform: translateY(0) scale(0.994); }
.launch__primary:focus-visible { outline: 2px solid var(--bullet); outline-offset: 3px; }

.launch__icon { color: var(--bullet); font-size: 1.45rem; }
.launch__copy { min-width: 0; display: grid; gap: 3px; }
.launch__copy strong { color: var(--text-strong); font-size: clamp(1rem, 0.9rem + 0.4vw, 1.25rem); font-weight: 820; }
.launch__copy small { color: var(--text-soft); font-size: var(--text-xs); font-weight: 560; line-height: 1.4; }
.launch__chevron { color: var(--bullet); opacity: 0.62; transition: transform var(--motion-fast) var(--ease-premium), opacity var(--motion-fast); }
.launch__primary:hover .launch__chevron { transform: translateX(3px); opacity: 1; }
html[dir="rtl"] .launch__chevron { transform: scaleX(-1); }
html[dir="rtl"] .launch__primary:hover .launch__chevron { transform: translateX(-3px) scaleX(-1); }

/* Flex, not a two-column grid: Delete Checkpoint is hidden without a
   checkpoint, and New Run should then take the full width instead of leaving
   an empty half. */
.launch__secondary { display: flex; flex-wrap: wrap; gap: 8px; }
.launch__secondary > .button { flex: 1 1 0; min-width: 0; }

.launch__sector {
  margin: clamp(2px, 0.8vh, 8px) 0 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-soft);
  font-size: var(--text-sm);
  font-weight: 700;
}

.launch__sector-index { color: var(--cyan); font-family: var(--font-ui-latin); font-size: 0.74rem; font-weight: 820; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }

.metric { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 8px; }
.metric__icon { color: var(--cyan); opacity: 0.76; }
.metric__label { min-width: 0; color: var(--text-muted); font-size: var(--text-xs); line-height: 1.2; font-weight: 680; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric__value { color: var(--text); font-family: var(--font-ui-latin); font-size: var(--text-sm); font-weight: 820; font-variant-numeric: tabular-nums; white-space: nowrap; }

.button { position: relative; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); outline: 0; color: var(--text); background: rgba(8, 23, 33, 0.86); box-shadow: var(--inset-highlight); cursor: pointer; font-size: var(--text-sm); font-weight: 760; text-align: start; transition: transform var(--motion-fast) var(--ease-premium), color var(--motion-fast) var(--ease-premium), border-color var(--motion-fast) var(--ease-premium), background var(--motion-fast) var(--ease-premium), box-shadow var(--motion-fast) var(--ease-premium); }
.button:hover { transform: translateY(-1px); color: var(--text-strong); border-color: var(--line-strong); background: rgba(11, 31, 43, 0.94); box-shadow: 0 10px 26px rgba(0,0,0,.22), var(--inset-highlight); }
.button:active { transform: translateY(0) scale(0.992); }
.button:focus-visible,
.utility-button:focus-visible,
.language-segment:focus-visible,
.upgrade-card:focus-visible { outline: 2px solid rgba(244, 207, 120, 0.8); outline-offset: 2px; }
.button:disabled,
.upgrade-card:disabled { cursor: not-allowed; opacity: 0.42; transform: none; }
.button__icon { color: var(--cyan); font-size: 1.04rem; }

.button--primary { min-height: 64px; justify-content: flex-start; padding-inline: 17px 14px; border-color: rgba(231, 184, 77, 0.34); background: linear-gradient(100deg, rgba(231, 184, 77, 0.105), transparent 36%), rgba(7, 22, 31, 0.94); box-shadow: inset 3px 0 0 rgba(231, 184, 77, 0.8), 0 12px 30px rgba(0,0,0,.2), var(--inset-highlight); }
html[dir="rtl"] .button--primary { box-shadow: inset -3px 0 0 rgba(231, 184, 77, 0.8), 0 12px 30px rgba(0,0,0,.2), var(--inset-highlight); }
.button--primary:hover { border-color: rgba(244, 207, 120, 0.56); background: linear-gradient(100deg, rgba(231, 184, 77, 0.15), transparent 42%), rgba(9, 27, 37, 0.97); box-shadow: inset 3px 0 0 var(--amber-strong), 0 16px 36px rgba(0,0,0,.28), var(--inset-highlight); }
html[dir="rtl"] .button--primary:hover { box-shadow: inset -3px 0 0 var(--amber-strong), 0 16px 36px rgba(0,0,0,.28), var(--inset-highlight); }
.button--primary .button__icon { color: var(--amber-strong); font-size: 1.2rem; }
.button__content { min-width: 0; display: grid; gap: 2px; }
.button__content strong { color: var(--text-strong); font-size: var(--text-md); font-weight: 820; }
.button__content small { color: var(--text-muted); font-size: var(--text-xs); font-weight: 560; line-height: 1.35; }
.button__chevron { margin-inline-start: auto; color: var(--amber); opacity: 0.6; transition: transform var(--motion-fast) var(--ease-premium), opacity var(--motion-fast); }
.button--primary:hover .button__chevron { transform: translateX(2px); opacity: 1; }
html[dir="rtl"] .button--primary:hover .button__chevron { transform: translateX(-2px) scaleX(-1); }
html[dir="rtl"] .button__chevron { transform: scaleX(-1); }
.button--secondary { justify-content: flex-start; color: var(--text-soft); }
.button--danger { color: #dc8c96; border-color: rgba(227, 106, 121, 0.13); }
.button--danger .button__icon { color: var(--red); }
.button--danger:hover,
.button--danger.is-confirming { color: #f0abb3; border-color: rgba(227, 106, 121, 0.35); background: var(--red-soft); }
.button--ghost { min-height: 42px; justify-content: flex-start; color: var(--text-soft); border-color: var(--line-soft); background: rgba(6, 18, 32, 0.5); }
.button--ghost:hover { color: var(--text-strong); border-color: var(--line); background: rgba(10, 26, 42, 0.72); }
.button--ghost.button--danger { color: #d98c96; border-color: rgba(227, 106, 121, 0.16); }
.button--ghost.button--danger:hover,
.button--ghost.button--danger.is-confirming { color: #f0abb3; border-color: rgba(227, 106, 121, 0.4); background: var(--red-soft); }

.button--quiet { min-height: 40px; background: transparent; border-color: transparent; box-shadow: none; }
.button--quiet:hover { background: rgba(255,255,255,0.035); border-color: var(--line-soft); box-shadow: none; }
.button--compact { min-height: 52px; justify-content: center; }

/* Sector track — the signature.
 *
 * Eight sectors drawn as one continuous ricochet: the bullet enters bottom
 * left, bounces off the ceiling and floor of the band, and the vertices are
 * the sectors. Travelled segments are solid gold, the rest is dim, and the
 * bullet head sits on the sector you are actually in. Progress and the
 * bullet's flight path are literally the same line. */

.sector-track { display: grid; gap: clamp(6px, 1.2vh, 12px); }

.sector-track__head { display: flex; align-items: baseline; gap: clamp(10px, 1.4vw, 18px); flex-wrap: wrap; }
.sector-track__head strong { color: var(--text-soft); font-size: var(--text-sm); font-weight: 680; }
.sector-track__counter { margin-inline-start: auto; color: var(--text-muted); font-family: var(--font-ui-latin); font-size: 0.74rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* The SVG and the marker overlay share one grid area so the markers resolve
   against exactly the track box, with a caption row on either side of it. */
.progression-visual {
  display: grid;
  grid-template-areas: "above" "track" "below";
  grid-template-rows: auto auto auto;
  row-gap: clamp(4px, 0.8vh, 8px);
}

.progression-svg { grid-area: track; width: 100%; height: clamp(46px, 7vh, 74px); display: block; overflow: visible; }

/* Mirrored so progress still reads from the reading-direction start. The marker
   overlay must mirror with the path: its coordinates are physical percentages,
   so without this the nodes stay on the left while the track and its captions
   flip to the right. */
html[dir="rtl"] .progression-svg,
html[dir="rtl"] .progression-markers { transform: scaleX(-1); }

.progression-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.progression-line--base { stroke: rgba(126, 160, 178, 0.2); stroke-width: 1.5; stroke-dasharray: 3 7; }
.progression-line--active { stroke: var(--bullet); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(255, 212, 65, 0.35)); }

/* Markers overlay the stretched SVG as HTML so they stay perfectly round. */
.progression-markers { grid-area: track; position: relative; pointer-events: none; }

.progression-node,
.progression-bullet { position: absolute; border-radius: 50%; translate: -50% -50%; }

.progression-node {
  width: 11px;
  height: 11px;
  border: 1.5px solid #46607a;
  background: #0a1626;
  box-shadow: 0 0 0 3px rgba(5, 10, 22, 0.85);
  transition: background var(--motion-normal), border-color var(--motion-normal), width var(--motion-normal), height var(--motion-normal);
}

.progression-node.is-complete { border-color: var(--cyan-strong); background: var(--cyan); }
.progression-node.is-current { width: 15px; height: 15px; border: 2px solid #fff0b8; background: var(--bullet); box-shadow: 0 0 0 4px rgba(255, 212, 65, 0.1); }

.progression-bullet { width: 15px; height: 15px; background: var(--bullet); opacity: 0.3; }
@media (prefers-reduced-motion: no-preference) {
  .progression-bullet { animation: sector-pulse 2.4s var(--ease-premium) infinite; }
}
@keyframes sector-pulse {
  0% { transform: scale(1); opacity: 0.34; }
  70%, 100% { transform: scale(2.6); opacity: 0; }
}

.progression-labels { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.progression-labels--above { grid-area: above; align-items: end; }
.progression-labels--below { grid-area: below; align-items: start; }
.progression-labels--above .progression-label { grid-row: 1; }
.progression-labels--below .progression-label { grid-row: 1; }
.progression-label { min-width: 0; display: grid; justify-items: center; gap: 3px; color: var(--text-muted); text-align: center; font-size: 0.68rem; line-height: 1.2; }
.progression-labels--above .progression-label { grid-template-areas: "name" "index"; }
.progression-labels--above .progression-label strong { grid-area: index; }
.progression-labels--above .progression-label span { grid-area: name; }
/* #6b89a0 keeps unreached sectors de-emphasised while clearing WCAG AA (4.99:1)
   against the arena backdrop; the previous tone measured 4.18:1 at this size. */
.progression-label strong { color: #6b89a0; font-family: var(--font-ui-latin); font-size: 0.62rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.progression-label span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progression-label.is-complete { color: var(--text-soft); }
.progression-label.is-complete strong { color: var(--cyan); }
.progression-label.is-current { color: var(--text-strong); }
.progression-label.is-current strong { color: var(--bullet); }

html[dir="rtl"] .progression-labels { direction: rtl; }
html[dir="rtl"] .launch__sector-index,
html[dir="rtl"] .ledger dd,
html[dir="rtl"] .figure__value { direction: ltr; justify-self: start; }
html[dir="rtl"] .metric__value { direction: ltr; justify-self: start; }
html[dir="rtl"] .upgrade-card__top,
html[dir="rtl"] .upgrade-card__footer { direction: rtl; }

/* Combat HUD */
.hud-layer { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.hud-safe { position: absolute; left: 50%; top: 50%; width: var(--game-display-width, 100vw); height: var(--game-display-height, 100vh); translate: -50% -50%; display: grid; grid-template-columns: minmax(190px, 0.8fr) minmax(300px, 1.45fr) minmax(190px, 0.8fr); align-items: start; gap: clamp(8px, 1vw, 16px); padding: clamp(13px, 1.25vw, 20px); font-variant-numeric: tabular-nums; }
.hud-cluster,
.hud-center { min-height: 67px; border: 1px solid rgba(116, 203, 232, 0.12); border-radius: 12px; background: rgba(2, 12, 19, 0.64); box-shadow: 0 8px 24px rgba(0,0,0,.22), var(--inset-highlight); backdrop-filter: blur(10px) saturate(112%); }
.hud-cluster { padding: 11px 13px; }
.hud-status { display: flex; align-items: center; gap: 10px; }
.hud-status__icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 9px; color: var(--amber-strong); background: var(--amber-soft); }
.hud-status > span:last-child { min-width: 0; display: grid; gap: 1px; }
.hud-status small { color: var(--text-muted); font-size: 0.65rem; font-weight: 690; }
.hud-status strong { color: var(--text-strong); font-size: 0.77rem; font-weight: 790; white-space: nowrap; }
.hud-gauge { position: relative; height: 4px; margin-block-start: 10px; overflow: hidden; border-radius: 999px; background: rgba(131, 168, 183, 0.13); }
.hud-gauge__fill { position: absolute; inset: 0; border-radius: inherit; transform: scaleX(var(--value, 1)); transform-origin: left center; transition: transform 90ms linear; will-change: transform; }
html[dir="rtl"] .hud-gauge__fill { transform-origin: right center; }
.hud-gauge--recall .hud-gauge__fill { background: var(--amber); }
.hud-gauge--health .hud-gauge__fill { background: linear-gradient(90deg, #d85869, #ee8793); }
.hud-gauge--dash .hud-gauge__fill { background: var(--cyan); }
.hud-center { padding: 9px 16px 8px; text-align: center; }
.hud-wave { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.hud-wave span { color: var(--text-muted); font-family: var(--font-ui-latin); font-size: 0.67rem; font-weight: 820; letter-spacing: 0.08em; }
.hud-wave strong { color: var(--text-strong); font-family: var(--font-ui-latin); font-size: 1.16rem; font-weight: 840; }
.hud-encounter { margin-block-start: 1px; color: var(--amber-strong); font-size: 0.76rem; font-weight: 760; }
.hud-meta { margin-block-start: 5px; display: flex; justify-content: center; gap: 14px; color: var(--text-muted); font-size: 0.63rem; font-weight: 650; }
.hud-meta b { color: var(--text-soft); font-family: var(--font-ui-latin); font-weight: 780; }
.hud-resource-row { min-height: 28px; display: flex; align-items: center; gap: 8px; }
.hud-resource__icon { color: #ef8390; font-size: 1rem; }
.hud-resource__numbers { color: var(--text-strong); font-family: var(--font-ui-latin); font-size: 0.82rem; font-weight: 820; }
.hud-resource__shield { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--cyan); font-size: 0.76rem; }
.hud-cluster--right .hud-gauge { margin-block-start: 6px; }

/* Guardian health — HUD-resident, directly under the wave block. Sized to be
   informative without becoming a cinematic bar that covers the play field. */
.hud-guardian {
  /* Absolutely placed rather than flowed: as a grid item it landed in row 2 of
     .hud-safe, which stretches the full height and pushed it to mid-screen. */
  position: absolute;
  top: calc(clamp(13px, 1.25vw, 20px) + 78px);
  left: 50%;
  translate: -50% 0;
  width: min(360px, 34vw);
  padding: 7px 11px 8px;
  border: 1px solid rgba(255, 212, 65, 0.3);
  border-radius: 10px;
  background: rgba(2, 12, 19, 0.72);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26), var(--inset-highlight);
  backdrop-filter: blur(10px) saturate(112%);
}

.hud-guardian__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-block-end: 6px; }
.hud-guardian__name { color: var(--text-strong); font-size: 0.72rem; font-weight: 820; letter-spacing: 0.06em; text-transform: uppercase; }
html[lang="ar"] .hud-guardian__name { letter-spacing: 0; text-transform: none; font-size: 0.78rem; }
.hud-guardian__phase { color: var(--bullet); font-size: 0.6rem; font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
html[lang="ar"] .hud-guardian__phase { letter-spacing: 0; text-transform: none; font-size: 0.66rem; }

.hud-guardian__track { position: relative; height: 5px; overflow: hidden; border-radius: 999px; background: rgba(131, 168, 183, 0.16); }
.hud-guardian__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--bullet);
  transform: scaleX(var(--value, 1));
  transform-origin: left center;
  transition: transform 120ms linear;
  will-change: transform;
}
html[dir="rtl"] .hud-guardian__fill { transform-origin: right center; }

/* The vulnerability window is the one moment the player must not miss. */
.hud-guardian[data-phase="stalk"] { border-color: rgba(88, 215, 156, 0.42); }
.hud-guardian[data-phase="stalk"] .hud-guardian__phase { color: var(--green); }
.hud-guardian[data-phase="wind"] .hud-guardian__phase,
.hud-guardian[data-phase="strike"] .hud-guardian__phase { color: #ef8995; }

.hud-minimap { position: absolute; inset-block-start: clamp(92px, 8.5vw, 126px); inset-inline-end: clamp(13px, 1.25vw, 20px); width: clamp(138px, 10.5vw, 170px); padding: 8px 9px 9px; border: 1px solid rgba(116, 203, 232, 0.11); border-radius: 11px; background: rgba(2, 12, 19, 0.58); box-shadow: 0 8px 24px rgba(0,0,0,.18), var(--inset-highlight); backdrop-filter: blur(9px) saturate(108%); }
.hud-minimap__label { display: flex; align-items: center; justify-content: space-between; margin-block-end: 5px; color: var(--text-muted); font-size: 0.59rem; font-weight: 760; letter-spacing: 0.05em; text-transform: uppercase; }
.hud-minimap__label b { color: var(--cyan); font-family: var(--font-ui-latin); font-variant-numeric: tabular-nums; }
.hud-minimap__svg { display: block; width: 100%; height: auto; overflow: hidden; border-radius: 8px; }
.hud-minimap__arena { fill: rgba(5, 20, 29, 0.56); stroke: rgba(116, 203, 232, 0.18); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hud-minimap__trail { fill: none; stroke: rgba(83, 205, 245, 0.32); stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hud-minimap__viewport { fill: rgba(232, 184, 77, 0.045); stroke: rgba(232, 184, 77, 0.55); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hud-minimap__player { fill: var(--cyan-strong); stroke: rgba(238, 250, 255, 0.8); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* The menu is a designed screen, not the paused play field, so the canvas is
   hidden behind it and revealed only for states that actually render. */
body[data-game-state="menu"] .game-render-layer {
  opacity: 0;
}

.game-frame:has(.game-ui-layer[data-state="playing"]) .game-render-layer,
.game-frame:has(.game-ui-layer[data-state="paused"]) .game-render-layer,
.game-frame:has(.game-ui-layer[data-state="upgrade"]) .game-render-layer,
.game-frame:has(.game-ui-layer[data-state="gameover"]) .game-render-layer {
  opacity: 1;
}

/* The dashboard paints its own arena backdrop, so the shared ambient wash
   would only double up on it. */
.game-ui-layer[data-state="menu"] .ambient-ui {
  display: none;
}

/* Upgrade identity cards */
.upgrade-card {
  border-radius: 12px;
}

.upgrade-card__icon {
  position: relative;
  border-radius: 12px;
}

.upgrade-card__icon::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid currentColor;
  border-radius: 16px;
  opacity: 0.11;
}

.upgrade-card--heavy-shot .upgrade-card__icon,
.upgrade-card--phase-round .upgrade-card__icon,
.upgrade-card--bullet-velocity .upgrade-card__icon {
  color: var(--amber-strong);
  background: rgba(231, 184, 77, 0.13);
}

.upgrade-card--extended-ricochet .upgrade-card__icon,
.upgrade-card--hot-ricochet .upgrade-card__icon,
.upgrade-card--shock-impact .upgrade-card__icon,
.upgrade-card--kinetic-catch .upgrade-card__icon,
.upgrade-card--magnetic-recall .upgrade-card__icon,
.upgrade-card--recall-strike .upgrade-card__icon {
  color: var(--cyan);
  background: rgba(98, 213, 243, 0.12);
}

.upgrade-card--quick-dash .upgrade-card__icon,
.upgrade-card--swift-steps .upgrade-card__icon,
.upgrade-card--dash-impact .upgrade-card__icon {
  color: #8cf0c5;
  background: rgba(85, 215, 155, 0.13);
}

.upgrade-card--vitality .upgrade-card__icon,
.upgrade-card--field-medic .upgrade-card__icon,
.upgrade-card--wave-shield .upgrade-card__icon,
.upgrade-card--second-chance .upgrade-card__icon {
  color: #f294a1;
  background: rgba(216, 88, 105, 0.12);
}

/* Overlay screens */
.overlay-screen,
.upgrade-screen { display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
.overlay-scrim { position: absolute; inset: 0; background: rgba(0, 5, 9, 0.44); backdrop-filter: blur(3px) saturate(90%); }
.overlay-scrim--strong { background: rgba(0, 5, 9, 0.62); backdrop-filter: blur(6px) saturate(86%); }
.overlay-card { position: relative; z-index: 2; width: min(520px, calc(100vw - 48px)); padding: clamp(25px, 3vw, 38px); text-align: center; }
.overlay-card__icon { width: 48px; height: 48px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 14px; color: var(--cyan); background: var(--cyan-soft); font-size: 1.35rem; }
.overlay-card h2 { margin: 7px 0 0; color: var(--text-strong); font-size: clamp(1.7rem, 1.35rem + 1vw, 2.45rem); line-height: 1.05; font-weight: 830; }
.overlay-metrics { margin-block: 24px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; text-align: start; }
.overlay-metrics .metric { border-radius: 10px; background: rgba(0,0,0,.13); }
.overlay-actions { display: grid; gap: 8px; }
.overlay-card--gameover { width: min(560px, calc(100vw - 48px)); }
.gameover-score { margin-block: 24px 18px; display: grid; gap: 4px; }
.gameover-score span { color: var(--text-muted); font-size: var(--text-xs); font-weight: 680; }
.gameover-score strong { color: var(--text-strong); font-family: var(--font-ui-latin); font-size: clamp(2.8rem, 2rem + 2vw, 4.9rem); line-height: 0.95; letter-spacing: -0.055em; font-weight: 790; font-variant-numeric: tabular-nums; }

.upgrade-shell { position: relative; z-index: 2; width: min(1160px, calc(100vw - 64px)); }
.upgrade-header { max-width: 720px; margin-inline: auto; margin-block-end: clamp(18px, 2.3vw, 30px); text-align: center; }
.upgrade-header h2 { margin: 7px 0 8px; color: var(--text-strong); font-size: clamp(1.8rem, 1.3rem + 1.4vw, 3rem); line-height: 1.05; font-weight: 830; }
.upgrade-header > p:last-child { margin: 0; color: var(--text-soft); font-size: var(--text-sm); line-height: 1.55; }
.upgrade-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 1.5vw, 18px); }
.upgrade-card { min-height: 330px; padding: clamp(20px, 2vw, 27px); display: flex; flex-direction: column; text-align: start; color: var(--text); background: linear-gradient(150deg, rgba(255,255,255,.03), transparent 34%), rgba(5, 18, 28, 0.92); cursor: pointer; outline: 0; transition: transform var(--motion-normal) var(--ease-premium), border-color var(--motion-normal) var(--ease-premium), background var(--motion-normal) var(--ease-premium), box-shadow var(--motion-normal) var(--ease-premium); }
.upgrade-card:hover,
.upgrade-card:focus-visible { transform: translateY(-4px); border-color: rgba(231, 184, 77, 0.32); background: linear-gradient(150deg, rgba(231,184,77,.07), transparent 38%), var(--surface-2); box-shadow: 0 24px 54px rgba(0,0,0,.32), var(--inset-highlight); }
.upgrade-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.upgrade-card__index { color: var(--text-muted); font-family: var(--font-ui-latin); font-size: 0.72rem; font-weight: 800; }
.upgrade-card__tag { padding: 5px 8px; border-radius: 999px; color: var(--amber-strong); background: var(--amber-soft); font-size: 0.66rem; font-weight: 760; }
.upgrade-card__icon { width: 50px; height: 50px; margin-block: 32px 18px; display: grid; place-items: center; border-radius: 14px; color: var(--cyan); background: var(--cyan-soft); font-size: 1.45rem; }
.upgrade-card h3 { margin: 0; color: var(--text-strong); font-size: var(--text-lg); line-height: 1.18; font-weight: 820; }
.upgrade-card p { margin: 10px 0 0; color: var(--text-soft); font-size: var(--text-sm); line-height: 1.62; max-width: 32ch; }
.upgrade-card__footer { margin-block-start: auto; padding-block-start: 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--text-muted); font-size: var(--text-xs); font-weight: 710; }
.upgrade-card__footer strong { color: var(--amber-strong); font-family: var(--font-ui-latin); font-variant-numeric: tabular-nums; }
html[dir="rtl"] .upgrade-card { text-align: right; }
html[dir="rtl"] .upgrade-card__icon { margin-inline-start: auto; }
html[dir="rtl"] .upgrade-card p { margin-inline-start: auto; }
