:root {
  color-scheme: light;
  --bg: #f3efe6;
  --bg-accent: #e7dcc8;
  --panel: rgba(255, 252, 245, 0.86);
  --panel-border: rgba(55, 37, 20, 0.1);
  --text: #2b1f14;
  --muted: #65594c;
  --accent: #ab3f1b;
  --accent-dark: #7b2d14;
  --success: #197a49;
  --danger: #b13030;
  --shadow: 0 24px 60px rgba(55, 37, 20, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.7), transparent 30%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-accent) 100%);
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
}

.app-shell {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.panel {
  display: none;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel.active {
  display: block;
}

.panel-start,
.panel-result {
  padding: clamp(32px, 5vw, 60px);
  text-align: center;
}

.panel-start h1,
.panel-result h2 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  font-weight: 700;
}

.lead,
.result-summary {
  width: min(640px, 100%);
  margin: 20px auto 0;
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--muted);
}

.primary-button,
.secondary-button,
.choice-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.choice-button:hover {
  transform: translateY(-2px);
}

.primary-button {
  margin-top: 28px;
  background: var(--accent);
  color: #fff9f3;
  box-shadow: 0 16px 32px rgba(171, 63, 27, 0.24);
}

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

.panel-quiz {
  padding: clamp(18px, 2.4vw, 24px);
}

.quiz-topbar {
  margin-bottom: 18px;
}

.progress-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(43, 31, 20, 0.1);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d68757, var(--accent));
  transition: width 220ms ease;
}

.card {
  display: grid;
  gap: 14px;
}

.media-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.image-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #f8f3eb;
  border: 1px solid rgba(43, 31, 20, 0.08);
  aspect-ratio: 4 / 3;
  max-height: min(34vh, 300px);
  display: grid;
  place-items: center;
  cursor: zoom-in;
}

.image-frame::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74px;
  height: 74px;
  border-radius: 999px;
  background:
    rgba(255, 255, 255, 0.38)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b1f14' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4.5 4.5'/%3E%3C/svg%3E")
    center / 34px 34px no-repeat;
  border: 1px solid rgba(43, 31, 20, 0.12);
  box-shadow: 0 8px 20px rgba(43, 31, 20, 0.12);
  backdrop-filter: blur(4px);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  margin: auto;
}

.question-block h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.question-block p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.choice-button {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border: 1px solid rgba(43, 31, 20, 0.12);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.choice-button:hover {
  box-shadow: 0 10px 20px rgba(43, 31, 20, 0.08);
}

.choice-button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.choice-button.selected-correct {
  background: rgba(25, 122, 73, 0.14);
  color: var(--success);
  border-color: rgba(25, 122, 73, 0.3);
  opacity: 1;
}

.choice-button.selected-wrong {
  background: rgba(177, 48, 48, 0.12);
  color: var(--danger);
  border-color: rgba(177, 48, 48, 0.28);
  opacity: 1;
}

.feedback {
  min-height: 0;
}

.secondary-button {
  align-self: start;
  background: rgba(43, 31, 20, 0.08);
  color: var(--text);
  padding: 12px 20px;
}

.secondary-button:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.result-score {
  margin: 18px 0 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
}

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

.result-stat {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(43, 31, 20, 0.08);
}

.result-stat strong {
  display: block;
  font-size: 1.8rem;
}

.result-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(24, 16, 10, 0.82);
  backdrop-filter: blur(6px);
}

.lightbox.active {
  display: grid;
}

.lightbox img {
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  background: #fff;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.feedback-pop {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  font-size: 4rem;
  font-weight: 900;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
}

.feedback-pop.show {
  animation: pop-feedback 800ms ease forwards;
}

.feedback-pop.correct {
  background: rgba(25, 122, 73, 0.92);
  box-shadow: 0 24px 50px rgba(25, 122, 73, 0.35);
}

.feedback-pop.wrong {
  background: rgba(177, 48, 48, 0.92);
  box-shadow: 0 24px 50px rgba(177, 48, 48, 0.35);
}

@keyframes pop-feedback {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }

  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  75% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 960px);
    padding: 8px 0;
  }

  .media-row,
  .answer-row,
  .result-details {
    grid-template-columns: 1fr;
  }

  .image-frame {
    max-height: 28vh;
  }

  .image-frame::after {
    width: 62px;
    height: 62px;
    background-size: 28px 28px;
  }

  .secondary-button {
    width: 100%;
    justify-self: stretch;
  }

  .lightbox {
    padding: 16px;
  }
}
