:root {
  --ink: #151515;
  --muted: #6d6762;
  --paper: #fbfaf7;
  --paper-strong: #ffffff;
  --line: rgba(21, 21, 21, 0.14);
  --red: #b41f2c;
  --gold: #d8a642;
  --green: #2f7d46;
  --blue: #285a8e;
  --shadow: 0 24px 70px rgba(24, 18, 12, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  color: var(--ink);
  display: grid;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(180, 31, 44, 0.1), rgba(47, 125, 70, 0.08)),
    var(--paper);
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0;
  min-height: clamp(38px, 5vh, 46px);
  padding: 0 18px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: default;
  opacity: 0.42;
}

.quiz-app {
  aspect-ratio: 16 / 9;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(100vh, calc(100vw * 9 / 16));
  max-height: 100vh;
  max-width: 100vw;
  min-height: 0;
  overflow: hidden;
  padding: clamp(18px, 3vh, 30px) clamp(22px, 4vh, 46px) clamp(12px, 2vh, 20px);
  width: min(100vw, calc(100vh * 16 / 9));
}

.topbar {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1440px;
  width: 100%;
}

.eyebrow {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

#slideTitle {
  font-size: clamp(1.1rem, 2.8vh, 1.9rem);
  line-height: 1.06;
}

.progress {
  align-items: flex-end;
  color: var(--muted);
  display: grid;
  font-size: 0.95rem;
  font-weight: 800;
  gap: 8px;
  justify-items: end;
  min-width: 168px;
}

.progressTrack {
  background: rgba(21, 21, 21, 0.12);
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
  width: min(24vh, 220px);
}

.progressTrack span {
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green));
  display: block;
  height: 100%;
  width: 0;
}

.stage {
  margin: clamp(8px, 1.5vh, 16px) auto clamp(8px, 1.4vh, 14px);
  max-width: 1440px;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.introSlide,
.questionSlide,
.videoSlide {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.introSlide {
  display: block;
  position: relative;
}

.introCopy {
  background: linear-gradient(90deg, rgba(251, 250, 247, 0.86), rgba(251, 250, 247, 0));
  bottom: auto;
  display: grid;
  gap: clamp(8px, 1.5vh, 16px);
  left: clamp(28px, 6vh, 72px);
  max-width: 42%;
  padding: clamp(14px, 3vh, 30px) clamp(36px, 6vh, 72px) clamp(14px, 3vh, 30px) 0;
  position: absolute;
  top: 48%;
  transform: translateY(-50%);
  text-shadow: 0 2px 18px rgba(255, 255, 255, 0.62);
  z-index: 3;
}

.introCopy h2 {
  font-size: clamp(4.4rem, 13vh, 7.8rem);
  line-height: 0.9;
}

.introCopy p {
  color: var(--muted);
  font-size: clamp(1rem, 2.4vh, 1.45rem);
  font-weight: 750;
  max-width: 14em;
}

.introBadges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.introBadges span {
  background: var(--ink);
  border-radius: 999px;
  color: #fff;
  font-size: clamp(0.68rem, 1.45vh, 0.86rem);
  font-weight: 900;
  padding: 7px 11px;
}

.photoWall {
  align-items: center;
  bottom: 7%;
  display: grid;
  gap: clamp(14px, 3vh, 34px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  left: 36%;
  position: absolute;
  right: 3%;
  top: 8%;
  z-index: 1;
}

.introSlide .photoFrame {
  align-self: center;
  justify-self: center;
  width: min(100%, 31vh);
}

.introSlide .photoFrame:nth-child(1) {
  transform: translateY(1%) rotate(-2deg);
  z-index: 2;
}

.introSlide .photoFrame:nth-child(2) {
  transform: translateY(-5%) rotate(1.2deg);
  z-index: 1;
}

.introSlide .photoFrame:nth-child(3) {
  transform: translateY(2%) rotate(1.8deg);
  z-index: 2;
}

.photoFrame {
  align-self: center;
  background: var(--paper-strong);
  border: 1px solid rgba(21, 21, 21, 0.13);
  box-shadow: var(--shadow);
  display: grid;
  justify-self: stretch;
  margin: 0;
  min-height: 0;
  padding: clamp(7px, 1.4vh, 12px) clamp(7px, 1.4vh, 12px) clamp(28px, 4.8vh, 42px);
  position: relative;
  transform: rotate(var(--tilt, 0deg));
  width: 100%;
}

.photoFrame::after {
  bottom: clamp(9px, 1.7vh, 13px);
  color: var(--muted);
  content: attr(data-caption);
  font-size: clamp(0.58rem, 1.25vh, 0.76rem);
  font-weight: 850;
  left: 14px;
  overflow: hidden;
  position: absolute;
  right: 14px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.photoFrame img {
  aspect-ratio: 16 / 10;
  display: block;
  height: auto;
  image-orientation: from-image;
  object-fit: cover;
  width: 100%;
}

.photoFrame.portrait {
  align-self: center;
  justify-self: center;
  width: min(100%, 39vh);
}

.photoFrame.portrait img {
  aspect-ratio: 3 / 4;
  background:
    linear-gradient(135deg, rgba(216, 166, 66, 0.12), rgba(40, 90, 142, 0.1)),
    #f6f2ec;
  height: auto;
  object-fit: contain;
}

.questionSlide {
  align-items: center;
  display: grid;
  gap: clamp(16px, 3vh, 34px);
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
}

.questionPanel {
  align-content: center;
  display: grid;
  gap: clamp(9px, 1.7vh, 17px);
  min-height: 0;
}

.category {
  color: var(--blue);
  font-size: clamp(0.72rem, 1.55vh, 0.92rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.questionNumber {
  align-items: center;
  background: var(--ink);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: clamp(0.82rem, 1.8vh, 1.05rem);
  font-weight: 950;
  height: clamp(34px, 5vh, 44px);
  justify-content: center;
  width: fit-content;
  min-width: clamp(34px, 5vh, 44px);
  padding: 0 15px;
}

.questionText {
  font-size: clamp(2rem, 7vh, 4.25rem);
  line-height: 0.98;
  max-width: 12em;
}

.note {
  color: var(--muted);
  font-size: clamp(0.92rem, 2vh, 1.15rem);
  font-weight: 750;
}

.options {
  display: grid;
  gap: clamp(8px, 1.4vh, 12px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 2px;
}

.option {
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 9px;
  grid-template-columns: clamp(30px, 4.6vh, 36px) minmax(0, 1fr);
  min-height: clamp(50px, 8.2vh, 72px);
  padding: clamp(8px, 1.6vh, 13px) clamp(10px, 1.9vh, 16px);
  text-align: left;
}

.optionLetter {
  align-items: center;
  background: rgba(21, 21, 21, 0.08);
  border-radius: 999px;
  display: inline-flex;
  font-weight: 950;
  height: clamp(30px, 4.6vh, 36px);
  justify-content: center;
  width: clamp(30px, 4.6vh, 36px);
}

.optionText {
  overflow-wrap: anywhere;
}

.option.selected {
  border-color: var(--blue);
  box-shadow: 0 10px 28px rgba(40, 90, 142, 0.16);
}

.option.correct {
  background: rgba(47, 125, 70, 0.14);
  border-color: var(--green);
}

.option.correct .optionLetter {
  background: var(--green);
  color: #fff;
}

.option.wrong {
  opacity: 0.58;
}

.mediaPanel {
  align-content: center;
  display: grid;
  gap: 16px;
  justify-items: center;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.mediaStack {
  align-items: center;
  display: grid;
  gap: clamp(10px, 2vh, 18px);
  grid-template-columns: repeat(var(--media-count, 1), minmax(0, 1fr));
  max-height: 100%;
  width: min(100%, 820px);
}

.mediaStack[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.mediaStack[data-count="2"],
.mediaStack[data-count="3"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mediaStack[data-count="3"] .photoFrame:first-child {
  grid-column: 1 / -1;
}

.mediaStack .photoFrame {
  width: 100%;
}

.mediaStack .photoFrame.portrait {
  width: min(100%, 36vh);
}

.mediaStack[data-count="1"] .photoFrame:not(.portrait) img {
  aspect-ratio: 16 / 11;
}

.mediaStack[data-count="1"] .photoFrame.portrait {
  width: min(100%, 39vh);
}

.mediaStack[data-count="1"] .photoFrame.portrait img {
  aspect-ratio: 3 / 4;
}

.answerBanner {
  background: var(--ink);
  border-radius: 8px;
  color: #fff;
  display: none;
  font-size: clamp(0.92rem, 2vh, 1.2rem);
  font-weight: 900;
  line-height: 1.2;
  padding: clamp(9px, 1.7vh, 14px) 18px;
  text-align: center;
  width: min(100%, 820px);
}

.answerBanner.show {
  display: block;
}

.videoSlide {
  align-items: center;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 0.58fr) minmax(0, 1.42fr);
}

.videoSlide.portraitVideoSlide {
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
}

.videoCopy {
  display: grid;
  gap: 18px;
}

.videoCopy h2 {
  font-size: clamp(3.2rem, 10vh, 5.8rem);
  line-height: 0.92;
}

.videoCopy p {
  color: var(--muted);
  font-size: clamp(0.95rem, 2.1vh, 1.3rem);
  font-weight: 760;
}

.videoFrame {
  background: #111;
  border: 10px solid #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  justify-self: center;
  overflow: hidden;
  width: 100%;
}

.videoFrame video {
  aspect-ratio: 16 / 9;
  background: #111;
  display: block;
  max-height: 66vh;
  object-fit: contain;
  width: 100%;
}

.videoFrame.portraitVideo {
  aspect-ratio: 9 / 16;
  max-height: 66vh;
  width: min(100%, 38vh);
}

.videoFrame.portraitVideo video {
  aspect-ratio: 9 / 16;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 0 auto;
  max-width: 1440px;
  width: 100%;
}

.primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 12px 28px rgba(180, 31, 44, 0.22);
}

.primary:nth-of-type(3) {
  background: var(--green);
  box-shadow: 0 12px 28px rgba(47, 125, 70, 0.22);
}

.ghost {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--ink);
}

@media (max-width: 980px) {
  .quiz-app {
    padding: 18px 18px 14px;
  }

  .topbar {
    align-items: start;
  }

  .introSlide,
  .questionSlide,
  .videoSlide {
    grid-template-columns: 1fr;
  }

  .questionText {
    font-size: clamp(1.8rem, 6vh, 3.3rem);
  }

  .mediaPanel {
    align-content: start;
  }
}

@media (max-width: 680px) {
  .topbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .progress {
    align-items: start;
    justify-items: start;
    min-width: 0;
  }

  .progressTrack {
    width: 100%;
  }

  .photoWall,
  .mediaStack,
  .mediaStack[data-count="2"],
  .mediaStack[data-count="3"],
  .options {
    grid-template-columns: 1fr;
  }

  .mediaStack[data-count="3"] .photoFrame:first-child {
    grid-column: auto;
  }

  .introCopy h2,
  .videoCopy h2 {
    font-size: clamp(2.7rem, 9vh, 4.2rem);
  }

  button {
    width: 100%;
  }
}
