:root {
  --ink: #eff6ff;
  --muted: #9fb2cc;
  --navy-950: #07111f;
  --navy-900: #0a1628;
  --navy-850: #10243c;
  --navy-800: #142b46;
  --card: #f7f9fc;
  --card-ink: #162235;
  --card-muted: #5b6778;
  --gold: #caa45d;
  --gold-strong: #e0bd73;
  --tech: #36a3ff;
  --danger: #df5f5f;
  --success: #2f9e72;
  --line: rgba(255, 255, 255, 0.14);
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.exam-shell {
  width: 100%;
  background:
    linear-gradient(135deg, rgba(54, 163, 255, 0.11), transparent 34%),
    linear-gradient(180deg, var(--navy-950), var(--navy-900));
  padding: 18px;
}

.app-frame {
  width: 100%;
  margin: 0;
}

.topbar,
.hero-panel,
.exam-panel,
.result-panel,
.modal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel,
.exam-panel,
.result-panel {
  background: rgba(10, 22, 40, 0.94);
}

.hero-panel {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 3vw, 32px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold-strong);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 980px;
  margin-bottom: 10px;
  font-size: clamp(1.85rem, 4.2vw, 3.35rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.lead {
  max-width: 760px;
  color: #d7e3f3;
  font-size: clamp(1rem, 1.6vw, 1.14rem);
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 86px;
  padding: 14px 16px;
  background: rgba(20, 43, 70, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  color: #ffffff;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
}

.metric span {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.notice-panel,
.instruction-panel {
  padding: 16px 18px;
  border-radius: 8px;
  line-height: 1.55;
}

.notice-panel p,
.instruction-panel p {
  margin-bottom: 0;
}

.instruction-panel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(202, 164, 93, 0.38);
}

.notice-panel {
  background: rgba(223, 95, 95, 0.1);
  border: 1px solid rgba(223, 95, 95, 0.36);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  min-height: 48px;
  padding: 13px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: 800;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:hover:not(:disabled),
.btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.34);
  outline: 3px solid rgba(54, 163, 255, 0.28);
  outline-offset: 2px;
}

.btn-primary {
  border-color: rgba(224, 189, 115, 0.65);
  background: linear-gradient(180deg, #d9b466, #b98e3f);
  color: #101827;
}

.btn-tech {
  border-color: rgba(54, 163, 255, 0.54);
  background: rgba(54, 163, 255, 0.16);
}

.btn-danger {
  border-color: rgba(223, 95, 95, 0.5);
  background: rgba(223, 95, 95, 0.16);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px 18px;
  background: rgba(10, 22, 40, 0.96);
}

.exam-title {
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #dce8f8;
  font-size: 0.9rem;
  font-weight: 700;
}

.timer {
  min-width: 138px;
  padding: 9px 12px;
  border: 1px solid rgba(202, 164, 93, 0.5);
  border-radius: 8px;
  color: var(--gold-strong);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.18rem, 2.5vw, 1.55rem);
  font-weight: 900;
}

.timer.warning {
  border-color: rgba(223, 95, 95, 0.65);
  color: #ffb8b8;
}

.progress-track {
  overflow: hidden;
  width: 100%;
  height: 9px;
  margin: 0 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--gold), var(--tech));
  transition: width 0.2s ease;
}

.exam-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
}

.exam-panel {
  padding: 14px;
}

.question-card {
  padding: clamp(16px, 2.4vw, 24px);
  border-radius: 8px;
  background: var(--card);
  color: var(--card-ink);
}

.question-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  color: var(--card-muted);
  font-weight: 800;
}

.question-text {
  margin-bottom: 18px;
  color: #111827;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  font-weight: 750;
  line-height: 1.45;
}

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

.option-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border: 2px solid #d7deea;
  border-radius: 8px;
  background: #ffffff;
  color: var(--card-ink);
  text-align: left;
}

.option-card:hover,
.option-card:focus-visible {
  border-color: var(--tech);
  outline: 3px solid rgba(54, 163, 255, 0.2);
  outline-offset: 2px;
}

.option-card.selected {
  border-color: #a67c2e;
  background: #fff8ea;
  box-shadow: inset 0 0 0 1px rgba(166, 124, 46, 0.24);
}

.option-letter {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #e8eef7;
  color: #172033;
  font-weight: 900;
}

.option-card.selected .option-letter {
  background: var(--gold);
  color: #101827;
}

.option-text {
  line-height: 1.42;
}

.exam-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.exam-controls-top {
  margin-top: 0;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 43, 70, 0.72);
}

.exam-controls-top .btn {
  min-height: 40px;
  padding: 9px 12px;
  font-size: 0.92rem;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.status-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 43, 70, 0.9);
}

.status-card p {
  margin: 0 0 6px;
  color: var(--muted);
}

.status-card p:last-child {
  margin-bottom: 0;
}

.question-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(1.75rem, 4.6vw, 2.35rem), 1fr));
  gap: clamp(0.25rem, 0.7vw, 0.45rem);
}

.question-jump {
  min-width: 0;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: clamp(0.62rem, 1.35vw, 0.82rem);
  font-weight: 900;
  line-height: 1;
}

.question-jump.current {
  border-color: var(--tech);
  background: rgba(54, 163, 255, 0.28);
  outline: 2px solid rgba(54, 163, 255, 0.35);
  outline-offset: 1px;
}

.question-jump.answered {
  border-color: rgba(47, 158, 114, 0.95);
  background: rgba(47, 158, 114, 0.46);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(173, 240, 209, 0.35);
}

.question-jump.marked {
  border-color: rgba(224, 189, 115, 0.82);
  background: rgba(202, 164, 93, 0.34);
  color: #fff3cc;
  box-shadow: inset 0 0 0 1px rgba(255, 243, 204, 0.24);
}

.question-list-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  background: rgba(2, 8, 18, 0.72);
}

.question-list-card {
  width: min(58rem, 100%);
  max-height: calc(100dvh - clamp(1.5rem, 4vw, 3rem));
  overflow: auto;
  padding: clamp(0.9rem, 2vw, 1.25rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 22, 40, 0.98);
  box-shadow: var(--shadow);
}

.question-list-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: clamp(0.75rem, 1.6vw, 1rem);
}

.question-list-head h3 {
  margin-bottom: 0.25rem;
}

.question-list-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.result-panel {
  padding: clamp(22px, 4vw, 42px);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.score-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 43, 70, 0.9);
}

.score-card strong {
  display: block;
  color: #ffffff;
  font-size: 2rem;
}

.score-card span {
  color: var(--muted);
  font-weight: 800;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.summary-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr 130px;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.tag {
  display: inline-flex;
  justify-content: center;
  padding: 6px 9px;
  border-radius: 8px;
  font-weight: 900;
}

.tag.ok {
  background: rgba(47, 158, 114, 0.18);
  color: #adf0d1;
}

.tag.bad {
  background: rgba(223, 95, 95, 0.18);
  color: #ffc2c2;
}

.tag.empty {
  background: rgba(255, 255, 255, 0.12);
  color: #d9e3f2;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 8, 18, 0.72);
}

.modal-card {
  width: min(620px, 100%);
  padding: 24px;
  background: #f8fafc;
  color: #101827;
}

.modal-card p {
  color: #4b5563;
  line-height: 1.6;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.modal-stat {
  padding: 14px;
  border: 1px solid #d9e1ed;
  border-radius: 8px;
  background: #ffffff;
}

.modal-stat strong {
  display: block;
  font-size: 1.6rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .exam-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .exam-shell {
    padding: 12px;
  }

  .metric-grid,
  .modal-stats {
    grid-template-columns: 1fr;
  }

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

  .timer {
    width: 100%;
  }

  .option-card {
    grid-template-columns: 38px 1fr;
    padding: 14px;
  }

  .question-list-head {
    display: grid;
  }

  .summary-row {
    grid-template-columns: 1fr;
  }

  .actions,
  .exam-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }
}
