@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #0d6efd;
  --primary-dark: #084298;
  --surface: #ffffff;
  --page: #f5f9ff;
  --text: #172033;
  --muted: #667085;
  --border: #d7e4f5;
  --success: #198754;
  --danger: #dc3545;
  --warning: #ffc107;
  --shadow: 0 16px 48px rgba(13, 110, 253, .12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  font-family: "Roboto", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(13, 110, 253, .12), transparent 32rem),
    linear-gradient(180deg, #ffffff 0%, var(--page) 42%, #ffffff 100%);
}

.app-header {
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.navbar-brand {
  color: var(--primary-dark);
}

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

.hero-card {
  max-width: 860px;
  padding: clamp(2rem, 5vw, 4rem);
}

.hero-logo {
  width: min(32vw, 168px);
  height: auto;
  margin-bottom: 1.5rem;
}

.hero-card h1 {
  color: var(--primary-dark);
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: .75rem;
}

.hero-card h2 {
  color: #24324b;
  font-size: clamp(1rem, 2.7vw, 1.55rem);
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 2rem;
}

.question-total {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1.25rem;
  margin-bottom: 2rem;
  background: #eef6ff;
  border: 1px solid #cfe3ff;
  border-radius: var(--radius);
}

.question-total span {
  color: var(--muted);
  font-weight: 500;
}

.question-total strong {
  color: var(--primary);
  font-size: 2rem;
  line-height: 1;
}

.mode-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.mode-actions .btn {
  min-width: 180px;
}

.panel {
  padding: 1.25rem;
}

.side-panel {
  top: 5.75rem;
  max-height: calc(100vh - 6.5rem);
  overflow: auto;
}

.section-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: .95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-box .form-control {
  padding-left: 2.6rem;
}

.form-control,
.form-select,
.btn {
  border-radius: var(--radius);
}

.btn {
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.stats-grid,
.result-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.stats-grid div,
.result-metrics div {
  padding: .85rem;
  background: #f7fbff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stats-grid span,
.result-metrics span {
  display: block;
  color: var(--muted);
  font-size: .84rem;
  margin-bottom: .25rem;
}

.stats-grid strong,
.result-metrics strong {
  color: var(--primary-dark);
  font-size: 1.35rem;
}

.chart-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  margin: 1.25rem auto;
}

.chart-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.chart-center span {
  color: var(--primary-dark);
  font-size: 1.35rem;
  font-weight: 700;
}

.question-navigator {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: .45rem;
}

.nav-question {
  min-height: 38px;
  padding: .35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--primary-dark);
  font-weight: 700;
}

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

.nav-question.done {
  border-color: rgba(25, 135, 84, .45);
  background: #ebf8f1;
}

.nav-question.wrong {
  border-color: rgba(220, 53, 69, .45);
  background: #fff1f2;
}

.nav-question.marked::after {
  content: "•";
  color: var(--warning);
  margin-left: 1px;
}

.quiz-panel {
  min-height: 620px;
}

.quiz-toolbar,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.quiz-toolbar h3,
.result-header h3 {
  margin: 0;
  color: var(--primary-dark);
  font-weight: 700;
}

.timer-box {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1rem;
  color: var(--primary-dark);
  background: #eef6ff;
  border: 1px solid #cfe3ff;
  border-radius: var(--radius);
  font-weight: 700;
}

.question-card {
  min-height: 370px;
}

.question-text {
  flex: 1;
  margin-bottom: 1rem;
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  line-height: 1.55;
  font-weight: 700;
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.icon-btn.marked {
  color: #7a5a00;
  background: #fff4cf;
  border-color: #ffd760;
}

.answers-list {
  display: grid;
  gap: .8rem;
}

.answer-option {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  width: 100%;
  padding: 1rem;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform .16s ease, border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.answer-option:hover {
  border-color: #9bc5ff;
  box-shadow: 0 10px 26px rgba(13, 110, 253, .08);
}

.answer-option.selected {
  border-color: var(--primary);
  background: #eef6ff;
}

.answer-option.correct {
  border-color: rgba(25, 135, 84, .55);
  background: #eaf8f1;
}

.answer-option.incorrect {
  border-color: rgba(220, 53, 69, .5);
  background: #fff0f2;
}

.answer-letter {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
}

.answer-option.correct .answer-letter {
  background: var(--success);
}

.answer-option.incorrect .answer-letter {
  background: var(--danger);
}

.answer-notice {
  margin-top: 1rem;
  padding: .9rem 1rem;
  color: #0f5132;
  background: #d1e7dd;
  border: 1px solid #badbcc;
  border-radius: var(--radius);
  font-weight: 700;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1.25rem;
}

.wrong-title {
  margin: 1.25rem 0 .85rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.wrong-list {
  display: grid;
  gap: .75rem;
}

.wrong-item {
  padding: 1rem;
  background: #fff7f7;
  border: 1px solid #ffd3d8;
  border-radius: var(--radius);
}

.wrong-item strong {
  color: var(--danger);
}

.fade-in {
  animation: fadeIn .22s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 991.98px) {
  .side-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 575.98px) {
  main.container {
    padding-left: .85rem;
    padding-right: .85rem;
  }

  .panel,
  .hero-card {
    padding: 1rem;
  }

  .quiz-toolbar,
  .result-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .action-bar .btn {
    width: 100%;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-switch .btn {
    flex: 1 1 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
