:root {
  --bg: #0b1026;
  --bg-2: #0f1533;
  --card: #151c3f;
  --card-2: #1c2550;
  --line: #2a3468;
  --text: #eef1ff;
  --muted: #a9b0d6;
  --amber: #ffb547;
  --amber-2: #ffcf85;
  --sky: #7aa7ff;
  --pink: #ff7aa8;
  --green: #4fd1a5;
  --red: #ff6b6b;
  --me: #ffb547;
  --me-text: #1a1405;
  --them: #222c5c;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --topbar: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 80% -10%, rgba(122, 167, 255, .12), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(255, 181, 71, .07), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
}
img { max-width: 100%; display: block; }
a { color: var(--amber-2); }
a:hover { color: #fff; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 5.4vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.error { color: var(--red); font-weight: 600; }
.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; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--amber); color: #000; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 0; border-radius: 999px; padding: .7em 1.2em;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background-color .2s ease, box-shadow .2s ease, opacity .2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--amber); color: #1a1405; box-shadow: 0 8px 24px rgba(255, 181, 71, .3); }
.btn-primary:hover { background: var(--amber-2); color: #1a1405; }
.btn-secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { background: #26306a; color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--card); color: #fff; }
.btn-danger { background: var(--red); color: #2a0606; }
.btn-link { background: none; color: var(--muted); text-decoration: underline; padding: .4em; min-height: 0; }
.btn-link:hover { color: #fff; }
.btn-xl { width: 100%; font-size: 1.15rem; padding: .95em 1.4em; }
.btn-icon { background: transparent; color: var(--text); width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); }
.btn-icon:hover { background: var(--card-2); }
.btn-icon span[aria-hidden] { font-size: 1.5rem; line-height: 1; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-left));
  background: rgba(11, 16, 38, .82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(42, 52, 104, .6);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.brand.small { font-size: .95rem; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.online-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); padding: 6px 12px; background: var(--card); border-radius: 999px; border: 1px solid var(--line); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #5b6390; display: inline-block; flex: none; }
.dot.live, .dot.on { background: var(--green); box-shadow: 0 0 0 0 rgba(79, 209, 165, .6); }
.dot.live { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(79, 209, 165, .55); } 70% { box-shadow: 0 0 0 8px rgba(79, 209, 165, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 209, 165, 0); } }
#friends-btn { position: relative; padding: .55em 1em; }
#friends-btn svg { color: var(--pink); }
.badge { background: var(--pink); color: #2b0614; font-size: .75rem; font-weight: 800; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; }

.banner { position: sticky; top: var(--topbar); z-index: 19; background: #3b2a0a; color: var(--amber-2); text-align: center; padding: 8px 16px; font-weight: 600; font-size: .95rem; }

/* ---------- home ---------- */
main { display: block; }
.screen { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.hero { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: center; padding: 22px 0 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 800; color: var(--amber); margin-bottom: .8em; }
.glow { color: var(--amber); text-shadow: 0 0 28px rgba(255, 181, 71, .45); }
.lead { font-size: 1.15rem; color: #d3d8f5; max-width: 34em; }

.start-card { background: linear-gradient(180deg, var(--card), var(--bg-2)); border: 1px solid var(--line); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); margin-top: 20px; }
.field { margin-bottom: 18px; }
.field-label { display: block; font-weight: 700; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: var(--bg-2); color: var(--text); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; min-height: 40px; transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--sky); }
.chip[aria-pressed="true"] { background: rgba(255, 181, 71, .16); border-color: var(--amber); color: var(--amber-2); }
.chip[aria-pressed="true"]::before { content: "\2713  "; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px; }
.tag-input:focus-within { border-color: var(--amber); }
.tag-input input { flex: 1; min-width: 160px; border: 0; background: transparent; color: var(--text); font: inherit; padding: 8px 4px; outline: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: rgba(122, 167, 255, .16); color: #cfe0ff; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: .88rem; font-weight: 600; }
.tag button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 2px 6px; border-radius: 50%; }
.tag button:hover { background: rgba(255, 255, 255, .12); }
.tag.static { padding: 4px 12px; }
.start-card .field:first-child { margin-bottom: 14px; }
.start-card #start-btn { margin-top: 4px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented button { text-align: left; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; color: var(--text); padding: 12px 14px; font: inherit; cursor: pointer; min-height: 64px; }
.segmented button strong { display: block; font-size: 1rem; }
.segmented button small { display: block; color: var(--muted); font-size: .82rem; line-height: 1.3; margin-top: 2px; }
.segmented button[aria-checked="true"] { border-color: var(--amber); background: rgba(255, 181, 71, .1); box-shadow: inset 0 0 0 1px var(--amber); }
.interests { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.interests summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; min-height: 40px; }
.interests summary::-webkit-details-marker { display: none; }
.interests summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--amber); margin-left: auto; }
.interests[open] summary::after { content: "2"; }
.interests .count { background: rgba(255, 181, 71, .16); color: var(--amber-2); border-radius: 999px; padding: 2px 10px; font-size: .8rem; }
.interests .count:empty { display: none; }
.interests p { margin: 4px 0 10px; }
.fineprint { font-size: .84rem; color: var(--muted); margin: 12px 0 0; text-align: center; }

.hero-art { position: relative; margin: 8px auto 0; width: min(340px, 80vw); aspect-ratio: 1; }
.hero-art img { position: relative; width: 100%; height: 100%; object-fit: cover; clip-path: circle(47.4% at 50.3% 50.1%); }
.hero-art::before { content: ""; position: absolute; inset: 3%; border-radius: 50%; box-shadow: 0 0 90px rgba(122, 167, 255, .3), 0 0 0 1px rgba(122, 167, 255, .12); }
.ping { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.ping::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--amber); animation: ping 2.4s ease-out infinite; }
.p1 { top: 25%; left: 50%; } .p2 { top: 45%; left: 43%; } .p3 { top: 77%; left: 79%; }
.p2::after { animation-delay: .8s; } .p3::after { animation-delay: 1.6s; }
@keyframes ping { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(3); opacity: 0; } }
.float-bubble { position: absolute; background: var(--amber); color: #1a1405; font-weight: 700; font-size: .9rem; padding: 8px 14px; border-radius: 16px 16px 16px 4px; box-shadow: var(--shadow); animation: floaty 6s ease-in-out infinite; white-space: nowrap; }
.float-bubble.b1 { top: 14%; left: -2%; }
.float-bubble.b2 { bottom: 16%; right: -2%; background: var(--sky); border-radius: 16px 16px 4px 16px; animation-delay: -3s; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.qotd { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; background: linear-gradient(120deg, rgba(255, 181, 71, .14), rgba(122, 167, 255, .1)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 12px 0 40px; }
.qotd .eyebrow { margin-bottom: .4em; }
.qotd-text { font-size: 1.3rem; font-weight: 700; margin: 0; }

.how { padding: 8px 0 32px; }
.how h2 { text-align: center; margin-bottom: 24px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; grid-template-columns: 1fr; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.steps img { width: 100%; max-width: 240px; height: auto; margin: 0 auto 10px; }
.steps p { color: var(--muted); margin: 0; }

.world { margin: 24px -16px 0; background: linear-gradient(180deg, rgba(11, 16, 38, .55), rgba(11, 16, 38, .9)), url("/images/earth-at-night-map.jpg") center / cover no-repeat; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.world-inner { max-width: 760px; margin: 0 auto; padding: 56px 20px; }
.world p { color: #d3d8f5; font-size: 1.08rem; }
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li { position: relative; padding-left: 32px; margin-bottom: 10px; }
.ticks li::before { content: "\2713"; position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: rgba(79, 209, 165, .18); color: var(--green); font-weight: 800; font-size: .8rem; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.ticks.small li { font-size: .95rem; }

.rules-card { padding: 48px 0 24px; }
.rules-card h2 { text-align: center; }
.rule-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 24px 0; }
.rule-grid > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.rule-grid p { color: var(--muted); margin: 0; font-size: .95rem; }
.rule-icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 32px; }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 24px 16px 32px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-inner nav a { color: var(--muted); text-decoration: none; }
.footer-inner nav a:hover { color: #fff; }
.credit { font-size: .8rem; margin: 0; }

/* ---------- waiting ---------- */
.center-screen { text-align: center; padding: 40px 16px 60px; max-width: 640px; }
.radar { position: relative; width: 220px; height: 220px; margin: 10px auto 28px; border-radius: 50%; }
.radar img { width: 100%; height: 100%; object-fit: cover; clip-path: circle(47.4% at 50.3% 50.1%); transform: scale(1.05); }
.radar .sweep { position: absolute; inset: 2%; border-radius: 50%; background: conic-gradient(from 0deg, rgba(255, 181, 71, 0) 0deg, rgba(255, 181, 71, 0) 280deg, rgba(255, 181, 71, .22) 359deg, rgba(255, 181, 71, 0) 360deg); mix-blend-mode: screen; animation: spin 2.4s linear infinite; }
.radar .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 181, 71, .5); animation: grow 3s ease-out infinite; }
.radar .r2 { animation-delay: 1s; } .radar .r3 { animation-delay: 2s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes grow { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.7); opacity: 0; } }
.center-tags { justify-content: center; margin: 8px 0 16px; }
.tip { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; color: #d3d8f5; font-size: .95rem; margin: 18px auto 22px; max-width: 460px; }
.tip:empty { display: none; }
.quiet { background: linear-gradient(120deg, rgba(122, 167, 255, .14), rgba(255, 122, 168, .1)); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin: 0 auto 20px; max-width: 460px; }
.quiet p { margin: 0 0 12px; }
.ai-offer { display: flex; gap: 14px; align-items: flex-start; text-align: left; background: linear-gradient(120deg, rgba(143, 123, 255, .18), rgba(79, 209, 197, .12)); border: 1px solid rgba(143, 123, 255, .45); border-radius: 18px; padding: 16px 18px; margin: 0 auto 20px; max-width: 460px; animation: pop .25s ease-out; }
.ai-offer img { flex: none; width: 56px; height: 56px; }
.ai-offer p { margin: 0 0 12px; }
.ai-tag { display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .06em; background: rgba(11, 16, 38, .25); padding: 1px 6px; border-radius: 6px; margin-left: 4px; vertical-align: 1px; }
.big-emoji { font-size: 3.5rem; margin-bottom: 8px; }
.help-list { text-align: left; display: inline-block; padding-left: 20px; }
.help-list li { margin-bottom: 8px; }

/* ---------- chat ---------- */
body.in-chat .site-footer { display: none; }
body.in-chat { background-attachment: scroll; }
.chat-screen { display: flex; flex-direction: column; height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); max-width: 860px; padding: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; background: var(--sky); color: #0b1026; }
.who-name { margin: 0; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who-place { margin: 0; color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: rgba(79, 209, 165, .16); color: var(--green); padding: 2px 8px; border-radius: 999px; }
.band.far { background: rgba(122, 167, 255, .16); color: var(--sky); }
.band.ai { background: rgba(143, 123, 255, .22); color: #c4b8ff; }
.avatar.sunny { background: url(/images/sunny.svg) center / cover no-repeat; color: transparent; }
.ai-strip { padding: 8px 14px; font-size: .88rem; color: #d9d2ff; background: rgba(143, 123, 255, .14); border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.ai-strip .pulse { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: blink 1.4s infinite; }
.msg.sunny { background: #2e2a63; border: 1px solid rgba(143, 123, 255, .35); }
.typing b { font-weight: inherit; }
.chat-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.btn-save { background: rgba(255, 122, 168, .14); color: var(--pink); border: 1px solid rgba(255, 122, 168, .4); padding: .5em 1em; }
.btn-save:hover { background: rgba(255, 122, 168, .24); color: #ffc2d7; }
.btn-save[aria-pressed="true"] { background: var(--pink); color: #2b0614; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 170px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: rgba(255, 255, 255, .08); }
.shared { padding: 8px 14px; font-size: .9rem; color: var(--muted); border-bottom: 1px solid var(--line); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.4; animation: pop .16s ease-out; }
.msg.me { align-self: flex-end; background: var(--me); color: var(--me-text); border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; background: var(--them); color: var(--text); border-bottom-left-radius: 6px; }
.msg time { display: block; font-size: .7rem; opacity: .65; margin-top: 2px; }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }
.sys { align-self: center; text-align: center; color: var(--muted); font-size: .9rem; max-width: 90%; padding: 4px 10px; }
.sys strong { color: var(--text); }
.starter { align-self: stretch; background: linear-gradient(120deg, rgba(255, 181, 71, .12), rgba(122, 167, 255, .1)); border: 1px dashed rgba(255, 181, 71, .45); border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.starter p { margin: 0; font-weight: 600; }
.starter small { display: block; color: var(--amber); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; }
.starter .btn { padding: .4em 1em; min-height: 36px; font-size: .9rem; }
.ended-card { align-self: stretch; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; text-align: center; margin-top: 8px; }
.ended-card h3 { margin-bottom: .3em; }
.ended-card p { color: var(--muted); }
.ended-card .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.inline-cta { margin-top: 8px; }
.typing { padding: 0 18px 6px; color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 3px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; margin-right: 6px; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg-2); }
.composer textarea { flex: 1; resize: none; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 22px; padding: 11px 16px; font: inherit; font-size: 1rem; line-height: 1.35; max-height: 140px; min-height: 46px; outline: none; }
.composer textarea:focus { border-color: var(--amber); }
.composer textarea:disabled { opacity: .5; }
.btn-send { width: 46px; height: 46px; padding: 0; flex: none; }
.btn-next { background: var(--card-2); color: var(--text); border: 1px solid var(--line); flex: none; height: 46px; padding: 0 16px; }
.btn-next:hover { background: #26306a; }
.btn-next.go { background: var(--green); color: #052219; border-color: var(--green); }

/* ---------- dialogs ---------- */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(4, 6, 18, .72); backdrop-filter: blur(3px); }
.sheet { border: 1px solid var(--line); background: var(--card); border-radius: 24px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.sheet-body { padding: 26px 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.sheet-body h2 { margin: 0; font-size: 1.5rem; }
.sheet-body p { margin: 0; }
.sheet-body input[type="text"] { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 14px; padding: 12px 14px; font: inherit; }
.gate-art { font-size: 2.6rem; }
.reasons { display: flex; flex-direction: column; gap: 6px; }
.reasons label { display: flex; gap: 10px; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 600; }
.reasons label:has(input:checked) { border-color: var(--red); background: rgba(255, 107, 107, .1); }
.reasons input { accent-color: var(--red); width: 18px; height: 18px; }

.drawer { margin: 0 0 0 auto; height: 100vh; height: 100dvh; max-height: none; width: min(420px, 100vw); border: 0; border-left: 1px solid var(--line); padding: 0; background: var(--bg-2); }
.drawer[open] { display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-view { display: flex; flex-direction: column; height: 100%; overflow-y: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-2); z-index: 2; }
.drawer-head h2 { margin: 0; font-size: 1.3rem; }
.thread-who { flex: 1; min-width: 0; }
.my-name { padding: 14px; border-bottom: 1px solid var(--line); }
.my-name label { font-weight: 700; display: block; margin-bottom: 6px; }
.my-name .row { display: flex; gap: 8px; }
.my-name input { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 10px 12px; font: inherit; }
.my-name p { margin: 6px 0 0; }
.notif-btn { margin: 12px 14px 0; }
.friend-list { list-style: none; margin: 0; padding: 8px; }
.friend-list button { width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: none; border: 0; color: var(--text); padding: 10px; border-radius: 14px; cursor: pointer; font: inherit; }
.friend-list button:hover { background: var(--card); }
.friend-meta { flex: 1; min-width: 0; }
.friend-meta strong { display: flex; align-items: center; gap: 6px; }
.friend-meta span { display: block; color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .dot { position: absolute; right: 0; bottom: 0; border: 2px solid var(--bg-2); width: 13px; height: 13px; }
.empty { text-align: center; padding: 24px 22px; }
.empty img { margin: 0 auto 12px; }
.device-note { padding: 0 16px 16px; margin-top: auto; }
.thread-log { flex: 1; }
#thread-view { overflow: hidden; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { background: #f4f6ff; color: #0b1026; font-weight: 700; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); animation: pop .2s ease-out; pointer-events: auto; font-size: .95rem; }

/* ---------- content pages ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 32px 16px 48px; }
.page h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.page h2 { font-size: 1.35rem; margin-top: 1.6em; }
.page li { margin-bottom: .5em; }
.page .updated { color: var(--muted); font-size: .9rem; }
.callout { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 20px 0; }

/* ---------- larger screens ---------- */
@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .rule-grid { grid-template-columns: repeat(2, 1fr); }
  .qotd { flex-direction: row; align-items: center; justify-content: space-between; padding: 24px 28px; }
  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .start-card { padding: 24px; }
}
@media (min-width: 960px) {
  .hero { grid-template-columns: 1.05fr .95fr; gap: 48px; padding: 48px 0 32px; }
  .hero-art { order: 0; width: min(500px, 100%); }
  .rule-grid { grid-template-columns: repeat(4, 1fr); }
  .chat-screen { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .hide-sm { display: none; }
  .brand span { font-size: 1rem; }
  #friends-btn span:not(.badge) { display: none; }
  #friends-btn { padding: 0; width: 44px; }
  #friends-btn .badge { position: absolute; top: -4px; right: -4px; }
  .hero-art { width: min(280px, 74vw); }
  .lead { font-size: 1.05rem; }
  .start-card { margin-top: 14px; padding: 16px; }
  .float-bubble { font-size: .8rem; padding: 6px 10px; }
  .float-bubble.b1 { left: -4%; }
  .float-bubble.b2 { right: -4%; }
  .segmented button { padding: 10px; min-height: 72px; }
  .msg { max-width: 86%; }
  .btn-save span { display: none; }
  .btn-save { width: 44px; padding: 0; }
  .inline-cta.btn-save, .ended-card .btn-save { width: auto; padding: .5em 1em; }
  .inline-cta { display: flex; margin: 8px auto 0; }
  .btn-next { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
}
