/* ═══════════ RESET ═══════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --board: #1e3a2e;
  --wood: #8b6914;
  --wood-dark: #5a4510;
  --wood-light: #c4952a;
  --chalk: rgba(255,255,255,.88);
  --chalk-dim: rgba(255,255,255,.45);
  --chalk-faint: rgba(255,255,255,.1);
  --accent: #f7c948;
  --neon: #a78bfa;
  --green: #34d399;
  --red: #f87171;
  --card-bg: rgba(15,35,25,.9);
  --radius: 4px;
  --font-chalk: "Fredericka the Great", cursive;
  --font-body: "Nunito", sans-serif;
}

html { font-size: 22px; }

/* ═══════════ CHALKBOARD BODY ═══════════ */

body {
  font-family: var(--font-body);
  color: var(--chalk);
  min-height: 100dvh;
  overflow-x: hidden;
  background-color: var(--board);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.03) 2px, rgba(0,0,0,.03) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(0,0,0,.015) 3px, rgba(0,0,0,.015) 6px);
}

.chalk-dust {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 15%, rgba(255,255,255,.06), transparent),
    radial-gradient(1px 1px at 22% 72%, rgba(255,255,255,.04), transparent),
    radial-gradient(2px 1px at 55% 10%, rgba(255,255,255,.05), transparent),
    radial-gradient(1px 2px at 80% 45%, rgba(255,255,255,.04), transparent),
    radial-gradient(1.5px 1px at 35% 88%, rgba(255,255,255,.05), transparent),
    radial-gradient(1px 1px at 68% 30%, rgba(255,255,255,.04), transparent);
}

/* ═══════════ WOODEN FRAME ═══════════ */

.wood-frame {
  position: fixed; inset: 0; pointer-events: none; z-index: 9998;
  border: 10px solid var(--wood);
  border-image: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 25%, var(--wood-dark) 50%, var(--wood) 75%, var(--wood-light) 100%) 1;
}

/* ═══════════ SCREENS ═══════════ */

.screen { display: none; min-height: 100dvh; padding: 2rem 1.5rem; }
.screen.active { display: flex; flex-direction: column; align-items: center; }

/* ═══════════ START SCREEN ═══════════ */

.start-container {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 1.5rem;
  max-width: 560px; width: 100%; text-align: center;
  position: relative; z-index: 2;
  padding-bottom: 2rem;
}

.chalk-canvas {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  min-height: 180px; justify-content: center;
}

.chalk-line {
  font-family: var(--font-chalk);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  color: var(--chalk);
  line-height: 1.3;
  min-height: 1.3em;
}

.chalk-line.chalk-big {
  font-size: clamp(3rem, 9vw, 5rem);
  color: #fff;
}

.chalk-char {
  display: inline-block;
  opacity: 0;
  animation: chalkWrite .08s ease forwards;
}

@keyframes chalkWrite {
  0% { opacity: 0; transform: translateY(3px) scale(.8); }
  100% { opacity: .88; transform: translateY(0) scale(1); }
}

.chalk-char.space { width: .35em; }

.chalk-cursor {
  display: inline-block;
  width: 3px; height: 1.1em;
  background: var(--chalk);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink .5s step-end infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ═══════════ START GATE ═══════════ */

.start-gate {
  width: 100%; max-width: 320px;
  display: flex; flex-direction: column; gap: .6rem;
  align-items: center;
}

.gate-field {
  width: 100%; display: flex; flex-direction: column; gap: .2rem;
}

.gate-label {
  font-size: .55rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--chalk-dim);
}

.gate-input, .gate-select {
  font-family: var(--font-body);
  font-size: .85rem; font-weight: 700;
  padding: .55rem .7rem;
  border: 1.5px solid var(--chalk-faint);
  border-radius: var(--radius);
  background: rgba(0,0,0,.15);
  color: var(--chalk);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.gate-input:focus, .gate-select:focus { border-color: rgba(255,255,255,.3); }
.gate-input::placeholder { color: var(--chalk-dim); }

.gate-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  padding-right: 2rem;
}
.gate-select option { background: #1e3a2e; color: #fff; }

.gate-error {
  font-size: .6rem; font-weight: 700;
  color: var(--red);
  margin-top: -.2rem;
}

/* X sign-in button */
.btn-x-signin {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--font-body);
  font-weight: 800; font-size: .85rem;
  padding: .6rem 1.4rem;
  background: #000; color: #fff;
  border: 1px solid #333; border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s;
}
.btn-x-signin:hover { border-color: #555; }
.btn-x-signin svg { flex-shrink: 0; }

.auth-prompt {
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  width: 100%;
}

.auth-required-text {
  font-size: .75rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent);
}

.btn-x-signin-lg {
  font-size: 1rem;
  padding: .8rem 2rem;
  border-width: 2px;
  animation: subtlePulse 2s ease-in-out infinite;
}

@keyframes subtlePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.1); }
  50% { box-shadow: 0 0 16px 4px rgba(255,255,255,.12); }
}

.auth-divider {
  display: flex; align-items: center; gap: .5rem;
  width: 100%; color: rgba(255,255,255,.2);
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.08);
}

.auth-user {
  display: flex; align-items: center; gap: .5rem;
  justify-content: center;
}

.auth-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--chalk-faint);
}

.auth-handle {
  font-size: .8rem; font-weight: 700;
  color: var(--chalk);
}

.lb-empty {
  padding: .6rem; text-align: center;
  font-size: .7rem; font-weight: 600;
  color: var(--chalk-dim);
}

/* ═══════════ CTA BUTTON ═══════════ */

.btn-chalk-cta {
  font-family: var(--font-body);
  font-weight: 800; font-size: 1.1rem;
  padding: .85rem 2.5rem;
  border: 2px solid var(--chalk);
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
  color: var(--chalk);
  cursor: pointer;
  transition: background .15s;
}
.btn-chalk-cta:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.btn-chalk-cta:active:not(:disabled) { background: rgba(255,255,255,.18); }
.btn-chalk-cta:disabled { opacity: .25; cursor: not-allowed; }

.btn-chalk {
  font-family: var(--font-body);
  font-weight: 800; font-size: 1rem;
  padding: .75rem 2rem;
  border: 2px solid var(--chalk);
  border-radius: var(--radius);
  background: transparent;
  color: var(--chalk);
  cursor: pointer;
  transition: background .15s;
}
.btn-chalk:hover { background: rgba(255,255,255,.08); }
.btn-chalk:active { background: rgba(255,255,255,.14); }

/* ═══════════ LEADERBOARD ═══════════ */

.leaderboard {
  width: 100%; max-width: 400px;
  opacity: 0; transition: opacity .6s ease;
}
.leaderboard.visible { opacity: 1; }

.lb-label {
  font-size: .55rem; font-weight: 800;
  color: rgba(255,255,255,.25);
  margin-bottom: .4rem;
  text-transform: uppercase; letter-spacing: .16em;
}

.lb-rows {
  display: flex; flex-direction: column; gap: 1px;
}

.lb-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .6rem;
  background: rgba(0,0,0,.1);
}
.lb-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.lb-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }

.lb-row.lb-top {
  background: rgba(0,0,0,.18);
}

.lb-row.lb-you {
  background: rgba(52, 211, 153, .1);
  border-left: 2px solid var(--green);
}
.lb-row.lb-you .lb-handle { color: var(--green); }

.lb-fc {
  font-size: .55rem; font-weight: 700;
  color: var(--chalk-dim);
  margin-left: .3rem;
  opacity: .6;
}

.lb-rank {
  width: 1.4rem; flex-shrink: 0;
  font-size: .7rem; font-weight: 800;
  color: rgba(255,255,255,.2);
}
.lb-top .lb-rank { font-size: .8rem; }

.lb-info {
  flex: 1; min-width: 0;
  display: flex; align-items: baseline; gap: .4rem;
}

.lb-handle {
  font-size: .75rem; font-weight: 700;
  color: var(--chalk);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex-shrink: 0;
}

.lb-result {
  font-size: .62rem; font-weight: 600;
  color: rgba(255,255,255,.25);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.chalk-hint {
  font-size: .75rem;
  color: var(--chalk-dim);
  opacity: 0;
  transition: opacity .4s;
}
.chalk-hint.visible { opacity: 1; }
.chalk-hint.gone { display: none; }

.fade-up { animation: fadeUp .4s ease forwards; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════ HUD ═══════════ */

#screen-quiz { max-width: 620px; margin: 0 auto; width: 100%; position: relative; z-index: 2; }

.quiz-hud {
  display: flex; align-items: center;
  width: 100%; margin-bottom: .8rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--chalk-faint);
}

.hud-grade {
  font-weight: 900; font-size: .6rem;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--chalk);
}

.hud-qnum {
  margin-left: auto;
  font-weight: 700; font-size: .6rem;
  color: var(--chalk-dim);
  letter-spacing: .03em;
}

.hud-strikes {
  display: flex; align-items: center; gap: .25rem;
  margin-left: .6rem;
}

.strike-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,.1); display: block;
  border: 1px solid rgba(255,255,255,.12);
  transition: background .2s, border-color .2s;
}
.strike-dot.hit {
  background: var(--red); border-color: var(--red);
  animation: strikePop .3s ease;
}
@keyframes strikePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ═══════════ QUIZ CARD ═══════════ */

.quiz-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--chalk-faint);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  position: relative;
  transition: border-color .2s;
}

.quiz-card.correct-glow { border-color: var(--green); }

.quiz-card.shake { animation: shake .35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.slide-in { animation: slideIn .25s ease-out; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .75rem;
}

.subject-tag {
  font-weight: 800; font-size: .65rem; text-transform: uppercase;
  letter-spacing: .06em; background: rgba(255,255,255,.06);
  color: var(--chalk-dim); padding: .2rem .5rem; border-radius: 3px;
}
.subject-tag.obscure { background: rgba(248,113,113,.1); color: var(--red); }

.calc-tag {
  font-size: .55rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  padding: .15rem .4rem; border-radius: 3px;
}
.calc-none { color: rgba(255,255,255,.25); background: rgba(255,255,255,.04); }
.calc-scientific { color: var(--accent); background: rgba(247,201,72,.1); }
.calc-graphing { color: var(--green); background: rgba(52,211,153,.1); }

.question-text {
  font-size: clamp(1rem, 2.8vw, 1.25rem);
  font-weight: 800;
  line-height: 1.7; margin-bottom: 1.25rem;
  color: var(--chalk);
}

.question-text .katex { font-size: 1.1em; }
.opt-text .katex { font-size: 1em; }
.katex .mathnormal, .katex .mathit { color: var(--chalk); }
.katex { color: var(--chalk); }

/* ═══════════ OPTIONS ═══════════ */

.options-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
}

.opt-btn {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: .85rem;
  padding: .75rem .8rem; text-align: left;
  border: 1px solid var(--chalk-faint); border-radius: var(--radius);
  background: rgba(0,0,0,.12); color: var(--chalk); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt-btn:hover:not(.opt-correct):not(.opt-wrong):not(.opt-dim) {
  border-color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.04);
}
.opt-btn:active { opacity: .8; }

.opt-letter {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 3px; flex-shrink: 0;
  background: rgba(255,255,255,.06); color: var(--chalk-dim);
  font-size: .7rem; font-weight: 900;
}

.opt-text { flex: 1; }

.opt-correct {
  border-color: var(--green) !important;
  background: rgba(52,211,153,.08) !important;
}
.opt-correct .opt-letter { background: var(--green); color: #111; }

.opt-wrong {
  border-color: var(--red) !important;
  background: rgba(248,113,113,.08) !important;
  animation: optShake .3s ease;
}
.opt-wrong .opt-letter { background: var(--red); color: #111; }

@keyframes optShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.opt-dim { opacity: .2; pointer-events: none; }

/* ═══════════ FREE RESPONSE ═══════════ */

.free-wrap { display: flex; gap: .5rem; align-items: center; }

.free-input {
  flex: 1; font-size: .95rem; font-weight: 700;
  padding: .8rem 1rem;
  border: 1px solid var(--chalk-faint);
  border-radius: var(--radius);
  background: rgba(0,0,0,.15); color: var(--chalk);
  outline: none; transition: border-color .15s;
}
.free-input:focus { border-color: rgba(255,255,255,.35); }
.free-input::placeholder { color: var(--chalk-dim); }
.free-input.input-correct { border-color: var(--green); }
.free-input.input-wrong { border-color: var(--red); animation: shake .3s ease; }

.btn-submit {
  font-weight: 800; font-size: .9rem;
  padding: .8rem 1.3rem; border: 1.5px solid var(--accent);
  border-radius: var(--radius); background: transparent;
  color: var(--accent); cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.btn-submit:hover { background: rgba(247,201,72,.08); }
.btn-submit:disabled { opacity: .3; pointer-events: none; }

/* ═══════════ GRADE TRANSITION ═══════════ */

.grade-transition {
  position: fixed; inset: 0; z-index: 200;
  background: var(--board);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.03) 2px, rgba(0,0,0,.03) 4px);
  overflow-y: auto;
  display: flex; justify-content: center;
  padding: 2rem 1.5rem;
}
.grade-transition.hidden { display: none; }
.grade-transition.fade-in { animation: fadeIn .25s ease forwards; }
.grade-transition.fade-out { animation: fadeOut .3s ease forwards; }

.gt-inner {
  text-align: center; max-width: 380px; width: 100%;
  margin: auto;
}

.gt-grade {
  font-family: var(--font-chalk);
  font-size: clamp(1.8rem, 6vw, 3rem);
  color: var(--chalk);
  animation: scaleIn .3s ease;
  white-space: nowrap;
}

.gt-detail {
  font-size: .8rem; color: var(--chalk-dim); font-weight: 600; margin-top: .35rem;
}

.gt-topics {
  font-size: .6rem; font-weight: 600;
  color: rgba(255,255,255,.22);
  margin-top: .25rem;
}

.gt-global {
  font-size: .62rem; font-weight: 600;
  color: rgba(255,255,255,.28);
  margin-top: .4rem;
}

.gt-btn {
  margin-top: 1.2rem;
  font-family: var(--font-body);
  font-weight: 800; font-size: .85rem;
  padding: .6rem 1.8rem;
  border: 2px solid var(--chalk);
  border-radius: var(--radius);
  background: transparent;
  color: var(--chalk);
  cursor: pointer;
  transition: background .15s;
}
.gt-btn:hover { background: rgba(255,255,255,.08); }
.gt-btn:active { background: rgba(255,255,255,.14); }

/* data panel */
.gt-data {
  margin-top: .7rem; text-align: left; width: 100%;
}

.gt-data > summary {
  font-size: .55rem; font-weight: 700;
  color: rgba(255,255,255,.22);
  cursor: pointer; list-style: none;
  text-align: center;
  text-transform: uppercase; letter-spacing: .1em;
}
.gt-data > summary::-webkit-details-marker { display: none; }
.gt-data > summary::before { content: "▸ "; }
.gt-data[open] > summary::before { content: "▾ "; }

.gt-data-body {
  margin-top: .4rem;
  border: 1px solid var(--chalk-faint);
  border-radius: var(--radius);
  padding: .4rem .55rem;
  background: rgba(0,0,0,.12);
}

.gt-data-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .2rem 0;
  font-size: .6rem; font-weight: 600;
  color: var(--chalk-dim);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.gt-data-row:last-of-type { border-bottom: none; }
.gt-data-row span:last-child { color: var(--chalk); font-weight: 800; }

.gt-data-source {
  margin-top: .3rem;
  font-size: .48rem; font-weight: 600;
  color: rgba(255,255,255,.18);
  text-align: center;
}

.gt-data-disclaimer {
  margin-top: .2rem;
  font-size: .5rem; font-weight: 700;
  color: rgba(255,200,100,.35);
  text-align: center;
}

.gt-method { margin-top: .3rem; }

.gt-method summary {
  font-size: .48rem; font-weight: 700;
  color: rgba(255,255,255,.18);
  cursor: pointer; list-style: none;
  text-align: center;
  text-transform: uppercase; letter-spacing: .06em;
}
.gt-method summary::-webkit-details-marker { display: none; }
.gt-method summary::before { content: "▸ "; }
.gt-method[open] summary::before { content: "▾ "; }

.gt-method-text {
  margin-top: .25rem;
  font-size: .48rem; font-weight: 500;
  color: rgba(255,255,255,.18);
  line-height: 1.5;
}

@keyframes scaleIn { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ═══════════ RESULTS ═══════════ */

#screen-results { max-width: 520px; margin: 0 auto; width: 100%; padding-bottom: 3rem; z-index: 2; position: relative; }

.results-card {
  width: 100%; border-radius: var(--radius); overflow: hidden;
  background: rgba(15,35,25,.95);
  border: 1px solid var(--chalk-faint);
  padding: 1.75rem 1.5rem; text-align: center;
}
.results-card.capturing { padding: 2.5rem 2rem; }

.rc-badge {
  font-weight: 900; font-size: .6rem; letter-spacing: .22em;
  color: var(--accent); margin-bottom: .6rem;
}

.rc-emoji { font-size: 3rem; display: block; margin-bottom: .4rem; }

.rc-title {
  font-size: clamp(1.2rem, 4vw, 1.65rem);
  font-weight: 900;
  line-height: 1.3; margin-bottom: 1rem;
}
.rc-title.smart { color: var(--green); }
.rc-title.not-smart { color: var(--red); }

.rc-bars { display: flex; flex-direction: column; gap: .25rem; margin-bottom: 1rem; }

.bar-row { display: flex; align-items: center; gap: .35rem; font-size: .7rem; font-weight: 700; }
.bar-label { width: 5rem; text-align: right; color: var(--chalk-dim); flex-shrink: 0; }
.bar-track { flex: 1; height: 6px; background: rgba(255,255,255,.05); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 2px; transition: width .6s ease .15s; }
.bar-row.passed .bar-fill { background: var(--green); }
.bar-row.failed .bar-fill { background: var(--red); }
.bar-score { width: 2.5rem; text-align: center; color: var(--chalk-dim); flex-shrink: 0; }

.rc-stats {
  display: flex; justify-content: center; gap: 2rem;
  margin-bottom: .6rem; padding-top: .6rem;
  border-top: 1px solid var(--chalk-faint);
}
.rc-stat { display: flex; flex-direction: column; align-items: center; }
.rc-stat-val { font-weight: 900; font-size: 1.1rem; color: var(--chalk); }
.rc-stat-label { font-size: .55rem; font-weight: 800; color: var(--chalk-dim); text-transform: uppercase; letter-spacing: .06em; }

.rc-context {
  font-size: .78rem; line-height: 1.5;
  color: var(--chalk-dim);
  border: 1px solid var(--chalk-faint);
  border-radius: var(--radius); padding: .6rem .8rem; margin-top: .5rem;
}

/* ═══════════ SHARE BUTTONS ═══════════ */

.results-actions { display: flex; gap: .5rem; margin-top: 1rem; justify-content: center; flex-wrap: wrap; }

.btn-share {
  display: inline-flex; align-items: center; gap: .4rem;
  font-weight: 800; font-size: .82rem;
  padding: .6rem 1.1rem; border: none; border-radius: var(--radius);
  cursor: pointer; transition: opacity .15s;
}
.btn-share:hover { opacity: .85; }
.btn-share:active { opacity: .7; }

.btn-x { background: #000; color: #fff; border: 1px solid #333; }
.btn-dl { background: rgba(0,0,0,.25); color: var(--chalk); border: 1px solid var(--chalk-faint); }

/* ═══════════ METHODOLOGY ═══════════ */

.methodology {
  margin-top: 1rem; width: 100%;
  background: rgba(0,0,0,.15); border: 1px solid var(--chalk-faint);
  border-radius: var(--radius); overflow: hidden;
}
.methodology summary {
  padding: .75rem 1rem; font-weight: 800; cursor: pointer;
  color: var(--accent); font-size: .82rem;
  list-style: none;
}
.methodology summary::-webkit-details-marker { display: none; }
.methodology summary::before { content: "▸ "; }
.methodology[open] summary::before { content: "▾ "; }

.methodology-body {
  padding: 0 1rem 1rem;
  font-size: .78rem; line-height: 1.6; color: var(--chalk-dim);
}
.methodology-body h4 { color: var(--chalk); margin: .8rem 0 .25rem; font-size: .82rem; }
.methodology-body ul { margin-left: 1.2rem; margin-bottom: .4rem; }
.methodology-body li { margin-bottom: .15rem; }

.bd-table { width: 100%; border-collapse: collapse; margin-top: .4rem; font-size: .75rem; }
.bd-table th { text-align: left; padding: .25rem .35rem; border-bottom: 1px solid var(--chalk-faint); color: var(--chalk); font-weight: 700; }
.bd-table td { padding: .25rem .35rem; border-bottom: 1px solid rgba(255,255,255,.03); }
.r-ok td:last-child { color: var(--green); font-weight: 700; }
.r-bad td:last-child { color: var(--red); font-weight: 700; }

/* ═══════════ LOCKED LEADERBOARD ═══════════ */

.leaderboard-locked {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}

.leaderboard-locked .lb-rows {
  filter: blur(6px);
  opacity: .4;
  pointer-events: none;
  user-select: none;
}

.leaderboard-locked.unlocked .lb-rows {
  filter: none;
  opacity: 1;
  pointer-events: auto;
  user-select: auto;
  transition: filter .4s ease, opacity .4s ease;
}

.lb-lock-overlay {
  position: absolute;
  inset: 0; top: 1.5rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .4rem;
  z-index: 5;
}

.leaderboard-locked.unlocked .lb-lock-overlay { display: none; }

.lb-lock-icon { font-size: 1.8rem; }

.lb-lock-text {
  font-size: .7rem; font-weight: 700;
  color: var(--chalk-dim);
  text-align: center;
  max-width: 220px;
}

/* ═══════════ EXIT-INTENT WARNING ═══════════ */

.exit-warning {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  animation: fadeIn .2s ease;
}

.exit-warning.hidden { display: none !important; }

.exit-warning-backdrop {
  position: absolute; inset: 0;
  background: rgba(180, 30, 30, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.exit-warning-card {
  position: relative; z-index: 1;
  max-width: 380px; width: 100%;
  background: linear-gradient(170deg, #2a0a0a 0%, #1a0505 100%);
  border: 2px solid var(--red);
  border-radius: 8px;
  padding: 2rem 1.75rem;
  text-align: center;
  box-shadow: 0 0 60px rgba(248, 113, 113, .3), 0 0 120px rgba(248, 113, 113, .1);
  animation: exitPop .3s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes exitPop {
  from { opacity: 0; transform: scale(.85) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.exit-warning-icon {
  font-size: 2.5rem;
  margin-bottom: .5rem;
}

.exit-warning-title {
  font-family: var(--font-body);
  font-weight: 900; font-size: 1.3rem;
  color: var(--red);
  margin-bottom: .6rem;
}

.exit-warning-msg {
  font-size: .82rem; font-weight: 600;
  color: rgba(255, 255, 255, .7);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.exit-warning-msg strong {
  color: #fff;
  font-weight: 900;
}

.exit-warning-btn {
  font-family: var(--font-body);
  font-weight: 900; font-size: 1rem;
  padding: .75rem 2.2rem;
  border: 2px solid var(--red);
  border-radius: var(--radius);
  background: var(--red);
  color: #1a0505;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.exit-warning-btn:hover { background: #fca5a5; transform: scale(1.03); }
.exit-warning-btn:active { transform: scale(.97); }

/* Red vignette flash on the edges when mouse nears top */
.exit-vignette {
  position: fixed; inset: 0; z-index: 9990;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
  background: radial-gradient(ellipse at 50% 0%, rgba(248,113,113,.25) 0%, transparent 60%);
}
.exit-vignette.active { opacity: 1; }

/* ═══════════ UTILITY ═══════════ */

.hidden { display: none !important; }

/* ═══════════ RESPONSIVE ═══════════ */

@media (max-width: 500px) {
  .options-grid { grid-template-columns: 1fr; }
  .free-wrap { flex-direction: column; }
  .btn-submit { width: 100%; }
  .results-card { padding: 1.25rem .9rem; }
  .bar-label { width: 3.5rem; }
  .wood-frame { border-width: 6px; }
  .screen { padding: 1.5rem 1rem; }
}
