:root {
  --navy: #0b2f55;
  --blue: #1167b1;
  --blue-soft: #eaf4ff;
  --green: #1f8b55;
  --green-soft: #e9f8f0;
  --red: #bd3443;
  --red-soft: #fff0f2;
  --ink: #1f2937;
  --muted: #64748b;
  --line: #dbe4ee;
  --card: #ffffff;
  --bg: #f3f7fb;
  --shadow: 0 18px 50px rgba(20, 45, 75, .10);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
button, input { font: inherit; }
a { color: inherit; }
.page-bg { min-height: 100vh; background: radial-gradient(circle at top right, #dceeff 0, transparent 34%), var(--bg); }
.center-shell { width: min(920px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; display: grid; place-items: center; padding: 40px 0; }
.center-shell.narrow { width: min(540px, calc(100% - 32px)); }
.card { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: clamp(24px, 5vw, 48px); box-shadow: var(--shadow); }
.eyebrow { color: var(--blue); font-weight: 800; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 10px 0 10px; color: var(--navy); font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.03; }
.lead { color: var(--muted); font-size: 1.08rem; margin: 0 0 28px; }
.info-grid, .result-grid, .stats-grid { display: grid; gap: 12px; }
.info-grid { grid-template-columns: repeat(4, 1fr); margin: 28px 0; }
.info-grid div, .result-grid div { background: #f8fbfe; border: 1px solid var(--line); border-radius: 16px; padding: 18px; text-align: center; }
.info-grid strong, .result-grid strong { display: block; color: var(--navy); font-size: 1.45rem; }
.info-grid span, .result-grid span { display: block; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.student-form { display: grid; gap: 16px; }
label { font-weight: 700; color: var(--navy); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"] { width: 100%; margin-top: 7px; border: 1px solid #cdd8e4; border-radius: 12px; padding: 13px 14px; outline: none; background: #fff; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(17, 103, 177, .12); }
.btn { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 800; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--blue); color: white; }
.btn-secondary { background: #e9eff5; color: var(--navy); }
.btn-danger { background: var(--red); color: #fff; }
.btn:disabled { opacity: .7; cursor: wait; }
.fine-print { margin: 18px 0 0; color: var(--muted); font-size: .86rem; }
.alert { padding: 13px 14px; border-radius: 12px; margin-bottom: 18px; }
.alert-error { color: #8c2532; background: var(--red-soft); border: 1px solid #f2c3c9; }
.exam-page { background: #f6f8fb; }
.exam-header, .admin-header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: 14px max(20px, calc((100vw - 1100px)/2)); display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.timer-wrap { text-align: right; }
.timer-wrap span { color: var(--muted); font-size: .75rem; display: block; }
.timer { color: var(--navy); font-size: 1.65rem; line-height: 1; font-variant-numeric: tabular-nums; font-weight: 900; }
.timer.danger { color: var(--red); }
.exam-shell, .admin-shell { width: min(1100px, calc(100% - 32px)); margin: 28px auto 60px; }
.progress-card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-bottom: 16px; display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: .9rem; }
.progress { flex: 1; height: 8px; background: #edf2f7; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.question-card, .submit-card, .table-card, .answer-card, .mini-summary { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 4vw, 30px); margin-bottom: 16px; }
.question-top { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.question-number { font-size: .82rem; font-weight: 800; color: var(--blue); }
.topic { font-size: .75rem; font-weight: 800; color: var(--muted); background: #eff4f8; border-radius: 99px; padding: 6px 10px; }
.question-card h2, .answer-card h2 { font-size: 1.15rem; color: var(--navy); line-height: 1.45; margin: 14px 0 18px; }
.options { display: grid; gap: 10px; }
.option { display: grid; grid-template-columns: 22px 34px 1fr; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 13px; padding: 12px; cursor: pointer; font-weight: 500; color: var(--ink); }
.option:hover { border-color: #91bce0; background: #f8fbff; }
.option:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.option input { margin: 0; }
.letter { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #eef3f7; color: var(--navy); font-weight: 900; }
.submit-card { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.submit-card p { margin: 4px 0 0; color: var(--muted); }
.score-circle { width: 170px; height: 170px; margin: 26px auto; border-radius: 50%; display: grid; place-content: center; text-align: center; border: 12px solid #d9e6f2; }
.score-circle.pass { border-color: #9ed8bb; background: var(--green-soft); }
.score-circle.fail { border-color: #f0aeb6; background: var(--red-soft); }
.score-circle strong { font-size: 2.65rem; color: var(--navy); line-height: 1; }
.score-circle span { color: var(--muted); }
.result-grid { grid-template-columns: repeat(4, 1fr); }
.notice { margin-top: 20px; background: #f5f8fb; border-radius: 12px; padding: 14px; color: var(--muted); text-align: center; }
.text-pass { color: var(--green) !important; }
.text-fail { color: var(--red) !important; }
.admin-page { background: #f3f6f9; }
.admin-header { position: static; }
.admin-header h1 { font-size: 1.7rem; margin: 4px 0; }
.admin-header p { margin: 0; color: var(--muted); }
.stats-grid { grid-template-columns: repeat(5, 1fr); margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.stat-card span { display: block; color: var(--muted); font-size: .8rem; }
.stat-card strong { display: block; color: var(--navy); font-size: 1.8rem; margin-top: 5px; }
.table-card { padding: 0; overflow: hidden; }
.table-tools { padding: 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 14px; }
.search-form { display: flex; gap: 8px; width: min(520px, 100%); }
.search-form input { margin: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #edf1f5; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: .9rem; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.badge { border-radius: 99px; padding: 6px 9px; font-size: .76rem; font-weight: 800; }
.badge-pass { background: var(--green-soft); color: var(--green); }
.badge-fail { background: var(--red-soft); color: var(--red); }
.link, .back-link { color: var(--blue); font-weight: 800; text-decoration: none; }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.detail-score { text-align: right; }
.detail-score strong { display: block; font-size: 2rem; color: var(--navy); }
.detail-score span { color: var(--muted); }
.detail-shell { width: min(900px, calc(100% - 32px)); }
.mini-summary { display: flex; gap: 28px; flex-wrap: wrap; }
.answer-card { border-left: 5px solid var(--line); }
.answer-correct { border-left-color: var(--green); }
.answer-wrong { border-left-color: var(--red); }
.answer-card p { margin: 8px 0 0; }
@media (max-width: 800px) {
  .info-grid, .result-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .submit-card, .table-tools { align-items: stretch; flex-direction: column; }
}
@media (max-width: 520px) {
  .center-shell { width: min(100% - 20px, 920px); padding: 20px 0; }
  .card { border-radius: 18px; }
  .exam-header { padding: 12px 14px; }
  .exam-header .eyebrow { display: none; }
  .exam-shell, .admin-shell { width: calc(100% - 20px); margin-top: 14px; }
  .question-card { padding: 18px 14px; }
  .option { grid-template-columns: 20px 30px 1fr; padding: 11px 9px; }
  .info-grid, .result-grid, .stats-grid { grid-template-columns: 1fr 1fr; }
}
