/* ============================================================
   Reading Genie — design system
   Cozy-magical: midnight plum + gold, serif display, soft cards.
   ============================================================ */

:root {
  /* surfaces */
  --bg:      #16112a;
  --bg-1:    #1e1838;   /* cards */
  --bg-2:    #271f47;   /* inputs, raised */
  --bg-3:    #322a57;   /* hover */
  --line:    rgba(255,255,255,0.09);
  --line-2:  rgba(255,255,255,0.16);

  /* accents */
  --gold:      #e9b85c;
  --gold-2:    #f5d692;
  --gold-soft: rgba(233,184,92,0.14);
  --lilac:     #a896ec;
  --lilac-soft:rgba(168,150,236,0.16);
  --rose:      #e58bab;
  --rose-soft: rgba(229,139,171,0.15);
  --teal:      #5fd2b0;
  --teal-soft: rgba(95,210,176,0.15);
  --danger:    #ec8088;

  /* text */
  --text:   #f4eee2;
  --text-2: #c7bedb;
  --text-3: #968cae;

  /* shape */
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --pill: 999px;

  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --shadow-sm: 0 4px 14px rgba(0,0,0,0.28);
  --glow: 0 6px 22px rgba(233,184,92,0.32);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 480px;
  --nav-h: 74px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(120% 80% at 50% -10%, #221a3d 0%, #16112a 55%, #100c20 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--gold-soft); }

/* scrollbars (webkit) */
.app-main::-webkit-scrollbar { width: 0; }

/* ---------- App shell ---------- */
.app {
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.45);
}

.topbar {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  height: calc(56px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(22,17,42,0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand img { width: 26px; height: 26px; }
.brand-mark { width: 28px; height: 28px; display: inline-block; line-height: 0; flex: none; }
.brand-mark svg { display: block; }
.brand-name { font-family: var(--serif); font-size: 19px; letter-spacing: 0.2px; }
.brand-name b { color: var(--gold); font-weight: 600; }
.beta-tag { font-size: 9px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--lilac); background: var(--lilac-soft); border-radius: var(--pill); padding: 2px 7px; align-self: center; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.app-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(var(--nav-h) + 28px);
}

.screen { animation: fadeUp 0.28s ease both; }
.screen-title { font-family: var(--serif); font-size: 27px; line-height: 1.15; margin: 4px 0 2px; }
.screen-sub { color: var(--text-2); font-size: 14px; margin: 0 0 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 12px; }
.section-title { font-size: 13px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.section-link { color: var(--gold); font-size: 13px; font-weight: 600; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  flex: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(20,15,38,0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  z-index: 6;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.2px;
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
  transition: color 0.18s, transform 0.18s;
  background: none; border: 0;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--gold); }
.nav-item:active { transform: scale(0.92); }
.nav-fab {
  width: 56px; height: 56px; margin-top: -22px; border-radius: var(--pill);
  background: linear-gradient(160deg, #f3d28c, #e0a544);
  color: #2a1c06; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow); border: 3px solid var(--bg);
  cursor: pointer; transition: transform 0.18s;
}
.nav-fab svg { width: 27px; height: 27px; }
.nav-fab:active { transform: scale(0.93); }

/* ---------- Cards & surfaces ---------- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 12px; }
.surface { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: var(--pill); border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font-weight: 600; font-size: 14.5px;
  cursor: pointer; transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.97); }
.btn:hover { background: var(--bg-3); }
.btn-primary {
  background: linear-gradient(160deg, #f3d28c, #e0a544);
  color: #2a1c06; border: 0; box-shadow: var(--glow);
}
.btn-primary:hover { filter: brightness(1.04); background: linear-gradient(160deg, #f3d28c, #e0a544); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 18px; font-size: 15.5px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--pill); display: inline-flex;
  align-items: center; justify-content: center; background: var(--bg-2);
  border: 1px solid var(--line); cursor: pointer; color: var(--text-2);
  transition: transform 0.15s, color 0.15s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:active { transform: scale(0.92); }

/* ---------- Pills / tags / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--pill); font-size: 12.5px; font-weight: 600;
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--line);
}
.pill svg { width: 14px; height: 14px; }
.pill-gold { background: var(--gold-soft); color: var(--gold-2); border-color: transparent; }
.pill-teal { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.pill-rose { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
.pill-lilac { background: var(--lilac-soft); color: var(--lilac); border-color: transparent; }

.tagrow { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 6px 12px; border-radius: var(--pill); font-size: 13px; font-weight: 500;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2);
}
.tag.love { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.tag.hate { background: var(--rose-soft); color: var(--rose); border-color: transparent; }

/* ---------- Segmented control ---------- */
.seg {
  display: flex; gap: 6px; padding: 5px; background: var(--bg-1);
  border: 1px solid var(--line); border-radius: var(--pill); margin-bottom: 16px;
}
.seg-item {
  flex: 1; text-align: center; padding: 8px 6px; border-radius: var(--pill);
  font-size: 13px; font-weight: 600; color: var(--text-3); cursor: pointer;
  border: 0; background: none; transition: color 0.15s, background 0.15s;
}
.seg-item.active { background: var(--gold-soft); color: var(--gold-2); }

/* ---------- Avatars ---------- */
.avatar {
  width: 38px; height: 38px; border-radius: var(--pill); flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #1a1330;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12.5px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }

/* ---------- Book covers & rows ---------- */
.book-cover {
  width: 52px; height: 76px; border-radius: 7px; flex: none; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center; position: relative;
  box-shadow: var(--shadow-sm);
}
.book-cover.lg { width: 104px; height: 152px; border-radius: 10px; }
.book-cover.sm { width: 40px; height: 58px; border-radius: 6px; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .spine { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: rgba(0,0,0,0.22); }
.book-cover .glyph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.book-cover .glyph svg { width: 40%; height: 40%; opacity: 0.55; }

.book-row { display: flex; gap: 13px; align-items: center; }
.book-row + .book-row { margin-top: 14px; }
.book-meta { flex: 1; min-width: 0; }
.book-title { font-size: 15px; font-weight: 600; line-height: 1.25; }
.book-author { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.book-note { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--lilac), var(--gold)); border-radius: 3px; }

/* ---------- Rating ---------- */
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars svg { width: 15px; height: 15px; }
.stars .off { color: var(--text-3); opacity: 0.5; }

/* Tappable rating — same star, bigger touch target */
.star-rating { display: inline-flex; gap: 5px; }
.star-btn { background: none; border: 0; padding: 2px; line-height: 0; cursor: pointer; color: var(--text-3); opacity: 0.45; transition: transform 0.12s, color 0.12s, opacity 0.12s; }
.star-btn svg { display: block; }
.star-btn.on { color: var(--gold); opacity: 1; }
.star-btn:active { transform: scale(0.85); }

/* ---------- Chat / interview ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; padding-bottom: 6px; }
.bubble {
  max-width: 84%; padding: 12px 15px; border-radius: 18px; font-size: 14.5px; line-height: 1.5;
  animation: fadeUp 0.26s ease both;
}
.bubble.genie { align-self: flex-start; background: var(--bg-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.me { align-self: flex-end; background: linear-gradient(160deg, #f3d28c, #e0a544); color: #2a1c06; border-bottom-right-radius: 6px; }
.bubble .who { font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }

.chat-input { display: flex; gap: 9px; align-items: flex-end; margin-top: 12px; }
.chat-input textarea {
  flex: 1; resize: none; background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 18px; padding: 11px 15px; font-size: 14.5px; max-height: 120px; line-height: 1.4;
}
.chat-input textarea:focus { outline: none; border-color: var(--gold); }
.send-btn {
  width: 44px; height: 44px; flex: none; border-radius: var(--pill); border: 0;
  background: linear-gradient(160deg, #f3d28c, #e0a544); color: #2a1c06;
  display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--glow);
}
.send-btn svg { width: 20px; height: 20px; }
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; margin-top: 4px; }
.chips-scroll::-webkit-scrollbar { height: 0; }
.chip-btn {
  flex: none; padding: 8px 13px; border-radius: var(--pill); white-space: nowrap;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip-btn:active { transform: scale(0.96); }
.chip-btn.active { background: var(--gold-soft); border-color: transparent; color: var(--gold-2); }

/* ---------- Wish / hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 20px;
  background: linear-gradient(155deg, #2c2152 0%, #1d1740 70%);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.hero .spark { position: absolute; color: var(--gold); opacity: 0.8; animation: twinkle 3s infinite; }
.hero .spark svg { width: 11px; height: 11px; }
.hero .spark.s1 { top: 16px; right: 86px; } .hero .spark.s1 svg { width: 13px; height: 13px; }
.hero .spark.s2 { top: 50px; right: 16px; animation-delay: 0.8s; } .hero .spark.s2 svg { width: 9px; height: 9px; }
.hero .spark.s3 { top: 82px; right: 52px; animation-delay: 1.5s; } .hero .spark.s3 svg { width: 12px; height: 12px; }
.hero .spark.s4 { top: 66px; right: 92px; animation-delay: 2.2s; } .hero .spark.s4 svg { width: 8px; height: 8px; }
.hero-kicker { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.hero-title { font-family: var(--serif); font-size: 23px; line-height: 1.2; margin: 7px 0 6px; max-width: 78%; }
.hero-sub { color: var(--text-2); font-size: 13.5px; max-width: 82%; margin-bottom: 16px; }
.hero-familiar { position: absolute; top: 12px; right: 12px; width: 66px; height: 66px; border-radius: 50%; background: radial-gradient(circle, rgba(233,184,92,0.18), transparent 68%); animation: float 3.6s ease-in-out infinite; }
.hero-familiar svg { display: block; }

/* ---------- Recommendation card ---------- */
.rec-conf { display: flex; align-items: center; gap: 9px; margin-top: 4px; }
.conf-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; }
.conf-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); }
.conf-num { font-size: 12px; font-weight: 700; color: var(--gold-2); }
.rec-line { display: flex; gap: 8px; font-size: 13px; line-height: 1.45; margin-top: 9px; color: var(--text-2); }
.rec-line svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.rec-line.good svg { color: var(--teal); }
.rec-line.warn svg { color: var(--gold); }

/* ---------- Friends / taste-match ---------- */
.friend-row { display: flex; align-items: center; gap: 13px; }
.friend-row + .friend-row { margin-top: 4px; }
.match-ring { position: relative; width: 50px; height: 50px; flex: none; }
.match-ring svg { width: 50px; height: 50px; transform: rotate(-90deg); }
.match-ring .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.friend-name { font-size: 15px; font-weight: 600; }
.friend-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 12px; text-align: center; }
.stat-num { font-family: var(--serif); font-size: 24px; color: var(--gold); }
.stat-label { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.stat.clickable { cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.stat.clickable:hover { border-color: var(--line-2); }
.stat.clickable:active { transform: scale(0.97); }

/* ---------- Range slider (reading progress) ---------- */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; background: var(--bg-3); outline: none; cursor: pointer; }
.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(160deg, #f3d28c, #e0a544); box-shadow: var(--glow); border: 2px solid var(--bg); cursor: pointer; }
.range::-moz-range-thumb { width: 18px; height: 18px; border: 2px solid var(--bg); border-radius: 50%; background: linear-gradient(160deg, #f3d28c, #e0a544); cursor: pointer; }
.range:disabled { opacity: 0.6; }

/* ---------- Insights / timeline ---------- */
.insight { display: flex; gap: 11px; align-items: flex-start; padding: 12px 0; }
.insight + .insight { border-top: 1px solid var(--line); }
.insight .ico { width: 32px; height: 32px; border-radius: var(--pill); flex: none; display: flex; align-items: center; justify-content: center; }
.insight .ico svg { width: 17px; height: 17px; }
.insight p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.insight b { color: var(--text); font-weight: 600; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 2px; background: var(--line-2); }
.tl-item { position: relative; padding: 6px 0 14px; }
.tl-item::before { content: ""; position: absolute; left: -18px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--bg); }
.tl-date { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.tl-text { font-size: 13.5px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }

/* ---------- Feed ---------- */
.feed-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; }
.feed-item + .feed-item { border-top: 1px solid var(--line); }
.feed-body { flex: 1; min-width: 0; }
.feed-text { font-size: 14px; line-height: 1.45; color: var(--text-2); }
.feed-text b { color: var(--text); font-weight: 600; }
.feed-time { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.feed-actions { display: flex; gap: 8px; margin-top: 9px; }

/* ---------- Badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.badge { text-align: center; }
.badge-medal {
  width: 58px; height: 58px; margin: 0 auto 7px; border-radius: var(--pill);
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #f3d28c, #c98e34);
  color: #3a2706; box-shadow: var(--glow);
}
.badge-medal svg { width: 28px; height: 28px; }
.badge.locked .badge-medal { background: var(--bg-2); color: var(--text-3); box-shadow: none; border: 1px solid var(--line); }
.badge-name { font-size: 12px; font-weight: 600; }
.badge-name.locked { color: var(--text-3); }

/* ---------- Blind date ---------- */
.blind-card {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 22px;
  text-align: center; background: linear-gradient(155deg, #3a2150, #221541);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.blind-gift {
  width: 76px; height: 76px; margin: 6px auto 14px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #f3d28c, #e0a544); color: #2a1c06; box-shadow: var(--glow);
  animation: float 3.4s ease-in-out infinite;
}
.blind-gift svg { width: 38px; height: 38px; }
.blind-title { font-family: var(--serif); font-size: 21px; margin-bottom: 6px; }
.blind-teaser { color: var(--text-2); font-size: 14px; line-height: 1.55; margin-bottom: 18px; }

/* ---------- Onboarding ---------- */
.onb { min-height: 100%; display: flex; flex-direction: column; }
.onb-hero { text-align: center; padding: 30px 8px 10px; }
.onb-hero img { width: 92px; height: 92px; margin: 0 auto 14px; animation: float 3.6s ease-in-out infinite; }
.familiar-lg { width: 98px; height: 98px; margin: 0 auto 14px; animation: float 3.6s ease-in-out infinite; }
.familiar-sm { width: 36px; height: 36px; flex: none; }
.familiar-lg svg, .familiar-sm svg { display: block; }
.onb-hero h1 { font-family: var(--serif); font-size: 30px; margin: 0 0 8px; }
.onb-hero p { color: var(--text-2); font-size: 15px; line-height: 1.55; max-width: 320px; margin: 0 auto; }
.onb-steps { display: flex; flex-direction: column; gap: 12px; margin: 22px 0; }
.onb-step { display: flex; gap: 13px; align-items: center; }
.onb-step .num { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--gold-soft); color: var(--gold-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.onb-step .txt { font-size: 14px; color: var(--text-2); }
.onb-step .txt b { color: var(--text); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-3); font-weight: 600; margin-bottom: 6px; letter-spacing: 0.3px; }
.field input, .field textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 12px 14px; font-size: 15px;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold); }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-pick button { width: 44px; height: 44px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); font-size: 22px; cursor: pointer; }
.emoji-pick button.active { border-color: var(--gold); background: var(--gold-soft); }

/* ---------- Misc ---------- */
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.gold { color: var(--gold); }
.dim-ico { color: var(--text-3); flex: none; }
.book-row > svg { flex: none; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.center-col { display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty { text-align: center; color: var(--text-3); padding: 40px 20px; }
.empty svg { width: 40px; height: 40px; opacity: 0.5; margin-bottom: 10px; }
.back-btn { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 14px; font-weight: 600; background: none; border: 0; cursor: pointer; padding: 0; margin-bottom: 8px; }
.back-btn svg { width: 18px; height: 18px; }

/* Keep the back button reachable in long chats (sticks under the app header). */
.chat-topbar {
  position: sticky; top: 0; z-index: 6;
  margin: 0 -16px 10px; padding: 8px 16px;
  background: rgba(22,17,42,0.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.chat-topbar .back-btn { margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Splash ---------- */
.splash { height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.splash-lamp { width: 76px; height: 76px; animation: float 3s ease-in-out infinite; }
.splash-lamp svg { display: block; }
.splash-title { font-family: var(--serif); font-size: 28px; margin-top: 14px; }
.splash-sub { color: var(--text-3); font-size: 14px; background: linear-gradient(90deg, var(--text-3), var(--gold), var(--text-3)); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: shimmer 2.4s linear infinite; }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes twinkle { 0%,100% { opacity: 0.25; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes blink { 0%,80%,100% { opacity: 0.3; } 40% { opacity: 1; } }
@keyframes shimmer { to { background-position: 200% center; } }
@keyframes pulseGlow { 0%,100% { box-shadow: 0 6px 22px rgba(233,184,92,0.35); } 50% { box-shadow: 0 8px 34px rgba(233,184,92,0.78); } }
/* Pulsing "thinking" state for the consult button (replaces a separate spinner box) */
.btn.pulsing { animation: pulseGlow 1.15s ease-in-out infinite; }
.btn.pulsing svg { animation: twinkle 1.1s ease-in-out infinite; }
/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 22px); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); padding: 11px 16px; border-radius: var(--pill); font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); z-index: 60; max-width: 88%; animation: fadeUp 0.25s ease both; }
.toast svg { width: 16px; height: 16px; color: var(--teal); flex: none; }

/* ---------- New-user walkthrough ---------- */
.tour-overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(10,7,20,0.66); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeUp 0.2s ease both; }
.tour-card { width: 100%; max-width: 360px; position: relative; text-align: center; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-xl); padding: 26px 22px 20px; box-shadow: var(--shadow); }
.tour-skip { position: absolute; top: 13px; right: 15px; background: none; border: 0; color: var(--text-3); font-size: 13px; font-weight: 600; cursor: pointer; }
.tour-icon { width: 64px; height: 64px; margin: 4px auto 14px; border-radius: var(--pill); display: flex; align-items: center; justify-content: center; background: var(--gold-soft); color: var(--gold); }
.tour-icon svg { width: 30px; height: 30px; }
.tour-icon.fam { background: radial-gradient(circle, rgba(233,184,92,0.18), transparent 68%); }
.tour-icon.fam svg { width: 100%; height: 100%; }
.tour-title { font-family: var(--serif); font-size: 22px; margin-bottom: 8px; }
.tour-body { color: var(--text-2); font-size: 14px; line-height: 1.55; margin: 0; }
.tour-dots { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.tour-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bg-3); transition: background 0.2s, width 0.2s; }
.tour-dot.on { background: var(--gold); width: 18px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
