/* ── Neuro-Link NAP — app shell styles ───────────────────────────────────────
   Mobile-first, dark, clean sans. Default theme tokens live in :root and may be
   overridden at runtime by the Dynamic Theme Loader (theme.js) via inline
   CSS custom properties on :root before the app mounts. */

:root {
  /* ── Neuro-Link brand palette ─────────────────────────────────────────── */
  --nl-deep-cove: #090f4a;
  --nl-cobalt: #2e3884;
  --nl-pale-sky: #71777c;
  --nl-grey-goose: #c9cfd3;
  --nl-porcelain: #f1f1f1;
  --nl-gold-drop: #ff7e00;

  /* Default (no sponsor) theme tokens — Deep Cove navy base. Overridable by the
     dynamic theme loader (theme.js) via inline custom properties on :root. */
  --nl-accent: #ff7e00; /* Gold Drop */
  --nl-bg: #090f4a; /* Deep Cove */
  --nl-surface: #141b5c; /* lighter navy panel */
  --nl-text: #f1f1f1; /* Porcelain */

  /* Derived tokens. */
  --nl-surface-2: #20285f; /* elevated navy */
  --nl-muted: #c9cfd3; /* Grey Goose */
  --nl-border: #28316b; /* navy hairline */
  --nl-on-accent: #090f4a; /* text/icon sitting on Gold Drop */
  --nl-radius: 14px;
  --nl-radius-sm: 10px;
  --nl-tabbar-h: 64px;
  --nl-header-h: 56px;
  --nl-safe-top: env(safe-area-inset-top, 0px);
  --nl-safe-bottom: env(safe-area-inset-bottom, 0px);
  --nl-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--nl-bg);
  color: var(--nl-text);
  font-family: var(--nl-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* ── Ambient animated background ───────────────────────────────────────────── */
/* Floating brand-colour glow orbs + a slow aurora sweep + drifting particles,
   behind all content. Theme-aware (softer in light), respects reduced-motion. */
.bg-motion {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.9;
}
:root[data-theme='light'] .bg-motion {
  opacity: 0.45;
}

/* Slow-rotating aurora sweep. */
.bg-aurora {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160vmax;
  height: 160vmax;
  margin: -80vmax 0 0 -80vmax;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    color-mix(in srgb, var(--nl-cobalt) 45%, transparent) 70deg,
    transparent 150deg,
    color-mix(in srgb, var(--nl-accent) 30%, transparent) 230deg,
    transparent 320deg
  );
  filter: blur(60px);
  opacity: 0.5;
  will-change: transform;
  animation: bg-rotate 70s linear infinite;
}

/* Floating glow orbs. */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  will-change: transform;
}
.orb--1 {
  width: 62vw;
  height: 62vw;
  left: -14vw;
  top: -12vh;
  background: radial-gradient(circle, color-mix(in srgb, var(--nl-cobalt) 85%, transparent), transparent 68%);
  animation: float-a 27s ease-in-out infinite alternate;
}
.orb--2 {
  width: 44vw;
  height: 44vw;
  right: -10vw;
  top: 8vh;
  background: radial-gradient(circle, color-mix(in srgb, var(--nl-accent) 50%, transparent), transparent 68%);
  animation: float-b 34s ease-in-out infinite alternate;
}
.orb--3 {
  width: 56vw;
  height: 56vw;
  left: 20vw;
  bottom: -18vh;
  background: radial-gradient(circle, color-mix(in srgb, var(--nl-cobalt) 78%, transparent), transparent 70%);
  animation: float-c 31s ease-in-out infinite alternate;
}
.orb--4 {
  width: 30vw;
  height: 30vw;
  left: 42vw;
  top: 36vh;
  background: radial-gradient(circle, color-mix(in srgb, #4a57c8 70%, transparent), transparent 66%);
  animation: float-d 23s ease-in-out infinite alternate;
}
.orb--5 {
  width: 26vw;
  height: 26vw;
  left: -6vw;
  bottom: 6vh;
  background: radial-gradient(circle, color-mix(in srgb, var(--nl-accent) 42%, transparent), transparent 66%);
  animation: float-e 38s ease-in-out infinite alternate;
}

/* Drifting particles. */
.pt {
  position: absolute;
  bottom: -6vh;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--nl-accent);
  opacity: 0;
  will-change: transform, opacity;
  animation: rise linear infinite;
}
.pt--1 { left: 12%; animation-duration: 19s; animation-delay: 0s; }
.pt--2 { left: 27%; animation-duration: 24s; animation-delay: -6s; background: var(--nl-cobalt); width: 4px; height: 4px; }
.pt--3 { left: 41%; animation-duration: 16s; animation-delay: -10s; }
.pt--4 { left: 56%; animation-duration: 28s; animation-delay: -3s; background: var(--nl-cobalt); }
.pt--5 { left: 68%; animation-duration: 21s; animation-delay: -14s; width: 3px; height: 3px; }
.pt--6 { left: 79%; animation-duration: 26s; animation-delay: -8s; }
.pt--7 { left: 88%; animation-duration: 18s; animation-delay: -2s; background: var(--nl-cobalt); width: 4px; height: 4px; }
.pt--8 { left: 6%; animation-duration: 23s; animation-delay: -16s; width: 3px; height: 3px; }

@keyframes bg-rotate {
  to { transform: rotate(360deg); }
}
@keyframes float-a {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(9vw, 7vh) scale(1.16); }
}
@keyframes float-b {
  0% { transform: translate(0, 0) scale(1.05); }
  100% { transform: translate(-8vw, 9vh) scale(0.9); }
}
@keyframes float-c {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(6vw, -8vh) scale(1.12); }
}
@keyframes float-d {
  0% { transform: translate(0, 0) scale(0.95); }
  100% { transform: translate(-7vw, -6vh) scale(1.2); }
}
@keyframes float-e {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(8vw, -5vh) scale(1.15); }
}
@keyframes rise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.5; }
  100% { transform: translateY(-112vh) translateX(4vw); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-aurora,
  .orb,
  .pt {
    animation: none;
  }
  .pt { display: none; }
}
/* Keep the shells above the motion layer; let it show through transparent gaps. */
.app {
  position: relative;
  z-index: 1;
}

[hidden] {
  display: none !important;
}

/* ── Boot splash ──────────────────────────────────────────────────────────── */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 16px;
  justify-items: center;
  background: var(--nl-bg);
  z-index: 50;
}
/* Sci-fi loader: rotating HUD rings + scanning sweep + pulsing brand core. */
.loader {
  position: relative;
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
}
.loader__rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.lr {
  fill: none;
  transform-origin: 60px 60px;
}
.lr--1 {
  stroke: var(--nl-accent);
  stroke-width: 1.4;
  stroke-dasharray: 30 14;
  opacity: 0.85;
  animation: lr-spin 3.4s linear infinite;
}
.lr--2 {
  stroke: var(--nl-cobalt, #2e3884);
  stroke-width: 2.4;
  stroke-dasharray: 4 12;
  opacity: 0.9;
  animation: lr-spin 2.2s linear infinite reverse;
}
.lr--3 {
  stroke: var(--nl-accent);
  stroke-width: 1;
  stroke-dasharray: 2 8;
  opacity: 0.55;
  animation: lr-spin 1.5s linear infinite;
}
.lr-scan {
  stroke: var(--nl-accent);
  stroke-width: 2;
  stroke-linecap: round;
  transform-origin: 60px 60px;
  opacity: 0.8;
  animation: lr-spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  filter: drop-shadow(0 0 4px var(--nl-accent));
}
.lr-pip {
  fill: var(--nl-accent);
  transform-origin: 60px 60px;
}
.lr-pip--1 {
  animation: lr-spin 3.4s linear infinite;
}
.lr-pip--2 {
  fill: var(--nl-cobalt, #2e3884);
  animation: lr-spin 2.2s linear infinite reverse;
}
.loader__core {
  width: 56px;
  height: 56px;
  object-fit: contain;
  animation: lr-pulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255, 126, 0, 0.55));
}
.boot__text {
  color: var(--nl-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  margin: 26px 0 0;
  text-transform: uppercase;
}
.boot__dots i {
  opacity: 0.2;
  animation: lr-dot 1.2s infinite;
}
.boot__dots i:nth-child(2) {
  animation-delay: 0.2s;
}
.boot__dots i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes lr-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes lr-pulse {
  0%, 100% {
    transform: scale(0.92);
    filter: drop-shadow(0 0 6px rgba(255, 126, 0, 0.4));
  }
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 14px rgba(255, 126, 0, 0.7));
  }
}
@keyframes lr-dot {
  0%, 100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lr,
  .lr-scan,
  .lr-pip,
  .loader__core,
  .boot__dots i {
    animation: none;
  }
}

/* ── App layout ───────────────────────────────────────────────────────────── */
.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(var(--nl-header-h) + var(--nl-safe-top));
  padding: var(--nl-safe-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: color-mix(in srgb, var(--nl-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--nl-border);
}
.app-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-header__logo {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
}
.app-header__logo img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}
.app-header__title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.app-header__action {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.avatar {
  display: grid;
  place-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--nl-surface-2);
  color: var(--nl-text);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--nl-border);
}

/* ── View / page container ────────────────────────────────────────────────── */
.view {
  flex: 1;
  padding: 20px 16px calc(var(--nl-tabbar-h) + var(--nl-safe-bottom) + 24px);
  outline: none;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.page__eyebrow {
  color: var(--nl-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.page__title {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 800;
  margin: 0 0 8px;
}
.page__lede {
  color: var(--nl-muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 20px;
}

.card {
  background: var(--nl-surface);
  border: 1px solid var(--nl-border);
  border-radius: var(--nl-radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card__title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}
.card__body {
  color: var(--nl-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.stub-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nl-bg);
  background: var(--nl-accent);
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 4px;
}

/* ── Bottom tab bar ───────────────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(var(--nl-tabbar-h) + var(--nl-safe-bottom));
  padding-bottom: var(--nl-safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--nl-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--nl-border);
}
.tab {
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--nl-muted);
  font-family: inherit;
  padding: 8px 4px;
  transition: color 0.15s ease;
}
.tab__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
}
.tab__icon svg {
  width: 22px;
  height: 22px;
  display: block;
  transition: transform 0.12s ease;
}
.tab[aria-selected='true'] .tab__icon svg {
  transform: scale(1.08);
}
.tab__label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tab[aria-selected="true"] {
  color: var(--nl-accent);
}
.tab:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: -2px;
  border-radius: 8px;
}

/* ── Assessment (Page 1) ──────────────────────────────────────────────────── */
.auth-logo {
  width: min(64vw, 280px);
  height: auto;
  display: block;
  margin: 4px auto 22px;
}
.assess-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--nl-muted);
  font-size: 15px;
  padding: 24px 0;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--nl-surface-2);
  border-top-color: var(--nl-accent);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

/* Buttons */
.btn {
  appearance: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--nl-radius-sm);
  border: 1px solid transparent;
  padding: 11px 16px;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--nl-accent);
  color: var(--nl-on-accent);
}
.btn--primary:not(:disabled):hover {
  filter: brightness(1.07);
}
.btn--launch {
  background: var(--launch-accent, var(--nl-accent));
  color: var(--nl-on-accent);
}
.btn--launch:not(:disabled):hover {
  filter: brightness(1.07);
}
.btn--ghost {
  background: transparent;
  color: var(--nl-text);
  border-color: var(--nl-border);
}
.btn--ghost:not(:disabled):hover {
  background: var(--nl-surface-2);
}
.btn--block {
  display: block;
  width: 100%;
  margin-top: 4px;
}
.btn--sm {
  padding: 6px 10px;
  font-size: 12.5px;
}

/* Sign-in form fields */
.field {
  display: block;
  margin-bottom: 12px;
}
.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--nl-muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--nl-text);
  background: var(--nl-bg);
  border: 1px solid var(--nl-border);
  border-radius: var(--nl-radius-sm);
  padding: 11px 12px;
}
.field input:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: 0;
}
.form-note {
  color: var(--nl-accent);
  font-size: 13px;
  margin: 4px 0 10px;
}
.form-hint {
  color: var(--nl-muted);
  font-size: 12px;
  margin: 12px 0 0;
}

/* Tickets */
.ticket__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.ticket__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ticket__credits {
  font-size: 14px;
  color: var(--nl-muted);
  font-weight: 600;
}
.pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--nl-surface-2);
  color: var(--nl-muted);
  white-space: nowrap;
}
.pill--amber {
  background: rgba(255, 126, 0, 0.16);
  color: var(--nl-accent);
}

/* Banners */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--nl-radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 12px;
}
.banner--error {
  background: rgba(220, 60, 60, 0.14);
  color: #ffb4b4;
  border: 1px solid rgba(220, 60, 60, 0.35);
}
.banner--warn {
  background: rgba(255, 126, 0, 0.12);
  color: var(--nl-accent);
  border: 1px solid rgba(255, 126, 0, 0.3);
}

/* Runner */
.runner__top {
  margin-bottom: 14px;
}
.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--nl-surface-2);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--nl-accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.runner__count {
  font-size: 12.5px;
  color: var(--nl-muted);
  margin: 8px 0 0;
}
.runner__qcard {
  background: var(--nl-surface);
  border: 1px solid var(--nl-border);
  border-radius: var(--nl-radius);
  padding: 18px;
}
.runner__element {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nl-accent);
  margin: 0 0 8px;
}
.runner__prompt {
  font-size: 19px;
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 6px;
}
.runner__hint {
  font-size: 12.5px;
  color: var(--nl-muted);
  margin: 0 0 16px;
}
.opts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.opt {
  appearance: none;
  text-align: left;
  font-family: inherit;
  font-size: 15px;
  color: var(--nl-text);
  background: var(--nl-bg);
  border: 1px solid var(--nl-border);
  border-radius: var(--nl-radius-sm);
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.opt:hover {
  border-color: var(--nl-muted);
}
.opt--on {
  border-color: var(--nl-accent);
  background: rgba(255, 126, 0, 0.1);
  box-shadow: 0 0 0 1px var(--nl-accent) inset;
}
.opt:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: 1px;
}
.runner__nav {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}
.runner__nav .btn {
  flex: 1;
}

/* ── My Profile (Page 2) ──────────────────────────────────────────────────── */
.profile-head {
  margin-bottom: 8px;
}
.profile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--nl-muted);
  font-size: 12.5px;
  margin: 2px 0 0;
}

.matrix {
  background: var(--nl-surface);
  border: 1px solid var(--nl-border);
  border-radius: var(--nl-radius);
  padding: 16px 14px;
  margin-top: 16px;
}
.matrix__head {
  margin-bottom: 10px;
}
.matrix__title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}
.matrix__sub {
  font-size: 12.5px;
  color: var(--nl-muted);
  margin: 3px 0 0;
}

/* Static Matrix (interactive SVG bars) */
.sm-svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
}
.sm-row {
  cursor: pointer;
}
.sm-selbg {
  fill: var(--nl-bg);
  stroke: var(--nl-accent);
  stroke-width: 1.5;
}
.sm-label {
  fill: var(--nl-text);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--nl-font);
}
.sm-score {
  fill: var(--nl-muted);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--nl-font);
}
.sm-row.is-sel .sm-score {
  fill: var(--nl-accent);
}
.sm-track {
  fill: var(--nl-surface-2);
}
.sm-fill {
  fill: var(--nl-accent);
}
.sm-row:hover .sm-track {
  fill: color-mix(in srgb, var(--nl-surface-2) 70%, var(--nl-muted));
}
.sm-row:focus-visible {
  outline: none;
}
.sm-row:focus-visible .sm-label {
  text-decoration: underline;
}
.sm-row:focus-visible rect[pointer-events] {
  outline: 2px solid var(--nl-accent);
}

.sm-detail {
  margin-top: 12px;
  background: var(--nl-bg);
  border: 1px solid var(--nl-border);
  border-radius: var(--nl-radius-sm);
  padding: 13px 14px;
}
.sm-detail__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.sm-detail__title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}
.sm-detail__score {
  font-size: 20px;
  font-weight: 800;
  color: var(--nl-accent);
}
.sm-detail__max {
  font-size: 12px;
  color: var(--nl-muted);
  font-weight: 600;
}
.sm-detail__body {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--nl-text);
  margin: 8px 0 0;
}
.ml-tag {
  font-size: 11px;
  color: var(--nl-muted);
  font-style: italic;
  margin: 8px 0 0;
}

/* Dynamic Matrix (radar) */
.rd-wrap {
  max-width: 320px;
  margin: 0 auto;
}
.rd-svg {
  display: block;
  width: 100%;
  height: auto;
}
.rd-grid {
  fill: none;
  stroke: var(--nl-border);
  stroke-width: 1;
}
.rd-spoke {
  stroke: var(--nl-border);
  stroke-width: 1;
}
.rd-num {
  fill: var(--nl-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--nl-font);
}
.rd-area {
  fill: color-mix(in srgb, var(--nl-accent) 26%, transparent);
  stroke: var(--nl-accent);
  stroke-width: 2;
  stroke-linejoin: round;
}
.rd-dot {
  fill: var(--nl-accent);
  stroke: var(--nl-bg);
  stroke-width: 1.5;
}
.rd-legend {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.rd-legend__item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}
.rd-legend__n {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--nl-surface-2);
  color: var(--nl-accent);
  font-size: 11px;
  font-weight: 800;
}
.rd-legend__label {
  flex: 1;
  color: var(--nl-text);
}
.rd-legend__score {
  font-weight: 800;
  color: var(--nl-text);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 28px 18px;
}
.empty__mark {
  font-size: 34px;
  color: var(--nl-accent);
  line-height: 1;
}
.empty__title {
  font-size: 18px;
  font-weight: 800;
  margin: 10px 0 6px;
}
.empty .btn {
  margin-top: 16px;
}

.btn--pdf {
  margin-top: 18px;
}

/* ── Consult (Page 3) ─────────────────────────────────────────────────────── */
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--nl-surface-2);
  border: 1px solid var(--nl-border);
  border-radius: 999px;
  padding: 4px;
  margin: 12px 0 14px;
}
.seg__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--nl-muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg__btn.is-on {
  background: var(--nl-accent);
  color: var(--nl-on-accent);
}

.coach-note {
  font-size: 12px;
  color: var(--nl-muted);
  font-style: italic;
  margin: 0 0 12px;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.bubble {
  max-width: 85%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.45;
  white-space: normal;
  word-wrap: break-word;
}
.bubble--user {
  align-self: flex-end;
  background: var(--nl-accent);
  color: var(--nl-on-accent);
  border-bottom-right-radius: 5px;
  font-weight: 600;
}
.bubble--coach {
  align-self: flex-start;
  background: var(--nl-surface);
  border: 1px solid var(--nl-border);
  color: var(--nl-text);
  border-bottom-left-radius: 5px;
}
.bubble--typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.bubble--typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nl-muted);
  animation: typing 1s infinite ease-in-out;
}
.bubble--typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.bubble--typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .bubble--typing span { animation: none; }
}

.coach-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.coach-input {
  flex: 1;
  resize: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--nl-text);
  background: var(--nl-bg);
  border: 1px solid var(--nl-border);
  border-radius: 14px;
  padding: 11px 13px;
  max-height: 120px;
  min-height: 44px;
}
.coach-input:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: 0;
}
.coach-input-row .btn {
  flex: none;
  height: 44px;
}

.booking__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

/* ── Brain Fitness (Page 4) ───────────────────────────────────────────────── */
.gam {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.gam__stat {
  background: var(--nl-surface);
  border: 1px solid var(--nl-border);
  border-radius: var(--nl-radius);
  padding: 14px;
  text-align: center;
}
.gam__num {
  display: block;
  font-size: 30px;
  font-weight: 800;
  color: var(--nl-accent);
  line-height: 1;
}
.gam__label {
  display: block;
  font-size: 12px;
  color: var(--nl-muted);
  margin-top: 4px;
}
.gam__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.card__titlerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ci-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
}
.ci-row__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--nl-text);
  flex: none;
  width: 64px;
}
.lvls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  flex: 1;
}
.lvl {
  appearance: none;
  border: 1px solid var(--nl-border);
  background: var(--nl-bg);
  color: var(--nl-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.lvl.is-on {
  background: var(--nl-accent);
  color: var(--nl-on-accent);
  border-color: var(--nl-accent);
}
.lvl:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: 1px;
}

.spark-wrap {
  margin-top: 16px;
}
.spark {
  display: block;
  width: 100%;
  height: auto;
}
.spark-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spark-mood {
  stroke: var(--nl-accent);
}
.spark-focus {
  stroke: var(--nl-grey-goose);
  stroke-dasharray: 4 4;
  opacity: 0.85;
}
.spark-mood-dot {
  fill: var(--nl-accent);
}
.spark-empty {
  font-size: 13px;
  color: var(--nl-muted);
  text-align: center;
  margin: 8px 0;
}
.spark-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  color: var(--nl-muted);
  margin-top: 6px;
}
.spark-legend .sw {
  display: inline-block;
  width: 12px;
  height: 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}
.sw--mood {
  background: var(--nl-accent);
}
.sw--focus {
  background: var(--nl-grey-goose);
}
.spark-legend__scale {
  margin-left: auto;
}

.pdp-sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--nl-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 16px 0 8px;
}
.goals {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.goals li {
  position: relative;
  padding-left: 18px;
  font-size: 14.5px;
  color: var(--nl-text);
}
.goals li::before {
  content: '◆';
  position: absolute;
  left: 0;
  color: var(--nl-accent);
  font-size: 10px;
  top: 3px;
}
.actions {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action {
  display: flex;
  align-items: center;
  gap: 10px;
}
.action__label {
  flex: 1;
  font-size: 14.5px;
  color: var(--nl-text);
}
.action.is-done .action__label {
  color: var(--nl-muted);
  text-decoration: line-through;
}
.action__due {
  font-size: 12px;
  color: var(--nl-muted);
  flex: none;
}
.check {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1.5px solid var(--nl-border);
  background: var(--nl-bg);
  color: var(--nl-on-accent);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.action.is-done .check {
  background: var(--nl-accent);
  border-color: var(--nl-accent);
}
.check:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: 1px;
}
.action-add {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}
.action-add input[type='text'] {
  font-family: inherit;
  font-size: 14.5px;
  color: var(--nl-text);
  background: var(--nl-bg);
  border: 1px solid var(--nl-border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.action-add input[type='date'] {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--nl-muted);
  background: var(--nl-bg);
  border: 1px solid var(--nl-border);
  border-radius: 10px;
  padding: 9px 8px;
}
.action-add input:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: 0;
}

/* ── Settings (Page 5) ────────────────────────────────────────────────────── */
.acct {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}
.acct__avatar {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--nl-accent);
  background-size: cover;
  background-position: center;
  color: var(--nl-on-accent);
  font-weight: 800;
  font-size: 17px;
}
.acct--edit {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.weblink {
  margin-top: 12px;
  text-decoration: none;
  text-align: center;
}
.avatar--img {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.acct__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.acct__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--nl-text);
}
.acct__email,
.acct__phone {
  font-size: 13px;
  color: var(--nl-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 0 4px;
}
.consent-row__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.consent-row__label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--nl-text);
}
.consent-row__hint {
  font-size: 12.5px;
  color: var(--nl-muted);
  line-height: 1.45;
}

.switch {
  flex: none;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--nl-border);
  background: var(--nl-surface-2);
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
  margin-top: 2px;
}
.switch__dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--nl-porcelain);
  transition: transform 0.18s ease;
}
.switch.is-on {
  background: var(--nl-accent);
  border-color: var(--nl-accent);
}
.switch.is-on .switch__dot {
  transform: translateX(20px);
  background: var(--nl-on-accent);
}
.switch:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: 2px;
}
.switch:disabled {
  opacity: 0.6;
  cursor: progress;
}

.org {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--nl-text);
}
.org-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 1px var(--nl-border) inset;
}

.btn--danger {
  margin-top: 6px;
  color: #ffb4b4;
  border-color: rgba(220, 60, 60, 0.4);
}
.btn--danger:hover {
  background: rgba(220, 60, 60, 0.12);
}

/* ── Auth + onboarding screen ─────────────────────────────────────────────── */
.auth {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  background: transparent; /* let the ambient motion show behind the auth screen */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--nl-safe-top) + 36px) 16px calc(var(--nl-safe-bottom) + 36px);
  z-index: 40;
}
.auth__inner {
  width: 100%;
  max-width: 420px;
}
.auth__logo {
  width: min(60vw, 240px);
  height: auto;
  display: block;
  margin: 0 auto 26px;
}
.auth__title {
  font-size: 25px;
  font-weight: 800;
  margin: 0 0 6px;
  text-align: center;
}
.auth__lede {
  color: var(--nl-muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 18px;
  text-align: center;
}
.auth__alt {
  font-size: 13.5px;
  color: var(--nl-muted);
  text-align: center;
  margin: 14px 0 0;
}
.linkbtn {
  background: none;
  border: 0;
  color: var(--nl-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.linkbtn:focus-visible {
  outline: 2px solid var(--nl-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.ob-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 18px;
}
.ob-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--nl-surface-2);
  transition: width 0.2s ease, background 0.2s ease;
}
.ob-dot.is-on {
  width: 20px;
  background: var(--nl-accent);
}
.ob-body {
  text-align: left;
}
.ob-list {
  list-style: none;
  padding: 0;
  margin: 2px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ob-list li {
  position: relative;
  padding-left: 18px;
  color: var(--nl-text);
  font-size: 14.5px;
  line-height: 1.4;
}
.ob-list li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 4px;
  font-size: 9px;
  color: var(--nl-accent);
}
.ob-consent {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0 2px;
}
.ob-choice {
  text-align: left;
  background: var(--nl-surface);
  border: 1px solid var(--nl-border);
  border-radius: var(--nl-radius-sm);
  padding: 13px 14px;
  cursor: pointer;
  color: var(--nl-text);
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ob-choice b {
  font-size: 14.5px;
}
.ob-choice span {
  font-size: 12.5px;
  color: var(--nl-muted);
}
.ob-choice.is-on {
  border-color: var(--nl-accent);
  box-shadow: 0 0 0 1px var(--nl-accent) inset;
}
.ob-nav {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}
.ob-nav .btn,
.ob-nav > span {
  flex: 1;
}

/* ── Brain exercises (Fitness › Train) ────────────────────────────────────── */
.ex-card {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ex-card__main {
  flex: 1;
  min-width: 0;
}
.ex-card__best {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--nl-accent);
}
.ex-card .btn {
  flex: none;
}

.game {
  text-align: center;
}
.game__status {
  font-size: 15px;
  font-weight: 700;
  color: var(--nl-text);
  margin: 0 0 12px;
}
.game__hint {
  font-size: 12.5px;
  color: var(--nl-muted);
  margin: 12px 0 0;
}
.game-host {
  padding: 18px 16px;
}

/* Reaction */
.g-react {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 180px;
  border-radius: var(--nl-radius);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: background 0.05s linear;
}
.g-react--idle {
  background: var(--nl-surface-2);
  color: var(--nl-text);
}
.g-react--wait {
  background: #b23b3b;
}
.g-react--go {
  background: #1f9d55;
}
.g-react--early {
  background: #8a5a00;
}

/* Memory (Simon) */
.g-mem {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 260px;
  margin: 0 auto;
}
.g-mem__tile {
  appearance: none;
  border: 0;
  aspect-ratio: 1;
  border-radius: 14px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
}
.g-mem__tile--0 { background: #2e3884; }
.g-mem__tile--1 { background: #ff7e00; }
.g-mem__tile--2 { background: #1f9d55; }
.g-mem__tile--3 { background: #b23b8a; }
.g-mem__tile.is-lit {
  opacity: 1;
  transform: scale(1.04);
  box-shadow: 0 0 18px currentColor;
}

/* Focus grid (Schulte) */
.g-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
}
.g-cell {
  appearance: none;
  aspect-ratio: 1;
  border: 1px solid var(--nl-border);
  background: var(--nl-bg);
  color: var(--nl-text);
  font-size: 22px;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
}
.g-cell.is-done {
  opacity: 0.3;
  background: var(--nl-surface-2);
}
.g-cell.is-wrong {
  border-color: #b23b3b;
  background: rgba(178, 59, 59, 0.18);
}

/* Result */
.ex-result {
  text-align: center;
}
.ex-result__label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nl-accent);
  margin: 0;
}
.ex-result__score {
  font-size: 40px;
  font-weight: 800;
  color: var(--nl-text);
  margin: 6px 0 4px;
}
.ex-result__pts {
  color: var(--nl-accent);
  font-weight: 700;
}

/* ── Install banner (proactive add-to-home-screen prompt) ─────────────────── */
.ibanner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nl-tabbar-h) + var(--nl-safe-bottom) + 12px);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 616px;
  margin: 0 auto;
  background: var(--nl-surface);
  border: 1px solid var(--nl-border);
  border-radius: 14px;
  padding: 11px 12px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
  animation: ibanner-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ibanner__icon img {
  width: 34px;
  height: 34px;
  display: block;
}
.ibanner__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ibanner__text strong {
  font-size: 14px;
}
.ibanner__text span {
  font-size: 12px;
  color: var(--nl-muted);
}
.ibanner__actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ibanner__close {
  background: none;
  border: 0;
  color: var(--nl-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}
@keyframes ibanner-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ibanner {
    animation: none;
  }
}

/* ── Motion (entrance + interaction) ──────────────────────────────────────── */
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
/* Page transition on navigation (re-triggered by the router, not in-page renders). */
.view--enter {
  animation: view-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Auth + onboarding + game panels get a gentle entrance too. */
.auth__inner,
.game {
  animation: pop-in 0.3s ease both;
}
/* Tactile press feedback. */
.btn:active:not(:disabled),
.seg__btn:active,
.lvl:active,
.opt:active,
.ob-choice:active,
.tab:active {
  transform: scale(0.97);
}
.tab:active .tab__icon {
  transform: scale(0.88);
}
@media (prefers-reduced-motion: reduce) {
  .view--enter,
  .auth__inner,
  .game {
    animation: none;
  }
  .btn:active:not(:disabled),
  .seg__btn:active,
  .lvl:active,
  .opt:active,
  .ob-choice:active,
  .tab:active,
  .tab:active .tab__icon {
    transform: none;
  }
}
