/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/*
 * ── Design tokens ─────────────────────────────────────────────
 *
 *  Colors
 *  bg:                 #040714
 *  surface-1 (cards):  rgba(255,255,255,.03)
 *  surface-2 (hover):  rgba(255,255,255,.06)
 *  border-subtle:      rgba(255,255,255,.07)
 *  border:             rgba(255,255,255,.1)
 *  border-strong:      rgba(255,255,255,.22)
 *  blue accent:        #0063e5
 *  blue accent bright: #0080ff
 *  text primary:       #f9f9f9
 *  text secondary:     #cacaca
 *  text muted:         rgba(255,255,255,.55)
 *  header gradient:    in oklch 135deg, #B015B0 0%, #3D0080 50%, #040714 100%
 *
 *  Typography scale (rem)
 *  --text-xs: 0.75    --text-sm: 0.875   --text-base: 1
 *  --text-lg: 1.125   --text-xl: 1.25    --text-2xl: 1.5
 *  font stack: 'Avenir Next', -apple-system, BlinkMacSystemFont,
 *              'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif
 *
 *  Spacing scale (4px grid)
 *  --space-1: 4px   --space-2: 8px   --space-3: 12px   --space-4: 16px
 *  --space-6: 24px  --space-8: 32px
 *
 *  Radii
 *  --radius-sm: 6px   --radius: 10px   --radius-lg: 15px
 *
 *  Easing
 *  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1)  (spring/overshoot)
 *  --dur-fast: 120ms   --dur: 200ms
 *
 *  UI primitives
 *  --control-height: 44px   (touch minimum)
 *  --control-height-sm: 36px
 *  --z-sticky-header: 200   --z-modal: 400   --z-toast: 500
 */

:root {
  --bg: #040714;
  --surface-1: rgba(255,255,255,.03);
  --surface-2: rgba(255,255,255,.06);
  --surface-toast: #1a1730;
  --border-subtle: rgba(255,255,255,.07);
  --border: rgba(255,255,255,.1);
  --border-strong: rgba(255,255,255,.22);
  --text-primary: #f9f9f9;
  --text-secondary: #cacaca;
  --text-muted: rgba(255,255,255,.55);
  --accent: #0063e5;
  --accent-bright: #0080ff;
  --danger: #e11d48;
  --danger-hover: #f43f5e;
  --font: 'Avenir Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-base: 1rem;
  --text-lg: 1.125rem; --text-xl: 1.25rem; --text-2xl: 1.5rem;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 15px;
  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms; --dur: 200ms;
  --control-height: 44px;
  --control-height-sm: 36px;
  --shadow-card: 0 12px 28px rgba(15, 23, 42, 0.5);
  --shadow-modal: 0 24px 48px rgba(2, 6, 23, 0.58);
  --z-sticky-header: 200;
  --z-modal: 400;
  --z-toast: 500;
}

html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  min-height: 100%;
  color: var(--text-primary);
  display: flex; flex-direction: column;
}

body.modal-open {
  overflow: hidden;
}

main#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

/* ── Layout ────────────────────────────────────────────────── */
/*
 * GOTCHA: body { display:flex; flex-direction:column } + margin: 0 auto
 * on a child collapses its width — always pair with width: 100%.
 *
 * GOTCHA: External images (YouTube ggpht, Gravatar, etc.) may block loading
 * when the Referer header points to localhost or an unknown origin. Fix:
 * 1. Add <meta name="referrer" content="no-referrer"> in <head> (global)
 * 2. Or add referrerpolicy="no-referrer" on each <img> tag
 */
.container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6);
  flex: 1;
}

/* Vertical rhythm: use inside .container or nested regions */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.stack--tight { gap: var(--space-4); }
.stack--loose { gap: var(--space-8); }

/* Page section: title row + body (replaces “card everything” for grouping) */
.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}
.section__titles {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.section__title {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}
.section__lead {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 52ch;
}
.section__lead code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  color: var(--text-secondary);
}
.stack > .card { margin-bottom: 0; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ── Header ────────────────────────────────────────────────────
 * Owned by the Neorgon Header Kit (css/neorgon-header.css — canonical
 * source: packages/neorgon-ui/header/). Do NOT style .header-bar,
 * .header-logo*, .header-title-link, .header-subtitle, .header-right,
 * .header-actions, or .header-home here. Auth styles (.auth-*) stay
 * site-owned below.
 */
nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Buttons (canonical) ─────────────────────────────────────
 * Use .btn + a variant. Aliases: .nav-link = toolbar ghost; .auth-* map below.
 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  transition:
    background-color var(--dur),
    color var(--dur),
    border-color var(--dur),
    box-shadow var(--dur),
    transform var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn--sm {
  min-height: var(--control-height-sm);
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}
.btn--block { width: 100%; }
.btn--icon {
  min-width: var(--control-height);
  padding: 0;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.btn--primary:hover { background: var(--accent-bright); }
.btn--secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}
.btn--ghost {
  background: transparent;
  color: rgba(255,255,255,0.92);
  border-color: rgba(255,255,255,0.18);
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}
.btn--danger:hover { background: var(--danger-hover); }

/* Toolbar ghost (header nav) — same as .btn.btn--ghost.btn--sm */
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.auth-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--control-height);
  min-height: var(--control-height);
  padding: 0;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  font-family: inherit;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.auth-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.auth-toggle svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
}
.auth-toggle.logged-in { color: var(--accent); }
.auth-toggle.logged-in svg circle:nth-of-type(2) {
  fill: currentColor;
  stroke: none;
}

/* ── Sheet (inline panel under header) — not a modal ─────────
 * Use for auth, filters, compact forms. No backdrop; page scrolls.
 * For blocking overlays use .modal below.
 */
.auth-panel {
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-subtle);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.auth-panel.open { max-height: 300px; }
.auth-panel-inner {
  padding: var(--space-6);
  max-width: 400px;
  margin: 0 auto;
}
.auth-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.auth-tab {
  flex: 1;
  min-height: var(--control-height-sm);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.auth-tab.active {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.auth-form input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
}
.auth-submit {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background-color var(--dur);
}
.auth-submit:hover { background: var(--accent-bright); }
#authUser {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.auth-username {
  color: var(--text-primary);
  font-weight: 600;
}
.auth-logout {
  min-height: var(--control-height-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.auth-logout:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.auth-divider {
  height: 1px;
  background: var(--border-subtle);
}

/* ── Modal (blocking overlay) ──────────────────────────────── */
.modal[hidden] {
  display: none !important;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 12, 0.72);
  backdrop-filter: blur(4px);
}
.modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 440px);
  max-height: min(88vh, 560px);
  overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}
.modal__header h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.modal__body {
  padding: var(--space-6);
  overflow: auto;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.55;
}
.modal__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  color: var(--text-primary);
}
.modal__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

/* ── Card ──────────────────────────────────────────────────── */
/*
 * GOTCHA: backdrop-filter creates a stacking context — dropdowns inside
 * a card can be clipped by a later card's stacking context. Fix by adding
 * position: relative; z-index: 10 to the card that owns the open dropdown.
 *
 * Default: static surface (no hover lift — avoids generic “dashboard demo”).
 * Use .card--interactive for raised hover + entrance motion.
 *
 * GOTCHA: a <button> or <a> used AS a card does not inherit body text color —
 * buttons default to canvas text (near-black), rendering invisible on the dark
 * bg. When a card is an interactive element, set color: var(--text-primary)
 * and font-family: var(--font) explicitly on it.
 */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  backdrop-filter: blur(10px);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.45);
}
.card--interactive {
  transition:
    transform var(--dur) ease-out,
    box-shadow var(--dur) ease-out,
    border-color var(--dur);
  animation: fadeIn 0.35s ease-out both;
}
.card--interactive:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
  border-color: var(--border-strong);
}
.card--enter {
  animation: fadeIn 0.35s ease-out both;
}
.card--flat:hover {
  box-shadow: none;
}

/* ── Button press feedback ─────────────────────────────────── */
button:active,
.btn:active,
.nav-link:active,
.auth-toggle:active,
.auth-tab:active,
.auth-submit:active,
.auth-logout:active {
  transform: scale(0.98);
  transition-duration: var(--dur-fast);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Skeleton loading ──────────────────────────────────────── */
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  max-width: min(360px, calc(100vw - var(--space-8)));
  background: var(--surface-toast);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  pointer-events: none;
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Footer ────────────────────────────────────────────────── */
.info-footer {
  text-align: center;
  padding: var(--space-6) var(--space-6) 28px;
  color: var(--text-muted);
  font-size: .78em;
  line-height: 1.8;
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-8);
}
.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--dur);
}
.footer-link:hover,
.footer-link:focus-visible {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* ── Focus styles ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* ── Skip link ─────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--accent-bright);
  color: #000;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top var(--dur);
}
.skip-link:focus { top: 0; }

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card--interactive:hover { transform: none; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .container { padding: var(--space-4); }
  .toast {
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }
}

/* ════════════════════════════════════════════════════════════
   MINIMAP GAME STYLES
   Accent: sky-300 #7dd3fc (the minimap line color).
   HUD gold: #c8aa6e serif, an affectionate parody layout.
   ════════════════════════════════════════════════════════════ */

:root {
  --mm-accent: #7dd3fc;
  --mm-gold: #c8aa6e;
  --mm-gold-dim: #a8926a;
  --hud-serif: Palatino, 'Palatino Linotype', Georgia, 'Times New Roman', serif;
}

.screen[hidden] { display: none !important; }
.screen { flex: 1; display: flex; flex-direction: column; }
.screen-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.screen-lead {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  max-width: 62ch;
  margin-top: var(--space-1);
}
.panel-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--mm-accent);
  margin: var(--space-4) 0 var(--space-2);
}
.text-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
}

/* ── Chargen ───────────────────────────────────────────────── */
.chargen {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}
.chargen__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-6);
  margin-top: var(--space-6);
}
.chargen__panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.class-picker { display: grid; gap: var(--space-2); }
.class-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-areas: "icon name" "icon blurb" "icon skill";
  text-align: left;
  gap: 0 var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  cursor: pointer;
  transition: border-color var(--dur), background-color var(--dur), box-shadow var(--dur);
}
.class-card:hover { border-color: var(--border-strong); background: var(--surface-1); }
.class-card--active {
  border-color: var(--mm-accent);
  background: rgba(125, 211, 252, 0.06);
  box-shadow: 0 0 18px rgba(125, 211, 252, 0.15);
}
.class-card__icon { grid-area: icon; font-size: 1.7rem; align-self: center; text-align: center; }
.class-card__name { grid-area: name; font-weight: 700; }
.class-card__blurb { grid-area: blurb; font-size: var(--text-xs); color: var(--text-secondary); }
.class-card__skill { grid-area: skill; font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

.opt-row { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.opt-row__label { font-size: var(--text-xs); color: var(--text-muted); width: 52px; flex-shrink: 0; }
.opt-row__chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--dur), color var(--dur), background-color var(--dur);
}
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip--active {
  border-color: var(--mm-accent);
  color: var(--mm-accent);
  background: rgba(125, 211, 252, 0.08);
}

.chargen__preview { display: flex; flex-direction: column; }
.portrait {
  background: radial-gradient(circle at 50% 30%, rgba(125, 211, 252, 0.06), transparent 70%), var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  aspect-ratio: 7 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.portrait svg { width: 100%; height: 100%; }
.portrait-tag {
  fill: rgba(255, 255, 255, 0.45);
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: capitalize;
}
.portrait-note { font-size: var(--text-xs); color: var(--text-muted); margin: var(--space-2) 0 var(--space-4); }
.chargen__actions { margin-top: auto; display: grid; gap: var(--space-2); }

/* ── Roster ────────────────────────────────────────────────── */
.roster {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}
.roster__list { display: grid; gap: var(--space-3); margin: var(--space-6) 0; }
.roster__empty { color: var(--text-muted); font-size: var(--text-sm); }
.roster-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.roster-card--active { border-color: var(--mm-accent); }
.roster-card__icon { font-size: 1.8rem; }
.roster-card__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.roster-card__info span { font-size: var(--text-xs); color: var(--text-muted); }
.roster-card__actions { display: flex; gap: var(--space-2); }

/* ── Atlas hub ─────────────────────────────────────────────── */
.hub {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  flex: 1;
}
.hub__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.hub__legend { display: flex; gap: var(--space-4); font-size: var(--text-xs); color: var(--text-muted); }
.hub__legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot--open { background: var(--mm-accent); }
.dot--cleared { background: #4ade80; }
.dot--locked { background: transparent; border: 1px solid var(--border-strong); }

.atlas-wrap {
  margin-top: var(--space-4);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(125, 211, 252, 0.05), transparent 50%),
    radial-gradient(ellipse at 75% 80%, rgba(176, 21, 176, 0.05), transparent 50%),
    var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
#atlasSvg { display: block; width: 100%; height: auto; }
.atlas-edge { stroke: rgba(255, 255, 255, 0.10); stroke-width: 2; }
.atlas-edge--lit { stroke: rgba(125, 211, 252, 0.4); }
.atlas-node { cursor: pointer; }
.atlas-node--locked { cursor: default; opacity: 0.35; }
.atlas-node__ring {
  fill: rgba(4, 7, 20, 0.8);
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.5;
  transition: stroke var(--dur);
}
.atlas-node--open:hover .atlas-node__ring,
.atlas-node--open:focus-visible .atlas-node__ring { stroke: var(--mm-accent); }
.atlas-node--selected .atlas-node__ring { stroke: var(--mm-accent); stroke-width: 3; }
.atlas-node--cleared .atlas-node__core { opacity: 0.5; }
.atlas-node--cleared .atlas-node__ring { stroke: rgba(74, 222, 128, 0.6); }
.atlas-node__tier {
  fill: #04101a;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}
.atlas-node--locked .atlas-node__tier { fill: rgba(255, 255, 255, 0.5); }
.atlas-node--cleared .atlas-node__tier { fill: #4ade80; }

.hub__detail {
  margin-top: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.hub__detail-text h3 { font-size: var(--text-lg); }
.hub__detail-text p { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

/* ── Game stage ────────────────────────────────────────────── */
body[data-screen="game"] { overflow: hidden; height: 100dvh; }
.screen--game { flex: 1; display: flex; min-height: 0; }
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #05030a;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#bgCanvas { filter: blur(22px) saturate(1.15) brightness(0.9); transform: scale(1.12); }
#gameCanvas { z-index: 1; }

/* tracker: top right, gold serif */
.tracker {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 2;
  text-align: right;
  font-family: var(--hud-serif);
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  max-width: min(300px, 44vw);
}
.tracker__map { color: var(--mm-gold); font-size: 13px; line-height: 1.45; }
.tracker__map div:first-child { font-size: 15px; font-weight: 700; }
.tracker__quest { margin-top: var(--space-4); }
.tracker__quest-title {
  color: #e5c77b;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.tracker__quest-body { color: var(--mm-gold-dim); font-size: 12px; line-height: 1.45; margin-top: 2px; }

/* boss bar */
.boss-bar {
  position: absolute;
  top: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: min(560px, 62vw);
  text-align: center;
  pointer-events: none;
}
.boss-bar__name {
  font-family: var(--hud-serif);
  color: #e8c06a;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  margin-bottom: 4px;
}
.boss-bar__track {
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.8);
  outline: 1px solid rgba(200, 170, 110, 0.5);
  background: rgba(10, 4, 4, 0.8);
}
.boss-bar__fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #b32020, #5e0d0d);
  transition: width 120ms linear;
}

/* bottom HUD */
.hud {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: var(--space-4);
  gap: var(--space-3);
  pointer-events: none;
}
.orb {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 3px solid #3a3120;
  outline: 2px solid rgba(0, 0, 0, 0.75);
  background: rgba(8, 6, 10, 0.85);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 6px 18px rgba(0, 0, 0, 0.8), 0 4px 14px rgba(0, 0, 0, 0.6);
}
.orb__fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 100%;
  transition: height 150ms linear;
}
.orb--life .orb__fill { background: radial-gradient(circle at 35% 25%, #ff7a5c, #b32014 55%, #5e0d08); }
.orb--mana .orb__fill { background: radial-gradient(circle at 35% 25%, #6ea8ff, #1d4fb3 55%, #0a1e5e); }
.orb__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--hud-serif);
  font-size: 12px;
  font-weight: 700;
  color: #f4ead2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  z-index: 1;
}
.orb::after {
  content: '';
  position: absolute;
  top: 8%; left: 18%;
  width: 42%; height: 24%;
  border-radius: 50%;
  background: linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  z-index: 2;
}

.hud__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}
.charline {
  font-family: var(--hud-serif);
  font-size: 12px;
  color: var(--mm-gold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.skillbar { display: flex; gap: var(--space-2); pointer-events: auto; }
.skill {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(200, 170, 110, 0.45);
  background: rgba(10, 8, 14, 0.85);
  color: #f4ead2;
  font-size: 1.3rem;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.skill:hover { border-color: var(--mm-gold); box-shadow: 0 0 12px rgba(200, 170, 110, 0.25); }
.skill--util { font-size: 1rem; color: var(--text-secondary); }
.skill__icon { position: relative; z-index: 1; }
.skill__cd {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0%;
  background: rgba(0, 0, 0, 0.72);
  z-index: 2;
  pointer-events: none;
}
.skill__key {
  position: absolute;
  right: 3px; bottom: 1px;
  z-index: 3;
  font-size: 9px;
  font-family: var(--font);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
}

.xpbar {
  position: relative;
  width: min(640px, 56vw);
  margin-top: 16px;
  height: 10px;
  border: 1px solid rgba(200, 170, 110, 0.4);
  background: rgba(6, 8, 14, 0.85);
  border-radius: 3px;
}
.xpbar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #a5e0fb, #4a9ec4);
  border-radius: 2px;
  transition: width 200ms ease-out;
}
.xpbar__label {
  position: absolute;
  left: 50%;
  bottom: 13px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  font-family: var(--font);
  color: rgba(244, 234, 210, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* waypoint panel */
.wp-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: min(320px, 86vw);
  background: rgba(6, 9, 18, 0.94);
  border: 1px solid rgba(200, 170, 110, 0.4);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-modal);
}
.wp-panel h3 {
  font-family: var(--hud-serif);
  color: var(--mm-gold);
  font-size: var(--text-base);
  margin-bottom: var(--space-3);
}
.wp-panel__list { display: grid; gap: var(--space-2); margin-bottom: var(--space-3); }
.wp-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur), background-color var(--dur);
}
.wp-item span { color: var(--mm-accent); }
.wp-item:hover:not(:disabled) { border-color: var(--mm-accent); background: rgba(125, 211, 252, 0.06); }
.wp-item--locked { opacity: 0.4; cursor: not-allowed; }
.wp-item--leave span { color: var(--mm-gold); }

/* overlays */
.overlay[hidden],
.wp-panel[hidden],
.boss-bar[hidden] { display: none !important; }
.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
  background: rgba(2, 3, 8, 0.62);
  backdrop-filter: blur(3px);
  padding: var(--space-6);
}
.overlay h2 {
  font-family: var(--hud-serif);
  font-size: 2rem;
  letter-spacing: 0.06em;
}
.overlay--death h2 { color: #d4362a; text-shadow: 0 0 24px rgba(212, 54, 42, 0.5); }
.overlay--cleared h2 { color: #e8c06a; text-shadow: 0 0 24px rgba(232, 192, 106, 0.4); }
.overlay p { color: var(--text-secondary); font-size: var(--text-sm); max-width: 46ch; }
.overlay__penalty { color: #f0b9b3; font-size: var(--text-xs); }
.overlay__actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); flex-wrap: wrap; justify-content: center; }

/* in-stage toasts */
.toastbox {
  position: absolute;
  top: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}
.toastbox .toast {
  position: static;
  transform: translateY(-6px);
  font-family: var(--hud-serif);
  color: #e8dcbc;
  background: rgba(8, 10, 18, 0.9);
  border-color: rgba(200, 170, 110, 0.35);
}
.toastbox .toast.visible { transform: translateY(0); }

/* ── Game responsive ───────────────────────────────────────── */
@media (max-width: 720px) {
  .chargen__grid { grid-template-columns: 1fr; }
  .orb { width: 76px; height: 76px; }
  .orb__label { font-size: 10px; }
  .xpbar { width: 40vw; }
  .xpbar__label { display: none; }
  .charline { display: none; }
  .tracker__map { font-size: 11px; }
  .tracker__map div:first-child { font-size: 13px; }
  .tracker__quest-body { display: none; }
  .skill { width: 46px; height: 46px; }
}
