:root {
  --bg: #f7f1ec;
  --bg-soft: #efe6e2;
  --card: #ffffff;
  --ink: #2a1f33;
  --muted: #6b6072;
  --line: #e6dbd8;
  --plum: #4a2f5c;
  --plum-ink: #ffffff;
  --plum-soft: #ece3f1;
  --coral: #e07a6b;
  --coral-soft: #fbe6e1;
  --ok: #2f8a66;
  --no: #b8513c;
  --shadow: 0 1px 2px rgba(42, 31, 51, .06), 0 10px 28px rgba(42, 31, 51, .08);
  --radius: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17121c; --bg-soft: #1e1824; --card: #241d2b; --ink: #f1ebf4; --muted: #b3a8ba; --line: #352b3e;
    --plum: #c9a6e0; --plum-ink: #17121c; --plum-soft: #33283f; --coral: #f0917f; --coral-soft: #3d2622;
    --ok: #4fc59a; --no: #ee7d68;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17121c; --bg-soft: #1e1824; --card: #241d2b; --ink: #f1ebf4; --muted: #b3a8ba; --line: #352b3e;
  --plum: #c9a6e0; --plum-ink: #17121c; --plum-soft: #33283f; --coral: #f0917f; --coral-soft: #3d2622;
  --ok: #4fc59a; --no: #ee7d68; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.5;
}
a { color: var(--plum); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 6.5vw, 2.5rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
main { flex: 1; }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }

.top { padding: 16px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 750; }
.logo { width: 30px; height: 22px; flex: none; background: url("img/icon-mark.svg") center / contain no-repeat; }

footer { padding: 28px 0 36px; color: var(--muted); font-size: .85rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 6px 16px; }
footer a { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > :last-child { margin-bottom: 0; }
.card.soft { background: var(--bg-soft); box-shadow: none; }
.card.glow { border-color: var(--coral); background: var(--coral-soft); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  color: var(--plum-ink); background: var(--plum); border: 0; border-radius: 14px; padding: 12px 18px;
}
.btn.secondary { color: var(--ink); background: var(--card); border: 1px solid var(--line); }
.btn.danger { color: var(--no); background: transparent; border: 1px solid var(--line); }
.btn[disabled] { opacity: .5; cursor: default; }
.linkbtn { font: inherit; font-size: .9rem; color: var(--muted); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn:focus-visible, .opt:focus-visible, .chip:focus-visible, .trio:focus-visible, .linkbtn:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }

label.field, .field { display: block; font-weight: 650; margin-bottom: 6px; }
input[type="text"] {
  width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
input[type="text"]:focus { outline: 2px solid var(--plum); outline-offset: 1px; }
.error { color: var(--no); font-weight: 600; margin: 0; min-height: 1.2em; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { margin-top: 4px; width: 20px; height: 20px; flex: none; accent-color: var(--plum); }

.hero { padding: 8px 0 12px; }
.hero p { color: var(--muted); font-size: 1.05rem; }
.hero-img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: var(--radius); margin: 0 0 16px; background: var(--bg-soft); }
.steps { margin: 0; padding-left: 1.2em; }
.steps li { margin-bottom: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--plum); color: var(--plum-ink); border-color: var(--plum); }

/* one question */
.qhead { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .88rem; margin-bottom: 10px; }
.dots { display: flex; gap: 6px; }
.dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots span.on { background: var(--coral); }
.question { font-size: 1.35rem; font-weight: 750; margin-bottom: 16px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  font: inherit; text-align: left; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; cursor: pointer; min-height: 52px;
}
.opt:hover { border-color: var(--plum); }
.opt[aria-pressed="true"] { border-color: var(--plum); background: var(--plum-soft); box-shadow: inset 0 0 0 1px var(--plum); }
.suggest { margin-top: 12px; }
.suggest form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* trios */
.trios { display: flex; flex-direction: column; gap: 10px; }
.trio {
  font: inherit; text-align: left; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow);
}
.trio[aria-pressed="true"] { border-color: var(--coral); background: var(--coral-soft); box-shadow: inset 0 0 0 2px var(--coral); }
.trio ul, .labels { list-style: none; margin: 0; padding: 0; }
.trio li, .labels li { padding: 3px 0 3px 18px; position: relative; }
.trio li::before, .labels li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }

/* statistics */
.bar { margin: 6px 0; }
.bar .lbl { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.bar .track { height: 8px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin-top: 3px; }
.bar .fill { height: 100%; background: var(--plum); opacity: .35; border-radius: 99px; }
.bar.mine .fill { opacity: 1; background: var(--coral); }
.bar.mine .lbl { font-weight: 700; }

/* matches */
.found { border-left: 3px solid var(--coral); padding-left: 12px; margin: 10px 0; }
.found .when { font-size: .85rem; color: var(--muted); }
.guess { margin: 12px 0; }
.guess .q { font-weight: 650; margin-bottom: 6px; }
.verdict { font-size: .92rem; margin: 4px 0; }
.verdict.hit { color: var(--ok); font-weight: 650; }
.contact { font-size: 1.1rem; font-weight: 700; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--coral); color: #fff; margin-left: 6px; vertical-align: middle; }

.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; font-size: .85rem; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 10;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 650;
  box-shadow: var(--shadow); transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.reveal { text-align: center; padding: 28px 20px; }
.reveal .threads { width: 160px; height: 60px; margin: 0 auto 10px; display: block; }
.reveal h2 { font-size: 1.5rem; }

details summary { cursor: pointer; font-weight: 650; }
details[open] summary { margin-bottom: 8px; }
.faq { padding: 4px 0 28px; }
.faq h2 { margin: 0 0 12px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.faq[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.offscreen { position: fixed; opacity: 0; pointer-events: none; }
