:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #eef3f8;
  --text: #18212f;
  --muted: #5f6f82;
  --line: #d9e1ea;
  --primary: #146c94;
  --primary-dark: #0f526f;
  --accent: #6b8e23;
  --danger: #b6403a;
  --warning: #9a6a13;
  --shadow: 0 18px 45px rgba(24, 33, 47, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  background: #132334;
  color: #fff;
  border-bottom: 4px solid var(--accent);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #132334;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  font-size: 19px;
  font-weight: 750;
}

.brand-subtitle {
  display: block;
  color: #b9c6d3;
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
}

.topnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topnav a {
  color: #dce7f1;
  text-decoration: none;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  font-size: 14px;
}

.topnav a:hover,
.topnav a:focus {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 34px 24px 48px;
}

.page-header {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
  letter-spacing: 0;
  line-height: 1.15;
}

h1 {
  margin-bottom: 10px;
  font-size: 34px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 18px;
}

.subtitle,
.lede {
  margin: 0;
  color: var(--muted);
}

.lede {
  max-width: 760px;
  font-size: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.config,
.quiz,
#resultats {
  max-width: 900px;
  margin: 0 auto 24px;
  padding: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-row {
  margin-bottom: 18px;
}

.form-row.full {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
}

.muted,
label small.muted {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(20, 108, 148, 0.24);
  outline-offset: 2px;
}

.btn-row,
.actions,
.nav-questions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

button,
.button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.btn-primary,
.button.primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover,
.button.primary:hover {
  background: var(--primary-dark);
}

.btn-secondary,
.button.secondary {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-secondary:hover,
.button.secondary:hover {
  background: #e2ebf3;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #96302c;
}

.hidden {
  display: none !important;
}

.notice,
.note {
  border-left: 4px solid var(--primary);
  background: var(--surface-muted);
  padding: 14px 16px;
  border-radius: 8px;
  color: var(--muted);
}

.flashbar {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 14px;
  z-index: 9999;
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}

.flashbar.info,
.flashbar.success {
  background: var(--primary);
}

.flashbar.warn {
  background: var(--warning);
}

.flashbar.error {
  background: var(--danger);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 16px;
}

.question-text {
  font-size: 22px;
  line-height: 1.5;
  margin: 0 0 22px;
}

.answers {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}

.answers label {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
  font-weight: 550;
}

.answers label:hover {
  border-color: #9fb6c9;
  background: #f4f8fb;
}

.answers input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.nav-questions {
  justify-content: space-between;
}

.nav-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-number {
  min-width: 38px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text);
}

.nav-number.active {
  background: var(--primary);
  color: #fff;
}

.timer,
#examTimer {
  position: sticky;
  top: 14px;
  z-index: 10;
  width: fit-content;
  margin: 0 0 18px auto;
  background: #132334;
  color: #fff;
  font-weight: 800;
  padding: 9px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.themes-tree {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.themes-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 18px;
}

.themes-tree > ul {
  padding-left: 0;
}

.themes-tree li {
  margin: 6px 0;
}

.themes-tree label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  font-weight: 550;
}

.themes-tree label.theme-partial {
  color: var(--primary);
}

.themes-tree input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 3px;
  accent-color: var(--primary);
}

.selection-review {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #bfd3e2;
  border-radius: 8px;
  background: #f3f8fc;
}

.selection-review h3 {
  margin-bottom: 8px;
}

.selection-review-meta {
  margin: 0 0 12px;
  color: var(--muted);
}

.selection-review ul {
  max-height: 190px;
  overflow: auto;
  margin: 0;
  padding-left: 20px;
}

.selection-review li {
  margin: 5px 0;
}

.selection-review-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

@media (max-width: 760px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .page {
    padding: 24px 14px 36px;
  }

  h1 {
    font-size: 28px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .config,
  .quiz,
  #resultats {
    padding: 20px;
  }

  .question-text {
    font-size: 19px;
  }

  .nav-questions {
    align-items: stretch;
    flex-direction: column;
  }

  button,
  .button {
    width: 100%;
  }
}
