:root {
  color-scheme: dark;
  --bg: #10091c;
  --bg-deep: #090510;
  --panel: rgba(31, 20, 49, 0.86);
  --panel-solid: #211632;
  --text: #fff9fd;
  --muted: #c8b8cf;
  --dim: #8f7d99;
  --pink: #ff5c9a;
  --pink-strong: #ef3d84;
  --peach: #ffb58c;
  --violet: #9c7cff;
  --line: rgba(255, 255, 255, 0.11);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 5%, rgba(239, 61, 132, 0.13), transparent 28rem),
    radial-gradient(circle at 90% 30%, rgba(156, 124, 255, 0.12), transparent 24rem),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  color: var(--text);
  overflow-x: hidden;
}
button, select, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.ambient {
  position: fixed;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: -1;
}
.ambient-one { top: 18%; left: -10rem; background: rgba(255, 92, 154, 0.2); }
.ambient-two { right: -10rem; bottom: 8%; background: rgba(156, 124, 255, 0.18); }

.skip-link {
  position: fixed;
  top: -5rem;
  left: 1rem;
  z-index: 100;
  padding: .75rem 1rem;
  border-radius: .75rem;
  background: #fff;
  color: #111;
}
.skip-link:focus { top: 1rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hidden { display: none !important; }

.topbar {
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  min-height: 4.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.02em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .65rem;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 8px 22px rgba(239, 61, 132, .28);
}
.lang-label select {
  min-height: 2.75rem;
  max-width: 10.5rem;
  padding: 0 2.3rem 0 .8rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.lang-label option { color: #111; }

main {
  width: min(66rem, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: 4rem;
}
.hero {
  max-width: 48rem;
  margin: 3.5rem auto 2.4rem;
  text-align: center;
}
.eyebrow, .section-kicker {
  margin: 0 0 .55rem;
  color: var(--peach);
  font-size: .77rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2 {
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -.035em;
}
h1 {
  margin: 0;
  font-size: clamp(2.45rem, 8vw, 5.4rem);
  line-height: .98;
}
.hero-sub {
  max-width: 40rem;
  margin: 1.2rem auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.18rem);
  line-height: 1.7;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
  margin-top: 1.4rem;
}
.hero-meta span, .type-chip {
  padding: .42rem .72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}
.type-chip {
  display: inline-flex;
  margin-top: .75rem;
  color: #ffe4ef;
  border-color: rgba(255,92,154,.35);
  background: rgba(255,92,154,.1);
}

.mode-panel, .saved-panel, .guide-panel, .boundary-note, .test-cta {
  margin-top: 1.25rem;
  padding: clamp(1.1rem, 3vw, 1.7rem);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: rgba(26, 16, 41, .72);
  box-shadow: 0 18px 55px rgba(0,0,0,.16);
  backdrop-filter: blur(16px);
}
.mode-panel h2, .saved-panel h2, .guide-panel h2, .boundary-note h2, .test-cta h2 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .7rem;
  margin-top: 1.25rem;
}
.mode-btn {
  min-height: 7.5rem;
  padding: 1rem .8rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255,255,255,.035);
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.mode-btn:hover { transform: translateY(-2px); border-color: rgba(255,181,140,.4); }
.mode-btn.is-active {
  border-color: rgba(255,92,154,.65);
  background: linear-gradient(145deg, rgba(255,92,154,.18), rgba(156,124,255,.1));
  box-shadow: inset 0 0 0 1px rgba(255,92,154,.12);
}
.mode-btn > span { display: block; color: var(--peach); font-size: 1.25rem; }
.mode-btn strong { display: block; margin-top: .65rem; font-size: .94rem; }
.mode-btn small { display: block; margin-top: .28rem; color: var(--dim); line-height: 1.35; }

.deck-shell {
  width: min(42rem, 100%);
  margin: 1.6rem auto 0;
}
.deck-progress {
  display: flex;
  justify-content: space-between;
  margin: 0 .2rem .55rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
}
.progress-track {
  height: .34rem;
  margin-bottom: .9rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--peach));
  transition: width .3s ease;
}
.conversation-card {
  position: relative;
  min-height: 25rem;
  padding: 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 1.8rem;
  background:
    radial-gradient(circle at 85% 8%, rgba(255,181,140,.24), transparent 13rem),
    radial-gradient(circle at 5% 100%, rgba(156,124,255,.22), transparent 15rem),
    linear-gradient(145deg, #382044, #1c1433 70%);
  box-shadow: var(--shadow);
}
.conversation-card::before {
  content: "";
  position: absolute;
  inset: .65rem;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 1.35rem;
  pointer-events: none;
}
.card-topline {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-number {
  font-family: "Fraunces", serif;
  color: rgba(255,255,255,.62);
  font-size: 1.1rem;
}
.card-mode {
  padding: .35rem .6rem;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  color: #fff0f6;
  font-size: .72rem;
  font-weight: 700;
}
.card-cover, .card-face {
  position: relative;
  z-index: 1;
  min-height: 20rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.cover-heart {
  display: grid;
  place-items: center;
  width: 5.5rem;
  height: 5.5rem;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  color: var(--pink);
  font-size: 2.4rem;
  box-shadow: 0 18px 40px rgba(0,0,0,.2);
}
.card-cover p {
  max-width: 18rem;
  margin: 1.3rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.card-question {
  max-width: 33rem;
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.75rem, 5.4vw, 2.7rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.025em;
}
.card-note {
  max-width: 27rem;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.6;
}
.conversation-card.card-enter { animation: cardIn .34s ease both; }
@keyframes cardIn {
  from { opacity: .35; transform: translateY(12px) rotate(.5deg); }
  to { opacity: 1; transform: none; }
}

.primary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
  margin-top: .9rem;
}
.primary-btn, .secondary-btn, .restart-btn {
  min-height: 3.35rem;
  border-radius: 1rem;
  cursor: pointer;
  font-weight: 700;
}
.primary-btn {
  grid-column: 1 / -1;
  border: 0;
  background: linear-gradient(135deg, var(--pink-strong), #b34cda);
  color: #fff;
  box-shadow: 0 14px 30px rgba(239,61,132,.25);
}
.secondary-btn {
  grid-column: 1 / -1;
  border: 1px solid rgba(255,92,154,.45);
  background: rgba(255,92,154,.1);
}
.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .55rem;
  margin-top: .65rem;
}
.card-actions button {
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: rgba(255,255,255,.045);
  cursor: pointer;
}
.card-actions button span:first-child { margin-right: .25rem; color: var(--peach); }
.card-actions button.is-saved {
  border-color: rgba(255,92,154,.5);
  background: rgba(255,92,154,.12);
}
.restart-btn {
  width: 100%;
  margin-top: .65rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 3px solid #ffd0e2;
  outline-offset: 3px;
}

.ad-slot {
  width: min(46rem, 100%);
  min-height: 7rem;
  margin: 1.8rem auto 0;
  padding: .8rem;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 1rem;
  background: rgba(255,255,255,.025);
  text-align: center;
}
.ad-label {
  display: block;
  margin-bottom: .35rem;
  color: var(--dim);
  font-size: .58rem;
  letter-spacing: .14em;
}

.saved-head, .test-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.saved-head button, .test-cta a {
  flex: 0 0 auto;
  min-height: 2.8rem;
  padding: .7rem 1rem;
  border: 1px solid rgba(255,92,154,.38);
  border-radius: .85rem;
  background: rgba(255,92,154,.1);
  color: #ffe5ef;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}
.saved-head button:disabled { opacity: .4; cursor: not-allowed; }
.empty-saved {
  margin: 1rem 0 0;
  color: var(--dim);
  line-height: 1.6;
}
.saved-list {
  display: grid;
  gap: .6rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.saved-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .8rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: rgba(255,255,255,.03);
}
.saved-index {
  color: var(--peach);
  font-family: "Fraunces", serif;
}
.saved-question { color: var(--muted); line-height: 1.45; }
.saved-remove {
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  cursor: pointer;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .8rem;
  margin-top: 1.15rem;
}
.guide-grid > div {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255,255,255,.025);
}
.guide-grid span { color: var(--pink); font-size: .72rem; font-weight: 700; }
.guide-grid h3 { margin: .6rem 0 .35rem; font-size: 1rem; }
.guide-grid p, .boundary-note p, .test-cta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.boundary-note { border-color: rgba(255,181,140,.25); }
.boundary-note p { margin-top: .7rem; }
.test-cta > div { max-width: 42rem; }
.test-cta p:last-child { margin-top: .65rem; }

footer {
  width: min(66rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 2rem;
  display: flex;
  justify-content: center;
  gap: .55rem;
  color: var(--dim);
  font-size: .82rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100% - 2rem);
  padding: .72rem 1rem;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: #2a1b37;
  box-shadow: 0 14px 35px rgba(0,0,0,.35);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: .22s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .topbar { width: min(100% - 1.25rem, 66rem); }
  main { width: min(100% - 1.25rem, 66rem); }
  .hero { margin-top: 2.5rem; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .mode-btn { min-height: 6.8rem; }
  .conversation-card { min-height: 23rem; padding: 1.2rem; }
  .card-cover, .card-face { min-height: 18.5rem; }
  .guide-grid { grid-template-columns: 1fr; }
  .test-cta { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .brand span:last-child { display: none; }
  .lang-label select { max-width: 8.7rem; }
  .mode-panel, .saved-panel, .guide-panel, .boundary-note, .test-cta { border-radius: 1.05rem; }
  .mode-grid { gap: .5rem; }
  .mode-btn { min-height: 6.4rem; padding: .8rem .7rem; }
  .mode-btn small { font-size: .72rem; }
  .conversation-card { min-height: 21.5rem; border-radius: 1.35rem; }
  .card-cover, .card-face { min-height: 17rem; }
  .card-actions button span:last-child { font-size: .78rem; }
  .saved-list li { grid-template-columns: auto 1fr auto; gap: .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

@media print {
  body { background: #fff; color: #111; }
  .topbar, .hero, .mode-panel, .deck-shell, .ad-slot, .guide-panel, .boundary-note, .test-cta, footer, .toast { display: none !important; }
  main { width: 100%; padding: 0; }
  .saved-panel { margin: 0; border: 0; background: #fff; box-shadow: none; }
  .saved-head button, .empty-saved, .saved-remove { display: none !important; }
  .saved-list li { break-inside: avoid; border-color: #bbb; background: #fff; color: #111; }
  .saved-question { color: #222; }
}
