/* =====================================================================
   ระบบจัดสอบผู้บริหารสถานศึกษา — Design tokens
   โทน: น้ำเงิน (navy/blue) - ขาว (paper) - ดำ (ink) ทันสมัย สะอาดตา
   ===================================================================== */
:root {
  --ink: #0b1220;
  --ink-soft: #33415c;
  --muted: #64748b;
  --heading: #081d3a;       /* สีตัวอักษรหัวข้อ (แยกจาก --navy-deep ที่ใช้เป็นพื้นหลังแถบต่างๆ) */
  --text-on-tint: #0c2d57;  /* สีตัวอักษรบนพื้นสีอ่อน เช่น sky/success-bg/danger-bg */
  --navy: #0c2d57;
  --navy-deep: #081d3a;
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --violet: #7c3aed;
  --sky: #eaf1fd;
  --sky-line: #d7e6fb;
  --paper: #f5f8fc;
  --white: #ffffff;
  --line: #e3e8f0;
  --success: #0f8a5f;
  --success-bg: #e5f6ee;
  --danger: #d5303f;
  --danger-bg: #fceaec;
  --gold: #b9840c;
  --gold-bg: #fbf1dc;
  --surface-2: #fafcfe;     /* พื้นหลังตอน hover แถวตาราง ฯลฯ */
  --badge-gray-bg: #eef1f5;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(12, 45, 87, .06);
  --shadow-md: 0 6px 20px rgba(12, 45, 87, .08);
  --shadow-lg: 0 16px 40px rgba(12, 45, 87, .14);
}

/* ---------- โทนสีหน้าจอ: ขาว (ค่าเริ่มต้น, ไม่ต้องกำหนดเพิ่ม) / ดำ / ถนอมสายตา ---------- */
html[data-theme="dark"] {
  --ink: #e7ecf5;
  --ink-soft: #c2cbdb;
  --muted: #93a1b8;
  --heading: #f2f5fb;
  --text-on-tint: #dce8fb;
  --sky: #16273f;
  --sky-line: #24405f;
  --paper: #0c121d;
  --white: #141d2c;
  --line: #29354a;
  --success: #34d399;
  --success-bg: #113328;
  --danger: #f3707e;
  --danger-bg: #3a1620;
  --gold: #f2c14e;
  --gold-bg: #3a2f10;
  --surface-2: #182335;
  --badge-gray-bg: #1d2738;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 6px 20px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
}
html[data-theme="sepia"] {
  --ink: #3a2f22;
  --ink-soft: #5b4a37;
  --muted: #8a765f;
  --heading: #2c2013;
  --text-on-tint: #4a3722;
  --sky: #f1e4c9;
  --sky-line: #e1cda1;
  --paper: #f6ecd9;
  --white: #fbf3e3;
  --line: #e6d6b8;
  --success: #4c7a3e;
  --success-bg: #e4ecd6;
  --danger: #a8432f;
  --danger-bg: #f3ddd2;
  --gold: #93630f;
  --gold-bg: #f0e0b8;
  --surface-2: #f1e6cd;
  --badge-gray-bg: #ece0c6;
  --blue: #3d6b96;
  --blue-light: #4c7fac;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Sarabun', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--blue-light); text-decoration: underline; }
h1, h2, h3, h4 { color: var(--heading); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }

::selection { background: var(--sky-line); color: var(--heading); }

/* ---------- ลายเซ็นของระบบ: แถบไล่สีบางด้านบนสุดทุกหน้า ---------- */
body::before {
  content: "";
  display: block;
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, var(--navy-deep) 0%, var(--blue) 55%, var(--blue-light) 100%);
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--navy-deep);
  background-image: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 100%);
  color: #fff;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar a { color: rgba(255,255,255,.92); text-decoration: none; }
.topbar a:hover { color: #fff; text-decoration: none; }
.topbar .brand {
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.topbar .brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--blue-light), var(--violet));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; box-shadow: 0 3px 10px rgba(37,99,235,.5);
  flex-shrink: 0;
}
.topbar nav { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.topbar nav a {
  padding: 8px 15px; border-radius: 999px; font-size: .89rem; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); }
.topbar nav a.active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.topbar nav a.logout-link {
  margin-left: 6px; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.18);
  border-radius: 0; display: flex; align-items: center; gap: 8px;
}
.user-chip {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #d9a52b);
  color: #3a2a02; font-weight: 800; font-size: .8rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ---------- ตัวเลือกโทนสีหน้าจอ (ขาว / ดำ / ถนอมสายตา) ---------- */
.theme-switcher { display: flex; gap: 6px; background: rgba(255,255,255,.1); border-radius: 999px; padding: 5px; }
.theme-switcher button {
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1.35rem;
  background: transparent; color: rgba(255,255,255,.85); transition: background .15s ease, transform .1s ease;
}
.theme-switcher button:hover { background: rgba(255,255,255,.18); transform: scale(1.06); }
.theme-switcher button.active { background: #fff; color: var(--navy-deep); box-shadow: var(--shadow-sm); }
.theme-switcher.on-light button { color: var(--ink-soft); }
.theme-switcher.on-light button.active { background: var(--navy-deep); color: #fff; }
.theme-switcher.on-light { background: var(--sky); }

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.container.narrow { max-width: 480px; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
  animation: cardIn .35s ease both;
}
.card h2, .card h3 { margin-top: 0; }
.card.hoverable:hover { box-shadow: var(--shadow-md); border-color: var(--sky-line); transform: translateY(-2px); }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Page header (icon + title + subtitle) ---------- */
.page-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.page-header .icon {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue-light), var(--violet));
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
  box-shadow: 0 6px 16px rgba(37,99,235,.28);
}
.page-header h2 { margin: 0; }
.page-header p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; margin-bottom: 7px; font-size: .9rem; color: var(--ink-soft); }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); font-size: .98rem; font-family: inherit;
  background: var(--white); color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--sky);
}
input[type=file] { padding: 9px 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 11px 22px; border-radius: var(--radius-sm); border: none;
  background: var(--blue); color: #fff; cursor: pointer; font-size: .95rem;
  font-family: inherit; font-weight: 600; text-align: center;
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(37,99,235,.25);
}
.btn:hover { background: var(--navy); text-decoration: none; box-shadow: 0 4px 12px rgba(12,45,87,.25); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #64748b; box-shadow: none; }
.btn.secondary:hover { background: #475569; }
.btn.success { background: var(--success); box-shadow: 0 1px 2px rgba(15,138,95,.25); }
.btn.success:hover { background: #0b6e4b; }
.btn.danger { background: var(--danger); box-shadow: 0 1px 2px rgba(213,48,63,.25); }
.btn.danger:hover { background: #b3242f; }
.btn.outline { background: #fff; color: var(--blue); border: 1.5px solid var(--blue); box-shadow: none; }
.btn.outline:hover { background: var(--sky); color: var(--text-on-tint); }
.btn.small { padding: 6px 14px; font-size: .84rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .91rem; }
th { background: var(--sky); color: var(--text-on-tint); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: var(--surface-2); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .76rem; font-weight: 700; letter-spacing: .01em; }
.badge.green { background: var(--success-bg); color: var(--success); }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.gray { background: var(--badge-gray-bg); color: var(--muted); }
.badge.gold { background: var(--gold-bg); color: var(--gold); }

/* ---------- Alerts ---------- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .93rem; border: 1px solid transparent; }
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: #f4c3c9; }
.alert.success { background: var(--success-bg); color: var(--success); border-color: #bfe6d3; }
.alert.info { background: var(--sky); color: var(--text-on-tint); border-color: var(--sky-line); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tabs a { padding: 11px 18px; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 600; font-size: .92rem; }
.tabs a:hover { color: var(--text-on-tint); text-decoration: none; background: var(--sky); }
.tabs a.active { color: var(--blue); background: #fff; border: 2px solid var(--line); border-bottom-color: #fff; margin-bottom: -2px; }

.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; }
.flex.between { justify-content: space-between; }
.flex.gap { gap: 10px; }

code {
  background: var(--sky); border: 1px solid var(--sky-line); border-radius: 6px;
  padding: 2px 7px; font-size: .88em; color: var(--text-on-tint);
}
hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }

/* ---------- Landing hero ---------- */
body.auth-bg {
  background: radial-gradient(circle at 15% 0%, #12345f 0%, transparent 45%),
              radial-gradient(circle at 100% 10%, #1d3f74 0%, transparent 40%),
              linear-gradient(180deg, var(--navy-deep) 0%, var(--paper) 340px);
}
.hero-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 44px 36px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: cardIn .4s ease both;
}
.hero-mark {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 18px;
  background: linear-gradient(135deg, var(--navy-deep), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; box-shadow: 0 8px 24px rgba(12,45,87,.28);
}
.hero-card h1 { font-size: 1.55rem; margin: 0 0 6px; }

/* ---------- Stat tiles ---------- */
.stat-tile { text-align: center; }
.stat-tile .stat-icon {
  width: 42px; height: 42px; border-radius: 12px; margin: 0 auto 10px;
  background: var(--sky); display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.stat-tile .label { color: var(--muted); font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.stat-tile .value { font-size: 2rem; font-weight: 800; color: var(--heading); }
.stat-tile .value.success { color: var(--success); }
.stat-tile .value.gold { color: var(--gold); }

/* ---------- Explanation search link (Google) ---------- */
.explain-search {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 9px 16px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  background: var(--sky); color: var(--text-on-tint); border: 1px solid var(--sky-line);
  transition: background .15s ease, box-shadow .15s ease;
}
.explain-search:hover { background: var(--sky-line); text-decoration: none; box-shadow: var(--shadow-sm); }

/* ---------- ช่องทางติดต่อ (หน้าชำระเงิน) ---------- */
.contact-box { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line); }
.contact-box h4 { margin: 0 0 10px; font-size: .95rem; color: var(--heading); }
.contact-box .who { font-weight: 700; color: var(--ink); }
.contact-box .role { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.contact-links { display: flex; flex-direction: column; gap: 8px; }
.contact-links a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--sky); border: 1px solid var(--sky-line); color: var(--text-on-tint); font-weight: 600; font-size: .9rem;
  transition: background .15s ease;
}
.contact-links a:hover { background: var(--sky-line); text-decoration: none; }
.contact-links .icon { font-size: 1.1rem; flex-shrink: 0; }

/* ---------- Exam taking screen ---------- */
/* เนื้อหาโจทย์/ตัวเลือกแสดงเต็มความกว้าง ตัวนำทางข้อสอบอยู่เป็นแถบแนวนอนด้านบน เลื่อนซ้าย-ขวาได้ */
.exam-page { max-width: 820px; margin: 0 auto; }

.exam-timer {
  color: #fff;
  background: linear-gradient(135deg, var(--navy-deep), var(--blue));
  padding: 16px; border-radius: var(--radius); text-align: center; margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}
.exam-timer .time { font-size: 1.9rem; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.exam-timer.warn { background: linear-gradient(135deg, #7a1a24, var(--danger)); animation: pulseWarn 1.4s ease-in-out infinite; }
@keyframes pulseWarn { 0%, 100% { box-shadow: 0 0 0 0 rgba(213,48,63,.4); } 50% { box-shadow: 0 0 0 10px rgba(213,48,63,0); } }

.save-indicator {
  display: flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 600;
  color: var(--muted); margin: 4px 0 14px; min-height: 18px; transition: opacity .2s ease;
}
.save-indicator .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex-shrink: 0; transition: background .15s ease; }
.save-indicator.saving .dot { background: var(--gold); animation: pulseDot .8s ease-in-out infinite; }
.save-indicator.saved .dot { background: var(--success); }
.save-indicator.error .dot { background: var(--danger); }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* แถบเลื่อนหมายเลขข้อสอบแนวนอนด้านบน — กล่องสี่เหลี่ยมมุมมน ข้อที่ทำแล้ว = น้ำเงิน, ยังไม่ทำ = ขาว */
.question-strip-wrap {
  position: sticky; top: 78px; z-index: 20; background: var(--paper);
  padding: 10px 0 6px; margin-bottom: 18px;
}
.question-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--sky-line) transparent;
}
.question-strip::-webkit-scrollbar { height: 6px; }
.question-strip::-webkit-scrollbar-thumb { background: var(--sky-line); border-radius: 999px; }
.question-strip a {
  flex: 0 0 auto; width: 42px; height: 42px; scroll-snap-align: start;
  border: 1.5px solid var(--line); background: #fff; border-radius: 50%;
  cursor: pointer; font-weight: 700; font-size: .85rem; color: var(--ink-soft);
  transition: all .12s ease; text-decoration: none; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.question-strip a:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.question-strip a.answered { background: var(--blue); color: #fff; border-color: var(--blue); }
.question-strip a.current { outline: 3px solid var(--gold); outline-offset: 1px; }

.nav-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: .8rem; color: var(--muted); }
.nav-legend span { display: inline-flex; align-items: center; gap: 5px; }
.nav-legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1.5px solid var(--line); }
.nav-legend b { color: var(--ink); }

.exam-timer-actions { display: flex; gap: 8px; margin-top: 10px; }
.exam-timer-actions button {
  flex: 1; padding: 8px 10px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.12); color: #fff; font-weight: 600; font-size: .78rem; cursor: pointer;
  transition: background .15s ease;
}
.exam-timer-actions button:hover { background: rgba(255,255,255,.22); }

.pause-overlay, .timeup-overlay {
  display: none; position: fixed; inset: 0; background: rgba(8,29,58,.6); z-index: 110;
  align-items: center; justify-content: center; padding: 20px;
}
.pause-overlay .card, .timeup-overlay .card { max-width: 420px; width: 100%; margin: 0; text-align: center; }

.choice-option {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; cursor: pointer;
  transition: all .12s ease; position: relative;
}
.choice-option:hover { background: var(--sky); border-color: var(--sky-line); }
.choice-option.selected { border-color: var(--blue); background: var(--sky); box-shadow: 0 0 0 3px var(--sky); }
.choice-option.correct { border-color: var(--success); background: var(--success-bg); }
.choice-option.incorrect { border-color: var(--danger); background: var(--danger-bg); }
.choice-option input { margin-top: 3px; accent-color: var(--blue); width: 18px; height: 18px; flex-shrink: 0; }

.submit-panel {
  border: 1.5px solid var(--danger-bg); background: linear-gradient(180deg, #fff, var(--danger-bg) 260%);
}
.submit-panel p { color: var(--ink-soft); font-size: .88rem; }


.score-circle {
  width: 168px; height: 168px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; flex-direction: column; margin: 0 auto 18px; border: 10px solid var(--line);
  background: var(--white); box-shadow: var(--shadow-sm);
}
.score-circle.pass { border-color: var(--success); }
.score-circle.fail { border-color: var(--danger); }
.score-circle .pct { font-size: 2.3rem; font-weight: 800; color: var(--heading); }

/* =====================================================================
   Responsive — รองรับทุกอุปกรณ์ (มือถือ / แท็บเล็ต / คอมพิวเตอร์)
   ===================================================================== */

/* แท็บเล็ต */
@media (max-width: 1024px) {
  .container { padding: 22px 18px 50px; }
  .exam-page { max-width: 100%; }
}

/* มือถือแนวนอน / แท็บเล็ตเล็ก */
@media (max-width: 700px) {
  .container { padding: 16px 12px 44px; }
  .card { padding: 18px; border-radius: var(--radius-sm); }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.08rem; }

  /* Topbar: วางซ้อนกันเป็นแถว แทนที่จะพยายามยัดทุกอย่างในแถวเดียว */
  .topbar { padding: 10px 14px; flex-direction: column; align-items: stretch; gap: 10px; }
  .topbar .brand { font-size: 1rem; justify-content: center; }
  .topbar nav { justify-content: center; }
  .topbar nav a { padding: 7px 11px; font-size: .82rem; }
  .topbar nav a.logout-link { margin-left: 0; border-left: none; padding-left: 11px; width: 100%; justify-content: center; border-top: 1px solid rgba(255,255,255,.15); padding-top: 10px; margin-top: 4px; }

  /* ตาราง: เลื่อนแนวนอนได้แทนการบีบอัดจนอ่านไม่ออก */
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  th, td { padding: 10px 12px; font-size: .85rem; }

  /* ฟอร์ม/ปุ่ม: เต็มความกว้างจับต้องง่ายขึ้นบนจอสัมผัส */
  .btn { padding: 11px 18px; font-size: .95rem; }
  .flex.gap form, .flex.gap { flex-wrap: wrap; }
  .grid-2, .grid-3, .grid-4 { gap: 12px; }

  /* หน้าทำข้อสอบ */
  .exam-timer { padding: 12px; }
  .exam-timer .time { font-size: 1.5rem; }
  .exam-timer-actions { flex-direction: column; }
  .question-strip a { width: 38px; height: 38px; font-size: .8rem; }
  .choice-option { padding: 13px 14px; }
  .page-header { gap: 10px; }
  .page-header .icon { width: 38px; height: 38px; font-size: 1.15rem; }

  .theme-switcher button { width: 38px; height: 38px; font-size: 1.2rem; }
  .hero-card { padding: 28px 20px; }
  .score-circle { width: 130px; height: 130px; }
  .score-circle .pct { font-size: 1.9rem; }
}

/* มือถือแนวตั้งจอเล็กมาก */
@media (max-width: 420px) {
  .topbar nav a span, .topbar nav a { font-size: .78rem; }
  .question-strip a { width: 34px; height: 34px; font-size: .76rem; }
  .stat-tile .value { font-size: 1.5rem; }
}
