/* ═══════════════════════════════════════
   LAYOUT v4 — mobile-native shell
═══════════════════════════════════════ */

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  background: var(--ob-bg);
  color: var(--ob-text);
}

/* ─────────────────────────────────────
   HEADER — fixed top chrome
───────────────────────────────────── */
#game-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  background: var(--ob-bg);
  display: none;
}

#game-header.active {
  display: block;
}

#xp-strip {
  height: 3px;
  background: var(--ob-divider);
  position: relative;
}

#xp-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: var(--ob-accent);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#gh-controls {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 8px;
}

#header-back {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ob-text-2);
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

#header-back:active { background: var(--ob-surface); }

#header-back.invisible {
  visibility: hidden;
  pointer-events: none;
}

#question-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ob-subtle);
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────
   ONBOARDING STAGE
───────────────────────────────────── */
#onboarding-stage {
  position: fixed;
  inset: 0;
  top: calc(var(--header-h) + 3px);
  background: var(--ob-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

#card-wrap {
  width: 100%;
  height: 100%;
  max-width: var(--card-maxw);
  position: relative;
  overflow: hidden;
}

/* ─────────────────────────────────────
   RESULTS STAGE — dark
───────────────────────────────────── */
#results-stage {
  display: none;
  background: var(--color-bg);
  min-height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

#results-stage.visible {
  display: block;
}

/* Sections */
#hero, #safety-bar, #core-metrics, #loan-cost-reality,
#biggest-impact, #what-if-lab, #risk-reality, #next-steps {
  border-radius: 14px;
  margin-bottom: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

/* Stagger on reveal */
@keyframes rsUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

#results-stage.visible #hero            { animation: rsUp 0.4s 0.05s both; }
#results-stage.visible #safety-bar      { animation: rsUp 0.4s 0.12s both; }
#results-stage.visible #core-metrics    { animation: rsUp 0.4s 0.19s both; }
#results-stage.visible #loan-cost-reality { animation: rsUp 0.4s 0.26s both; }
#results-stage.visible #biggest-impact  { animation: rsUp 0.4s 0.30s both; }
#results-stage.visible #what-if-lab     { animation: rsUp 0.4s 0.34s both; }
#results-stage.visible #risk-reality    { animation: rsUp 0.4s 0.38s both; }
#results-stage.visible #next-steps      { animation: rsUp 0.4s 0.42s both; }

@media (prefers-reduced-motion: reduce) {
  #results-stage.visible > * { animation: none !important; opacity: 1 !important; }
}

/* ─────────────────────────────────────
   HIDDEN FIELDS
───────────────────────────────────── */
#hidden-fields {
  display: none !important;
  visibility: hidden;
  position: absolute;
  pointer-events: none;
}

/* ─────────────────────────────────────
   SCROLLBAR
───────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ob-border); border-radius: 2px; }

@media (max-width: 480px) {
  :root { --card-px: 24px; }
}
