:root {
  --navy: #0f2a4a;
  --navy-dark: #0a1d33;
  --blue: #2563eb;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --gray-bg: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f8fafc;
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  background: var(--navy);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
header.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}
header.topbar .brand .tag {
  background: rgba(255,255,255,0.15);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
header.topbar nav {
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 0.92rem;
}
header.topbar nav a, header.topbar nav button {
  color: rgba(255,255,255,0.88);
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 6px 2px;
}
header.topbar nav a:hover, header.topbar nav button:hover { color: white; text-decoration: underline; }
header.topbar nav a.active { color: white; border-bottom: 2px solid var(--blue); }

main.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
main.container.wide { max-width: 1240px; }

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 28px 0 12px; }
p.sub { color: var(--text-muted); margin: 0 0 24px; }

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card.center { max-width: 420px; margin: 60px auto; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--navy);
  color: white;
}
.btn:hover { background: var(--navy-dark); }
.btn.secondary { background: var(--gray-bg); color: var(--text); }
.btn.secondary:hover { background: var(--border); }
.btn.danger { background: var(--red); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 1rem;
  font-family: inherit;
  margin-top: 4px;
}
label { font-weight: 600; font-size: 0.88rem; color: var(--text-muted); display: block; margin-top: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table th, table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
table tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 0.78rem; font-weight: 700; }
.badge.pass { background: var(--green-bg); color: #166534; }
.badge.fail { background: var(--red-bg); color: #991b1b; }
.badge.neutral { background: var(--gray-bg); color: var(--text-muted); }
.badge.admin { background: #ede9fe; color: #5b21b6; }

.row-tint-green { background: #f0fdf4; }
.row-tint-red { background: #fef2f2; }
.row-tint-amber { background: #fffbeb; }

.bar-track { background: var(--gray-bg); border-radius: 100px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 100px; }

.mode-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: white;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.mode-card:hover { box-shadow: 0 2px 10px rgba(15,42,74,0.1); border-color: var(--blue); }
.mode-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.mode-card p { margin: 0; color: var(--text-muted); font-size: 0.88rem; }
.mode-card.soon { cursor: default; opacity: 0.6; }
.mode-card.soon:hover { box-shadow: none; border-color: var(--border); }
.mode-card h3 .badge { vertical-align: middle; margin-left: 8px; font-size: 0.68rem; }

.option-choice {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 0.98rem;
}
.option-choice:hover { border-color: var(--blue); }
.option-choice.selected { border-color: var(--blue); background: #eff6ff; }
.option-choice.correct { border-color: var(--green); background: var(--green-bg); }
.option-choice.incorrect { border-color: var(--red); background: var(--red-bg); }
.option-choice input { width: auto; margin: 0 10px 0 0; }

.timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
}
.timer.low { background: var(--red); color: white; }

.qnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.qnav button {
  width: 34px; height: 34px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: white;
  font-size: 0.8rem;
  cursor: pointer;
}
.qnav button.answered { background: #eff6ff; border-color: var(--blue); }
.qnav button.current { border-color: var(--navy); border-width: 2px; }
.qnav button.flagged { box-shadow: inset 0 -3px 0 var(--amber); }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.92rem; }
.flash.error { background: var(--red-bg); color: #991b1b; }
.flash.success { background: var(--green-bg); color: #166534; }
.flash.info { background: #eff6ff; color: #1e40af; }

.muted { color: var(--text-muted); }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex.between { justify-content: space-between; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { background: none; border: none; padding: 10px 16px; cursor: pointer; font: inherit; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--navy); border-color: var(--navy); }
