@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700;800;900&display=swap");

:root {
  --paper: #f5f2ea;
  --paper-deep: #ebe5d9;
  --ink: #173b33;
  --ink-dark: #0d2923;
  --muted: #6e746f;
  --line: #d9d5ca;
  --white: #fffefa;
  --yellow: #f4c84b;
  --yellow-soft: #fff3c8;
  --orange: #e9804e;
  --orange-soft: #fde3d5;
  --green: #2f7a62;
  --green-soft: #dcece5;
  --red: #c85145;
  --red-soft: #fae4df;
  --shadow: 0 18px 50px rgba(29, 50, 43, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(244, 200, 75, 0.13) 0 140px, transparent 141px),
    radial-gradient(circle at 92% 36%, rgba(47, 122, 98, 0.08) 0 190px, transparent 191px),
    var(--paper);
  color: var(--ink-dark);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(23, 59, 51, 0.13);
}

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 14px 14px 14px 4px;
  background: var(--ink);
  color: var(--yellow);
  font-size: 22px;
  font-weight: 900;
  box-shadow: 5px 5px 0 var(--yellow);
}
.brand > span:last-child { display: grid; }
.brand strong { font-size: 18px; letter-spacing: 0.06em; }
.brand small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.22em; }
.header-user { display: flex; align-items: center; gap: 16px; }
.team-pill { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); font-size: 13px; font-weight: 700; }
.text-button { padding: 8px 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.text-button:hover { color: var(--ink); }

main { flex: 1; }

.auth-view {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  padding: 60px 0 70px;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, .82fr);
  gap: clamp(50px, 8vw, 110px);
  align-items: center;
}

.eyebrow { margin: 0 0 12px; color: var(--orange); font-size: 12px; font-weight: 900; letter-spacing: .19em; text-transform: uppercase; }
.auth-copy h1 { max-width: 650px; margin: 0; font-size: clamp(45px, 6.1vw, 76px); line-height: 1.11; letter-spacing: -.05em; }
.auth-copy h1 span { position: relative; color: var(--green); }
.auth-copy h1 span::after { content: ""; position: absolute; left: 3%; right: -2%; bottom: -7px; height: 9px; border-radius: 99px; background: var(--yellow); transform: rotate(-1.5deg); z-index: -1; }
.lead { max-width: 560px; margin: 28px 0; color: var(--muted); font-size: 17px; line-height: 1.9; }
.tier-mini-list { display: flex; flex-wrap: wrap; gap: 10px; }
.tier-mini-list span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.48); color: var(--muted); font-size: 12px; font-weight: 600; }
.tier-mini-list b { color: var(--ink); font-size: 10px; }

.auth-card { position: relative; padding: 28px 34px 24px; border: 1px solid rgba(23,59,51,.15); border-radius: 28px; background: rgba(255,254,250,.86); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.auth-card::before { content: ""; position: absolute; width: 64px; height: 64px; top: -18px; right: -18px; border-radius: 50%; background: var(--yellow); z-index: -1; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 13px; background: #ede9df; }
.auth-tab { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.auth-tab.active { background: var(--white); color: var(--ink); box-shadow: 0 4px 14px rgba(22,48,40,.07); }
.auth-form { display: grid; gap: 17px; margin-top: 26px; }
.form-heading { margin-bottom: 2px; }
.form-heading h2 { margin: 0 0 5px; font-size: 24px; }
.form-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 13px; font-weight: 700; }
.field input { width: 100%; height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #fff; color: var(--ink-dark); transition: border .16s, box-shadow .16s; }
.field input::placeholder { color: #a5a49e; }
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(47,122,98,.10); }
.primary-button, .secondary-button, .tier-button, .submit-answer { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; cursor: pointer; font-weight: 800; text-decoration: none; transition: transform .16s, background .16s, box-shadow .16s; }
.primary-button:hover, .tier-button:hover, .submit-answer:hover { background: var(--ink-dark); transform: translateY(-1px); box-shadow: 0 9px 24px rgba(22,51,43,.18); }
.primary-button:disabled, .submit-answer:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }
.primary-button span, .tier-button span, .secondary-button span { font-size: 20px; }
.auth-note { margin: 18px 0 0; color: #90928d; text-align: center; font-size: 11px; }

.dashboard-view { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 50px 0 80px; }
.dashboard-head { min-height: 240px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 50px; padding: 36px 48px; border-radius: 28px; background: var(--ink); color: #fff; overflow: hidden; position: relative; }
.dashboard-head::before { content: ""; position: absolute; width: 310px; height: 310px; right: -80px; top: -130px; border: 50px solid rgba(244,200,75,.13); border-radius: 50%; }
.dashboard-head::after { content: ""; position: absolute; left: -16px; bottom: 24px; width: 130px; height: 8px; border-radius: 99px; background: var(--yellow); transform: rotate(-4deg); }
.dashboard-head > * { position: relative; z-index: 1; }
.dashboard-head h1 { margin: 0 0 12px; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.04em; }
.dashboard-head h1 span { color: var(--yellow); }
.dashboard-head p:last-child { margin: 0; color: rgba(255,255,255,.67); }
.score-hero { min-width: 175px; min-height: 175px; display: grid; place-items: center; align-content: center; border: 1px solid rgba(255,255,255,.19); border-radius: 50%; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 12px rgba(255,255,255,.035); }
.score-hero span { font-size: 12px; color: rgba(255,255,255,.65); }
.score-hero strong { color: var(--yellow); font-size: 62px; line-height: 1.08; }
.score-hero small { font-size: 9px; letter-spacing: .2em; color: rgba(255,255,255,.48); }

.quiz-section, .scoreboard-section { padding-top: 56px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading h2 { margin: 0; font-size: 28px; }
.shared-badge, .private-badge { padding: 8px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 700; }
.private-badge { background: var(--yellow-soft); color: #83600f; }

.tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tier-card { min-width: 0; display: flex; flex-direction: column; min-height: 360px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,254,250,.82); box-shadow: 0 10px 30px rgba(29,50,43,.04); position: relative; overflow: hidden; }
.tier-card::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; right: -64px; bottom: 58px; opacity: .75; }
.tier-1::after { background: var(--yellow-soft); }
.tier-2::after { background: var(--green-soft); }
.tier-3::after { background: var(--orange-soft); }
.tier-card-top { display: flex; justify-content: space-between; align-items: start; }
.tier-number { color: var(--ink); font-size: 48px; line-height: 1; font-weight: 900; letter-spacing: -.06em; }
.point-chip { padding: 7px 10px; border-radius: 999px; background: var(--yellow-soft); color: #72550f; font-size: 11px; font-weight: 800; }
.tier-2 .point-chip { background: var(--green-soft); color: var(--green); }
.tier-3 .point-chip { background: var(--orange-soft); color: #a14b29; }
.tier-card-copy { margin: 35px 0 auto; }
.tier-card-copy h3 { margin: 0 0 9px; font-size: 23px; }
.tier-card-copy p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.tier-progress { margin: 30px 0 18px; }
.tier-progress > div:first-child { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.tier-progress b { color: var(--ink); }
.progress-track { height: 5px; border-radius: 99px; background: #e7e3da; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--yellow); border-radius: inherit; }
.tier-2 .progress-track i { background: var(--green); }
.tier-3 .progress-track i { background: var(--orange); }
.tier-button { min-height: 47px; position: relative; z-index: 1; }
.tier-button:disabled { border: 1px solid var(--line); background: #ece9e1; color: #9b9b95; cursor: not-allowed; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { min-height: 154px; padding: 20px; display: grid; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,254,250,.82); }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-card strong { align-self: end; font-size: 46px; line-height: 1; letter-spacing: -.05em; }
.stat-card small { margin-top: 5px; color: #aaa9a2; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.stat-card.correct strong { color: var(--green); }
.stat-card.wrong strong { color: var(--red); }
.stat-card.score { background: var(--yellow); border-color: var(--yellow); }
.stat-card.score span, .stat-card.score small { color: rgba(45,45,30,.65); }

.history-card, .question-preview-card { margin-top: 18px; padding: 6px 24px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,254,250,.82); }
.history-head { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.history-head h3, .history-head h2 { margin: 0; font-size: 17px; }
.history-head span { color: var(--muted); font-size: 11px; }
.history-row { min-height: 78px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto 62px; gap: 14px; align-items: center; border-bottom: 1px solid #e8e4da; }
.history-row:last-child { border-bottom: 0; }
.history-index { color: #a9aaa5; font-size: 11px; font-weight: 800; }
.history-question { min-width: 0; display: grid; gap: 5px; }
.history-question strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.history-question small { color: var(--muted); font-size: 10px; }
.result-badge { padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.result-badge.is-correct { background: var(--green-soft); color: var(--green); }
.result-badge.is-wrong { background: var(--red-soft); color: var(--red); }
.history-points { color: var(--muted); font-size: 20px; text-align: right; }
.history-points.has-points { color: var(--green); }
.history-points small { margin-left: 2px; font-size: 9px; }
.empty-history { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 16px; color: var(--muted); text-align: left; }
.empty-history > span { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--paper-deep); color: var(--green); font-weight: 900; }
.empty-history p { line-height: 1.6; }
.empty-history small { color: #9a9b95; }

.site-footer { width: min(1180px, calc(100% - 40px)); min-height: 76px; margin: auto auto 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid rgba(23,59,51,.13); color: var(--muted); font-size: 11px; }
.site-footer a { text-decoration: none; font-weight: 700; }
.site-footer a:hover { color: var(--ink); }

.question-layer { position: fixed; inset: 0; z-index: 50; }
.question-backdrop { position: absolute; inset: 0; background: rgba(9,24,20,.62); backdrop-filter: blur(6px); }
.question-panel { position: absolute; inset: 4vh max(20px, calc((100vw - 900px)/2)); max-height: 92vh; display: flex; flex-direction: column; border-radius: 26px; background: var(--paper); box-shadow: 0 35px 100px rgba(0,0,0,.3); overflow: hidden; animation: panel-in .24s ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.question-topbar { min-height: 72px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); }
.question-topbar > div { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; }
.tier-tag { padding: 7px 10px; border-radius: 999px; background: var(--yellow-soft); color: #795a10; font-weight: 800; }
.close-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 25px; line-height: 1; }
.close-button:hover { background: var(--white); color: var(--ink); }
.question-content { padding: 42px clamp(28px, 6vw, 74px) 50px; overflow-y: auto; }
.question-kicker { margin: 0 0 12px; color: var(--orange); font-size: 10px; font-weight: 900; letter-spacing: .22em; }
.question-content > h2 { max-width: 700px; margin: 0 0 34px; font-size: clamp(23px, 3.1vw, 34px); line-height: 1.45; letter-spacing: -.02em; }
.answer-form { display: grid; gap: 22px; }
.answer-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-option { min-height: 76px; display: grid; grid-template-columns: 42px minmax(0,1fr) 24px; align-items: center; gap: 12px; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 15px; background: var(--white); cursor: pointer; transition: border .15s, background .15s, transform .15s; }
.answer-option:hover { border-color: var(--green); transform: translateY(-1px); }
.answer-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 3px rgba(47,122,98,.08); }
.answer-option input { position: absolute; opacity: 0; pointer-events: none; }
.option-letter { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--paper-deep); font-weight: 900; }
.answer-option:has(input:checked) .option-letter { background: var(--green); color: white; }
.option-text { font-size: 14px; font-weight: 600; line-height: 1.5; }
.option-check { color: transparent; font-weight: 900; }
.answer-option:has(input:checked) .option-check { color: var(--green); }
.submit-answer { justify-content: center; width: min(260px, 100%); margin: 6px auto 0; }
.question-loading { grid-column: 1/-1; display: grid; gap: 12px; }
.question-loading i { height: 70px; border-radius: 14px; background: linear-gradient(90deg, #e8e4db 20%, #f4f1e9 50%, #e8e4db 80%); background-size: 300% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
.answer-result { padding: 4px 0; }
.result-title { display: flex; align-items: center; gap: 12px; }
.result-title > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 24px; font-weight: 900; }
.wrong-result .result-title > span { background: var(--red); }
.result-title strong { font-size: 24px; }
.result-title b { margin-left: auto; color: var(--green); font-size: 26px; }
.wrong-result .result-title b { color: var(--muted); }
.answer-result > p { margin: 20px 0; color: var(--muted); }
.explanation { margin: 24px 0; padding: 20px; border-left: 4px solid var(--yellow); border-radius: 0 14px 14px 0; background: var(--yellow-soft); }
.explanation span { color: #72550f; font-size: 11px; font-weight: 900; }
.explanation p { margin: 8px 0 0; line-height: 1.8; }
.answer-result .primary-button { width: min(260px, 100%); margin-left: auto; }

.toast { position: fixed; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); z-index: 100; max-width: calc(100% - 36px); padding: 12px 18px; border-radius: 999px; background: var(--ink-dark); color: #fff; box-shadow: 0 12px 38px rgba(0,0,0,.2); opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: opacity .2s, transform .2s; font-size: 13px; text-align: center; white-space: pre-line; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Admin */
.admin-main { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 80px; }
.back-link { color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--ink); }
.admin-login-card { width: min(460px, 100%); margin: 8vh auto; padding: 38px; border: 1px solid var(--line); border-radius: 26px; background: var(--white); box-shadow: var(--shadow); text-align: center; }
.admin-lock { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 18px 18px 18px 5px; background: var(--ink); color: var(--yellow); font-weight: 900; }
.admin-login-card h1 { margin: 0 0 10px; }
.admin-login-card > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.admin-login-card .auth-form { text-align: left; }
.admin-title-row { display: flex; justify-content: space-between; align-items: start; gap: 30px; margin-bottom: 28px; }
.admin-title-row h1 { margin: 0 0 8px; font-size: 38px; }
.admin-title-row p:last-child { margin: 0; color: var(--muted); }
.admin-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.admin-stat-grid article { min-height: 118px; padding: 17px; display: grid; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.admin-stat-grid span { color: var(--muted); font-size: 11px; }
.admin-stat-grid strong { align-self: end; font-size: 30px; line-height: 1; }
.admin-stat-grid strong i { margin: 0 4px; color: #aaa9a2; font-size: 14px; font-style: normal; }
.admin-stat-grid small { margin-top: 4px; color: #aaa9a2; font-size: 9px; }
.admin-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.upload-card { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.card-title { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: start; margin-bottom: 24px; }
.step-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); font-size: 10px; font-weight: 900; }
.card-title h2 { margin: 0 0 6px; font-size: 20px; }
.card-title p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.secondary-button { border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.secondary-button:hover { background: var(--ink); color: #fff; }
.template-columns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.template-columns span { padding: 5px 8px; border-radius: 6px; background: var(--paper); color: var(--muted); font-size: 9px; font-weight: 700; }
#uploadForm { display: grid; gap: 17px; }
.drop-zone { min-height: 138px; display: grid; place-items: center; align-content: center; gap: 6px; padding: 18px; border: 1.5px dashed #b9b8b1; border-radius: 15px; background: var(--paper); cursor: pointer; text-align: center; transition: border .15s, background .15s; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--green); background: var(--green-soft); }
.drop-zone.has-file { border-style: solid; border-color: var(--green); background: var(--green-soft); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 20px; }
.drop-zone strong { max-width: 100%; font-size: 13px; overflow-wrap: anywhere; }
.drop-zone small { color: var(--muted); font-size: 10px; }
.import-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; border: 0; }
.import-mode legend { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 700; }
.import-mode label { display: flex; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.import-mode input { accent-color: var(--green); }
.import-mode span { display: grid; gap: 2px; }
.import-mode b { font-size: 11px; }
.import-mode small { color: var(--muted); font-size: 8px; }
.question-preview-card { margin-top: 18px; }
.question-preview article { min-height: 64px; display: grid; grid-template-columns: 35px minmax(0,1fr) auto; gap: 12px; align-items: center; border-bottom: 1px solid #e8e4da; }
.question-preview article:last-child { border-bottom: 0; }
.preview-index { color: #aaa9a2; font-size: 10px; font-weight: 800; }
.question-preview article div { min-width: 0; display: grid; gap: 3px; }
.question-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.question-preview small { color: var(--muted); font-size: 9px; }
.preview-tier { padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.tier-bg-1 { background: var(--yellow-soft); color: #74550d; }
.tier-bg-2 { background: var(--green-soft); color: var(--green); }
.tier-bg-3 { background: var(--orange-soft); color: #a14b29; }
.admin-empty { padding: 30px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  .auth-view { grid-template-columns: 1fr; gap: 46px; padding-top: 45px; }
  .auth-copy { text-align: center; }
  .lead { margin-left: auto; margin-right: auto; }
  .tier-mini-list { justify-content: center; }
  .auth-card { width: min(490px, 100%); margin: auto; }
  .tier-grid { grid-template-columns: 1fr 1fr; }
  .tier-card:last-child { grid-column: 1/-1; }
  .stat-grid, .admin-stat-grid { grid-template-columns: 1fr 1fr; }
  .admin-workspace { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-header { width: calc(100% - 28px); min-height: 70px; }
  .brand-mark { width: 37px; height: 37px; border-radius: 12px 12px 12px 4px; font-size: 18px; box-shadow: 4px 4px 0 var(--yellow); }
  .brand strong { font-size: 15px; }
  .team-pill { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .auth-view, .dashboard-view, .admin-main { width: calc(100% - 28px); }
  .auth-view { padding: 35px 0 50px; }
  .auth-copy h1 { font-size: 42px; }
  .lead { font-size: 14px; }
  .tier-mini-list span { font-size: 10px; }
  .auth-card { padding: 22px 20px; border-radius: 22px; }
  .dashboard-view { padding: 24px 0 55px; }
  .dashboard-head { min-height: 0; grid-template-columns: 1fr auto; gap: 15px; padding: 26px 20px; border-radius: 22px; }
  .dashboard-head h1 { font-size: 25px; line-height: 1.35; }
  .dashboard-head p:last-child { max-width: 200px; font-size: 11px; line-height: 1.6; }
  .score-hero { min-width: 94px; min-height: 94px; }
  .score-hero span { font-size: 9px; }
  .score-hero strong { font-size: 38px; }
  .score-hero small { display: none; }
  .quiz-section, .scoreboard-section { padding-top: 38px; }
  .section-heading { align-items: start; }
  .section-heading h2 { font-size: 23px; }
  .shared-badge, .private-badge { max-width: 135px; text-align: center; line-height: 1.5; }
  .tier-grid { grid-template-columns: 1fr; }
  .tier-card, .tier-card:last-child { grid-column: auto; min-height: 300px; padding: 20px; }
  .tier-card-copy { margin-top: 24px; }
  .stat-grid { gap: 9px; }
  .stat-card { min-height: 125px; padding: 15px; }
  .stat-card strong { font-size: 38px; }
  .history-card { padding: 4px 15px 9px; }
  .history-row { grid-template-columns: minmax(0,1fr) auto 45px; gap: 9px; padding: 12px 0; }
  .history-index { display: none; }
  .history-question strong { font-size: 12px; }
  .result-badge { padding: 5px 7px; }
  .history-points { font-size: 18px; }
  .site-footer { width: calc(100% - 28px); flex-direction: column; justify-content: center; gap: 8px; text-align: center; }
  .question-panel { inset: 0; max-height: none; border-radius: 0; }
  .question-topbar { min-height: 64px; padding: 0 16px; }
  .question-content { padding: 30px 18px 42px; }
  .question-content > h2 { margin-bottom: 24px; font-size: 23px; }
  .answer-options { grid-template-columns: 1fr; }
  .answer-option { min-height: 68px; }
  .result-title strong { font-size: 21px; }
  .admin-main { padding-top: 32px; }
  .admin-login-card { padding: 28px 20px; }
  .admin-title-row { display: grid; }
  .admin-title-row h1 { font-size: 29px; }
  .admin-stat-grid { gap: 8px; }
  .admin-stat-grid article { min-height: 105px; }
  .admin-stat-grid strong { font-size: 26px; }
  .upload-card { padding: 20px; }
  .import-mode { grid-template-columns: 1fr; }
  .question-preview-card { padding: 5px 14px 10px; }
}

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