:root {
  --ink: #173342;
  --muted: #5b6d75;
  --paper: #fffdf7;
  --blue: #2b6f89;
  --blue-dark: #1f5368;
  --blue-soft: #eaf6f9;
  --green: #32734b;
  --green-soft: #e2f3e7;
  --red: #ad3f3a;
  --red-soft: #fde9e6;
  --gold: #f2c94c;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #f8f2e5, #eef7f5);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, sans-serif;
}

button { font: inherit; }

[hidden] { display: none !important; }

.knowledge-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(100%, 1220px);
  height: 100dvh;
  margin: auto;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.knowledge-header { min-height: 134px; }

.knowledge-header.is-compact { min-height: 64px; }

.profile-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.quiet-button,
.text-button,
.activity-link {
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid #adc4ce;
  border-radius: 13px;
  background: white;
  color: var(--blue-dark);
  font-weight: 850;
  cursor: pointer;
}

.activity-link {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.setup-card,
.practice-card,
.finish-card {
  border: 3px solid white;
  border-radius: 25px;
  background: rgb(255 253 247 / 94%);
  box-shadow: 0 12px 30px rgb(29 72 87 / 12%);
}

.setup-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  height: auto;
  min-height: 0;
  padding: 24px;
}

.setup-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.setup-heading h2,
.finish-card h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 43px);
}

.save-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.activity-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: min(1030px, 100%);
  height: 100%;
  max-height: 460px;
  min-height: 0;
  align-self: start;
  margin: 0 auto;
}

.activity-choice {
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 58%);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 4px solid var(--blue);
  border-radius: 25px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
}

.prepositions-stage-grid { grid-template-rows: minmax(0, 1fr); max-height: 330px; }

.activity-choice img { width: 100%; height: 100%; object-fit: contain; background: #fffaf0; }
.activity-choice span { display: grid; align-content: center; min-width: 0; gap: 5px; padding: 15px 16px; }
.activity-choice strong { font-size: clamp(24px, 2.7vw, 32px); line-height: 1.1; }
.activity-choice small { color: var(--muted); font-size: clamp(17px, 2vw, 22px); font-weight: 750; line-height: 1.15; }
.activity-choice em { min-height: 21px; color: var(--green); font-size: 16px; font-style: normal; font-weight: 850; }
.activity-choice em:empty { display: none; }

.practice-card {
  height: calc(100dvh - 92px);
  min-height: 500px;
  padding: 13px 16px 16px;
}

#knowledge-practice, #knowledge-finish { height: 100%; min-height: 0; }

.practice-top {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 51px;
}

.knowledge-journey {
  position: relative;
  flex: 1;
  height: 39px;
  display: grid;
  align-items: center;
  padding: 0 18px;
}

.knowledge-journey::before {
  content: "";
  position: absolute;
  left: 23px;
  right: 23px;
  top: 18px;
  height: 7px;
  border-radius: 99px;
  background: #cfdee2;
}

.journey-step {
  z-index: 1;
  width: 18px;
  height: 18px;
  justify-self: center;
  border: 4px solid #9db6bf;
  border-radius: 50%;
  background: white;
}

.journey-step.is-complete { border-color: var(--green); background: #70b886; }
.journey-finish { z-index: 1; justify-self: end; font-size: 25px; }
.journey-traveler {
  position: absolute;
  z-index: 2;
  left: var(--journey-position, 5%);
  top: 0;
  font-size: 29px;
  line-height: 1;
  transform: translateX(-50%);
  transition: left 450ms ease;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(0, 58%) minmax(320px, 42%);
  gap: 17px;
  height: calc(100% - 51px);
}

.scene-card {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 4px solid white;
  border-radius: 22px;
  background: #dcecf0;
  box-shadow: 0 5px 16px rgb(26 65 81 / 18%);
}

.scene-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene-card.is-prepositions { background: #fffaf0; }
.scene-card.is-prepositions .scene-image { object-fit: contain; }

.scene-logo-wrap {
  position: absolute;
  z-index: 3;
  left: 5%;
  top: 3.5%;
  display: grid;
  place-items: center;
  width: 90%;
  height: 17%;
  padding: 5px 24px;
  overflow: hidden;
  border-radius: 4px;
  background: rgb(255 255 255 / 92%);
  transform: perspective(500px) rotateX(1deg);
}

.scene-logo { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.scene-logo-wrap:has(.bakery-sign) { left: 5%; top: 1%; width: 90%; height: 19%; }
.scene-logo-wrap:has(.facility-sign) { left: 17%; top: 4%; width: 75%; height: 18%; }
.scene-logo-wrap:has(.ingym-sign) { left: 42%; top: 4%; width: 55%; height: 18%; padding: 0 14px; }

.scene-dim,
.scene-focus,
.scene-object-focuses {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms ease;
}

.scene-dim { background: rgb(12 31 39 / 58%); }
.scene-focus {
  inset: 5% 8%;
  border: 7px solid var(--gold);
  border-radius: 24px;
  box-shadow: 0 0 0 999px rgb(12 31 39 / 22%), 0 0 20px rgb(255 227 103 / 90%);
}

.scene-object-focuses { z-index: 6; }
.scene-object-focus {
  position: absolute;
  border: 7px solid var(--gold);
  border-radius: 28px;
  background: rgb(255 255 255 / 10%);
  box-shadow: 0 0 0 3px rgb(255 255 255 / 70%), 0 0 28px rgb(255 224 75 / 100%);
  backdrop-filter: brightness(2) saturate(1.25);
  -webkit-backdrop-filter: brightness(2) saturate(1.25);
}

.scene-card.is-supported .scene-dim { opacity: .92; }
.scene-card.is-supported .scene-object-focuses { opacity: 1; }
.scene-card.is-highlighted .scene-focus { opacity: 1; }
.scene-card.is-highlighted .scene-dim { opacity: .1; }
.scene-card.is-highlighted .scene-logo-wrap { z-index: 5; box-shadow: 0 0 0 6px var(--gold), 0 0 22px #fff3a0; }

.question-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border-radius: 22px;
  background: var(--blue-soft);
}

.question-line { display: flex; align-items: flex-start; gap: 12px; }
.question-line h2 { margin: 3px 0 13px; font-size: clamp(26px, 3.2vw, 39px); line-height: 1.12; }
.cloze-prompt {
  margin: 0 0 14px 68px;
  color: var(--ink);
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 900;
  line-height: 1.15;
}

.audio-button {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  padding: 12px;
  border: 3px solid var(--blue);
  border-radius: 50%;
  background: white;
  color: var(--blue-dark);
  cursor: pointer;
}
.audio-button svg { width: 100%; height: 100%; fill: currentColor; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }

.answer-grid { display: grid; gap: 11px; }
.answer-button {
  min-height: 71px;
  padding: 10px 18px;
  border: 4px solid var(--blue);
  border-radius: 18px;
  background: white;
  color: var(--ink);
  font-size: clamp(24px, 2.8vw, 34px);
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}
.answer-button.is-wrong { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.answer-button.is-correct { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.answer-button:disabled { opacity: 1; cursor: default; }

.knowledge-feedback { min-height: 30px; margin: 12px 0 0; color: var(--muted); font-size: 21px; font-weight: 850; }
.knowledge-feedback.is-wrong { color: var(--red); }
.knowledge-feedback.is-correct { color: var(--green); }

.primary-button,
.secondary-button {
  min-width: 150px;
  min-height: 58px;
  padding: 10px 22px;
  border: 3px solid var(--blue);
  border-radius: 17px;
  background: var(--blue);
  color: white;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}
.secondary-button { background: white; color: var(--blue-dark); }
.next-button { align-self: flex-end; margin-top: auto; }

.finish-card {
  display: grid;
  place-content: center;
  height: calc(100dvh - 92px);
  padding: 30px;
  text-align: center;
}
.finish-card p:not(.eyebrow) { margin: 12px 0 25px; font-size: 24px; font-weight: 750; }
.finish-actions { display: flex; justify-content: center; gap: 14px; }

button:focus-visible { outline: 5px solid var(--gold); outline-offset: 3px; }

.rotate-message { display: none; }
.rotate-card { text-align: center; }
.rotate-card strong, .rotate-card span { display: block; }
.rotate-icon { font-size: 50px; }

@media (orientation: portrait) and (max-width: 820px) {
  .knowledge-shell { display: none !important; }
  .rotate-message { display: grid; place-items: center; min-height: 100dvh; padding: 30px; }
  .rotate-card { padding: 30px; border-radius: 24px; background: white; box-shadow: 0 10px 30px rgb(0 0 0 / 15%); }
}

@media (max-height: 650px) and (orientation: landscape) {
  .knowledge-shell { padding-top: 8px; padding-bottom: 8px; }
  .knowledge-header.is-compact { min-height: 54px; }
  .activity-choice-grid { height: 100%; max-height: 420px; gap: 12px; }
  .activity-choice span { padding: 8px 12px; gap: 3px; }
  .activity-choice strong { font-size: clamp(22px, 3vw, 30px); }
  .activity-choice small { font-size: clamp(16px, 1.8vw, 19px); }
  .practice-card, .finish-card { height: calc(100dvh - 70px); }
  .practice-top { min-height: 42px; }
  .practice-layout { height: calc(100% - 42px); }
  .question-card { padding: 13px; }
  .question-line h2 { font-size: clamp(24px, 3vw, 34px); margin-bottom: 8px; }
  .cloze-prompt { margin: 0 0 9px 62px; font-size: clamp(23px, 2.7vw, 31px); }
  .audio-button { width: 50px; height: 50px; flex-basis: 50px; }
  .answer-grid { gap: 8px; }
  .answer-button { min-height: 61px; font-size: clamp(22px, 2.6vw, 30px); }
  .knowledge-feedback { margin-top: 7px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

.emet-motion-disabled *,
.emet-motion-disabled *::before,
.emet-motion-disabled *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
