:root {
    --bg: #14101f;
    --bg-2: #1d1730;
    --card: #231c3a;
    --card-2: #2c2448;
    --line: #3a3060;
    --text: #f4f1ff;
    --muted: #aaa2c8;
    --accent: #ffb547;
    --accent-2: #ff6b8b;
    --liked: #3ddc97;
    --disliked: #ff5d6c;
    --interested: #ffc93c;
    --radius: 18px;
    --shadow: 0 18px 40px rgb(0 0 0 / 0.35);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1000px 600px at 90% -10%, rgb(255 107 139 / 0.16), transparent 60%),
        radial-gradient(900px 600px at -10% 10%, rgb(124 92 255 / 0.18), transparent 60%),
        var(--bg);
}

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; margin-top: 1.1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }
a { color: var(--accent); }
code { background: var(--card-2); padding: .1em .4em; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-header {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
    padding: 14px 16px; max-width: 1040px; width: 100%; margin: 0 auto;
}
.brand { font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: -.01em; font-size: 1.1rem; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; }
.nav a:hover { color: var(--text); }
.nav a.active { background: var(--card-2); color: var(--text); }

.container { max-width: 1040px; width: 100%; margin: 0 auto; padding: 8px 16px 40px; flex: 1; }
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px; }
.site-footer p { margin: 0 0 4px; }
.attribution { max-width: 560px; margin: 14px auto 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: .78rem; }
.attribution a { color: var(--muted); }
.attribution__tmdb { display: inline-block; margin-bottom: 6px; font-weight: 700; color: var(--text) !important; text-decoration: none; }
.attribution__tmdb img { display: block; height: 12px; width: auto; }
.source { font-size: .8rem; }
.source a { color: var(--muted); }

.card {
    background: linear-gradient(180deg, var(--card), var(--bg-2));
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.narrow { max-width: 520px; margin-inline: auto; }
.narrow-wide { max-width: 760px; margin-inline: auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.hint { color: var(--muted); font-size: .88rem; margin: .5rem 0; }
.count { font-size: .85rem; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; vertical-align: middle; color: var(--muted); }

.hero { text-align: center; padding: 24px 0 28px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); letter-spacing: -.03em; }
.hero--small { padding: 12px 0 18px; }
.hero--small h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.lead { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 1.05rem; }

input:not([type=checkbox]), select {
    display: block; width: 100%; padding: 12px 14px;
    font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    padding: 12px 20px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--card-2); color: var(--text);
    font-family: inherit; font-size: 1rem; font-weight: 700; line-height: 1.1;
    cursor: pointer; text-decoration: none; transition: transform .1s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #1b1026; border: 0; }
.btn-ghost { background: transparent; }
.btn-small { padding: 7px 13px; font-size: .88rem; }

.flash, .warning { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.flash { background: rgb(61 220 151 / .14); border: 1px solid rgb(61 220 151 / .4); }
.warning { background: rgb(255 93 108 / .12); border: 1px solid rgb(255 93 108 / .4); }
.error { color: var(--disliked); font-weight: 600; margin: 0; font-size: .9rem; }

/* Avatars */
.avatar { flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; background: hsl(var(--hue) 70% 62%); color: #1b1026; width: 34px; height: 34px; }
.avatar--xs { width: 20px; height: 20px; font-size: .7rem; vertical-align: -5px; }
.avatar--sm { width: 28px; height: 28px; font-size: .85rem; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.7rem; }
.avatar--new { background: var(--card-2); color: var(--muted); border: 2px dashed var(--line); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--card); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* People */
.people-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 20px; }
.person-card {
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
    background: linear-gradient(180deg, var(--card), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px;
}
.person-card h2 { margin: 4px 0 0; overflow-wrap: anywhere; }
.person-card p { margin: 0; }
.person-card__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.person-card--new { border-style: dashed; justify-content: center; }

/* Posters */
.poster {
    position: relative; flex: none; overflow: hidden; border-radius: 14px;
    background: linear-gradient(150deg, hsl(var(--hue) 70% 55%), hsl(calc(var(--hue) + 50) 60% 28%));
    display: grid; place-items: center; aspect-ratio: 2 / 3;
}
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster__initials { font-weight: 900; font-size: 3rem; letter-spacing: -.04em; color: rgb(255 255 255 / .9); text-shadow: 0 4px 20px rgb(0 0 0 / .35); }
.poster__type { position: absolute; top: 8px; left: 8px; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: rgb(0 0 0 / .45); color: #fff; padding: 2px 8px; border-radius: 6px; }
.poster--lg { width: 220px; }
.poster--md { width: 110px; border-radius: 10px; }
.poster--md .poster__initials { font-size: 2rem; }
.poster--sm { width: 48px; border-radius: 8px; }
.poster--sm .poster__initials { font-size: 1rem; }
.poster--sm .poster__type { display: none; }

.meta, .tags { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); }
.tags li { background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .85rem; color: var(--text); }
.rating-badge { font-weight: 800; color: #1b1026 !important; border-radius: 6px; padding: 0 7px; background: #ccc; }
.rating-u { background: #3ddc97; } .rating-pg { background: #ffd447; } .rating-12 { background: #ff9f43; }
.rating-15 { background: #ff6b8b; } .rating-18 { background: #ff3b4e; color: #fff !important; }
.overview { color: #dcd6f5; margin: 0; }

/* Swipe */
.swipe-top { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 14px; }
.swipe-top p { margin: 0; }
.switcher { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.switcher__item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-weight: 600; }
.switcher__item.is-current { background: var(--card-2); color: var(--text); border-color: var(--accent); }

.swipe-wrap { max-width: 720px; margin: 0 auto; }
.swipe-card {
    display: flex; gap: 22px; width: 100%; padding: 22px; border-radius: 24px; text-align: left;
    font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
    background: linear-gradient(180deg, var(--card), var(--bg-2)); border: 1px solid var(--line); box-shadow: var(--shadow);
    transition: transform .22s ease, opacity .22s ease, border-color .15s ease;
}
.swipe-card:hover { border-color: var(--accent); }
.swipe-card.fly-right { transform: translateX(110%) rotate(10deg); opacity: 0; }
.swipe-card.fly-left { transform: translateX(-110%) rotate(-10deg); opacity: 0; }
.swipe-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 4px; }
.swipe-title { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; line-height: 1.15; margin-bottom: 4px; }
.match-badge { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--liked); }
.match-badge.is-learning { color: var(--muted); }
.card-overview {
    color: #dcd6f5; font-size: .95rem; margin-bottom: 4px;
    /* Keep the card a sensible size; the full text is in the details dialog. */
    display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.reason { font-size: .9rem; color: var(--accent); }
.reason::before { content: "✦ "; }
.tap-hint { margin-top: auto; padding-top: 10px; font-size: .85rem; color: var(--muted); text-decoration: underline dotted; }
@media (max-width: 600px) {
    .swipe-card { flex-direction: column; align-items: center; text-align: center; padding: 18px; }
    .swipe-body { align-items: center; }
    .swipe-card .meta, .swipe-card .tags { justify-content: center; }
    .poster--lg { width: min(190px, 55vw); }
}

.answer-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 6px; }
@media (max-width: 520px) { .answer-groups { grid-template-columns: 1fr; } }
.answer-group { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin: 0; }
.answer-group__label { margin: 0 0 8px; text-align: center; font-weight: 700; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.answer-group__buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.answer-group .btn { padding: 14px 8px; border: 0; }
.btn-liked { background: var(--liked); color: #0d2b1e; }
.btn-disliked { background: var(--disliked); color: #fff; }
.btn-interested { background: var(--interested); color: #2b1d00; }
.btn-not-interested { background: var(--card-2); color: var(--text); border: 1px solid var(--line) !important; }
.btn.is-chosen { transform: scale(1.06); box-shadow: 0 0 0 3px var(--text); }
.keys-hint { display: none; }
@media (hover: hover) and (pointer: fine) { .keys-hint { display: block; } }

.undo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: 18px; font-size: .9rem; }

/* Details dialog */
.dialog {
    width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 24px; border: 1px solid var(--line); border-radius: 20px;
    background: var(--card); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgb(8 5 16 / .7); backdrop-filter: blur(3px); }
.dialog form[method=dialog] { margin: 0; }
.dialog__close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-size: 1rem; cursor: pointer; }
.details__head { display: flex; gap: 16px; align-items: flex-start; padding-right: 36px; }
.details__name { font-size: 1.5rem; }
.details section { margin-top: 6px; }
.cast { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cast li { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; font-size: .92rem; }
.where { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.where__region h4 { margin: 0 0 6px; font-size: .95rem; }
.platform-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.platform { background: var(--accent); color: #1b1026; font-weight: 700; font-size: .88rem; border-radius: 8px; padding: 3px 10px; }
.platform--off { background: var(--card-2); color: var(--muted); text-decoration: line-through; font-weight: 500; }

/* Lists */
.title-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.title-list li { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 6px; align-items: center; }
.title-list .poster { grid-row: span 2; align-self: start; }
.title-list__text { min-width: 0; display: flex; flex-direction: column; }
.title-list__text a { color: var(--text); text-decoration: none; }
.title-list__text a:hover { text-decoration: underline; }
.title-list__actions { display: flex; flex-wrap: wrap; gap: 4px; }
.title-list__actions form { margin: 0; }
.platforms-inline { color: var(--accent); }

/* Profile */
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.profile-head__text { flex: 1; min-width: 180px; }
.profile-head__text p { margin: 0; }
.profile-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.taste-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.taste-bars li { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; font-size: .92rem; }
.bar { height: 10px; border-radius: 999px; width: max(6px, var(--w)); }
.bar--pos { background: var(--liked); }
.bar--neg { background: var(--disliked); }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
h2.inline { display: inline; }
.danger-zone { margin-top: 10px; }

/* Together */
.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; }
.filter__label { margin: 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip > span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
.chip input:checked + span { border-color: var(--accent); background: var(--card-2); box-shadow: 0 0 0 1px var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }
.match-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.match-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 10px 10px; }
.match-item.is-everyone { border-color: var(--liked); box-shadow: 0 0 0 1px var(--liked); }
.match-item__link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.match-item__text { display: flex; flex-direction: column; min-width: 0; }
.match-item__people { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.is-everyone .match-item__people .small { color: var(--liked); font-weight: 800; }

.verdicts { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.verdicts li { display: flex; align-items: center; gap: 10px; }
.verdict { margin-left: auto; font-size: .85rem; font-weight: 700; border-radius: 8px; padding: 2px 10px; }
.verdict--liked { background: var(--liked); color: #0d2b1e; }
.verdict--disliked { background: var(--disliked); color: #fff; }
.verdict--interested { background: var(--interested); color: #2b1d00; }
.verdict--not_interested { background: var(--card-2); color: var(--muted); }

/* Platforms */
.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-bottom: 16px; }
.platform-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.platform-table th, .platform-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.platform-table th[scope=row], .platform-table thead th:first-child { text-align: left; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle__track { width: 44px; height: 26px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); position: relative; transition: background .15s ease; }
.toggle__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s ease, background .15s ease; }
.toggle input:checked + .toggle__track { background: var(--liked); border-color: var(--liked); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); background: #fff; }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle__count { font-size: .8rem; color: var(--muted); min-width: 2ch; text-align: left; }
