/* ─── KALEO: WHO AM I? ──────────────────────────────────────────────────────
   styles.css — Complete design system
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  --teal:       #C4941A;
  --teal-dark:  #8B6914;
  --teal-light: #FAE8B0;
  --teal-mid:   #F0C860;
  --text-1:     #1a1a1a;
  --text-2:     #5a5a5a;
  --text-3:     #9a9a9a;
  --bg-0:       #ffffff;
  --bg-1:       #f5f5f3;
  --bg-2:       #eeede9;
  --border:     rgba(0,0,0,0.10);
  --border-md:  rgba(0,0,0,0.18);
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --font:       -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 2px 8px rgba(0,0,0,0.10);
  --max-w:      430px;
  --nav-h:      60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-1:  #f0f0ee;
    --text-2:  #a8a8a6;
    --text-3:  #686866;
    --bg-0:    #1a1a18;
    --bg-1:    #242422;
    --bg-2:    #2e2e2c;
    --border:  rgba(255,255,255,0.10);
    --border-md: rgba(255,255,255,0.18);
  }
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-1);
  color: var(--text-1);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: var(--max-w);
  background: var(--bg-0);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  padding: 1.25rem 1.25rem calc(var(--nav-h) + 1.25rem);
  animation: fadeUp 0.2s ease-out;
}
.screen.active { display: flex; }
.screen.no-nav { padding-bottom: 1.5rem; }

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

/* ── Bottom nav ──────────────────────────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: var(--max-w);
  height: var(--nav-h);
  background: var(--bg-0);
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 0;
  color: var(--text-3);
  font-size: 10px;
  transition: color 0.15s;
}
.nav-item svg { stroke: currentColor; }
.nav-item.active { color: var(--teal); }

/* ── Typography ──────────────────────────────────────────────────────────── */
.t-overline { font-size: 10px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.t-title    { font-size: 22px; font-weight: 600; color: var(--text-1); line-height: 1.25; }
.t-heading  { font-size: 17px; font-weight: 600; color: var(--text-1); }
.t-body     { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.t-caption  { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.t-label    { font-size: 11px; font-weight: 600; letter-spacing: .5px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: none; border-radius: var(--radius-md);
  padding: 14px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: opacity .15s, transform .1s;
  font-family: var(--font);
}
.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary   { background: var(--teal); color: #fff; }
.btn-secondary { background: var(--bg-1); color: var(--text-1); border: 0.5px solid var(--border-md); }
.btn-ghost     { background: transparent; color: var(--text-2); border: 0.5px solid var(--border-md); }
.btn-danger    { background: transparent; color: #D85A30; border: 0.5px solid #D85A30; }
.btn-sm        { padding: 10px 16px; font-size: 13px; border-radius: var(--radius-sm); }
.btn + .btn    { margin-top: 8px; }
.btn:disabled  { opacity: .4; cursor: not-allowed; transform: none; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-0);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  margin-bottom: 10px;
}
.card-surface {
  background: var(--bg-1);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  margin-bottom: 10px;
}
.card-hero {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 14px;
  color: #fff;
}
.card-hero .t-overline { color: rgba(255,255,255,.55); }
.card-hero .t-title    { color: #fff; }

/* ── Pills / badges ──────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; border-radius: 20px;
  padding: 3px 10px; letter-spacing: .2px;
}
.pill-teal   { background: var(--teal-light); color: var(--teal-dark); }
.pill-purple { background: #EEEDFE; color: #3C3489; }
.pill-amber  { background: #FAEEDA; color: #633806; }
.pill-coral  { background: #FAECE7; color: #712B13; }
.pill-blue   { background: #E6F1FB; color: #0C447C; }
.pill-gray   { background: var(--bg-1); color: var(--text-2); border: 0.5px solid var(--border); }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--bg-1);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text-1);
  font-family: var(--font);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  margin-bottom: 10px;
  -webkit-appearance: none;
}
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-light); }
.input::placeholder { color: var(--text-3); }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-track { height: 3px; background: var(--bg-2); border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.progress-fill  { height: 3px; background: var(--teal); border-radius: 3px; transition: width .4s ease; }

/* ── Trait bars ──────────────────────────────────────────────────────────── */
.trait-row { margin-bottom: 12px; }
.trait-meta { display: flex; justify-content: space-between; margin-bottom: 4px; }
.trait-name { font-size: 13px; font-weight: 500; color: var(--text-1); }
.trait-pct  { font-size: 12px; color: var(--text-3); }
.trait-track { height: 7px; background: var(--bg-2); border-radius: 7px; overflow: hidden; }
.trait-fill  { height: 7px; border-radius: 7px; transition: width .6s ease; }

/* ── Likert options ──────────────────────────────────────────────────────── */
.likert-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; margin-bottom: 7px;
  transition: border-color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.likert-opt:hover { border-color: var(--teal); }
.likert-opt.selected { border-color: var(--teal); background: var(--teal-light); }
.likert-opt.calling-selected { border-color: #7F77DD; background: #EEEDFE; }
.radio-circle {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--border-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s;
}
.likert-opt.selected .radio-circle       { background: var(--teal); border-color: var(--teal); }
.likert-opt.calling-selected .radio-circle { background: #7F77DD; border-color: #7F77DD; }
.radio-circle::after {
  content: ''; display: none;
  width: 7px; height: 7px; border-radius: 50%; background: #fff;
}
.likert-opt.selected .radio-circle::after,
.likert-opt.calling-selected .radio-circle::after { display: block; }
.likert-label { font-size: 14px; color: var(--text-1); }

/* ── Section dividers ────────────────────────────────────────────────────── */
.section-gap   { height: 20px; }
.divider       { height: 0.5px; background: var(--border); margin: 14px 0; }
.section-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; margin-top: 4px; }

/* ── Figure cards ────────────────────────────────────────────────────────── */
.figure-card {
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  margin-bottom: 7px;
}
.figure-header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.figure-name   { font-size: 14px; font-weight: 600; color: var(--text-1); }
.figure-theme  { font-size: 12px; color: var(--text-2); margin-bottom: 3px; }
.figure-verse  { font-size: 11px; color: var(--teal-dark); font-style: italic; }

/* ── Row items ───────────────────────────────────────────────────────────── */
.row-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 0.5px solid var(--border);
}
.row-item:last-child { border-bottom: none; }
.row-label { font-size: 13px; color: var(--text-2); }
.row-value { font-size: 13px; font-weight: 500; color: var(--text-1); }

/* ── Mode selector chips ─────────────────────────────────────────────────── */
.mode-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; white-space: nowrap; flex-wrap: nowrap; }
.mode-chips::-webkit-scrollbar { display: none; }
.mode-chip {
  flex-shrink: 0; font-size: 12px; padding: 5px 12px;
  border-radius: 20px; border: 0.5px solid var(--border);
  background: var(--bg-0); color: var(--text-2);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
  font-family: var(--font);
}
.mode-chip.active { background: var(--teal-dark); color: var(--teal-mid); border-color: var(--teal-dark); }

/* ── Insight card ────────────────────────────────────────────────────────── */
.insight-card { border: 0.5px solid var(--border); border-radius: var(--radius-md); padding: 1rem; margin-bottom: 10px; }
.insight-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.insight-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.insight-text { font-size: 14px; color: var(--text-1); line-height: 1.7; min-height: 60px; }
.cursor-blink { display: inline-block; width: 2px; height: 14px; background: var(--teal); margin-left: 2px; vertical-align: middle; animation: blink .7s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ── Thread messages ─────────────────────────────────────────────────────── */
.thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.msg { padding: .625rem .875rem; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6; max-width: 88%; }
.msg-user { background: var(--teal-light); color: var(--teal-dark); align-self: flex-end; margin-left: auto; }
.msg-ai   { background: var(--bg-1); color: var(--text-1); }

/* ── Toggle switches ─────────────────────────────────────────────────────── */
.toggle { width: 44px; height: 24px; border-radius: 12px; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle.on  { background: var(--teal); }
.toggle.off { background: var(--bg-2); }
.toggle-knob { width: 20px; height: 20px; border-radius: 50%; background: #fff; position: absolute; top: 2px; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle.on  .toggle-knob { left: 22px; }
.toggle.off .toggle-knob { left: 2px; }

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-card  { background: var(--bg-1); border-radius: var(--radius-sm); padding: .875rem; }
.stat-label { font-size: 10px; color: var(--text-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 24px; font-weight: 600; color: var(--text-1); line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ── Loading spinner ─────────────────────────────────────────────────────── */
.spinner-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 16px; }
.spinner { width: 52px; height: 52px; border: 3px solid var(--teal-light); border-top-color: var(--teal); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Paywall tiers ───────────────────────────────────────────────────────── */
.tier-card { border: 0.5px solid var(--border); border-radius: var(--radius-md); padding: 1.125rem; margin-bottom: 10px; }
.tier-card.featured { border: 2px solid var(--teal); }
.tier-price { font-size: 28px; font-weight: 700; color: var(--text-1); line-height: 1; }
.tier-per   { font-size: 13px; color: var(--text-3); }
.tier-features { margin: 12px 0; }
.tier-feat  { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 7px; font-size: 13px; color: var(--text-2); }

/* ── Check icon ──────────────────────────────────────────────────────────── */
.check-circle { width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.check-on  { background: var(--teal-light); }
.check-off { background: var(--bg-2); }

/* ── History cards ───────────────────────────────────────────────────────── */
.hist-card { background: var(--bg-0); border: 0.5px solid var(--border); border-radius: var(--radius-md); padding: 1rem; margin-bottom: 8px; cursor: pointer; transition: border-color .15s; }
.hist-card:hover { border-color: var(--teal); }

/* ── Compatibility ───────────────────────────────────────────────────────── */
.compat-score { font-size: 44px; font-weight: 700; line-height: 1; }

/* ── Misc utility ────────────────────────────────────────────────────────── */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-col     { display: flex; flex-direction: column; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-auto { margin-top: auto; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* ── Logo mark ───────────────────────────────────────────────────────────── */
.logo-mark { display: flex; flex-direction: column; align-items: flex-start; }
.logo-kaleo { font-size: 13px; font-weight: 700; letter-spacing: 2px; color: var(--teal); text-transform: uppercase; }
.logo-sub   { font-size: 18px; font-weight: 600; color: var(--text-1); line-height: 1.2; }

/* ── Avatar circle ───────────────────────────────────────────────────────── */
.avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; flex-shrink: 0; }

/* ── Back button ─────────────────────────────────────────────────────────── */
.back-btn { background: none; border: none; cursor: pointer; color: var(--text-2); font-size: 15px; padding: 4px 0; display: flex; align-items: center; gap: 4px; font-family: var(--font); margin-bottom: 14px; }
.screen-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ── Success animation ───────────────────────────────────────────────────── */
@keyframes popIn { 0%{transform:scale(0)} 70%{transform:scale(1.15)} 100%{transform:scale(1)} }
.pop-in { animation: popIn .4s ease-out; }

/* ── Mobile safe areas ───────────────────────────────────────────────────── */
@supports (padding: max(0px)) {
  #bottom-nav { padding-bottom: max(env(safe-area-inset-bottom), 8px); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .screen { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 1.25rem); }
}
