/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  --cream:        #F7F3EC;
  --cream-dark:   #EDE7DA;
  --cream-mid:    #E2D9CC;
  --ink:          #2A2420;
  --ink-soft:     #5A4E47;
  --ink-muted:    #8C7D75;
  --terra:        #B5673A;
  --terra-light:  #D4896A;
  --terra-pale:   #F0DDD3;
  --sage:         #7A8C76;
  --sage-pale:    #E8EDE7;
  --gold:         #C9A84C;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Nunito', 'Segoe UI', sans-serif;

  --max-width: 540px;
  --pad-x: 28px;
  --radius: 14px;
}

@media (max-width: 400px) {
  :root {
    --pad-x: 20px;
  }
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

/* ============================================
   SCREENS
   ============================================ */
.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: relative;
  background: var(--ink);
  padding: 48px var(--pad-x) 36px;
  overflow: visible;
}

.header--compact {
  padding: 28px var(--pad-x) 20px;
}

.header-orb {
  position: absolute;
  top: -60px;
  right: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--terra) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
}

/* ============================================
   HAMBURGER MENU
   ============================================ */
.burger-btn {
  position: absolute;
  top: 16px;
  right: var(--pad-x);
  z-index: 20;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  -webkit-tap-highlight-color: transparent;
}

.burger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 2px;
  transition: background 0.2s;
}

.burger-btn:hover .burger-line {
  background: #fff;
}

.burger-menu {
  position: absolute;
  top: 52px;
  right: var(--pad-x);
  z-index: 30;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  padding: 6px 0;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.burger-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.burger-menu-item {
  display: block;
  width: 100%;
  padding: 12px 18px;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.burger-menu-item:hover:not(:disabled) {
  background: var(--cream-dark);
}

.burger-menu-item:disabled {
  color: var(--ink-muted);
  opacity: 0.5;
  cursor: default;
}

.burger-menu-item--danger {
  color: #b53a3a;
}

.burger-menu-item--danger:disabled {
  color: #b53a3a;
}

.burger-menu-empty {
  padding: 12px 18px;
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
}

.burger-menu-divider {
  height: 1px;
  background: var(--cream-mid);
  margin: 4px 0;
}

.saves-list {
  max-height: 240px;
  overflow-y: auto;
}

.save-row {
  display: flex;
  align-items: center;
}

.save-row-load {
  flex: 1;
  min-width: 0;
}

.save-row-delete {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--ink-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  margin-right: 6px;
}

.save-row-delete:hover {
  background: rgba(181, 58, 58, 0.1);
  color: #b53a3a;
}

/* Save button on question screen */
.save-btn {
  position: absolute;
  top: 14px;
  right: var(--pad-x);
  z-index: 20;
  width: 38px;
  height: 38px;
  background: none;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.save-btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.save-toast {
  position: absolute;
  top: 18px;
  right: calc(var(--pad-x) + 46px);
  z-index: 20;
  background: var(--sage);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
}

.save-toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--terra-light);
  margin-bottom: 10px;
  position: relative;
}

.header-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.15;
  color: #fff;
  position: relative;
}

.header-title--small {
  font-size: 18px;
}

.header-subtitle {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 6px;
  position: relative;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--cream-mid);
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--terra), var(--gold));
  transition: width 0.35s ease;
}

/* ============================================
   CONTENT
   ============================================ */
.content {
  flex: 1;
  padding: 28px var(--pad-x) 36px;
}

.content--question {
  display: flex;
  flex-direction: column;
}

/* ============================================
   INTRO SCREEN
   ============================================ */
.intro-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

.scale-card {
  background: var(--cream-dark);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 28px;
}

.scale-card-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.scale-list {
  list-style: none;
}

.scale-list li {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  padding: 4px 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.scale-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--terra);
  min-width: 18px;
  text-align: center;
}

/* ============================================
   QUESTION SCREEN
   ============================================ */
.question-text {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.45;
  color: var(--ink);
  margin-bottom: 32px;
}

.rating-section {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-bottom: 32px;
  flex: 1;
}

.rating-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rating-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-muted);
}

.rating-row {
  display: flex;
  gap: 6px;
}

.rating-btn {
  flex: 1;
  height: 48px;
  border-radius: 8px;
  border: 2px solid var(--cream-mid);
  background: #fff;
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.rating-btn:hover {
  border-color: var(--terra-light);
  color: var(--terra);
}

.rating-btn:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

.rating-btn.selected-child {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.rating-btn.selected-now {
  background: var(--terra);
  border-color: var(--terra);
  color: #fff;
}

.rating-btn.selected-both {
  background: linear-gradient(135deg, var(--ink) 50%, var(--terra) 50%);
  border-color: var(--terra);
  color: #fff;
}

/* ============================================
   NAV BUTTONS
   ============================================ */
.nav-buttons {
  display: flex;
  gap: 12px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.btn {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: opacity 0.2s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--ink);
  color: var(--cream);
  width: 100%;
  padding: 18px;
  border-radius: var(--radius);
  font-size: 16px;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.btn-next {
  flex: 1;
}

.btn-back {
  background: transparent;
  border: 2px solid var(--cream-mid);
  color: var(--ink-soft);
  padding: 16px 20px;
  border-radius: var(--radius);
  white-space: nowrap;
}

.btn-back:hover {
  border-color: var(--ink-muted);
}

/* ============================================
   RESULTS SCREEN
   ============================================ */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Trap card */
.trap-card {
  background: #fff;
  border: 2px solid var(--cream-mid);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
}

.trap-card--medium {
  border-color: var(--gold);
}

.trap-card--active {
  background: var(--terra-pale);
  border-color: var(--terra);
}

.trap-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.trap-card-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--ink);
  flex: 1;
  padding-right: 12px;
}

.trap-card--active .trap-card-name {
  color: var(--terra);
}

.trap-card-score {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  color: var(--ink-muted);
  line-height: 1;
}

.trap-card--active .trap-card-score {
  color: var(--terra);
}

/* Score grid */
.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.score-cell {
  background: var(--cream-dark);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trap-card--active .score-cell {
  background: rgba(255, 255, 255, 0.6);
}

.score-cell-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-cell-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink-soft);
}

.trap-card--active .score-cell-value {
  color: var(--terra);
}

/* Description */
.trap-card-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  padding-top: 14px;
  border-top: 1px solid var(--cream-mid);
}

.trap-card--active .trap-card-desc {
  border-top-color: var(--terra-light);
  color: var(--ink);
}

.trap-card-detail {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin-top: 12px;
}

.trap-card--active .trap-card-detail {
  color: var(--ink);
}

/* ============================================
   DISCLAIMER
   ============================================ */
.disclaimer {
  background: var(--sage-pale);
  border-left: 3px solid var(--sage);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 24px;
}

.disclaimer p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.disclaimer em {
  font-style: italic;
}

/* ============================================
   PHASE INTERSTITIAL SCREENS
   ============================================ */
.phase-intro {
  margin-bottom: 32px;
}

.phase-intro-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.phase-intro-text:last-child {
  margin-bottom: 0;
}

.phase-intro-text--quiet {
  font-style: italic;
  color: var(--ink-muted);
}

/* ============================================
   FLOW STEPPER (Intro)
   ============================================ */
.flow-stepper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  background: var(--cream-dark);
  border-radius: var(--radius);
  padding: 22px 12px;
  margin-bottom: 24px;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.flow-step-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-step-icon--result {
  background: var(--terra);
  color: #fff;
}

.flow-step-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.flow-step-sub {
  font-size: 11px;
  color: var(--ink-muted);
  text-align: center;
}

.flow-arrow {
  font-size: 22px;
  color: var(--ink-muted);
  padding-top: 7px;
  flex-shrink: 0;
  margin: 0 2px;
}

/* ============================================
   RESTART BUTTON
   ============================================ */
.btn-restart {
  background: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 15px;
  margin-bottom: 20px;
}

.btn-restart:hover {
  background: var(--ink);
  color: var(--cream);
}

