/* Cupid's Algorithm — styles */
:root {
  --bg: #fbf4ec;
  --bg-2: #f5e9dc;
  --surface: #ffffff;
  --surface-2: #f7eee5;
  --ink: #241634;
  --muted: #64536f;
  --line: #e4d4c5;
  --rose: #c42a55;
  --rose-soft: #fde3ea;
  --moon: #136f82;
  --moon-soft: #dcf2f4;
  --gold: #9a6700;
  --gold-bright: #ffc94a;
  --gold-soft: #fff1c9;
  --rogue: #7a2fe0;
  --bad: #c0392b;
  --good: #1d7a4a;
  --shadow: 0 1px 2px rgba(36, 22, 52, .06), 0 8px 24px rgba(36, 22, 52, .08);
  --radius: 16px;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #150c24;
  --bg-2: #1c1130;
  --surface: #221639;
  --surface-2: #2b1d48;
  --ink: #f6eefc;
  --muted: #bcaacd;
  --line: #3b2b5c;
  --rose: #ff7096;
  --rose-soft: #3f1c35;
  --moon: #5fd6df;
  --moon-soft: #133240;
  --gold: #ffcf5a;
  --gold-bright: #ffc94a;
  --gold-soft: #3a2c16;
  --rogue: #bf98ff;
  --bad: #ff8a7a;
  --good: #6be3a1;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% -10%, var(--rose-soft) 0, transparent 40%),
    radial-gradient(circle at 100% 0, var(--moon-soft) 0, transparent 35%);
  background-repeat: no-repeat;
  min-height: 100vh;
  overflow-x: hidden;
}

img, svg { max-width: 100%; }

a { color: var(--rose); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 2px; border-radius: 6px; }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px;
}
.skip:focus { left: 8px; }

.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;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 7vw, 3.8rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 4.6vw, 2.4rem); font-weight: 650; }
h3 { font-size: 1.25rem; font-weight: 650; }
p { margin: 0 0 1em; }
em.hl { font-style: italic; color: var(--rose); }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 1080px; margin: 0 auto; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin-right: auto; }
.logo svg { width: 30px; height: 30px; flex: none; }
.main-nav { order: 3; width: 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  flex: none; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem;
  padding: 6px 12px; border-radius: 999px; border: 1px solid transparent;
}
.main-nav a:hover { color: var(--ink); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 1.05rem;
}
.icon-btn:hover { background: var(--surface-2); }
@media (min-width: 760px) {
  .main-nav { order: 0; width: auto; }
  .logo { margin-right: 12px; }
  .header-inner { flex-wrap: nowrap; }
  .main-nav { margin-right: auto; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: .98rem; line-height: 1.2;
  padding: 11px 18px; border-radius: 999px; cursor: pointer; text-decoration: none;
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
  min-height: 44px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-primary { background: var(--rose); border-color: var(--rose); color: #fff; }
[data-theme="dark"] .btn-primary { color: #1a0d1f; }
.btn-primary:hover { box-shadow: 0 4px 0 color-mix(in srgb, var(--rose) 55%, #000); }
.btn-moon { background: var(--moon); border-color: var(--moon); color: #fff; }
[data-theme="dark"] .btn-moon { color: #08222a; }
.btn-ghost { border-color: var(--line); background: transparent; }
.btn-small { padding: 7px 12px; font-size: .88rem; min-height: 36px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- hero ---------- */
.hero { padding: 34px 0 10px; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--rose); background: var(--rose-soft); padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.hero-lede { font-size: clamp(1.05rem, 2.6vw, 1.25rem); color: var(--muted); max-width: 640px; }
.hero h1 .swash { font-style: italic; color: var(--rose); }
.hero-grid { display: grid; gap: 18px; }
.hero-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.mode-card {
  display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); transition: transform .15s ease;
}
.mode-card:hover { transform: translateY(-3px) rotate(-.4deg); }
.mode-card .mc-emoji { font-size: 1.6rem; display: block; }
.mode-card strong { display: block; font-family: var(--font-display); font-size: 1.08rem; margin: 4px 0 2px; }
.mode-card span.mc-sub { color: var(--muted); font-size: .88rem; display: block; line-height: 1.35; }
@media (min-width: 760px) { .hero-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  padding: 18px; margin: 20px 0;
}
@media (min-width: 760px) { .panel { padding: 26px; } }
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
section { scroll-margin-top: 110px; }

/* ---------- controls ---------- */
.controls { display: grid; gap: 12px; margin: 14px 0; }
@media (min-width: 760px) { .controls { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; } }
.field label, .field .label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--rose); }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface-2); flex-wrap: wrap; }
.seg button {
  font: inherit; font-weight: 700; font-size: .88rem; border: 0; background: transparent; color: var(--muted);
  padding: 7px 12px; border-radius: 999px; cursor: pointer; min-height: 36px;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button.rose[aria-pressed="true"] { background: var(--rose); color: #fff; }
.seg button.moon[aria-pressed="true"] { background: var(--moon); color: #fff; }
[data-theme="dark"] .seg button.rose[aria-pressed="true"] { color: #1a0d1f; }
[data-theme="dark"] .seg button.moon[aria-pressed="true"] { color: #08222a; }
select, input[type="text"] {
  font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 12px;
  padding: 9px 12px; min-height: 44px; width: 100%;
}
input[type="text"]:focus, select:focus { border-color: var(--rose); outline: none; }

/* ---------- board ---------- */
.board-wrap { margin: 10px 0; }
.board-head { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-bottom: 8px; }
.house { font-family: var(--font-display); font-weight: 700; font-size: .98rem; }
.house-rose { color: var(--rose); }
.house-moon { color: var(--moon); text-align: right; }
.board {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(54px, 18vw, 180px);
}
.board-lines { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: visible; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.guest {
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--surface-2); border: 2px solid var(--line); border-radius: 14px;
  padding: 7px 9px; display: flex; flex-direction: column; gap: 3px; min-width: 0; width: 100%;
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
  position: relative;
}
.guest:hover { border-color: var(--muted); }
.guest .g-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.guest .g-emoji { font-size: 1.45rem; line-height: 1; flex: none; }
.guest .g-name { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.guest .g-badge { font-size: .72rem; font-weight: 700; color: var(--muted); flex: none; font-family: var(--font-mono); }
.guest .g-prefs { display: flex; flex-wrap: wrap; gap: 1px; font-size: .82rem; line-height: 1.2; }
.mini { display: inline-block; padding: 0 1px; border-radius: 6px; border: 1.5px solid transparent; transition: opacity .2s; }
.mini.held { border-color: var(--gold); background: var(--gold-soft); }
.mini.struck { opacity: .28; text-decoration: line-through; filter: grayscale(1); }
.mini.hot { border-color: var(--rogue); background: color-mix(in srgb, var(--rogue) 18%, transparent); }
.side-rose { border-left: 5px solid var(--rose); }
.side-moon { border-right: 5px solid var(--moon); }
.guest.asking { border-color: var(--rose); background: var(--rose-soft); transform: scale(1.03); box-shadow: var(--shadow); }
.guest.asked { border-color: var(--moon); background: var(--moon-soft); transform: scale(1.03); box-shadow: var(--shadow); }
.guest.paired { background: var(--surface); }
.guest.selected { border-color: var(--gold-bright); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold-bright) 45%, transparent); transform: scale(1.03); }
.guest.rogue { border-color: var(--rogue); animation: wobble .5s ease 2; }
.guest.single { opacity: .8; border-style: dashed; }
.guest.you { box-shadow: 0 0 0 3px var(--moon); }
.guest.you::after {
  content: 'YOU'; position: absolute; top: -9px; right: 8px; font-size: .62rem; font-weight: 800; letter-spacing: .08em;
  background: var(--moon); color: #fff; padding: 1px 6px; border-radius: 6px;
}
.guest.flash-bad { animation: shake .35s ease; border-color: var(--bad); }
.guest.flash-good { border-color: var(--rogue); background: color-mix(in srgb, var(--rogue) 14%, var(--surface)); }

@media (max-width: 420px) {
  .panel { padding: 14px 12px; }
  .board { column-gap: 46px; }
  .guest { padding: 6px 6px; }
  .side-rose { border-left-width: 4px; }
  .side-moon { border-right-width: 4px; }
  .guest .g-emoji { font-size: 1.25rem; }
  .guest .g-name { font-size: .84rem; }
  .guest .g-prefs { font-size: .74rem; }
}

.ln { fill: none; stroke-width: 3; stroke-linecap: round; }
.ln-held { stroke: var(--gold-bright); }
[data-theme="light"] .ln-held { stroke: #e0a400; }
.ln-propose { stroke: var(--rose); stroke-dasharray: 6 6; animation: dash 0.6s linear infinite; }
.ln-reject { stroke: var(--bad); stroke-dasharray: 3 6; opacity: .8; }
.ln-rogue, .ln-found { stroke: var(--rogue); stroke-width: 3.5; }
.ln-rogue { animation: flicker .5s ease-in-out infinite alternate; }
.ln-pick { stroke: var(--moon); }
.ln-ghost { stroke: var(--muted); opacity: .35; stroke-dasharray: 2 5; }
.lg { stroke-width: 2; }
.lg-held { fill: var(--surface); stroke: #e0a400; }
.lg-propose { fill: var(--surface); stroke: var(--rose); }
.lg-reject { fill: var(--surface); stroke: var(--bad); }
.lg-rogue, .lg-found { fill: var(--surface); stroke: var(--rogue); }
.lt { font-size: 11px; font-weight: 800; font-family: var(--font-body); }
.lt-held { fill: var(--rose); }
.lt-propose { fill: var(--rose); }
.lt-reject { fill: var(--bad); }
.lt-rogue, .lt-found { fill: var(--rogue); }

@keyframes dash { to { stroke-dashoffset: -12; } }
@keyframes flicker { from { opacity: .35; } to { opacity: 1; } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- machine ---------- */
.player { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.progress { flex: 1 1 140px; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--rose), var(--gold-bright)); transition: width .2s; }
.narration {
  min-height: 3.4em; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-size: .98rem;
  border: 1px solid var(--line);
}
.narration strong { color: var(--rose); }
.log {
  max-height: 180px; overflow-y: auto; font-family: var(--font-mono); font-size: .78rem; color: var(--muted);
  padding: 8px 12px; margin: 8px 0 0; list-style: none; border-left: 3px solid var(--line);
}
.log li { padding: 2px 0; }
.log li.cur { color: var(--ink); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat.rose b { color: var(--rose); }
.stat.moon b { color: var(--moon); }
.verdict {
  border-radius: 16px; padding: 14px 16px; margin: 12px 0; border: 2px solid var(--gold-bright);
  background: var(--gold-soft); animation: pop .4s ease;
}
.verdict h3 { margin-bottom: 4px; }
.profile { display: flex; gap: 12px; align-items: flex-start; }
.profile .big { font-size: 2.4rem; line-height: 1; }
.profile ol { margin: 6px 0 0; padding-left: 1.3em; font-size: .9rem; }

/* ---------- explainer ---------- */
.steps { display: grid; gap: 12px; counter-reset: step; padding: 0; list-style: none; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.steps li {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 16px 58px; position: relative;
}
.steps li::before {
  counter-increment: step; content: counter(step); position: absolute; left: 14px; top: 14px; width: 32px; height: 32px;
  border-radius: 50%; background: var(--rose); color: #fff; display: grid; place-items: center; font-weight: 800; font-family: var(--font-display);
}
[data-theme="dark"] .steps li::before { color: #1a0d1f; }
.callouts { display: grid; gap: 12px; }
@media (min-width: 760px) { .callouts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.callout { border-radius: var(--radius); padding: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.callout .ce { font-size: 1.8rem; }
.fact-strip { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .fact-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.fact b { display: block; font-family: var(--font-display); font-size: 1.7rem; color: var(--rose); line-height: 1.1; }
.fact span { font-size: .85rem; color: var(--muted); display: block; }

/* ---------- play ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.tab {
  font: inherit; font-weight: 700; cursor: pointer; padding: 10px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); color: var(--muted); min-height: 44px;
}
.tab[aria-selected="true"] { color: var(--ink); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.lvl {
  font: inherit; font-weight: 800; cursor: pointer; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 12px; padding: 6px 2px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.lvl small { font-size: .7rem; letter-spacing: 1px; color: var(--gold); font-weight: 700; }
.lvl[aria-current="true"] { border-color: var(--rose); background: var(--rose-soft); }
.lvl.locked { opacity: .45; }
.hud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 8px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: .88rem;
  background: var(--surface-2); border: 1px solid var(--line);
}
.chip.rogue { color: var(--rogue); }
.chip.good { color: var(--good); }
.chip.timer { font-family: var(--font-mono); }
.chip.timer.low { color: var(--bad); animation: flicker .5s infinite alternate; }
.howto { font-size: .92rem; color: var(--muted); margin: 6px 0 10px; }
.cheat-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.cheat-list li {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px 8px;
}
.cheat-list li.cut { opacity: .5; }
.cheat-list li.cut .cl-name { text-decoration: line-through; }
.cheat-list .cl-rank { font-family: var(--font-mono); font-weight: 700; width: 2.2em; text-align: center; color: var(--moon); }
.cheat-list .cl-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cheat-list .cl-true { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.cheat-list button {
  font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; flex: none; font-size: .95rem;
}
.cheat-list button[aria-pressed="true"] { background: var(--bad); color: #fff; border-color: var(--bad); }
.two-col { display: grid; gap: 16px; }
@media (min-width: 900px) { .two-col { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }

/* ---------- friends ---------- */
.side-editor { display: grid; gap: 14px; }
@media (min-width: 760px) { .side-editor { grid-template-columns: 1fr 1fr; } }
.side-box { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface-2); min-width: 0; }
.side-box.rose { border-color: color-mix(in srgb, var(--rose) 45%, var(--line)); }
.side-box.moon { border-color: color-mix(in srgb, var(--moon) 45%, var(--line)); }
.name-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.name-row input { flex: 1; min-width: 0; }
.emoji-btn { font-size: 1.3rem; width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; flex: none; }
.del-btn { width: 40px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; flex: none; font: inherit; font-size: 1.1rem; }
.rank-grid { display: grid; gap: 10px; }
@media (min-width: 760px) { .rank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rank-card { border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--surface); min-width: 0; }
.rank-card h4 { margin: 0 0 6px; font-size: .95rem; display: flex; gap: 6px; align-items: center; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank-list li { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 10px; padding: 3px 6px; font-size: .9rem; }
.rank-list .rk { font-family: var(--font-mono); font-weight: 700; width: 1.6em; color: var(--muted); }
.rank-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.rank-list button:disabled { opacity: .3; cursor: default; }
.pairs { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.pairs li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px;
}
.pairs .pa { text-align: right; min-width: 0; }
.pairs .pb { min-width: 0; }
.pairs .pn { font-weight: 700; display: block; overflow-wrap: anywhere; }
.pairs .pr { font-size: .78rem; color: var(--muted); }
.pairs .heart { font-size: 1.3rem; color: var(--rose); animation: pop .4s ease both; }
.cert-preview { width: 100%; max-width: 540px; border-radius: 16px; border: 1px solid var(--line); display: block; margin: 10px auto; }

/* ---------- quiz ---------- */
.quiz-card { max-width: 720px; margin: 0 auto; }
.q-meta { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: .88rem; margin-bottom: 8px; }
.q-text { font-family: var(--font-display); font-size: clamp(1.25rem, 3.6vw, 1.6rem); line-height: 1.25; margin-bottom: 14px; }
.options { display: grid; gap: 8px; }
.opt {
  font: inherit; text-align: left; cursor: pointer; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface-2); color: var(--ink); font-weight: 600; min-height: 48px;
}
.opt:hover:not(:disabled) { border-color: var(--ink); }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--surface)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.opt:disabled { cursor: default; }
.explain { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); border: 1px solid var(--line); animation: pop .3s ease; }
.explain .src { font-size: .78rem; color: var(--muted); }
.score-big { font-family: var(--font-display); font-size: clamp(3rem, 12vw, 5rem); color: var(--rose); line-height: 1; }
.banner {
  border-radius: 14px; padding: 12px 14px; background: var(--moon-soft); border: 1px solid var(--line); margin: 12px 0;
}
.dots { display: flex; gap: 4px; margin: 6px 0 14px; }
.dots span { flex: 1; height: 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.dots span.ok { background: var(--good); border-color: var(--good); }
.dots span.no { background: var(--bad); border-color: var(--bad); }
.dots span.now { background: var(--gold-bright); border-color: var(--gold-bright); }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 6, 28, .6); display: grid; place-items: center; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--surface); color: var(--ink); border-radius: 22px; padding: 22px; max-width: 460px; width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4); text-align: center; animation: pop .35s ease; max-height: 90vh; overflow-y: auto;
}
.modal-box .stars { font-size: 2.2rem; letter-spacing: 4px; }
.modal-box .btn-row { justify-content: center; margin-top: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 30px); opacity: 0; z-index: 80;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: .92rem;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- prose / about ---------- */
.prose h2 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .3em 0; }
.sources li { overflow-wrap: anywhere; font-size: .92rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 26px 0 40px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }

.floaty { display: inline-block; animation: floaty 3s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .ln-propose, .ln-rogue { animation: none !important; }
}
