:root {
  --ink: #1d2a44;
  --ink-soft: #3d4a66;
  --muted: #6b7385;
  --paper: #fbf6ec;
  --paper-2: #f4ecdc;
  --card: #ffffff;
  --line: #e7ddc9;
  --accent: #d9573b;
  --accent-dark: #b8432a;
  --accent-soft: #fbe5de;
  --teal: #2f6f6a;
  --teal-soft: #dcefec;
  --gold: #e0a526;
  --gold-soft: #fbf0d3;
  --good: #2e8b57;
  --good-soft: #e1f3e8;
  --bad: #c2412d;
  --bad-soft: #fbe3df;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(29, 42, 68, .06), 0 6px 20px rgba(29, 42, 68, .07);
  --shadow-lg: 0 10px 40px rgba(29, 42, 68, .18);
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(circle at 10% 0%, rgba(224, 165, 38, .10), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(47, 111, 106, .08), transparent 40%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--teal); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
code { background: var(--paper-2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header ---------- */
.site-header {
  background: var(--ink);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-globe { font-size: 1.8rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--display); font-size: 1.05rem; }
.brand-text small { color: var(--gold); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  color: rgba(255, 255, 255, .85); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: .95rem;
}
.site-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.site-nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
.site-nav a.nav-cta { background: var(--accent); color: #fff; }
.site-nav a.nav-cta:hover, .site-nav a.nav-cta.active { background: var(--accent-dark); }
.nav-toggle { display: none; background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 700; cursor: pointer; }
@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; width: 100%; padding-bottom: 12px; flex-direction: column; }
  .nav-open .site-nav { display: flex; }
  .site-nav a { padding: 10px 14px; }
}

.demo-banner { background: var(--gold-soft); border-bottom: 1px solid #efdca5; font-size: .9rem; padding: 8px 0; }

.site-footer { margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 800; font-size: 1rem;
  padding: 11px 20px; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .08s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-dark); }
.btn.primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn.teal { background: var(--teal); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--paper-2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: .88rem; }
.btn.lg { padding: 14px 26px; font-size: 1.08rem; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.input, textarea, select {
  font: inherit; color: var(--ink); width: 100%;
  padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, textarea:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
textarea { resize: vertical; min-height: 96px; }
label.field { display: block; font-weight: 800; margin: 0 0 6px; }
.field-hint { color: var(--muted); font-size: .9rem; margin: -2px 0 8px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card + .card { margin-top: 20px; }
.section { margin-top: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.eyebrow { display: inline-block; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; color: var(--accent); margin-bottom: 8px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--paper-2); color: var(--ink-soft); }
.level-easy { background: var(--good-soft); color: #20663f; }
.level-medium { background: var(--gold-soft); color: #8a6312; }
.level-hard { background: var(--bad-soft); color: #9a2f1f; }
.pill.mult { background: var(--accent); color: #fff; }
.pill.done { background: var(--teal); color: #fff; }

.notice { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--paper-2); border: 1px solid var(--line); }
.notice.error { background: var(--bad-soft); border-color: #f1c2b9; }
.notice.good { background: var(--good-soft); border-color: #bfe3cc; }
.notice.warn { background: var(--gold-soft); border-color: #efdca5; }

.loading { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 24px 0; justify-content: center; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; padding: 48px 0 16px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 28px; } }
.hero h1 em { font-style: italic; color: var(--accent); }
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 36em; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.drop-card { position: relative; overflow: hidden; background: var(--ink); color: #fff; border: none; }
.drop-card h3 { color: var(--gold); font-family: var(--body); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }
.drop-card .countdown { font-family: var(--display); font-size: 2.4rem; font-weight: 800; margin: 4px 0 14px; }
.drop-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.drop-card li { background: rgba(255, 255, 255, .08); border-radius: var(--radius-sm); padding: 10px 12px; }
.drop-card li strong { display: block; }
.drop-card li span { color: rgba(255, 255, 255, .7); font-size: .9rem; }
.stamp {
  position: absolute; right: -18px; top: -18px; width: 110px; height: 110px; border-radius: 50%;
  border: 3px dashed rgba(224, 165, 38, .55); display: grid; place-items: center; transform: rotate(14deg);
  color: rgba(224, 165, 38, .8); font-weight: 900; font-size: .7rem; letter-spacing: .1em; text-align: center; line-height: 1.2;
}

.step-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step-card { display: flex; gap: 14px; align-items: flex-start; }
.step-num { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 900; font-family: var(--display); font-size: 1.2rem; }

.mult-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
.mult-table td { padding: 8px 6px; border-bottom: 1px dashed var(--line); }
.mult-table td:last-child { text-align: right; font-weight: 900; font-family: var(--display); font-size: 1.15rem; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--paper); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat b { display: block; font-family: var(--display); font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; font-weight: 700; }

/* ---------- books ---------- */
.drop-group { margin-top: 28px; }
.drop-label { display: flex; align-items: center; gap: 10px; font-weight: 900; margin-bottom: 10px; }
.drop-label .date { font-family: var(--display); font-size: 1.3rem; }
.book-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.book {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
  border-top: 5px solid var(--teal);
}
.book.core { border-top-color: var(--accent); }
.book.locked { opacity: .72; border-top-color: var(--muted); }
.book .title { font-family: var(--display); font-weight: 700; font-size: 1.08rem; line-height: 1.25; }
.book .by { color: var(--muted); font-size: .92rem; }
.book .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.book .pts { margin-left: auto; font-family: var(--display); font-weight: 800; font-size: 1.3rem; color: var(--accent); white-space: nowrap; }
.book .pts small { font-family: var(--body); font-size: .75rem; color: var(--muted); font-weight: 700; }
.book .note { font-size: .82rem; color: #8a6312; background: var(--gold-soft); border-radius: 8px; padding: 6px 8px; }
.book .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.book .lock-msg { font-weight: 800; color: var(--muted); font-size: .9rem; }
button.book { font: inherit; text-align: left; cursor: pointer; color: inherit; transition: transform .1s, box-shadow .15s, border-color .15s; width: 100%; }
button.book:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
button.book:disabled { cursor: not-allowed; }
.book .status { font-weight: 800; font-size: .88rem; margin-top: 4px; }
.status.ok { color: var(--teal); }
.status.cool { color: var(--accent-dark); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input, .toolbar select { width: auto; flex: 1 1 200px; }
.tabs { display: inline-flex; background: var(--paper-2); border-radius: 999px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.tab { font: inherit; font-weight: 800; border: none; background: transparent; padding: 8px 16px; border-radius: 999px; cursor: pointer; color: var(--ink-soft); }
.tab.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.chip { font: inherit; font-weight: 800; font-size: .9rem; border: 2px solid var(--line); background: #fff; padding: 5px 12px; border-radius: 999px; cursor: pointer; color: var(--ink-soft); }
.chip.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; cursor: pointer; }

/* ---------- wizard ---------- */
.stepper { display: flex; gap: 6px; list-style: none; padding: 0; margin: 28px 0 20px; counter-reset: s; flex-wrap: wrap; }
.stepper li { flex: 1 1 120px; display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--muted); font-size: .92rem; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--paper-2); }
.stepper li::before { counter-increment: s; content: counter(s); width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--muted); font-size: .85rem; }
.stepper li.on { background: var(--ink); color: #fff; }
.stepper li.on::before { background: var(--accent); color: #fff; }
.stepper li.done { color: var(--teal); }
.stepper li.done::before { content: '✓'; background: var(--teal); color: #fff; }

.picker { position: relative; }
.picker.chosen .picker-input { border-color: var(--teal); background: var(--teal-soft); font-weight: 800; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 10; max-height: 320px; overflow: auto; }
.picker-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.picker-list li.active, .picker-list li:hover { background: var(--paper-2); }
.picker-list li.empty { color: var(--muted); cursor: default; }
.picker-list mark { background: var(--gold-soft); color: inherit; border-radius: 3px; }

.grade-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
@media (max-width: 480px) { .grade-picker { grid-template-columns: repeat(3, 1fr); } }
.grade-btn { font: inherit; font-family: var(--display); font-weight: 800; font-size: 1.4rem; padding: 12px 0; border-radius: var(--radius-sm); border: 2px solid var(--line); background: #fff; cursor: pointer; color: var(--ink); }
.grade-btn small { font-size: .7rem; font-family: var(--body); vertical-align: super; }
.grade-btn:hover { border-color: var(--teal); }
.grade-btn.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.form-stack > * + * { margin-top: 22px; }

.quiz-card { max-width: 720px; margin: 0 auto; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.qdots { display: flex; gap: 8px; }
.qdot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.qdot.cur { background: var(--ink); box-shadow: 0 0 0 3px var(--paper-2); }
.qdot.ok { background: var(--good); }
.qdot.bad { background: var(--bad); }
.question { font-family: var(--display); font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 700; margin: 6px 0 14px; }
.feedback { margin-top: 14px; border-radius: var(--radius-sm); padding: 14px 16px; font-weight: 800; display: flex; gap: 12px; align-items: center; animation: pop .25s ease-out; }
.feedback.ok { background: var(--good-soft); color: #1f6a41; }
.feedback.bad { background: var(--bad-soft); color: #9a2f1f; }
.feedback.hint { background: var(--gold-soft); color: #7d5810; }
.feedback .big { font-size: 1.8rem; line-height: 1; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.result { text-align: center; padding: 36px 24px; }
.result .big-pts { font-family: var(--display); font-size: clamp(3rem, 10vw, 5rem); font-weight: 800; color: var(--accent); line-height: 1; margin: 10px 0; }
.result .emoji { font-size: 3.4rem; }
.breakdown { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; background: var(--paper); border-radius: 999px; padding: 8px 18px; font-weight: 800; margin: 8px 0 20px; }
.timer { font-family: var(--display); font-size: 2.6rem; font-weight: 800; }

.confirm-book { display: grid; gap: 6px; background: var(--paper); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
.confirm-book .title { font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.rules { padding-left: 1.2em; margin: 0; }
.rules li { margin: 4px 0; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(29, 42, 68, .45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-weight: 700; transition: opacity .4s, transform .4s; }
.toast.good { background: var(--good); }
.toast.bad { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- leaderboard ---------- */
.class-list { display: grid; gap: 12px; }
.class-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.class-row.top { border: 2px solid var(--gold); background: linear-gradient(90deg, var(--gold-soft), #fff 60%); }
.class-row .medal { font-size: 2rem; text-align: center; }
.rank-num { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--paper-2); font-weight: 900; font-size: 1rem; }
.class-row .gname { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.bar { height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 999px; transition: width .6s; }
.class-row .avg { text-align: right; }
.class-row .avg b { font-family: var(--display); font-size: 1.7rem; display: block; line-height: 1; }
.class-row .avg span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.class-sub { color: var(--muted); font-size: .88rem; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.board { width: 100%; border-collapse: collapse; font-size: .98rem; }
.board th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 14px; border-bottom: 2px solid var(--line); background: var(--paper); }
.board td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.board tr:last-child td { border-bottom: none; }
.board td.num, .board th.num { text-align: right; white-space: nowrap; }
.board td.pts { font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.board tr.me td { background: var(--teal-soft); }
.board .rank { width: 56px; font-size: 1.3rem; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state .icon { font-size: 2.6rem; }

/* ---------- my books ---------- */
.profile { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.6rem; flex: none; }
.profile .stat-row { flex: 1 1 320px; }
.mybook { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: start; }
.mybook .pts { font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--accent); text-align: right; line-height: 1; }
.mybook .pts small { display: block; font-family: var(--body); font-size: .78rem; color: var(--muted); font-weight: 700; margin-top: 4px; }
.mybook .full { grid-column: 1 / -1; }
.stars { display: inline-flex; gap: 2px; }
.star { font-size: 1.5rem; line-height: 1; background: none; border: none; cursor: pointer; color: var(--line); padding: 2px; }
.star.on { color: var(--gold); }
.star:hover { transform: scale(1.15); }

/* ---------- teacher ---------- */
details.log-detail summary { cursor: pointer; font-weight: 700; color: var(--teal); }
.qa { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.qa li { background: var(--paper); border-radius: 8px; padding: 8px 10px; font-size: .92rem; }
.qa .q { font-weight: 800; }
.qa .k { color: var(--muted); }
.tag { font-size: .72rem; font-weight: 900; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.tag.ok { background: var(--good-soft); color: #1f6a41; }
.tag.bad { background: var(--bad-soft); color: #9a2f1f; }
.tag.open { background: var(--gold-soft); color: #7d5810; }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105vh; transform: rotate(720deg) translateX(40px); } }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .card { padding: 18px; }
  .class-row { grid-template-columns: 44px 1fr; }
  .class-row .avg { grid-column: 2; text-align: left; }
  .class-row .avg b { display: inline; margin-right: 6px; font-size: 1.3rem; }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .stat b { font-size: 1.4rem; }
  .board th, .board td { padding: 8px 10px; }
  .hide-sm { display: none; }
}

/* ---------- entry code screen ---------- */
body.gated { overflow: hidden; }
body.gated > :not(.gate) { visibility: hidden; }
.gate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: var(--ink);
  background-image: radial-gradient(circle at 20% 10%, rgba(224, 165, 38, .25), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(217, 87, 59, .25), transparent 45%);
  transition: opacity .25s;
}
.gate.gate-out { opacity: 0; }
.gate-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 32px 24px; width: 100%; max-width: 400px; text-align: center; }
.gate-card h1 { font-size: clamp(1.6rem, 6vw, 2rem); }
.gate-globe { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.gate-input {
  font: inherit; font-family: var(--display); font-weight: 800; font-size: 2.2rem; letter-spacing: .5em;
  text-align: center; text-indent: .5em; width: 100%; max-width: 240px; margin: 8px auto 0; display: block;
  padding: 12px; border: 2px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: #fff;
}
.gate-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.gate-msg { min-height: 1.5em; color: var(--bad); font-weight: 800; margin: 10px 0; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
/* hide page content until the code check has run (no flash before the code screen) */
html:not(.rc-ready) body > main { visibility: hidden; }
