:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: rgba(5, 5, 5, 0.76);
  --text: #f7f7f2;
  --muted: #b9c2bd;
  --cyan: #1ee6d6;
  --yellow: #ffe85c;
  --green: #2de071;
  --red: #ff476f;
  --line: rgba(255, 255, 255, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.48)),
    linear-gradient(135deg, rgba(30, 230, 214, 0.18), transparent 45%),
    linear-gradient(315deg, rgba(255, 232, 92, 0.14), transparent 42%);
  background-position: center;
  background-size: cover;
  color: var(--text);
  transition: background-image 220ms ease, background-color 220ms ease;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.view {
  display: none;
  min-height: 100vh;
  padding: 32px;
}

.view-active {
  display: grid;
}

.hero-shell,
.result-shell {
  align-self: center;
  justify-self: center;
  width: min(720px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: 3rem;
}

h2 {
  font-size: 2.4rem;
}

.start-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 28px;
}

.start-form label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 700;
}

.start-form input {
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.start-form input:focus {
  border-color: var(--cyan);
}

.start-form button,
.redirect-buttons a {
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: var(--cyan);
  color: #00110f;
  font-weight: 900;
  text-decoration: none;
}

.start-form button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.status-text {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
}

.loading-view {
  place-items: center;
  align-content: center;
  gap: 24px;
}

.spinner {
  width: 92px;
  height: 92px;
  border: 8px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--cyan);
  border-right-color: var(--yellow);
  border-radius: 50%;
  animation: spin 780ms linear infinite;
}

.loading-number {
  color: var(--text);
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.quiz-view {
  grid-template-rows: auto 1fr;
  gap: 24px;
  background: rgba(0, 0, 0, 0.28);
}

.quiz-topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.62);
  font-weight: 800;
}

#timer {
  min-width: 72px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--yellow);
  color: #171500;
  text-align: center;
}

.question-zone {
  align-self: center;
  justify-self: center;
  width: min(920px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 14, 16, 0.34);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(2px);
}

#questionImage {
  display: block;
  width: min(520px, 100%);
  max-height: 280px;
  margin: 0 auto 24px;
  object-fit: contain;
  border-radius: 8px;
}

#questionImage[hidden] {
  display: none !important;
}

#questionText {
  overflow-wrap: anywhere;
  text-align: center;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.option-button {
  min-height: 72px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-weight: 900;
  overflow-wrap: anywhere;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.option-button:hover:not(:disabled) {
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.option-button:disabled {
  cursor: default;
}

.option-button.correct {
  border-color: var(--green);
  background: rgba(45, 224, 113, 0.22);
}

.option-button.wrong {
  border-color: var(--red);
  background: rgba(255, 71, 111, 0.22);
}

.feedback {
  min-height: 34px;
  margin-top: 20px;
  color: var(--yellow);
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
}

.score-line {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0;
}

.score-line span {
  min-height: 90px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 2rem;
  font-weight: 900;
}

.redirect-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.redirect-buttons a {
  display: grid;
  place-items: center;
  text-align: center;
}

.redirect-buttons a:nth-child(2) {
  background: var(--red);
  color: #fff;
}

@media (max-width: 720px) {
  .view {
    padding: 18px;
  }

  .hero-shell,
  .result-shell,
  .question-zone {
    padding: 22px;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  .start-form,
  .options-grid,
  .score-line,
  .redirect-buttons,
  .quiz-topbar {
    grid-template-columns: 1fr;
  }

  .start-form button,
  .redirect-buttons a {
    width: 100%;
  }
}
