:root {
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #1a2333;
  --text: #e6eefc;
  --muted: #a5b4fc; /* soft indigo for contrast */
  --brand: #3b82f6; /* blue-500 */
  --accent: #60a5fa; /* blue-400 */
  --danger: #ff6b6b;
  --warn: #ffb86b;
  --ok: #34d399;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 10% -10%, #0f1626, #0b0f17), var(--bg);
  color: var(--text);
}
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* Layout */
.container { width: min(1120px, 92vw); margin: 0 auto; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 15, 23, 0.6);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; letter-spacing: .3px; }

/* Hero */
.hero-section {
  position: relative;
  padding: 80px 0 100px;
  text-align: center;
}
.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(900px 600px at 50% -10%, rgba(59,130,246,.25), transparent 60%);
  pointer-events: none;
}
.hero-inner { display: grid; gap: 18px; justify-items: center; }
.brand-badge {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin: 0 auto;
  background: linear-gradient(135deg, var(--brand), #93c5fd 60%, #fff);
  box-shadow: 0 10px 32px rgba(59, 130, 246, 0.35);
}
.brand-badge.small { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 4px 14px rgba(59,130,246,.35); }
.title {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0.3px;
}
.subtitle {
  margin: 0;
  color: var(--muted);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--brand), #86bfff);
  color: #0b1020;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.2s ease, opacity 0.2s;
  box-shadow: 0 6px 20px rgba(106, 169, 255, 0.3);
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn.secondary {
  background: #23314f;
  color: #e6eefc;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.btn.danger {
  background: linear-gradient(135deg, #ff6b6b, #ff9b8a);
  color: #230c0c;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 6px 10px;
}
.muted {
  color: var(--muted);
}
.hidden {
  display: none !important;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal-backdrop#strict-modal { z-index: 70; }
.modal-backdrop#strict-modal .modal { width: min(520px, 92vw); }
.modal-backdrop#strict-modal h2 { text-align: center; }
.modal {
  width: min(720px, 92vw);
  max-height: 88vh;
  overflow: auto;
}
.modal .panel {
  padding: 20px;
}
.modal h2 {
  margin: 0 0 8px 0;
}
.rule {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.space {
  height: 12px;
}

/* Exam layout (single-question) */
.exam-wrap {
  width: min(1000px, 94vw);
  height: min(680px, 86vh);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 16px;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.timer {
  font-weight: 700;
  color: var(--accent);
}
.progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 0.2s ease;
}

.q-card {
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  overflow: hidden;
}
.q-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.q-body {
  overflow: auto; /* if question content overflows, only this scrolls */
  display: grid;
  gap: 10px;
  padding-right: 4px;
}
.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.option.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(106, 169, 255, 0.25) inset;
  background: rgba(106, 169, 255, 0.12);
}

.q-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  background: #0d1423;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  color: #c7d7f2;
  min-width: 22px;
  text-align: center;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: #1c2436;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 60;
  max-width: 380px;
}
.warn {
  border-left: 4px solid var(--warn);
}
.danger-border {
  border-left: 4px solid var(--danger);
}

/* Webcam thumb (optional) */
.cam {
  width: 140px;
  height: 100px;
  background: #0d1423;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

/* Result + leaderboard modal */
.result {
  padding: 24px;
  text-align: center;
  display: grid;
  gap: 12px;
}
.lb-item {
  display: grid;
  grid-template-columns: 1fr 90px 90px 90px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}
.lb-item:last-child {
  border-bottom: none;
}
.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.good {
  background: rgba(52, 211, 153, 0.15);
  color: #b2f1d9;
}
.bad {
  background: rgba(255, 107, 107, 0.15);
  color: #ffb9b9;
}
