@font-face { font-family: 'InterVar'; src: url('fonts/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --indigo: #3b2a9e; --violet: #6d4fe0; --teal: #18b6a8; --warm: #ff9f7a; --warm-2: #ffc58f;
  --grad: linear-gradient(135deg, #3b2a9e 0%, #6d4fe0 50%, #18b6a8 100%);
  --grad-soft: linear-gradient(135deg, rgba(109,79,224,.12), rgba(24,182,168,.12));
  --bg: #f6f4fb; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #efecf8;
  --text: #1c1838; --muted: #6a6585; --line: rgba(40, 30, 100, .1);
  --me: linear-gradient(135deg, #5a40d6, #7b5cf0); --me-text: #fff;
  --them: #ffffff; --them-text: #1c1838;
  --danger: #d6455d; --shadow: 0 10px 30px -12px rgba(59, 42, 158, .25), 0 2px 6px rgba(59, 42, 158, .06);
  --radius: 22px; --radius-sm: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
[data-theme=dark] {
  --bg: #14112b; --bg-2: #1b1738; --surface: #211c43; --surface-2: #2a2453;
  --text: #f1eefe; --muted: #a8a2c8; --line: rgba(255,255,255,.08);
  --them: #2a2453; --them-text: #f1eefe;
  --shadow: 0 12px 30px -14px rgba(0,0,0,.6);
  --grad-soft: linear-gradient(135deg, rgba(109,79,224,.22), rgba(24,182,168,.16));
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'InterVar', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; transition: background .3s, color .3s;
}
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(60% 40% at 100% 0%, rgba(24,182,168,.14), transparent 70%), radial-gradient(60% 40% at 0% 100%, rgba(109,79,224,.14), transparent 70%); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; padding: calc(16px + var(--safe-t)) 22px calc(24px + var(--safe-b)); }
.screen.enter { animation: enter .45s cubic-bezier(.2,.8,.2,1); }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.spacer { flex: 1; }

/* Typography */
.display { font-size: 40px; line-height: 1.05; letter-spacing: -.03em; margin: 0; font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme=dark] .display { background: linear-gradient(135deg, #b9a8ff, #5fe3d4); -webkit-background-clip: text; background-clip: text; }
.h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; margin: 8px 0 0; font-weight: 750; }
.h2 { font-size: 21px; line-height: 1.25; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.h3 { font-size: 17px; margin: 8px 0 0; font-weight: 650; }
.lead { font-size: 19px; color: var(--muted); margin: 12px 0 0; line-height: 1.45; }
.sub { color: var(--muted); margin: 0; }
.small { font-size: 14px; }
.center { text-align: center; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--violet); margin: 0 0 6px; }
[data-theme=dark] .eyebrow { color: #a996ff; }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.link-muted { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-size: 14px; margin: 0; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.01em; font-size: 17px; }
.logo-mark { position: relative; width: 30px; height: 22px; }
.logo-mark span { position: absolute; top: 1px; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--violet); }
.logo-mark span:last-child { left: 10px; border-color: var(--teal); }

/* Buttons */
.btn { min-height: 56px; border-radius: 18px; border: 0; padding: 0 22px; font-weight: 650; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, box-shadow .2s, opacity .2s, background .2s; }
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 12px 24px -10px rgba(109,79,224,.6); background-size: 140% 140%; }
.btn-primary:hover { background-position: 100% 0; }
.btn-primary:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-danger { background: rgba(214,69,93,.1); color: var(--danger); }
.btn-danger:disabled { opacity: .45; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--surface); color: var(--text); display: grid; place-items: center; box-shadow: var(--shadow); transition: transform .15s; }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { opacity: .4; }
.icon-btn.small { width: 32px; height: 32px; box-shadow: none; background: transparent; font-size: 16px; }
.icon-btn-spacer { width: 44px; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.topbar-title { font-size: 18px; margin: 0; font-weight: 700; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--grad-soft); color: var(--violet); }
[data-theme=dark] .badge { color: #c3b6ff; }

/* Welcome */
.welcome { position: relative; overflow: hidden; justify-content: space-between; }
.welcome-top { display: flex; justify-content: space-between; align-items: center; }
.welcome-hero { margin-top: 8vh; }
.orb { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; z-index: -1; animation: float 12s ease-in-out infinite; }
.orb-a { width: 260px; height: 260px; background: #7b5cf0; top: -60px; right: -80px; }
.orb-b { width: 220px; height: 220px; background: #18b6a8; bottom: 18%; left: -90px; animation-delay: -6s; opacity: .35; }
@keyframes float { 50% { transform: translate(20px, 24px) scale(1.08); } }
.duo { display: flex; align-items: center; margin-bottom: 26px; }
.duo span { display: block; }
.duo-a, .duo-b { width: 64px; height: 64px; border-radius: 50%; box-shadow: var(--shadow); }
.duo-a { background: radial-gradient(circle at 30% 25%, #c8b8ff, transparent 50%), linear-gradient(135deg, #5a40d6, #8a6cf5); animation: breathe 4s ease-in-out infinite; }
.duo-b { background: radial-gradient(circle at 30% 25%, #a8fff4, transparent 50%), linear-gradient(135deg, #18b6a8, #0f8f9a); animation: breathe 4s ease-in-out infinite -2s; }
.duo-line { width: 46px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, #8a6cf5, var(--warm), #18b6a8); margin: 0 -4px; }
.duo.small .duo-a, .duo.small .duo-b { width: 52px; height: 52px; }
.paywall-hero { display: flex; justify-content: center; margin-top: 4px; }
.paywall-hero .duo { margin: 0; }
@keyframes breathe { 50% { transform: scale(1.07); } }
.points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.points li { display: flex; gap: 12px; align-items: center; font-weight: 550; font-size: 16px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.points li span { width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--grad-soft); color: var(--teal); }
.points.compact li { padding: 12px 14px; box-shadow: none; background: var(--surface); border: 1px solid var(--line); }

/* Options */
.options { display: grid; gap: 12px; }
.option { min-height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 18px; border-radius: 18px; border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow); text-align: left; transition: border-color .2s, transform .15s; }
.option.small { min-height: 54px; box-shadow: none; border: 2px solid var(--line); }
.option:active { transform: scale(.99); }
.option-flag { font-size: 26px; }
.option-label { flex: 1; font-weight: 600; font-size: 17px; }
.option-check { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--surface-2); opacity: .0; transition: .2s; }
.option.selected { border-color: var(--violet); }
.option.selected .option-check { opacity: 1; background: var(--grad); }

/* Fields */
.field { display: grid; gap: 8px; position: relative; }
.field-label { font-weight: 600; font-size: 14px; color: var(--muted); }
input[type=date], textarea { width: 100%; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); padding: 16px 18px; font-size: 17px; outline: none; transition: border-color .2s, box-shadow .2s; }
input[type=date] { min-height: 60px; }
textarea { resize: none; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(109,79,224,.15); }
.counter { position: absolute; right: 14px; bottom: 10px; font-size: 12px; color: var(--muted); }
.checkbox { display: flex; gap: 12px; align-items: center; min-height: 48px; font-size: 15px; }
.checkbox input { width: 24px; height: 24px; accent-color: var(--violet); flex: none; }

/* Minor */
.minor { justify-content: center; }
.minor-hero { display: flex; justify-content: center; margin-top: 12px; }
.heart { width: 84px; height: 84px; border-radius: 28px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--warm), #ff7aa2); box-shadow: 0 16px 30px -12px rgba(255,122,122,.6); animation: breathe 4s ease-in-out infinite; }
.heart svg { width: 38px; height: 38px; }
.stack { display: grid; gap: 12px; }
.helpline { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; min-height: 72px; }
.helpline-icon { width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--grad-soft); color: var(--teal); }
.helpline-text { flex: 1; display: grid; }
.helpline-text strong { font-size: 15px; }
.helpline-text span { font-size: 14px; color: var(--muted); }
.helpline-cta { font-size: 13px; font-weight: 700; color: var(--violet); padding: 8px 12px; border-radius: 99px; background: var(--grad-soft); }
[data-theme=dark] .helpline-cta { color: #c3b6ff; }

/* Home */
.identity-card { display: flex; gap: 16px; align-items: center; padding: 20px; border-radius: var(--radius); background: var(--grad); color: #fff; box-shadow: 0 18px 36px -16px rgba(59,42,158,.6); margin-top: 6px; }
.identity-card .sub { color: rgba(255,255,255,.8); }
.identity-card .avatar { box-shadow: 0 0 0 3px rgba(255,255,255,.4); }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.card.soft { background: var(--grad-soft); box-shadow: none; gap: 4px; }
.card-accent { border: 2px solid rgba(24,182,168,.35); }
.row { display: flex; align-items: center; gap: 12px; }
.avatar { display: inline-block; border-radius: 50%; flex: none; }

/* Category chips */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip { position: relative; min-height: 76px; border-radius: 18px; border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; text-align: left; font-weight: 600; font-size: 15px; line-height: 1.25; transition: .2s; }
.chip-icon { font-size: 20px; }
.chip.selected { border-color: var(--violet); background: var(--grad-soft); }
.chip-tag { position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 3px 7px; border-radius: 99px; background: var(--warm); color: #4a1d00; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px; border-radius: 18px; background: var(--surface-2); }
.segmented.three { grid-template-columns: repeat(3, 1fr); }
.segmented.four { grid-template-columns: repeat(4, 1fr); }
.segmented button { min-height: 48px; border: 0; border-radius: 13px; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); transition: .2s; padding: 4px 6px; }
.segmented button.selected { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
[data-theme=dark] .segmented button.selected { background: #43397f; }

/* Matching */
.matching { align-items: center; justify-content: center; text-align: center; }
.pulse { position: relative; width: 240px; height: 240px; margin-top: 14vh; display: grid; place-items: center; }
.pulse > span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(109,79,224,.5); animation: ripple 3.6s cubic-bezier(.2,.6,.3,1) infinite; }
.pulse > span:nth-child(2) { animation-delay: 1.2s; border-color: rgba(24,182,168,.5); }
.pulse > span:nth-child(3) { animation-delay: 2.4s; border-color: rgba(255,159,122,.5); }
@keyframes ripple { from { transform: scale(.35); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.pulse-core { animation: breathe 4s ease-in-out infinite; border-radius: 50%; box-shadow: 0 0 0 10px var(--grad-soft), 0 20px 40px -12px rgba(109,79,224,.6); }
.matching-text { font-size: 20px; font-weight: 650; margin: 26px 0 0; max-width: 300px; transition: opacity .3s; }
.matching-text.fade { opacity: 0; }

/* Chat */
.chat { padding: 0; gap: 0; height: 100dvh; min-height: 0; }
.chat-top { padding: calc(10px + var(--safe-t)) 14px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.chat-peer { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-peer strong { display: block; font-size: 16px; line-height: 1.2; }
.peer-sub { font-size: 13px; color: var(--muted); }
.messages { flex: 1; overflow-y: auto; padding: 16px 14px 20px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.sys { align-self: center; text-align: center; font-size: 13px; color: var(--muted); background: var(--surface-2); padding: 8px 14px; border-radius: 99px; max-width: 90%; }
.msg { display: flex; flex-direction: column; max-width: 84%; animation: pop .3s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.them { align-self: flex-start; }
.bubble { padding: 12px 16px; border-radius: 20px; font-size: 16px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.me .bubble { background: var(--me); color: var(--me-text); border-bottom-right-radius: 6px; }
.them .bubble { background: var(--them); color: var(--them-text); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--muted); margin: 6px 4px 0; }
.msg-meta span { display: inline-flex; gap: 4px; align-items: center; }
.toggle-orig { border: 0; background: var(--grad-soft); color: var(--violet); font-weight: 650; font-size: 12px; padding: 6px 10px; border-radius: 99px; min-height: 30px; }
[data-theme=dark] .toggle-orig { color: #c3b6ff; }
.typing { display: inline-flex; gap: 5px; align-items: center; padding: 16px 18px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .5; animation: dot 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 30% { transform: translateY(-4px); opacity: 1; } }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 10px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); }
.composer textarea { border-radius: 24px; padding: 13px 18px; min-height: 52px; max-height: 140px; font-size: 16px; }
.send { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 20px -8px rgba(109,79,224,.7); transition: transform .15s; }
.send:active { transform: scale(.92); }
.shake { animation: shake .4s; border-color: var(--danger) !important; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

.crisis { margin: 10px 12px 0; padding: 14px 16px; border-radius: 18px; background: linear-gradient(135deg, rgba(255,159,122,.18), rgba(255,122,162,.14)); border: 1px solid rgba(255,159,122,.45); animation: enter .4s; }
.crisis-head { display: flex; justify-content: space-between; align-items: center; }
.crisis p { margin: 6px 0 10px; font-size: 14px; }
.crisis-lines, .support-lines { display: flex; flex-wrap: wrap; gap: 8px; }
.crisis-lines a, .support-lines a { font-size: 13px; font-weight: 650; text-decoration: none; padding: 8px 12px; border-radius: 99px; background: var(--surface); min-height: 36px; display: inline-flex; align-items: center; }
.crisis-emergency { font-weight: 700; margin-bottom: 0 !important; }
.support-card { background: var(--grad-soft); border: 1px solid rgba(109,79,224,.25); border-radius: 18px; padding: 14px 16px; font-size: 14px; }
.support-card p { margin: 0 0 10px; }
.support-title { font-weight: 700; font-size: 15px; }
.ended-card { margin-top: 10px; background: var(--surface); border-radius: var(--radius); padding: 20px; display: grid; gap: 10px; text-align: center; box-shadow: var(--shadow); }
.ended-card .h3 { margin: 0; }

/* Paywall */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { position: relative; min-height: 96px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; padding: 14px; gap: 2px; text-align: left; transition: .2s; }
.plan strong { font-size: 16px; }
.plan span { font-size: 14px; color: var(--muted); }
.plan.selected { border-color: var(--violet); background: var(--grad-soft); }
.plan .plan-save { position: absolute; top: 10px; left: 12px; font-size: 11px; font-weight: 800; color: #4a1d00; background: var(--warm); padding: 3px 8px; border-radius: 99px; }

/* Settings */
.settings-group { background: var(--surface); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; box-shadow: var(--shadow); }

/* Sheet + toast */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(12,8,30,.0); display: flex; align-items: flex-end; justify-content: center; z-index: 20; transition: background .25s; }
.sheet-backdrop.open { background: rgba(12,8,30,.45); }
.sheet { width: 100%; max-width: 480px; background: var(--bg-2); border-radius: 28px 28px 0 0; padding: 10px 22px calc(22px + var(--safe-b)); display: grid; gap: 14px; transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.sheet-backdrop.open .sheet { transform: none; }
.sheet-handle { width: 44px; height: 5px; border-radius: 99px; background: var(--line); justify-self: center; margin-bottom: 4px; background: var(--muted); opacity: .3; }
.sheet-list { display: grid; gap: 8px; }
.sheet-list button { min-height: 56px; border: 0; border-radius: 16px; background: var(--surface-2); font-weight: 600; font-size: 16px; text-align: left; padding: 0 18px; }
.sheet-list .danger { color: var(--danger); }
.sheet-list .muted { background: transparent; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); width: min(440px, calc(100% - 32px)); text-align: center; background: #1c1838; color: #fff; padding: 14px 18px; border-radius: 16px; font-size: 14px; font-weight: 550; box-shadow: 0 16px 30px -10px rgba(0,0,0,.4); z-index: 30; animation: enter .3s; transition: opacity .4s; }
[data-theme=dark] .toast { background: #f1eefe; color: #1c1838; }
.toast.out { opacity: 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
