:root {
  --primary: #bf1e3c;
  --primary-dark: #9f1733;
  --accent: #2f8fa5;
  --ink: #263447;
  --muted: #697381;
  --paper: #fff8ed;
  --surface: rgba(255, 248, 237, 0.88);
  --border: #f0c7b4;
  --green: #4f9b78;
  --shadow: 0 18px 42px rgba(79, 47, 47, 0.16);
  --soft-shadow: 0 8px 0 rgba(128, 31, 50, 0.16), 0 20px 36px rgba(79, 47, 47, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(180deg, #fff7ed 0%, #eaf7f0 52%, #eef6ff 100%);
  font-family: "Trebuchet MS", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  letter-spacing: 0;
}

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

img {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(47, 143, 165, 0.35);
  outline-offset: 3px;
}

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

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

.home-shell,
.survey-shell,
.complete-shell,
.loading-view {
  min-height: 100dvh;
}

.loading-view {
  display: grid;
  place-items: center;
  padding: 32px;
  font-size: 1.4rem;
  font-weight: 700;
}

.hero {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 36, 48, 0.18) 0%, rgba(17, 36, 48, 0.06) 38%, rgba(255, 247, 237, 0.22) 100%);
}

.hero-overlay {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 32px));
  margin: 24px auto;
  padding: clamp(22px, 4vw, 44px);
  text-align: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.54), transparent 34%),
    linear-gradient(145deg, rgba(255, 248, 237, 0.82), rgba(255, 241, 232, 0.7));
  border: 3px solid rgba(255, 255, 255, 0.74);
  border-radius: 30px;
  box-shadow: 0 10px 0 rgba(191, 30, 60, 0.08), 0 24px 70px rgba(79, 47, 47, 0.16);
  backdrop-filter: blur(2px);
}

.eyebrow,
.form-kicker {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.8rem, 8vw, 5.6rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.hero-copy {
  max-width: 560px;
  margin: 18px auto 28px;
  color: #334155;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  line-height: 1.6;
}

.entry-actions,
.survey-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
}

.primary-button,
.secondary-button,
.start-button,
.quiet-button,
.option-button {
  min-height: 56px;
  border: 3px solid transparent;
  border-radius: 18px;
  padding: 12px 18px;
  font-weight: 900;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-button,
.start-button {
  color: #fffaf0;
  text-shadow: 0 1px 0 rgba(72, 17, 32, 0.25);
  background:
    radial-gradient(circle at 24% 16%, rgba(255, 255, 255, 0.2), transparent 30%),
    linear-gradient(180deg, #d43454 0%, var(--primary) 100%);
  box-shadow: var(--soft-shadow);
}

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

.secondary-button {
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.72), transparent 34%),
    rgba(255, 250, 244, 0.92);
  border-color: #9dc7cf;
  box-shadow: 0 8px 0 rgba(47, 143, 165, 0.16), 0 18px 30px rgba(79, 47, 47, 0.12);
}

.quiet-button {
  color: var(--ink);
  background: rgba(255, 248, 237, 0.78);
  border-color: rgba(255, 255, 255, 0.74);
}
.icon-button,
.nav-arrow {
  display: grid;
  place-items: center;
  width: 64px;
  min-width: 64px;
  height: 64px;
  min-height: 64px;
  padding: 0;
  border-radius: 18px;
  font-size: 2rem;
  line-height: 1;
}

.nav-arrow {
  font-size: 2.35rem;
}

.survey-actions {
  gap: 18px;
}

.survey-actions .primary-button,
.survey-actions .secondary-button {
  flex: 0 0 auto;
}

.hero.is-form-open .hero-overlay {
  width: min(620px, calc(100% - 32px));
  padding: clamp(18px, 3vw, 28px);
}

.hero.is-form-open h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.hero.is-form-open .hero-copy,
.hero.is-form-open .entry-actions {
  display: none;
}

.hero.is-form-open .teacher-form {
  margin-top: 14px;
  padding: clamp(16px, 2.6vw, 22px);
}

.hero.is-form-open .teacher-form.is-open {
  gap: 10px;
}

.hero.is-form-open input {
  min-height: 50px;
}

.hero.is-form-open .start-button {
  min-height: 54px;
}

.entry-actions .primary-button,
.entry-actions .secondary-button {
  min-width: min(260px, 100%);
  min-height: 76px;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  border-radius: 24px;
}

.teacher-form {
  display: none;
  width: min(580px, 100%);
  margin: 24px auto 0;
  padding: 24px;
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 255, 255, 0.66), transparent 34%),
    var(--surface);
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), var(--shadow);
}

.teacher-form.is-open {
  display: grid;
  gap: 18px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

label {
  display: grid;
  gap: 10px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 58px;
  border: 3px solid #efc1aa;
  border-radius: 16px;
  padding: 12px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 2px 8px rgba(137, 80, 62, 0.08);
  font-size: 1.15rem;
}

.form-error {
  min-height: 24px;
  color: #b91c1c;
  font-weight: 800;
  line-height: 1.5;
}

.survey-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  padding: clamp(14px, 3vw, 32px);
}

.survey-background,
.survey-scrim {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.survey-background {
  z-index: -2;
  object-fit: cover;
  object-position: 50% 50%;
}

.survey-scrim {
  z-index: -1;
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.12) 0%, rgba(255, 248, 237, 0.38) 100%);
}

.survey-header {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  width: min(1040px, 100%);
  margin: 0 auto 12px;
}

.progress-wrap {
  flex: 1 1 auto;
  display: grid;
  gap: 8px;
  max-width: none;
  min-width: 0;
  color: var(--ink);
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.progress-count {
  justify-self: end;
  color: var(--primary-dark);
  font-size: 1.05rem;
  font-weight: 900;
}

.progress-track {
  width: 100%;
  height: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid rgba(240, 199, 180, 0.9);
  border-radius: 999px;
  box-shadow: inset 0 2px 6px rgba(137, 80, 62, 0.08);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #bf1e3c, #eab308, #4f9b78, #2f8fa5);
  border-radius: inherit;
  transition: width 240ms ease;
}

.question-stage {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 0;
  width: min(1040px, 100%);
  margin: 0 auto;
}

.question-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: visible;
  background: rgba(255, 250, 244, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  box-shadow: 0 16px 42px rgba(79, 47, 47, 0.16), 0 4px 14px rgba(191, 30, 60, 0.08);
}

.frame-controls {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(220px, 3fr) minmax(72px, 1fr);
  gap: 8px;
  align-items: stretch;
  min-height: 82px;
  overflow: visible;
  padding: 10px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.56), transparent 34%),
    linear-gradient(180deg, rgba(255, 249, 241, 0.94), rgba(247, 224, 208, 0.9));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.62),
    inset 0 9px 18px rgba(255, 255, 255, 0.34),
    inset 0 -8px 16px rgba(137, 80, 62, 0.12);
}

.frame-controls > .nav-arrow,
.frame-controls > .audio-widget {
  width: 100%;
  min-height: 62px;
  border-radius: 18px;
  border-width: 1px;
  border-style: solid;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -10px 16px rgba(83, 18, 35, 0.12),
    0 4px 0 rgba(128, 31, 50, 0.18),
    0 7px 13px rgba(79, 47, 47, 0.13);
  touch-action: manipulation;
}

.frame-controls .nav-arrow {
  background:
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.5), transparent 34%),
    linear-gradient(180deg, rgba(255, 245, 229, 0.96), rgba(244, 215, 196, 0.92));
  border-color: rgba(255, 255, 255, 0.42);
  color: #9f2941;
}

.frame-controls .primary-button.nav-arrow {
  color: #fffaf0;
  background: linear-gradient(180deg, #c92545 0%, #bf1e3c 54%, #a91834 100%);
  border-color: rgba(255, 244, 229, 0.26);
}

.frame-controls .audio-widget {
  justify-self: stretch;
  cursor: pointer;
}

.frame-controls > .nav-arrow:hover,
.frame-controls > .audio-widget:hover {
  transform: translateY(-1px);
  filter: saturate(1.04);
}

.frame-controls > .nav-arrow:active,
.frame-controls > .audio-widget:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 3px 10px rgba(79, 47, 47, 0.18),
    inset 0 -6px 12px rgba(83, 18, 35, 0.1),
    0 1px 0 rgba(128, 31, 50, 0.12),
    0 3px 8px rgba(79, 47, 47, 0.1);
}

.frame-controls .form-error {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.question-content {
  display: grid;
  min-height: 0;
  overflow: visible;
}

.question-content.is-choice {
  grid-template-columns: 1fr 1fr;
}

.question-content.is-visual {
  grid-template-columns: 1fr;
}

.question-media,
.question-content,
.choice-visual-panel,
.option-panel,
.audio-panel,
.question-panel,
.complete-panel {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.58), transparent 34%),
    rgba(255, 248, 237, 0.84);
}

.choice-visual-panel {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100%;
  padding: 0;
  border-right: 2px solid rgba(240, 199, 180, 0.72);
}

.question-media {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  overflow: hidden;
  padding: 0;
}

.question-art {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  transform: translate(-50%, -50%);
  border-radius: 0;
}

.question-media.empty {
  background: linear-gradient(145deg, rgba(255, 248, 237, 0.94), rgba(232, 248, 247, 0.9));
}


.audio-panel,
.option-panel {
  display: grid;
  align-content: center;
  gap: clamp(12px, 2vh, 18px);
  min-height: 100%;
  min-width: 0;
  overflow: visible;
  padding: clamp(18px, 3vw, 34px);
}

.option-panel {
  position: relative;
  z-index: 30;
  justify-items: center;
}

.option-panel.has-image-options {
  align-content: center;
  justify-items: center;
  grid-template-rows: auto;
  padding: clamp(10px, 1.6vw, 18px);
}

.audio-widget {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  width: min(430px, 100%);
  justify-self: center;
  min-height: 50px;
  padding: 7px 14px 7px 7px;
  color: #fffaf0;
  background: linear-gradient(180deg, #c92545 0%, #bf1e3c 54%, #a91834 100%);
  border: 1px solid rgba(255, 244, 229, 0.28);
  border-radius: 18px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -12px 20px rgba(83, 18, 35, 0.1),
    0 10px 22px rgba(79, 47, 47, 0.13),
    0 2px 5px rgba(128, 31, 50, 0.1);
}

.audio-play {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #fff;
  background: linear-gradient(180deg, #63b8c5, #2f8ca0);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 13px;
  font-size: 1rem;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 4px 10px rgba(47, 143, 165, 0.18);
}

.audio-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  min-width: 0;
}

.audio-wave span {
  width: 4px;
  min-height: 8px;
  background: rgba(255, 239, 218, 0.88);
  border-radius: 999px;
}

.audio-widget::after {
  content: attr(data-transcript);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 3000;
  width: min(430px, 84vw);
  max-height: min(260px, 42vh);
  overflow: auto;
  padding: 14px 16px;
  color: var(--ink);
  background: rgba(255, 248, 237, 0.96);
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(79, 47, 47, 0.18);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.audio-widget:hover::after,
.audio-widget:focus-within::after {
  opacity: 1;
  transform: translate(-50%, 0);
}


.visual-full {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.58), transparent 34%),
    rgba(255, 248, 237, 0.84);
}


.visual-full.empty {
  background: linear-gradient(145deg, rgba(255, 248, 237, 0.94), rgba(232, 248, 247, 0.9));
}

.visual-overlay {
  position: absolute;
  left: 50%;
  bottom: clamp(14px, 3vw, 28px);
  display: grid;
  gap: 12px;
  justify-items: center;
  width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
}

.visual-overlay .audio-widget {
  width: min(340px, 100%);
  background: linear-gradient(180deg, rgba(201, 37, 69, 0.94) 0%, rgba(191, 30, 60, 0.94) 56%, rgba(169, 24, 52, 0.94) 100%);
  backdrop-filter: blur(2px);
}

.visual-overlay .survey-actions {
  padding: 8px 12px;
  background: rgba(255, 248, 237, 0.68);
  border: 2px solid rgba(255, 255, 255, 0.62);
  border-radius: 24px;
  backdrop-filter: blur(2px);
}
.palette-mark {
  width: min(220px, 60vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#bf1e3c, #eab308, #4f9b78, #2f8fa5, #c86b85, #bf1e3c);
  box-shadow: inset 0 0 0 26px rgba(255, 255, 255, 0.74), 0 18px 38px rgba(15, 23, 42, 0.16);
}

.question-copy {
  display: grid;
  gap: 4px;
  text-align: left;
}

.question-copy h2 {
  font-size: clamp(1.4rem, 3.2vw, 2.35rem);
}

.prompt {
  margin: 0;
  color: #24364a;
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  line-height: 1.5;
  font-weight: 700;
}

.option-grid {
  position: relative;
  z-index: 31;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 86px));
  justify-content: center;
  gap: 12px;
  margin: 0;
}

.option-grid.has-image-options {
  align-self: center;
  justify-self: center;
  width: min(230px, 100%);
  height: auto;
  max-height: 100%;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(3, auto);
  align-content: center;
  justify-items: center;
  gap: clamp(8px, 1.2vh, 12px);
}

.option-grid.needs-choice .option-button {
  border-color: #eab308;
  transform: translateY(-1px);
}

.option-button {
  position: relative;
  z-index: 32;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 70px;
  color: var(--ink);
  text-align: center;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.74), transparent 30%),
    rgba(255, 250, 244, 0.92);
  border-color: #b9dce0;
  box-shadow: 0 7px 0 rgba(47, 143, 165, 0.12);
}

.option-button::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 3001;
  width: min(360px, 76vw);
  max-height: min(220px, 38vh);
  overflow: auto;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 248, 237, 0.97);
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  box-shadow: 0 14px 30px rgba(79, 47, 47, 0.18);
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.option-button:hover::after,
.option-button:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.option-button.is-selected {
  border-color: var(--primary);
  background: rgba(255, 235, 230, 0.92);
  box-shadow: 0 7px 0 rgba(191, 30, 60, 0.2);
}

.option-button.has-image {
  justify-self: center;
  width: auto;
  height: auto;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 3px;
  line-height: 0;
  overflow: visible;
}

.option-image {
  width: auto;
  height: auto;
  max-width: min(210px, 100%);
  max-height: clamp(92px, 17vh, 136px);
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  border-radius: 10px;
  display: block;
}

.option-number {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: linear-gradient(180deg, #3ca7bb, var(--accent));
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  font-size: 1.35rem;
  font-weight: 900;
}
.complete-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: clamp(16px, 4vw, 40px);
}

.complete-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1fr);
  gap: clamp(20px, 4vw, 42px);
  align-items: center;
  max-width: 1040px;
  padding: clamp(20px, 4vw, 40px);
  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), var(--shadow);
}

.complete-panel img {
  width: 100%;
  border-radius: 18px;
}

.complete-panel p {
  color: #334155;
  font-size: 1.2rem;
  line-height: 1.65;
}

.receipt {
  padding: 12px 14px;
  background: #ecfdf5;
  border: 2px solid #bbf7d0;
  border-radius: 14px;
  font-weight: 800;
}

@media (max-width: 820px) {
  .hero::after {
    background: linear-gradient(180deg, rgba(17, 36, 48, 0.12) 0%, rgba(255, 247, 237, 0.18) 100%);
  }

  .hero-overlay {
    margin: 18px auto;
    padding: 18px;
  }

  .entry-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .survey-actions,
  .survey-header {
    align-items: center;
    flex-direction: row;
  }

  .survey-header {
    width: 100%;
    gap: 12px;
  }

  .primary-button,
  .secondary-button,
  .start-button,
  .quiet-button {
    width: 100%;
  }

  .icon-button,
  .nav-arrow {
    width: 58px;
    min-width: 58px;
    height: 58px;
    min-height: 58px;
  }

  .survey-actions .primary-button,
  .survey-actions .secondary-button,
  #back-home {
    width: 58px;
  }

  .survey-shell {
    padding: 14px;
  }

  .question-stage {
    width: 100%;
  }

  .question-content.is-choice,
  .question-content.is-visual,
  .complete-panel {
    grid-template-columns: 1fr;
  }

  .question-card {
    min-height: 0;
  }

  .frame-controls {
    grid-template-columns: minmax(66px, 1fr) minmax(138px, 3fr) minmax(66px, 1fr);
    min-height: 74px;
    gap: 6px;
    padding: 8px;
  }

  .frame-controls > .nav-arrow,
  .frame-controls > .audio-widget {
    min-height: 58px;
  }

  .choice-visual-panel {
    border-right: 0;
    border-bottom: 2px solid rgba(240, 199, 180, 0.72);
  }

  .question-media {
    min-height: 240px;
    border-right: 0;
    border-bottom: 0;
  }

  .question-media img,
  .visual-full img {
    height: 100%;
    max-height: none;
    object-fit: cover;
  }

  .audio-panel {
    min-height: 0;
  }

  .audio-widget {
    grid-template-columns: 48px 1fr;
    min-height: 50px;
  }
}


@media (min-width: 821px) and (max-width: 1180px) {
  .survey-shell {
    padding: clamp(12px, 2vw, 24px);
  }

  .survey-header,
  .question-stage {
    width: min(980px, 100%);
  }

  .question-content.is-choice {
    grid-template-columns: 1fr 1fr;
  }

  .option-panel {
    padding: clamp(16px, 2.4vw, 26px);
  }

  .option-grid.has-image-options {
    width: min(210px, 100%);
  }

  .option-button.has-image {
    min-height: 0;
  }

  .option-image {
    max-width: min(190px, 100%);
    max-height: clamp(86px, 16vh, 122px);
    min-height: 0;
  }
}

@media (max-width: 820px) {
  h1 {
    font-size: clamp(2.25rem, 10vw, 4rem);
  }

  .survey-shell {
    padding: 12px;
  }

  .survey-header {
    margin-bottom: 8px;
  }

  .progress-wrap {
    gap: 5px;
  }

  .progress-count {
    font-size: 0.95rem;
  }

  .progress-track {
    height: 12px;
  }

  .question-content.is-choice {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .choice-visual-panel {
    min-height: 0;
  }

  .question-media {
    min-height: 0;
  }

  .option-panel {
    min-height: 0;
    padding: 10px;
  }

  .option-grid {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 8px;
  }

  .option-grid.has-image-options {
    width: 100%;
    height: auto;
    max-height: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
    align-content: center;
    gap: 8px;
  }

  .option-panel.has-image-options {
    padding: 8px;
  }

  .option-button {
    min-height: 58px;
    padding: 8px;
    border-radius: 14px;
  }

  .option-button.has-image {
    height: auto;
    min-height: 0;
    padding: 3px;
  }

  .option-image {
    max-width: 100%;
    max-height: clamp(58px, 14vh, 82px);
    min-height: 0;
    border-radius: 9px;
  }

  .option-button::after {
    bottom: calc(100% + 8px);
    width: min(320px, 88vw);
    max-height: min(180px, 34vh);
    font-size: 0.9rem;
  }

  .audio-widget::after {
    width: min(360px, 88vw);
    max-height: min(210px, 36vh);
    font-size: 0.92rem;
  }

  .complete-shell {
    padding: 14px;
  }

  .complete-panel {
    max-width: min(560px, 100%);
    padding: 16px;
    gap: 14px;
  }

  .complete-panel img {
    max-height: 42vh;
    object-fit: cover;
  }

  .complete-panel p {
    font-size: 1rem;
  }
}

@media (max-width: 560px) {
  .hero-overlay {
    width: min(calc(100% - 24px), 560px);
    border-radius: 24px;
  }

  .entry-actions .primary-button,
  .entry-actions .secondary-button {
    min-height: 66px;
    font-size: 1.2rem;
  }

  .teacher-form {
    padding: 16px;
  }

  input {
    min-height: 52px;
  }

  .survey-shell {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .question-stage {
    min-height: calc(100dvh - 96px);
  }

  .question-card {
    min-height: calc(100dvh - 96px);
    border-radius: 22px;
  }

  .question-content.is-visual {
    min-height: 0;
  }

  .visual-full img {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    object-fit: cover;
    object-position: 50% 50%;
  }

  .frame-controls {
    grid-template-columns: minmax(60px, 1fr) minmax(108px, 3fr) minmax(60px, 1fr);
    min-height: 68px;
    padding: 6px;
    gap: 5px;
  }

  .frame-controls > .nav-arrow,
  .frame-controls > .audio-widget {
    min-height: 56px;
    border-radius: 14px;
  }

  .icon-button,
  .nav-arrow {
    width: 52px;
    min-width: 52px;
    height: 52px;
    min-height: 52px;
    font-size: 1.75rem;
  }

  .audio-widget {
    grid-template-columns: 40px 1fr;
    min-height: 46px;
    padding: 6px 10px 6px 6px;
  }

  .audio-play {
    width: 32px;
    height: 32px;
  }

  .audio-wave {
    gap: 3px;
  }

  .audio-wave span {
    width: 3px;
  }

  .complete-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px), (max-height: 620px) {
  .survey-shell {
    padding: 8px;
  }

  .survey-header {
    gap: 8px;
    margin-bottom: 6px;
  }

  .question-stage {
    min-height: calc(100dvh - 82px);
  }

  .question-card {
    min-height: calc(100dvh - 82px);
    border-width: 2px;
  }

  .option-panel {
    padding: 7px;
  }

  .option-button.has-image {
    min-height: 0;
  }

  .option-image {
    min-height: 0;
  }

  .frame-controls {
    grid-template-columns: minmax(58px, 1fr) minmax(102px, 3fr) minmax(58px, 1fr);
    min-height: 66px;
  }

  .frame-controls > .nav-arrow,
  .frame-controls > .audio-widget {
    min-height: 54px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .survey-shell {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    padding: 8px 12px;
  }

  .survey-header {
    margin-bottom: 6px;
  }

  .question-stage,
  .question-card {
    min-height: 440px;
  }

  .question-content.is-choice {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.74fr);
    grid-template-rows: none;
  }

  .choice-visual-panel {
    border-right: 2px solid rgba(240, 199, 180, 0.72);
    border-bottom: 0;
  }

  .option-grid.has-image-options {
    width: min(190px, 100%);
    height: auto;
    max-height: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, auto);
    align-content: center;
  }

  .option-button.has-image {
    min-height: 0;
  }

  .option-image {
    max-width: min(170px, 100%);
    max-height: clamp(60px, 18vh, 88px);
    min-height: 0;
  }

  .frame-controls {
    min-height: 58px;
  }

  .frame-controls > .nav-arrow,
  .frame-controls > .audio-widget {
    min-height: 46px;
  }
}

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

/* Keep questionnaire artwork mathematically centered when cover-cropped. */
.visual-full > .question-art,
.question-media > .question-art {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  object-fit: cover !important;
  object-position: 50% 50% !important;
  transform: translate(-50%, -50%) !important;
}

/* Hover transcripts must float above question artwork. */
.question-content.is-choice .option-panel,
.frame-controls {
  position: relative;
}

.question-content.is-choice .option-panel {
  z-index: 30;
}

.frame-controls {
  z-index: 40;
  overflow: visible;
}

.option-grid,
.option-button,
.audio-widget {
  position: relative;
}

.option-button::after,
.audio-widget::after {
  z-index: 3000 !important;
}
