:root {
  --ink: #07111f;
  --navy: #0b2d5a;
  --teal: #0f7789;
  --line: #b8c8d6;
  --soft: #edf5f9;
  --good: #177b4d;
  --bad: #b23b31;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #dfeaf0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

.quiz-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
}

.quiz-side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 18px 14px;
  background: linear-gradient(180deg, #0b2d5a 0%, #113b77 100%);
  color: #fff;
}

.quiz-side img {
  width: 170px;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.quiz-side nav {
  display: grid;
  gap: 10px;
}

.quiz-side a {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
}

.score-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.score-card span,
.score-card small {
  color: #d8eef4;
  font-size: 12px;
  font-weight: 800;
}

.score-card strong {
  font-size: 30px;
  line-height: 1;
}

.quiz-main {
  min-width: 0;
  padding: 16px;
}

.quiz-hero,
.quiz-controls,
.quiz-status,
.question-card,
.quiz-actions {
  border: 1px solid #8fa9ba;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(13, 37, 58, 0.12);
}

.quiz-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #0b2d5a 0%, #12446f 72%, #0f7789 100%);
  color: #fff;
}

.quiz-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 3.2vw, 40px);
}

.quiz-hero p {
  max-width: 880px;
  margin: 0;
  color: #d8eef4;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  background: var(--teal);
  color: #fff;
  font: 900 13px Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 11px 14px;
  background: #fff;
  color: var(--navy);
  font: 900 13px Arial, Helvetica, sans-serif;
  text-decoration: none;
}

.hero-actions {
  display: flex;
  gap: 10px;
}

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

.quiz-controls {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(220px, 1fr) 150px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 14px;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #344f62;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  min-width: 0;
  border: 1px solid #aebfcb;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  font: 800 13px Arial, Helvetica, sans-serif;
}

.quiz-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--line);
}

.quiz-status div {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #fff;
}

.quiz-status span {
  color: #536b7a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.quiz-status strong {
  color: var(--navy);
  font-size: 20px;
}

.question-card {
  min-height: 420px;
  padding: 18px;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.question-meta span {
  border: 1px solid #b8c8d6;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--soft);
  color: #344f62;
  font-size: 11px;
  font-weight: 900;
}

.question-card h2 {
  margin: 0 0 18px;
  color: #07111f;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.3;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid #b8c8d6;
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfd;
  color: var(--ink);
  text-align: left;
}

.choice .letter {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #113b77;
  color: #fff;
  font-weight: 900;
}

.choice.correct {
  border-color: #3ba16f;
  background: #e7f6ef;
}

.choice.wrong {
  border-color: #cf6a61;
  background: #fff1f0;
}

.choice.selected {
  border-color: #0f7789;
  background: #e8f6f8;
  box-shadow: inset 4px 0 0 #0f7789;
}

.answer-panel {
  margin-top: 14px;
  padding: 13px;
  border-radius: 8px;
  background: #e7f5f7;
  color: #0b5260;
  font-weight: 900;
}

.answer-panel:empty {
  display: none;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
}

.exam-panel,
.exam-grid-panel {
  border: 1px solid #8fa9ba;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(13, 37, 58, 0.12);
}

.exam-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 16px;
}

.exam-panel[hidden] {
  display: none;
}

.exam-panel h2,
.exam-grid-head h2 {
  margin: 0;
  font-size: 18px;
}

.exam-panel p {
  max-width: 760px;
  margin: 6px 0 0;
  color: #435b6b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.exam-card {
  min-height: 340px;
}

.exam-grid-panel {
  margin-top: 12px;
  padding: 12px;
}

.exam-grid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.question-jump {
  min-height: 38px;
  padding: 8px;
  border: 1px solid #b8c8d6;
  background: #f8fbfd;
  color: var(--navy);
}

.question-jump.active {
  border-color: #0b2d5a;
  background: #0b2d5a;
  color: #fff;
}

.question-jump.answered {
  border-color: #0f7789;
  background: #dff3f6;
  color: #063d49;
}

.question-jump.correct {
  border-color: #177b4d;
  background: #dff5e9;
  color: #07502f;
}

.question-jump.wrong {
  border-color: #b23b31;
  background: #ffe8e6;
  color: #7d1c15;
}

.timer-warn {
  color: #ffd266;
}

.result-panel.pass {
  background: #e1f5e9;
  color: #07502f;
}

.result-panel.fail {
  background: #ffe8e6;
  color: #7d1c15;
}

@media (max-width: 900px) {
  .quiz-shell {
    display: block;
  }

  .quiz-side {
    position: static;
    height: auto;
  }

  .quiz-side nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quiz-controls,
  .quiz-status {
    grid-template-columns: 1fr;
  }

  .quiz-hero,
  .quiz-actions,
  .hero-actions,
  .exam-panel,
  .exam-grid-head {
    align-items: stretch;
    flex-direction: column;
  }

  .question-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
