* { margin: 0; padding: 0; box-sizing: border-box; }

/* Form elements don't inherit fonts by default */
button, input, select, textarea { font-family: inherit; }

/* ── Keyboard focus ring ─────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Inputs have their own border-based focus indicator */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* ── Financial figures: always mono, tabular ─────────────── */
.stat-value,
.account-balance,
.acct-row-balance,
.hd-price-value,
.hd-total-value,
.txn-amount,
.txn-detail-amount {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.3;
}
body.light-mode::before { opacity: 0.22; }

/* ── Screen-reader only utility ──────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Loading screen: rocket to the moon ──────────────────── */
/* Line-art in the ink colors, terracotta for the flame and the flown course.
   Motion is driven by launch.js; these rules only style the parts and the
   landing/fade states it toggles (.launch-landed, .launch-done). */
#loadingScreen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 9999;
  transition: opacity 0.4s ease;   /* = FADE_MS in launch.js */
}
#loadingScreen.launch-done { opacity: 0; pointer-events: none; }

.launch-scene {
  width: min(250px, 66vw);
  height: auto;
  overflow: visible;
}

.launch-wordmark {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  color: var(--accent-text);   /* AA-safe accent in both themes */
  letter-spacing: 0.02em;
}

.launch-stars circle { fill: var(--muted); animation: launch-twinkle 2.4s ease-in-out infinite; }
.launch-stars circle:nth-child(2n) { animation-delay: -0.8s; }
.launch-stars circle:nth-child(3n) { animation-delay: -1.6s; }
@keyframes launch-twinkle { 50% { opacity: 0.25; } }

.launch-moon-body { fill: var(--surface); stroke: var(--text-dim); stroke-width: 1.25; }
.launch-crater    { fill: none; stroke: var(--muted); stroke-width: 1; opacity: 0.7; }
.launch-moon-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.launch-landed .launch-moon-pulse { animation: launch-pulse 0.6s ease-out forwards; }
@keyframes launch-pulse {
  from { opacity: 0.8; transform: scale(1); }
  to   { opacity: 0;   transform: scale(1.5); }
}

.launch-course {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.25;
  stroke-dasharray: 2 5;
  stroke-linecap: round;
}
.launch-trail {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.75;
}

.launch-body, .launch-fin {
  fill: var(--surface);
  stroke: var(--text-bright);
  stroke-width: 0.7;   /* ×2.1 rocket scale ≈ 1.5px */
  stroke-linejoin: round;
}
.launch-window { fill: var(--accent); stroke: var(--text-bright); stroke-width: 0.55; }
.launch-flame {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: right center;
  animation: launch-flicker 0.12s ease-in-out infinite alternate;
  transition: opacity 0.2s ease;
}
@keyframes launch-flicker {
  from { transform: scaleX(0.75); }
  to   { transform: scaleX(1.15); }
}
.launch-landed .launch-flame { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .launch-stars circle, .launch-flame { animation: none; }
  .launch-landed .launch-moon-pulse { animation: none; }
  #loadingScreen { transition-duration: 0.15s; }
}
