:root {
  --bg: #fdf6ec;
  --ink: #2b2118;
  --muted: #7a6a5c;
  --card: #ffffff;
  --accent: #ff6b4a;
  --accent-2: #ffb347;
  --m2: #e5484d; --m1: #f28c6a; --z: #e8c547; --p1: #8ac926; --p2: #2a9d8f;
  --esc: #c8b8e8;
  --shadow: 0 18px 50px rgba(60, 30, 10, 0.12);
  --radius: 22px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1713; --ink: #f6efe6; --muted: #b8a999; --card: #26211c; --shadow: 0 18px 50px rgba(0,0,0,0.45);
  }
}
:root[data-theme="dark"] { --bg: #1b1713; --ink: #f6efe6; --muted: #b8a999; --card: #26211c; --shadow: 0 18px 50px rgba(0,0,0,0.45); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.5;
  min-height: 100vh; overflow-x: hidden;
}
.bg-blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.45; animation: drift 24s ease-in-out infinite alternate; }
.b1 { width: 55vw; height: 55vw; left: -15vw; top: -20vw; background: #ffd6a5; }
.b2 { width: 45vw; height: 45vw; right: -10vw; top: 20vh; background: #caffbf; animation-delay: -8s; }
.b3 { width: 50vw; height: 50vw; left: 20vw; bottom: -25vw; background: #bdb2ff; animation-delay: -16s; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(6vw, 4vh) scale(1.08); } }

#app { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.screen { display: none; }
.screen.active { display: block; animation: rise 0.45s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.card.hero { text-align: center; }
h1 { font-family: "Fraunces", Georgia, serif; font-weight: 800; font-size: clamp(2rem, 5vw, 3.2rem); margin: 8px 0 10px; letter-spacing: -0.01em; }
h2 { font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: 1.9rem; margin: 0 0 8px; }
h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.25rem; margin: 26px 0 6px; }
.lede { font-size: 1.05rem; color: var(--ink); max-width: 62ch; margin: 0 auto 14px; }
.howto { text-align: left; background: rgba(255, 179, 71, 0.12); border-radius: 16px; padding: 14px 18px; margin: 14px 0 18px; font-size: 0.95rem; }
.howto p { margin: 6px 0; }
.tiny { font-size: 0.85rem; color: var(--muted); margin: 8px 0; }
kbd { background: rgba(0,0,0,0.08); border-radius: 6px; padding: 1px 6px; font-family: inherit; font-weight: 700; font-size: 0.85em; }

.mascot-hero { font-size: 64px; animation: bob 2.4s ease-in-out infinite; display: inline-block; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }

.name-label { display: block; font-weight: 700; margin-top: 6px; }
#name { font: inherit; font-size: 1.1rem; padding: 10px 14px; border-radius: 14px; border: 2px solid rgba(0,0,0,0.12); width: min(100%, 340px); margin: 6px 0 14px; background: var(--card); color: var(--ink); }
#name:focus { outline: none; border-color: var(--accent); }

.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 16px; padding: 12px 18px; cursor: pointer; color: var(--ink); background: rgba(0,0,0,0.06); transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s; }
.btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn.big { font-size: 1.15rem; padding: 14px 26px; }
.btn.ghost { background: transparent; border: 2px solid rgba(0,0,0,0.12); }
.btn.hidden { display: none; }

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.progress { position: relative; flex: 1; height: 14px; background: rgba(0,0,0,0.08); border-radius: 99px; overflow: visible; }
.bar { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s cubic-bezier(.2,.8,.2,1); }
.mascot { position: absolute; top: -22px; left: 0%; font-size: 26px; transform: translateX(-50%); transition: left 0.4s cubic-bezier(.2,.8,.2,1); animation: waddle 0.8s ease-in-out infinite; }
@keyframes waddle { 0%,100% { transform: translateX(-50%) rotate(-8deg); } 50% { transform: translateX(-50%) rotate(8deg); } }
.counter { font-weight: 800; color: var(--muted); min-width: 70px; text-align: right; }

.question { position: relative; }
.question.swap { animation: swap 0.35s ease-out; }
@keyframes swap { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { display: inline-block; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,0.07); }
.chip.theme { background: rgba(255, 107, 74, 0.15); color: #b33c22; }
.chip.part-E { background: rgba(42, 157, 143, 0.18); color: #1b6f65; }
.chip.part-N { background: rgba(189, 178, 255, 0.35); color: #4b3fa3; }
.chip.part-P { background: rgba(255, 179, 71, 0.3); color: #8a5a00; }
.premise { font-family: "Fraunces", Georgia, serif; font-size: clamp(1.25rem, 2.6vw, 1.7rem); line-height: 1.35; margin: 6px 0 22px; min-height: 2.6em; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale .btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; font-size: 0.9rem; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.scale .k, .escapes .k { font-size: 0.7rem; opacity: 0.8; background: rgba(0,0,0,0.18); border-radius: 6px; padding: 0 6px; }
.s-m2 { background: var(--m2); } .s-m1 { background: var(--m1); } .s-0 { background: var(--z); color: #3b3100 !important; text-shadow: none !important; } .s-p1 { background: var(--p1); } .s-p2 { background: var(--p2); }
.scale .btn.chosen, .escapes .btn.chosen { outline: 4px solid var(--ink); outline-offset: 2px; }
.escapes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.escapes .btn { background: var(--esc); color: #2b2158; display: flex; gap: 8px; align-items: center; justify-content: center; }
.why-label { display: block; font-weight: 700; margin-top: 16px; font-size: 0.9rem; }
#why { width: 100%; font: inherit; font-size: 0.95rem; padding: 10px 12px; border-radius: 12px; border: 2px solid rgba(0,0,0,0.1); margin-top: 6px; resize: vertical; background: var(--card); color: var(--ink); }
#why:focus { outline: none; border-color: var(--accent-2); }
.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

.floaty { position: fixed; font-size: 40px; pointer-events: none; z-index: 50; animation: floatup 1.1s ease-out forwards; }
@keyframes floatup { 0% { opacity: 1; transform: translate(-50%, 0) scale(0.6) rotate(0); } 60% { opacity: 1; transform: translate(-50%, -90px) scale(1.2) rotate(12deg); } 100% { opacity: 0; transform: translate(-50%, -160px) scale(1) rotate(-10deg); } }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.camp { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; margin: 8px 0; }
.camp .label { font-weight: 700; }
.camp .meta { font-size: 0.8rem; color: var(--muted); }
.camp .track { grid-column: 1 / -1; height: 10px; background: rgba(0,0,0,0.08); border-radius: 99px; overflow: hidden; }
.camp .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--p2), var(--p1)); width: 0; transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.camp.far .fill { background: linear-gradient(90deg, var(--m2), var(--m1)); }
.theme-row { display: grid; grid-template-columns: 180px 1fr 60px; gap: 10px; align-items: center; margin: 6px 0; font-size: 0.95rem; }
.theme-row .axis { position: relative; height: 10px; background: linear-gradient(90deg, var(--m2), var(--z), var(--p2)); border-radius: 99px; opacity: 0.35; }
.theme-row .dot { position: absolute; top: -5px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); border: 3px solid var(--card); transform: translateX(-50%); box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.crux { padding: 8px 0; border-top: 1px dashed rgba(0,0,0,0.12); font-size: 0.93rem; }
.crux b { color: var(--accent); }

table.cmp { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.cmp th, table.cmp td { padding: 6px 8px; border-bottom: 1px solid rgba(0,0,0,0.08); vertical-align: top; text-align: left; }
table.cmp th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.cell { display: inline-block; min-width: 2.2em; text-align: center; padding: 2px 6px; border-radius: 8px; font-weight: 800; color: #fff; }
.v-m2 { background: var(--m2); } .v-m1 { background: var(--m1); } .v-0 { background: var(--z); color: #3b3100; } .v-p1 { background: var(--p1); } .v-p2 { background: var(--p2); }
.v-unsure { background: #bbb; } .v-reject { background: #6b5aa8; } .v-none { background: transparent; color: var(--muted); }
.why { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.pair { display: inline-block; margin: 4px 10px 4px 0; padding: 6px 10px; border-radius: 10px; background: rgba(0,0,0,0.06); font-size: 0.9rem; }
.review { font-size: 0.92rem; }
.review .r { padding: 6px 0; border-top: 1px dashed rgba(0,0,0,0.1); display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: start; }
.review .r .edit { font-size: 0.78rem; }

@media (max-width: 640px) {
  .card { padding: 18px; }
  .scale { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .scale .btn { font-size: 0.68rem; padding: 10px 2px; }
  .theme-row { grid-template-columns: 110px 1fr 46px; }
  .escapes .btn { font-size: 0.85rem; }
}

.mapbox { margin: 6px 0 10px; }
svg.map { width: 100%; height: auto; background: rgba(0,0,0,0.03); border-radius: 16px; }
svg.map .axis { stroke: rgba(0,0,0,0.15); stroke-width: 1; }
svg.map .camp-pt circle { fill: #9a8c80; opacity: 0.8; }
svg.map .camp-pt text { font: 600 11px "Nunito", sans-serif; fill: #6b5d52; }
svg.map .person-pt circle { fill: var(--accent); stroke: #fff; stroke-width: 2.5; }
svg.map .person-pt text { font: 900 14px "Nunito", sans-serif; fill: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) svg.map { background: rgba(255,255,255,0.04); } :root:not([data-theme="light"]) svg.map .camp-pt text { fill: #c9bbae; } }
svg.map .leader { stroke: rgba(0,0,0,0.25); stroke-width: 1; }
