/* ==========================================================================
   Blast Isles prototype: shared foundation styles (owned by core).
   Page styles live in pages/<name>.css, scoped under .page-<name>.
   Rule: no color literal outside the two token blocks below.
   ========================================================================== */

/* ---------- Tokens: non-color (shared by both worlds) ---------- */
:root {
  --font-display: 'Lilita One', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, 'Segoe UI', sans-serif;
  --font-data: 'Chakra Petch', ui-monospace, monospace;

  --step--2: 0.75rem;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.45rem + 1.3vw, 2.25rem);
  --step-4: clamp(2rem, 1.6rem + 1.6vw, 2.75rem);
  --step-5: clamp(2.5rem, 1.7rem + 4vw, 4.75rem);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --stroke: 1px;
  --pop: 1px;

  --gutter: clamp(16px, 4vw, 40px);
  --gutter-start: max(var(--gutter), env(safe-area-inset-left, 0px));
  --gutter-end: max(var(--gutter), env(safe-area-inset-right, 0px));
  --max: 1160px;
}

/* ---------- Tokens: Day world (default) ---------- */
:root,
[data-world="day"],
[data-world="day"] ::backdrop {
  color-scheme: light;

  /* palette */
  --sky: #dff3ff;
  --sky-deep: #9fd8f7;
  --lagoon: #0b6fb3;
  --sand: #ffe9b8;
  --paper: #ffffff;
  --fuse: #ff7a1a;
  --ember: #ff3b5c;
  --leaf: #1f9d63;
  --gold: #ffc531;
  --lantern: #ffb72d;
  --ink: #172036;
  --ink-soft: #4a5672;

  /* semantic roles (same names in both worlds) */
  --bg: var(--row-alt);
  --surface: var(--paper);
  --surface-2: var(--sand);
  --surface-3: var(--sky-deep);
  --line: #bcd9ec;
  --edge: var(--ink);
  --ghost-edge: #697b94;
  --accent: var(--lagoon);
  --on-accent: #ffffff;
  --on-fuse: #172036;
  --on-ember: #172036;
  --on-leaf: #172036;
  --on-gold: #172036;
  --sel-bg: var(--ink);
  --sel-ink: #ffffff;
  --dark-bg: var(--ink);
  --dark-ink: #ffffff;
  --ok-ink: #12704a;
  --danger-ink: #b8122f;
  --danger-soft: #ffe1e6;
  --focus: #0b6fb3;
  --scrim: rgba(23, 32, 54, 0.55);
  --shadow: 0 8px 24px rgba(23, 32, 54, 0.08);
  --row-alt: #f4faff;
  --row-pinned: #fff1cc;
  --rank-1: #ffc531;
  --rank-2: #cdd6e4;
  --rank-3: #f0a568;
  --rank-1-bg: #fff7dc;
  --rank-2-bg: #f2f5f9;
  --rank-3-bg: #fdf0e5;
  --hud-bg: rgba(23, 32, 54, 0.84);
  --hud-ink: #ffffff;
  --hud-soft: #b7c2df;
  --hud-off: rgba(255, 255, 255, 0.2);
  --hud-accent: #ffc531;
  --hud-hot: #ff7a1a;
  --toast-bg: #172036;
  --toast-ink: #ffffff;
  --proto-bg: #172036;
  --proto-ink: #ffffff;
}

/* ---------- Tokens: Night world (Invite hub) ---------- */
[data-world="night"],
[data-world="night"] ::backdrop {
  color-scheme: dark;

  /* palette */
  --bg: #0f1530;
  --panel: #18214a;
  --panel-2: #212c5e;
  --lantern: #ffb72d;
  --fuse: #ff7a1a;
  --ember: #ff5c78;
  --leaf: #3fd18f;
  --gold: #ffc531;
  --ink: #f3f1ff;
  --ink-soft: #a9b3d9;
  --line: #2d3a78;

  /* semantic roles (same names in both worlds) */
  --surface: var(--panel);
  --surface-2: var(--panel-2);
  --surface-3: #2a3770;
  --edge: #060a1c;
  --ghost-edge: var(--ink-soft);
  --accent: var(--lantern);
  --on-accent: #172036;
  --on-fuse: #172036;
  --on-ember: #172036;
  --on-leaf: #172036;
  --on-gold: #172036;
  --sel-bg: var(--lantern);
  --sel-ink: #172036;
  --dark-bg: var(--panel-2);
  --dark-ink: var(--ink);
  --ok-ink: #63e3a8;
  --danger-ink: #ff9cb0;
  --danger-soft: #3a1f3a;
  --focus: #ffb72d;
  --scrim: rgba(4, 7, 20, 0.72);
  --shadow: 0 8px 24px rgba(4, 7, 20, 0.24);
  --row-alt: #1b2552;
  --row-pinned: #33305a;
  --rank-1: #ffc531;
  --rank-2: #cdd6e4;
  --rank-3: #f0a568;
  --rank-1-bg: #3a3326;
  --rank-2-bg: #262f5c;
  --rank-3-bg: #3a2b33;
  --hud-bg: rgba(6, 10, 28, 0.85);
  --hud-ink: #f3f1ff;
  --hud-soft: #a9b3d9;
  --hud-off: rgba(243, 241, 255, 0.18);
  --hud-accent: #ffb72d;
  --hud-hot: #ff7a1a;
  --toast-bg: #212c5e;
  --toast-ink: #f3f1ff;
  --proto-bg: #ffb72d;
  --proto-ink: #172036;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; }
svg { flex-shrink: 0; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  line-height: 1.1;
  text-wrap: balance;
}
h1, .h1 { font: 400 var(--step-5)/1 var(--font-display); letter-spacing: 0.01em; }
h2, .h2 { font: 800 var(--step-3)/1.2 var(--font-body); letter-spacing: -0.02em; }
h3, .h3 { font: 800 var(--step-2)/1.25 var(--font-body); letter-spacing: -0.01em; }
h4, .h4 { font: 800 var(--step-1)/1.3 var(--font-body); }
p { margin: 0; text-wrap: pretty; }
.lead { font-size: var(--step-1); line-height: 1.5; color: var(--ink-soft); }
.measure { max-width: 62ch; }
.muted { color: var(--ink-soft); }
.small { font-size: var(--step--1); }

a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
a:hover { text-decoration-thickness: 3px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.data {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font: 800 var(--step--1)/1.2 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--fuse);
  border: 1px solid var(--line);
}

.icon { width: 1.25em; height: 1.25em; vertical-align: -0.2em; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Focus ---------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
[tabindex="-1"]:focus { outline: none; }

/* ---------- Layout primitives ---------- */
/* The one side gutter lives on .app (outer wrapper). Use .bleed to paint full-width bands. */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-inline: var(--gutter-start) var(--gutter-end);
  overflow-x: clip;
}
.view { display: block; flex: 1; min-width: 0; }
.view:focus { outline: none; }

.bleed {
  margin-inline: calc(var(--gutter-start) * -1) calc(var(--gutter-end) * -1);
  padding-inline: var(--gutter-start) var(--gutter-end);
}

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
}

.section { padding-block: clamp(40px, 6vw, 72px); }
.section--tight { padding-block: clamp(32px, 4vw, 48px); }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap, var(--space-4));
}
.stack > * { min-width: 0; }

.row,
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--row-gap, var(--space-3));
}
.row > *,
.cluster > * { min-width: 0; }
.row--between { justify-content: space-between; }

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 240px)), 1fr));
  gap: var(--grid-gap, var(--space-5));
}
.grid-auto > * { min-width: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 46px;
  padding: 0.55em 1.25em;
  border: var(--stroke) solid var(--ghost-edge);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 800 var(--step-0)/1.15 var(--font-body);
  text-align: center;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--row-alt); text-decoration: none; }
.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}
.btn--primary { border-color: var(--on-fuse); background: var(--fuse); color: var(--on-fuse); }
.btn--primary:hover { background: var(--fuse); box-shadow: inset 0 0 0 1px var(--on-fuse); }
.btn--ghost {
  background: transparent;
  border-color: var(--ghost-edge);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--surface); }
.btn--ghost:active { transform: translateY(1px); }
.btn--dark { background: var(--dark-bg); color: var(--dark-ink); }
.btn--dark:hover { background: var(--dark-bg); box-shadow: inset 0 0 0 1px var(--dark-ink); }
.btn--sm {
  min-height: 44px;
  padding: 0.35em 0.95em;
  font-size: var(--step--1);
}
.btn--lg {
  min-height: 56px;
  padding: 0.7em 1.6em;
  font-size: var(--step-1);
}
.btn--icon { padding: 0; aspect-ratio: 1; min-width: 46px; }
.btn--icon.btn--sm { min-width: 44px; }
.btn--block { display: flex; width: 100%; }
.btn .icon { width: 1.15em; height: 1.15em; }
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------- Chips, badges, tags ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2em 0.75em;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font: 800 var(--step--1)/1.3 var(--font-body);
  white-space: nowrap;
}
.chip--sm { font-size: var(--step--2); padding: 0.15em 0.6em; }
.chip--accent { background: var(--accent); color: var(--on-accent); }
.chip--fuse { background: var(--fuse); color: var(--on-fuse); }
.chip--sand { background: var(--surface-2); }
.chip--placeholder {
  border-style: dashed;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
}

.badge-vip {
  display: inline-block;
  padding: 0.05em 0.45em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--gold);
  color: var(--on-gold);
  font: 700 var(--step--2)/1.4 var(--font-data);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Cards and placeholders ---------- */
.card {
  padding: var(--space-5);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.card--sticker {
  border: var(--stroke) solid var(--line);
  box-shadow: var(--shadow);
}
.card--sand { background: var(--surface-2); }

.art-slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: var(--ratio, 16 / 9);
  padding: var(--space-3);
  border: var(--stroke) dashed var(--edge);
  border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 12px, var(--surface) 12px 24px);
  color: var(--ink-soft);
  font-weight: 800;
  text-align: center;
}

.proto-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35em 0.75em;
  border: 1.5px dashed var(--ink-soft);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font: 700 var(--step--1)/1.35 var(--font-body);
}

/* ---------- Segmented tabs ---------- */
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.tab {
  min-height: 44px;
  padding: 0.4em 1em;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font: 800 var(--step--1)/1.2 var(--font-body);
  cursor: pointer;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--sel-bg); color: var(--sel-ink); }

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field > label,
.label {
  font: 800 var(--step--1)/1.3 var(--font-body);
  color: var(--ink);
}
.input {
  width: 100%;
  min-height: 48px;
  padding: 0.65em 0.9em;
  border: var(--stroke) solid var(--ghost-edge);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 600 var(--step-0)/1.3 var(--font-body);
}
.input.data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.input::placeholder { color: var(--ink-soft); opacity: 1; }
.input:focus-visible { outline-offset: 1px; }
.input[aria-invalid="true"] {
  border-color: var(--danger-ink);
  background: var(--danger-soft);
}
.input[readonly] { background: var(--surface-2); }
.input-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}
.input-row > .input { flex: 1; min-width: 0; }
.hint { font-size: var(--step--1); color: var(--ink-soft); }
.error-text { font: 700 var(--step--1)/1.4 var(--font-body); color: var(--danger-ink); }
.ok-text { font: 700 var(--step--1)/1.4 var(--font-body); color: var(--ok-ink); }
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--fuse);
}
.check label { font-weight: 700; min-width: 0; }

/* ---------- Stepper ---------- */
.stepper {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}
.stepper__step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  padding-inline: 4px;
  text-align: center;
  color: var(--ink-soft);
  font: 800 var(--step--1)/1.25 var(--font-body);
}
.stepper__step + .stepper__step::before {
  content: "";
  position: absolute;
  top: 17px;
  right: 50%;
  width: 100%;
  height: 3px;
  background: var(--line);
}
.stepper__num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: var(--stroke) solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font: 700 var(--step-0)/1 var(--font-data);
  font-variant-numeric: tabular-nums;
}
.stepper__step.is-done { color: var(--ink); }
.stepper__step.is-done .stepper__num { background: var(--leaf); color: var(--on-leaf); }
.stepper__step.is-done + .stepper__step::before { background: var(--edge); }
.stepper__step[aria-current="step"] { color: var(--ink); }
.stepper__step[aria-current="step"] .stepper__num { background: var(--fuse); color: var(--on-fuse); }
@media (max-width: 479.98px) {
  .stepper__label { font-size: var(--step--2); }
}

/* ---------- Tables ---------- */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}
.table thead th {
  padding: 12px 14px;
  border-bottom: 2px solid var(--line);
  color: var(--ink-soft);
  font: 800 var(--step--2)/1.2 var(--font-body);
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.table td,
.table tbody th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table .num {
  text-align: right;
  font-family: var(--font-data);
  font-weight: 600;
  white-space: nowrap;
}
.table thead th.num { font-family: var(--font-body); font-weight: 800; }
.table .row-pinned td {
  background: var(--row-pinned);
  font-weight: 800;
  border-bottom: var(--stroke) solid var(--line);
}
.rank {
  display: inline-grid;
  place-items: center;
  min-width: 2.25em;
  height: 2.25em;
  padding: 0 0.45em;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font: 700 var(--step--1)/1 var(--font-data);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rank-1 td { background: var(--rank-1-bg); }
.rank-2 td { background: var(--rank-2-bg); }
.rank-3 td { background: var(--rank-3-bg); }
.rank-1 .rank { background: var(--rank-1); border-color: var(--edge); color: var(--on-gold); }
.rank-2 .rank { background: var(--rank-2); border-color: var(--edge); color: var(--on-gold); }
.rank-3 .rank { background: var(--rank-3); border-color: var(--edge); color: var(--on-gold); }

/* ---------- Modal (native <dialog>) ---------- */
.modal {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: var(--scrim); }
.modal__inner {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
}
.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.modal__title { font: 800 var(--step-2)/1.25 var(--font-body); min-width: 0; }
.modal__body { display: grid; gap: var(--space-3); min-width: 0; }
.modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Wallet mock content (rendered by core inside the modal) */
.wallet-list { display: grid; gap: var(--space-3); }
.wallet-opt {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: var(--stroke) solid var(--ghost-edge);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
}
.wallet-opt:hover { background: var(--surface-2); }
.wallet-opt:active { transform: translateY(1px); box-shadow: none; }
.wallet-opt[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.wallet-opt__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--ink);
}
.wallet-opt__text { display: grid; flex: 1; min-width: 0; }
.wallet-opt__name { font-weight: 900; }
.wallet-opt__sub { font-size: var(--step--1); color: var(--ink-soft); }
.wallet-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 800;
}
.sign-msg {
  margin: 0;
  padding: var(--space-4);
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font: 500 var(--step--1)/1.55 var(--font-data);
  font-variant-numeric: tabular-nums;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sign-free {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--ok-ink);
  font-weight: 900;
}

.spinner {
  width: 22px;
  height: 22px;
  flex: none;
  border: 3px solid var(--line);
  border-top-color: var(--fuse);
  border-radius: 50%;
  animation: bi-spin 0.8s linear infinite;
}
@keyframes bi-spin { to { transform: rotate(360deg); } }

/* ---------- Toasts ---------- */
.toast-root {
  position: fixed;
  z-index: 39; /* above page content, below the header menus (40) and the prototype panel */
  top: calc(env(safe-area-inset-top, 0px) + 80px);
  left: 0;
  right: 0;
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding-inline: 16px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: min(440px, 100%);
  padding: 0.7em 1.1em;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-weight: 800;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: bi-toast-in 0.18s ease-out;
}
.toast--success .icon { color: var(--leaf); }
.toast--error .icon { color: var(--ember); }
@keyframes bi-toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- HUD (signature artillery readout) ---------- */
.hud {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: stretch;
  max-width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--hud-bg);
  color: var(--hud-ink);
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}
.hud__item {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 4px 10px;
}
.hud__item + .hud__item { border-left: 1px solid var(--hud-off); }
.hud__label {
  color: var(--hud-soft);
  font: 600 0.625rem/1.1 var(--font-data);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hud__value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 var(--step-1)/1.1 var(--font-data);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hud-angle__dial { width: 24px; height: 24px; fill: none; stroke-linecap: round; }
.hud-angle__base { stroke: var(--hud-off); stroke-width: 2; }
.hud-angle__arc { stroke: var(--hud-soft); stroke-width: 1.5; stroke-dasharray: 2 3; }
.hud-angle__needle { stroke: var(--hud-accent); stroke-width: 3; }
.hud-wind__arrow {
  display: inline-flex;
  color: var(--hud-accent);
  transform: scaleX(var(--wind-dir, 1));
}
.hud-wind__arrow svg { width: 26px; height: 14px; }
.hud-power__bar {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}
.hud-power__seg {
  width: 6px;
  border-radius: 2px;
  background: var(--hud-off);
}
.hud-power__seg.is-on { background: var(--hud-accent); }
.hud-power__seg.is-on.is-hot { background: var(--hud-hot); }

/* ---------- Header ---------- */
.skip-link {
  position: absolute;
  z-index: 70;
  top: 8px;
  left: 8px;
  transform: translateY(-200%);
  padding: 0.5em 1em;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--fuse);
  color: var(--on-fuse);
  font-weight: 900;
}
.skip-link:focus-visible { transform: none; }

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 40;
  background: var(--surface);
  border-bottom: var(--stroke) solid var(--line);
}
.site-header__bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 68px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-width: 0;
  color: var(--ink);
  font: 400 var(--step-2)/1 var(--font-display);
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark__mark {
  flex: none;
  width: 1.65em;
  height: 1.65em;
  border: 1px solid var(--line);
  border-radius: 28%;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.site-panel {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}
.site-nav {
  display: flex;
  gap: 4px;
  margin-inline: auto;
}
.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.55em 0.9em;
  border-radius: 0;
  color: var(--ink);
  font: 800 var(--step--1)/1.2 var(--font-body);
  text-decoration: none;
}
.site-nav__link:hover { color: var(--accent); text-decoration: none; }
.site-nav__link[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.site-panel__signin { display: none; }

.site-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}
.site-actions .btn { white-space: nowrap; }
.menu-btn { display: none; }

.acct { position: relative; }
.acct-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 300px;
  min-height: 46px;
  padding: 4px 12px 4px 4px;
  border: var(--stroke) solid var(--ghost-edge);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}
.acct-chip:active { transform: translateY(1px); }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--fuse);
  color: var(--on-fuse);
  font: 400 var(--step-1)/1 var(--font-display);
  text-transform: uppercase;
}
.acct-chip__text { display: grid; min-width: 0; line-height: 1.15; text-align: left; }
.acct-chip__name { overflow: hidden; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.acct-chip__wallet { color: var(--ink-soft); font-size: var(--step--2); }
.acct-chip__caret .icon { width: 1em; height: 1em; }
.acct-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  gap: 2px;
  min-width: 230px;
  padding: 6px;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.acct-menu__head {
  display: none;
  gap: 2px;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.acct-menu__note { padding: 4px 12px 8px; color: var(--ink-soft); font-size: var(--step--2); }
.acct-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: 800 var(--step-0)/1.2 var(--font-body);
  text-align: left;
  text-decoration: none;
}
.acct-menu__item:hover { background: var(--surface-2); text-decoration: none; }

@media (max-width: 759.98px) {
  .site-header__bar { gap: var(--space-2); min-height: 60px; }
  .wordmark { font-size: 1.125rem; }
  .menu-btn { display: inline-flex; }
  .site-actions { gap: var(--space-2); }
  .site-actions__signin { display: none; }
  .site-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    padding: var(--space-3) var(--gutter-end) var(--space-5) var(--gutter-start);
    background: var(--surface);
    border-bottom: var(--stroke) solid var(--line);
  }
  .site-nav { flex-direction: column; margin: 0; }
  .site-nav__link { padding: 0.9em 1em; font-size: var(--step-0); }
  .site-panel__signin {
    display: block;
    padding: 0.9em 1em;
    color: var(--accent);
    font-weight: 900;
  }
  .acct-chip { padding-right: 8px; }
  .acct-chip__text { display: none; }
  .acct-menu__head { display: grid; }
}
@media (max-width: 349.98px) {
  /* Very narrow phones: keep the logo mark only. */
  .site-header__bar .wordmark > span { display: none; }
}
@media (min-width: 760px) {
  /* Desktop: nav is always visible; [hidden] only drives the mobile panel. */
  .site-panel[hidden] { display: flex !important; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  padding-block: var(--space-7);
  background: var(--surface);
  border-top: var(--stroke) solid var(--line);
  color: var(--ink);
}
.site-footer__inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--space-5);
  align-items: start;
}
.site-footer__inner > * { min-width: 0; }
.site-footer__title {
  margin-bottom: var(--space-2);
  color: var(--ink-soft);
  font: 800 var(--step--2)/1.2 var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.site-footer__links { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.site-footer__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--ink);
  font-weight: 800;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
