:root {
  --bg: #e8eef2;
  --bg-deep: #d5dde4;
  --surface: #f7f9fb;
  --ink: #1a2430;
  --muted: #5a6a7a;
  --line: #c5d0da;
  --accent: #0d5c63;
  --accent-hover: #09484e;
  --ok: #1f7a3f;
  --ok-bg: #e6f5eb;
  --bad: #a32020;
  --bad-bg: #fce8e8;
  --warn: #8a5a00;
  --shadow: 0 12px 40px rgba(26, 36, 48, 0.08);
  --radius: 14px;
  --font: "Source Sans 3", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #c9dce3 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #d7e3d9 0%, transparent 50%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  min-height: 100%;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
#app { min-height: 100%; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px 28px;
}
.login-card h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.login-card .sub {
  color: var(--muted);
  margin: 0 0 28px;
  line-height: 1.45;
}
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.92rem; }
.field input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,92,99,.15); }
.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transition: background .15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: #eef2f5; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.error {
  color: var(--bad);
  background: var(--bad-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.shell { max-width: 860px; margin: 0 auto; padding: 28px 20px 60px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.brand {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0;
}
.muted { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  margin: 0 0 8px;
}
.modes {
  display: grid;
  gap: 10px;
  margin: 18px 0 8px;
}
.mode {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  cursor: pointer;
}
.mode:hover { border-color: #9eb0bd; }
.mode.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,92,99,.12);
}
.mode strong { display: block; margin-bottom: 2px; }
.mode span { color: var(--muted); font-size: 0.9rem; line-height: 1.35; }

/* Exam — one question */
.exam-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(247,249,251,.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  background: #eef3f6;
}
.timer.warn { background: #fff3d6; color: var(--warn); }
.timer.danger { background: var(--bad-bg); color: var(--bad); }

.q-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.q-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.q-head h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin: 0;
}
.q-img-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.q-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
}
.choices {
  display: grid;
  gap: 10px;
}
.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.choice:hover:not(:disabled) {
  border-color: #8fa3b3;
}
.choice .letter {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: #eef3f6;
  color: var(--ink);
}
.choice .label {
  padding-top: 6px;
  font-weight: 600;
}
.choice.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,92,99,.12);
  background: #f1f8f8;
}
.choice.selected .letter {
  background: var(--accent);
  color: #fff;
}
.choice.ok {
  border-color: #7cbc93;
  background: var(--ok-bg);
  box-shadow: 0 0 0 3px rgba(31,122,63,.12);
}
.choice.ok .letter { background: var(--ok); color: #fff; }
.choice.bad {
  border-color: #d98a8a;
  background: var(--bad-bg);
  box-shadow: 0 0 0 3px rgba(163,32,32,.1);
}
.choice.bad .letter { background: var(--bad); color: #fff; }
.choice.reveal {
  border-color: #7cbc93;
  background: var(--ok-bg);
}
.choice.reveal .letter { background: var(--ok); color: #fff; }

.feedback {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-top: 18px;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0;
}
.dot.answered { background: var(--accent); border-color: var(--accent); }
.dot.current { outline: 2px solid var(--ink); outline-offset: 2px; }
.dot.ok { background: var(--ok); border-color: var(--ok); }
.dot.bad { background: var(--bad); border-color: var(--bad); }

.result-hero { text-align: center; padding: 18px 10px 8px; }
.result-hero .score {
  font-family: var(--serif);
  font-size: 3rem;
  font-weight: 700;
  margin: 8px 0 0;
}
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}
.badge.pass { background: var(--ok-bg); color: var(--ok); }
.badge.fail { background: var(--bad-bg); color: var(--bad); }
.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  font-size: 0.95rem;
}
.result-table th, .result-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
}
.result-table th { color: var(--muted); font-weight: 600; }
