:root {
    --bg: #faf7fb;
    --surface: #ffffff;
    --surface-2: #f3eef6;
    --text: #1d1622;
    --muted: #6d6375;
    --line: #e7dfec;
    --accent: #e0306b;
    --accent-2: #7c3aed;
    --accent-soft: #fde7ef;
    --good: #16a34a;
    --bad: #dc2626;
    --shadow: 0 1px 2px rgba(29, 22, 34, .04), 0 8px 24px rgba(29, 22, 34, .06);
    --radius: 18px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #120e16;
        --surface: #1c1622;
        --surface-2: #261e2e;
        --text: #f4eef8;
        --muted: #a79bb1;
        --line: #33293d;
        --accent: #ff4f8b;
        --accent-2: #a78bfa;
        --accent-soft: #3a1828;
        --good: #4ade80;
        --bad: #f87171;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #120e16;
    --surface: #1c1622;
    --surface-2: #261e2e;
    --text: #f4eef8;
    --muted: #a79bb1;
    --line: #33293d;
    --accent: #ff4f8b;
    --accent-2: #a78bfa;
    --accent-soft: #3a1828;
    --good: #4ade80;
    --bad: #f87171;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand .logo { display: block; }
.steps { display: flex; gap: 4px; }
.steps a {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: 999px;
    color: var(--muted); text-decoration: none; font-size: 14px;
}
.steps a b {
    display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: var(--surface-2); font-size: 12px;
}
.steps a.done b { background: var(--accent); color: #fff; }
.steps a:hover { color: var(--text); }
@media (max-width: 560px) { .steps a span { display: none; } .steps a { padding: 6px; } }

/* ---------- layout ---------- */
main { max-width: 960px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
@media (max-width: 560px) { .card { padding: 18px 16px; } }

.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
h1 { margin: 0 0 8px; font-size: clamp(28px, 5vw, 42px); line-height: 1.1; letter-spacing: -.03em; }
h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
h3 { margin: 28px 0 12px; font-size: 18px; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.hero {
    background:
        radial-gradient(1200px 300px at 0% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent),
        radial-gradient(800px 300px at 100% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent),
        var(--surface);
}

.anon {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; border-radius: 14px;
    background: var(--surface-2); font-size: 15px;
}
.anon-icon { font-size: 22px; line-height: 1; }

.gender { border: 0; padding: 0; margin: 20px 0 12px; }
.gender legend { font-weight: 700; margin-bottom: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
    padding: 10px 18px; border-radius: 999px;
    border: 1.5px solid var(--line); background: var(--surface);
    font-weight: 600; transition: all .15s;
}
.pill:hover { border-color: var(--accent); }
.pill[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; margin: 16px 0; border-bottom: 1px solid var(--line); }
.tab {
    padding: 8px 14px; border: 0; background: none;
    border-bottom: 2.5px solid transparent; margin-bottom: -1px;
    font-weight: 700; color: var(--muted);
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { font-weight: 600; font-size: 12px; color: var(--accent); }

/* ---------- celebrity grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
@media (max-width: 400px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

.celeb {
    border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden;
    background: var(--surface); transition: border-color .15s, transform .15s;
}
.celeb.rated { border-color: var(--accent); }
.photo {
    position: relative; aspect-ratio: 4 / 5; background: var(--surface-2); overflow: hidden;
}
.photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; display: block; }
.photo .initials {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-size: 34px; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.photo .badge {
    position: absolute; top: 8px; right: 8px;
    min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
    display: grid; place-items: center;
    background: var(--accent); color: #fff; font-weight: 800; font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.celeb .name { padding: 8px 10px 4px; font-weight: 700; font-size: 14px; line-height: 1.25; min-height: 2.5em; }
.scores { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px 8px 10px; }
.scores button {
    padding: 5px 0; border-radius: 8px; border: 1px solid var(--line);
    background: var(--surface-2); font-size: 13px; font-weight: 700;
}
.scores button:hover { border-color: var(--accent); }
.scores button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.missing { margin: 16px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 14px; }
.bubble { max-width: 85%; padding: 12px 16px; border-radius: 18px; }
.bubble.bot { background: var(--surface-2); border-bottom-left-radius: 6px; align-self: flex-start; }
.bubble.user { white-space: pre-wrap; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.bubble .example { display: block; margin-top: 8px; color: var(--muted); font-size: 14px; font-style: italic; }
.bubble.typing { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); }
.chip.like { color: var(--good); }
.chip.dislike { color: var(--bad); }

.composer { border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); }
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
    display: block; width: 100%; border: 0; outline: 0; resize: vertical;
    padding: 12px 14px; background: transparent; min-height: 120px;
}
.composer-foot { display: flex; justify-content: flex-end; padding: 0 12px 8px; font-size: 13px; }
.composer-foot .over { color: var(--bad); font-weight: 700; }

.writeins { margin: 16px 0; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.writeins-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; font-size: 14px; }
.writein { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; margin-bottom: 8px; }
.writein input, .writein select {
    padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); min-width: 0;
}
.writein .remove { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 0 6px; }
@media (max-width: 480px) {
    .writein { grid-template-columns: 1fr 1fr auto; }
    .writein input { grid-column: 1 / -1; }
}

.ghost {
    border: 1.5px dashed var(--line); background: transparent; border-radius: 10px;
    padding: 8px 14px; font-weight: 600; color: var(--muted);
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }

.primary {
    width: 100%; padding: 14px 18px; border: 0; border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
    font-weight: 800; font-size: 17px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
    transition: transform .1s, opacity .15s;
}
.primary:active { transform: scale(.99); }
.primary:disabled { opacity: .55; cursor: default; }
.error { color: var(--bad); font-weight: 600; min-height: 1.5em; margin: 8px 0; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- results ---------- */
.locked { text-align: center; padding: 28px 12px; border-radius: 14px; background: var(--surface-2); }
.locked p { margin: 0 0 12px; font-weight: 600; }

.stats { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-top: 12px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(3, 1fr); } .stat.big { grid-column: 1 / -1; } }
.stat { padding: 14px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; }
.stat span { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat.big span { font-size: 38px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat small { color: var(--muted); font-weight: 600; }

.match {
    margin-top: 12px; padding: 16px; border-radius: 14px;
    background: var(--accent-soft); display: flex; gap: 14px; align-items: center;
}
.match .pct { font-size: 34px; font-weight: 800; color: var(--accent); white-space: nowrap; }

.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 18px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li {
    display: grid; grid-template-columns: 28px 40px 1fr auto; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 12px; background: var(--surface-2);
}
.board .rank { font-weight: 800; color: var(--muted); text-align: center; }
.board li:nth-child(1) .rank { color: #eab308; }
.board li:nth-child(2) .rank { color: #94a3b8; }
.board li:nth-child(3) .rank { color: #c2763a; }
.board .avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; position: relative; background: var(--surface); }
.board .avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.board .avatar .initials { font-size: 14px; }
.board .who { min-width: 0; }
.board .who .n { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .who .n .tag { font-size: 11px; font-weight: 700; color: var(--accent-2); margin-left: 6px; }
.bar { height: 6px; border-radius: 999px; background: var(--line); margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.board .score { text-align: right; }
.board .score b { font-size: 18px; }
.board .score small { display: block; color: var(--muted); font-size: 12px; }
.board .you { color: var(--accent); font-weight: 700; }
.board .unrated { opacity: .55; }

.traits { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.trait-col { padding: 14px; border-radius: 14px; background: var(--surface-2); }
.trait-col h4 { margin: 0 0 10px; font-size: 15px; }
.trait-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 40px; gap: 8px; align-items: center; font-size: 14px; margin-bottom: 6px; }
.trait-row .bar { margin: 0; }
.trait-row.dislike .bar i { background: var(--bad); }
.trait-row .pct { text-align: right; color: var(--muted); font-size: 12px; font-weight: 600; }
.empty { color: var(--muted); font-size: 14px; }

.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 16px 32px; }

.privacy { margin-top: 8px; font-size: 13px; }
.privacy summary { cursor: pointer; font-weight: 600; }
.privacy ul { margin: 8px 0 0; padding-left: 18px; }
.privacy li { margin: 4px 0; }

.rate-head { margin: 24px 0 10px; }
.rate-head .count { font-weight: 600; font-size: 13px; color: var(--accent); }
.board-head { margin: 18px 0 8px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
