:root {
  --bg: #08090d;
  --panel: rgba(18, 20, 29, 0.72);
  --line: rgba(255,255,255,0.095);
  --text: #f6f2ff;
  --muted: #9b94a8;
  --soft: #706a7d;
  --primary: #8b5cf6;
  --cyan: #06b6d4;
  --lime: #d7ff63;
  --danger: #ff6b6b;
  --shadow: 0 30px 90px rgba(0,0,0,.48);
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  overflow-x: hidden;
}

.bg-orb { position: fixed; border-radius: 999px; filter: blur(50px); pointer-events: none; opacity: .55; }
.orb-one { width: 340px; height: 340px; left: -120px; top: -90px; background: rgba(139,92,246,.45); }
.orb-two { width: 300px; height: 300px; right: -120px; top: 120px; background: rgba(6,182,212,.18); }

.grain {
  position: fixed; inset: 0; pointer-events: none; opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 260 260' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app { position: relative; z-index: 1; width: min(980px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; }

.brand { display: inline-flex; gap: 9px; align-items: center; font-weight: 900; letter-spacing: -.04em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--cyan)); }

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  color: var(--muted);
  padding: 9px 13px;
  border-radius: 999px;
}

.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.hero { padding: 52px 0 26px; }
.mini-label { color: var(--lime); text-transform: uppercase; letter-spacing: .14em; font-weight: 900; font-size: .72rem; }

h1 {
  margin-top: 12px;
  max-width: 820px;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(3.4rem, 8vw, 6.9rem);
  line-height: .88;
  letter-spacing: -.065em;
}

.hero p:not(.mini-label), .reveal-head p:not(.mini-label), .share-copy p, .unlock-card > p {
  max-width: 650px;
  color: var(--muted);
  margin-top: 18px;
  line-height: 1.7;
  font-size: 1.05rem;
}

.category-row { display: flex; gap: 9px; overflow-x: auto; padding: 8px 0 16px; scrollbar-width: none; }
.category-row::-webkit-scrollbar { display: none; }

.cat {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  color: var(--muted);
  padding: 11px 15px;
  border-radius: 999px;
  font-weight: 850;
}

.cat.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), #6d5dfc);
  box-shadow: 0 12px 34px rgba(139,92,246,.24);
}

.selected-strip { min-height: 54px; display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.selected-strip::-webkit-scrollbar { display: none; }

.selected-empty {
  color: var(--soft);
  border: 1px dashed rgba(255,255,255,.13);
  padding: 12px 14px;
  border-radius: 999px;
}

.selected-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: white;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 800;
}

.selected-chip button { border: 0; background: transparent; color: var(--danger); font-weight: 900; }

.search-line {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(13,15,22,.82);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.search-line input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.08rem;
  padding: 13px 8px 13px 14px;
}

.search-line button {
  border: 0;
  border-radius: 18px;
  background: rgba(255,255,255,.07);
  color: var(--muted);
  font-size: 1.4rem;
}

.search-meta { margin: 14px 3px 0; display: flex; justify-content: space-between; gap: 12px; color: var(--soft); font-size: .88rem; }
#activeLabel { color: var(--lime); font-weight: 900; }

.suggestions { margin-top: 14px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.suggestions::-webkit-scrollbar { display: none; }
.suggestions button { flex: 0 0 auto; border: 1px solid var(--line); background: rgba(255,255,255,.045); color: var(--muted); padding: 9px 12px; border-radius: 999px; }

.results { margin-top: 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.result {
  min-height: 112px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 26px;
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(18px);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.result:hover { transform: translateY(-2px); border-color: rgba(139,92,246,.4); background: rgba(255,255,255,.06); }

.poster { width: 72px; height: 72px; border-radius: 21px; object-fit: cover; background: #232532; }
.fallback-poster { display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--cyan)); color: white; font-weight: 900; font-size: 1.35rem; }

.result-content { min-width: 0; }
.result h3 { font-size: 1rem; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result p { color: var(--muted); margin-top: 5px; font-size: .9rem; }
.result button { margin-top: 12px; border: 0; background: var(--lime); color: #101010; padding: 8px 12px; border-radius: 999px; font-weight: 900; }

.bottom-bar {
  position: sticky;
  bottom: 12px;
  z-index: 6;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(13,15,22,.86);
  backdrop-filter: blur(22px);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.bottom-bar strong { display: block; }
.bottom-bar span { color: var(--muted); font-size: .88rem; }
.bottom-bar button, .primary, .secondary {
  border: 0;
  border-radius: 999px;
  padding: 13px 16px;
  font-weight: 900;
}

.bottom-bar button, .primary { background: linear-gradient(135deg, var(--primary), #6d5dfc); color: white; }
.secondary { background: rgba(255,255,255,.055); color: var(--muted); border: 1px solid var(--line); }

.generate-view { min-height: 78vh; display: none; place-items: center; }
.generate-view.active { display: grid; }

.loader-card {
  width: min(650px, 100%);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 38px;
  padding: 46px 24px;
  background: rgba(18,20,29,.76);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.loader-ring {
  width: 86px;
  height: 86px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 5px solid rgba(255,255,255,.09);
  border-top-color: var(--lime);
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-card h1 { margin-inline: auto; font-size: clamp(2.7rem, 7vw, 5.4rem); }
.loader-card p:last-child { color: var(--muted); max-width: 480px; margin: 16px auto 0; line-height: 1.6; }

.reveal-view, .insights-view, .unlock-view, .share-view { padding: 52px 0; }
.reveal-head h1, .share-copy h1, .unlock-card h1 { font-size: clamp(3rem, 8vw, 6.3rem); }

.trait-grid, .insight-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.trait-card, .insight-card {
  min-height: 176px;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 20px;
  background: rgba(255,255,255,.045);
  backdrop-filter: blur(18px);
}

.trait-card strong, .insight-card strong { display: block; color: var(--lime); margin-bottom: 12px; }
.trait-card p, .insight-card p { color: var(--muted); line-height: 1.55; }

.actions { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; }

.share-layout {
  display: grid;
  grid-template-columns: .9fr 430px;
  gap: 30px;
  align-items: center;
}

.story-card {
  width: 390px;
  min-height: 690px;
  margin: 0 auto;
  border-radius: 42px;
  padding: 28px;
  border: 1px solid rgba(255,255,255,.18);
  background:
    radial-gradient(circle at 70% 8%, rgba(215,255,99,.38), transparent 28%),
    radial-gradient(circle at 18% 86%, rgba(6,182,212,.28), transparent 26%),
    linear-gradient(145deg, #18122d, #0b0e16 58%, #050609);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.story-top, .story-footer {
  display: flex;
  justify-content: space-between;
  color: rgba(255,255,255,.68);
  font-weight: 850;
}

.story-main { margin-top: 90px; }
.story-main p { color: var(--lime); text-transform: uppercase; font-size: .78rem; letter-spacing: .14em; font-weight: 900; }
.story-main h2 {
  margin-top: 10px;
  font-family: Fraunces, Georgia, serif;
  font-size: 4.1rem;
  line-height: .82;
  letter-spacing: -.07em;
}
.story-main span { display: block; margin-top: 18px; color: rgba(255,255,255,.72); font-size: 1.05rem; }

.story-traits { margin-top: 46px; display: flex; flex-wrap: wrap; gap: 10px; }
.story-traits span {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 999px;
  color: white;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.12);
  font-weight: 800;
}

.story-signal {
  margin-top: 28px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(215,255,99,.18);
  background: rgba(215,255,99,.08);
}

.story-signal strong { display: block; color: var(--lime); margin-bottom: 8px; }
.story-signal span { color: rgba(255,255,255,.78); line-height: 1.45; }

.story-footer { margin-top: auto; align-items: end; }

.unlock-card {
  border: 1px solid var(--line);
  border-radius: 38px;
  padding: 34px;
  background: rgba(18,20,29,.76);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.unlock-list { margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.unlock-list div { border: 1px solid var(--line); border-radius: 24px; padding: 18px; background: rgba(255,255,255,.045); }
.unlock-list strong { display: block; margin-bottom: 7px; }
.unlock-list span { color: var(--muted); line-height: 1.5; }

.saved-note { color: var(--lime) !important; font-weight: 800; }

@media (max-width: 820px) {
  .app { width: calc(100% - 24px); padding-top: 16px; }
  .brand span:last-child { display: none; }
  .hero h1 { font-size: 3.55rem; }
  .results, .trait-grid, .insight-grid, .unlock-list { grid-template-columns: 1fr; }
  .bottom-bar { flex-direction: column; align-items: stretch; }
  .bottom-bar button { width: 100%; }
  .share-layout { grid-template-columns: 1fr; }
  .story-card { width: min(390px, 100%); min-height: 660px; }
  .actions { flex-direction: column; }
  .primary, .secondary { width: 100%; }
}


/* v5.1 refinement: tighter padding + cleaner app typography */
.app {
  width: min(940px, calc(100% - 32px));
  padding: 16px 0 44px;
}

.topbar {
  padding: 2px 0 6px;
}

.hero {
  padding: 40px 0 22px;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.75rem, 6.2vw, 5.5rem);
  line-height: .94;
  letter-spacing: -.055em;
}

.hero p:not(.mini-label),
.reveal-head p:not(.mini-label),
.share-copy p,
.unlock-card > p {
  max-width: 610px;
  margin-top: 14px;
  font-size: .98rem;
  line-height: 1.62;
}

.category-row {
  padding: 4px 0 12px;
}

.cat {
  padding: 10px 14px;
  font-size: .92rem;
}

.selected-strip {
  min-height: 48px;
  padding-bottom: 10px;
}

.selected-empty,
.selected-chip {
  padding: 9px 12px;
  font-size: .9rem;
}

.search-line {
  border-radius: 24px;
  padding: 8px;
}

.search-line input {
  font-size: 1rem;
  padding: 12px 8px 12px 12px;
}

.search-line button {
  border-radius: 16px;
}

.suggestions {
  margin-top: 12px;
}

.results {
  margin-top: 14px;
  gap: 10px;
}

.result {
  min-height: 96px;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: 22px;
}

.poster {
  width: 60px;
  height: 60px;
  border-radius: 18px;
}

.result h3 {
  font-size: .96rem;
}

.result p {
  font-size: .84rem;
}

.result button {
  margin-top: 9px;
  padding: 7px 11px;
  font-size: .85rem;
}

.bottom-bar {
  bottom: 10px;
  margin-top: 20px;
  padding: 12px;
  border-radius: 22px;
}

.bottom-bar button,
.primary,
.secondary {
  padding: 12px 15px;
  font-size: .92rem;
}

.loader-card {
  padding: 38px 22px;
  border-radius: 32px;
}

.loader-ring {
  width: 72px;
  height: 72px;
}

.loader-card h1 {
  font-size: clamp(2.3rem, 6vw, 4.4rem);
}

.reveal-view,
.insights-view,
.unlock-view,
.share-view {
  padding: 40px 0;
}

.reveal-head h1,
.share-copy h1,
.unlock-card h1 {
  font-size: clamp(2.65rem, 6.4vw, 5.2rem);
}

.trait-grid,
.insight-grid {
  margin-top: 22px;
  gap: 12px;
}

.trait-card,
.insight-card {
  min-height: 148px;
  padding: 18px;
  border-radius: 24px;
}

.story-card {
  width: 370px;
  min-height: 650px;
  border-radius: 36px;
  padding: 24px;
}

.story-main {
  margin-top: 72px;
}

.story-main h2 {
  font-size: 3.5rem;
  line-height: .86;
}

.story-traits {
  margin-top: 38px;
}

.unlock-card {
  border-radius: 32px;
  padding: 28px;
}

.unlock-list div {
  border-radius: 22px;
  padding: 16px;
}

@media (max-width: 820px) {
  .app {
    width: calc(100% - 22px);
    padding-top: 14px;
  }

  .hero {
    padding-top: 32px;
  }

  .hero h1 {
    font-size: 3rem;
  }

  h1 {
    font-size: 3rem;
  }

  .story-card {
    width: min(360px, 100%);
    min-height: 620px;
  }

  .story-main h2 {
    font-size: 3.15rem;
  }
}

@media (max-width: 420px) {
  .app {
    width: calc(100% - 18px);
  }

  h1,
  .hero h1 {
    font-size: 2.75rem;
  }

  .story-card {
    min-height: 590px;
    border-radius: 30px;
    padding: 20px;
  }

  .story-main {
    margin-top: 58px;
  }
}


/* v5.2 readability + spacing hard fix */
:root {
  --content-max: 860px;
}

.app {
  width: min(var(--content-max), calc(100% - 32px)) !important;
  padding: 18px 0 56px !important;
}

.topbar {
  width: 100%;
  min-height: 48px;
  padding: 0 !important;
  margin-bottom: 28px;
}

.brand {
  font-size: 1rem !important;
  letter-spacing: -0.015em !important;
}

.brand-mark {
  width: 34px !important;
  height: 34px !important;
  border-radius: 12px !important;
}

.ghost-btn {
  padding: 9px 14px !important;
  font-size: .9rem !important;
}

.hero {
  padding: 24px 0 22px !important;
}

h1,
.hero h1,
.reveal-head h1,
.share-copy h1,
.unlock-card h1,
.loader-card h1,
.finish-card h2,
.story-main h2 {
  font-family: Inter, system-ui, sans-serif !important;
  letter-spacing: -0.035em !important;
  word-spacing: 0.02em !important;
  line-height: 1.02 !important;
  font-weight: 900 !important;
}

h1,
.hero h1 {
  max-width: 720px !important;
  font-size: clamp(2.35rem, 5vw, 4.7rem) !important;
}

.reveal-head h1,
.share-copy h1,
.unlock-card h1 {
  font-size: clamp(2.25rem, 5vw, 4.4rem) !important;
}

.hero p:not(.mini-label),
.reveal-head p:not(.mini-label),
.share-copy p,
.unlock-card > p,
.loader-card p:last-child {
  max-width: 580px !important;
  font-size: .98rem !important;
  line-height: 1.65 !important;
  letter-spacing: 0 !important;
}

.mini-label {
  letter-spacing: .11em !important;
}

.category-row {
  margin-top: 6px !important;
  padding: 4px 0 14px !important;
}

.cat {
  padding: 10px 14px !important;
  font-size: .92rem !important;
  line-height: 1 !important;
}

.selected-strip {
  min-height: 46px !important;
}

.search-area {
  max-width: 760px !important;
}

.search-line {
  max-width: 760px !important;
  border-radius: 22px !important;
  padding: 8px !important;
}

.results {
  max-width: 760px !important;
  grid-template-columns: 1fr 1fr !important;
}

.bottom-bar {
  max-width: 760px !important;
  border-radius: 22px !important;
}

.loader-card,
.unlock-card {
  max-width: 760px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.trait-grid,
.insight-grid,
.dna-grid {
  max-width: 760px !important;
  grid-template-columns: repeat(2, 1fr) !important;
}

.share-layout {
  grid-template-columns: minmax(0, 1fr) 360px !important;
  max-width: 860px !important;
}

.story-card {
  width: 340px !important;
  min-height: 610px !important;
  border-radius: 34px !important;
}

.story-main h2 {
  font-size: 3rem !important;
  line-height: .96 !important;
  letter-spacing: -0.04em !important;
}

.story-main {
  margin-top: 64px !important;
}

.story-traits {
  margin-top: 34px !important;
}

.story-traits span {
  font-size: .88rem !important;
  padding: 8px 10px !important;
}

@media (max-width: 820px) {
  .app {
    width: min(100% - 24px, 520px) !important;
    padding-top: 14px !important;
  }

  .topbar {
    margin-bottom: 20px !important;
  }

  .hero {
    padding-top: 18px !important;
  }

  h1,
  .hero h1,
  .reveal-head h1,
  .share-copy h1,
  .unlock-card h1 {
    font-size: clamp(2.25rem, 10vw, 3.25rem) !important;
    line-height: 1.04 !important;
    letter-spacing: -0.03em !important;
  }

  .results {
    grid-template-columns: 1fr !important;
  }

  .trait-grid,
  .insight-grid,
  .dna-grid,
  .unlock-list {
    grid-template-columns: 1fr !important;
  }

  .share-layout {
    grid-template-columns: 1fr !important;
  }

  .story-card {
    width: min(100%, 340px) !important;
    min-height: 580px !important;
  }
}

@media (max-width: 420px) {
  .app {
    width: calc(100% - 20px) !important;
  }

  h1,
  .hero h1 {
    font-size: 2.3rem !important;
  }

  .hero p:not(.mini-label),
  .reveal-head p:not(.mini-label),
  .share-copy p,
  .unlock-card > p {
    font-size: .94rem !important;
  }

  .story-main h2 {
    font-size: 2.65rem !important;
  }
}


/* v5.3 continuity fix: onboarding should feel like the landing page */
:root {
  --landing-width: 1080px;
  --bg: #08090d;
  --primary: #8b5cf6;
  --cyan: #06b6d4;
  --lime: #d7ff63;
}

body {
  background:
    radial-gradient(circle at top left, rgba(139,92,246,0.22), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(6,182,212,0.08), transparent 28%),
    linear-gradient(180deg, #08090d, #090a0f 40%, #07080c) !important;
}

.orb-one,
.orb-two {
  opacity: 0 !important;
}

.app {
  width: min(var(--landing-width), calc(100% - 32px)) !important;
  padding: 22px 0 56px !important;
}

.topbar {
  min-height: 46px !important;
  margin-bottom: 30px !important;
  padding: 0 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

.brand {
  display: inline-flex !important;
  align-items: center !important;
  gap: 9px !important;
  font-size: 1.1rem !important;
  font-weight: 900 !important;
  letter-spacing: -0.04em !important;
  margin: 0 !important;
}

.brand span:last-child {
  display: inline !important;
}

.brand-mark {
  width: 32px !important;
  height: 32px !important;
  border-radius: 12px !important;
  display: grid !important;
  place-items: center !important;
  background: linear-gradient(135deg, var(--primary), var(--cyan)) !important;
  color: white !important;
}

.ghost-btn {
  padding: 10px 16px !important;
  border-radius: 999px !important;
  color: #f6f2ff !important;
  background: linear-gradient(135deg, var(--primary), #6d5dfc) !important;
  border: 0 !important;
  font-weight: 800 !important;
}

.hero {
  max-width: 760px !important;
  padding: 42px 0 26px !important;
}

.hero h1 {
  font-family: Inter, system-ui, sans-serif !important;
  max-width: 760px !important;
  font-size: clamp(3rem, 6.4vw, 5.4rem) !important;
  line-height: 1 !important;
  letter-spacing: -0.045em !important;
  font-weight: 900 !important;
}

.hero p:not(.mini-label) {
  color: #a09aaa !important;
  max-width: 610px !important;
  font-size: 1.04rem !important;
}

.mini-label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 9px !important;
  color: #a09aaa !important;
  background: rgba(255,255,255,0.045) !important;
  border: 1px solid rgba(255,255,255,0.095) !important;
  padding: 8px 13px !important;
  border-radius: 999px !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  letter-spacing: .11em !important;
}

.mini-label::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(34,197,94,0.12);
}

.category-row,
.selected-strip,
.search-area,
.bottom-bar,
.reveal-head,
.trait-grid,
.share-layout,
.insight-grid,
.unlock-card,
.loader-card {
  margin-left: 0 !important;
  margin-right: auto !important;
}

.search-area,
.bottom-bar,
.loader-card,
.unlock-card {
  max-width: 820px !important;
}

.results {
  max-width: 820px !important;
}

.trait-grid,
.insight-grid {
  max-width: 820px !important;
}

.category-row {
  max-width: 820px !important;
}

.selected-strip {
  max-width: 820px !important;
}

@media (max-width: 820px) {
  .app {
    width: calc(100% - 28px) !important;
    max-width: none !important;
    padding-top: 16px !important;
  }

  .topbar {
    margin-bottom: 22px !important;
  }

  .brand span:last-child {
    display: inline !important;
  }

  .hero {
    padding-top: 32px !important;
  }

  .hero h1 {
    font-size: clamp(2.65rem, 11vw, 3.6rem) !important;
    line-height: 1.02 !important;
  }
}

@media (max-width: 420px) {
  .app {
    width: calc(100% - 22px) !important;
  }

  .brand {
    font-size: 1.05rem !important;
  }

  .brand-mark {
    width: 30px !important;
    height: 30px !important;
  }

  .ghost-btn {
    padding: 9px 13px !important;
    font-size: .86rem !important;
  }
}


/* v5.4: brighter continuity + simplified flow */
body {
  background:
    radial-gradient(circle at top left, rgba(139,92,246,0.34), transparent 32%),
    radial-gradient(circle at 82% 6%, rgba(6,182,212,0.18), transparent 30%),
    radial-gradient(circle at 52% 110%, rgba(215,255,99,0.08), transparent 35%),
    linear-gradient(180deg, #090914, #08090d 42%, #07080c) !important;
}

.app {
  width: min(1080px, calc(100% - 32px)) !important;
}

.hero,
.search-area,
.selected-strip,
.category-row,
.bottom-bar,
.reveal-head,
.trait-grid,
.unlock-card,
.loader-card {
  max-width: 880px !important;
}

.search-line,
.bottom-bar,
.loader-card,
.unlock-card,
.result,
.trait-card,
.story-card {
  background-color: rgba(20, 22, 34, 0.78) !important;
  border-color: rgba(255,255,255,0.13) !important;
}

.cat {
  background: rgba(255,255,255,0.065) !important;
  color: #c8c2d6 !important;
}

.cat.active {
  background: linear-gradient(135deg, #9b6cff, #06b6d4) !important;
  color: #fff !important;
}

.hero p:not(.mini-label),
.reveal-head p:not(.mini-label),
.share-copy p,
.unlock-card > p {
  color: #b7b0c6 !important;
}

.mini-label {
  color: #d7ff63 !important;
  background: rgba(255,255,255,0.06) !important;
}

.share-layout {
  grid-template-columns: .86fr 390px !important;
  gap: 34px !important;
}

.story-card {
  background:
    radial-gradient(circle at 72% 8%, rgba(215,255,99,.46), transparent 28%),
    radial-gradient(circle at 18% 86%, rgba(6,182,212,.34), transparent 26%),
    radial-gradient(circle at 15% 20%, rgba(139,92,246,.38), transparent 32%),
    linear-gradient(145deg, #20143d, #0d1020 58%, #050609) !important;
}

.story-main h2 {
  font-size: 3.35rem !important;
}

.story-traits span {
  background: rgba(255,255,255,.13) !important;
}

.story-signal {
  background: rgba(215,255,99,.12) !important;
  border-color: rgba(215,255,99,.24) !important;
}

.unlock-list {
  grid-template-columns: repeat(3, 1fr) !important;
}

.insights-view,
.insight-grid {
  display: none !important;
}

@media (max-width: 820px) {
  .app {
    width: calc(100% - 24px) !important;
  }

  .share-layout {
    grid-template-columns: 1fr !important;
  }

  .unlock-list {
    grid-template-columns: 1fr !important;
  }

  .story-card {
    width: min(100%, 360px) !important;
  }
}


/* v6 Supabase auth UI */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-status {
  color: var(--muted);
  font-size: .86rem;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-note.error {
  color: #ff8d8d !important;
}

.saved-note.success {
  color: var(--lime) !important;
}

@media (max-width: 560px) {
  .header-actions {
    gap: 7px;
  }

  .auth-status {
    display: none;
  }

  .ghost-btn {
    padding: 8px 11px !important;
    font-size: .82rem !important;
  }
}
