:root {
  --white: #fffdf8;
  --cream: #f4efe4;
  --beige: #e8dcc8;
  --green: #7cb342;
  --green-deep: #558b2f;
  --green-soft: #e8f5d8;
  --orange: #ef6c00;
  --orange-soft: #fff3e0;
  --ink: #2c2a26;
  --ink-soft: #5c574e;
  --line: rgba(44, 42, 38, 0.12);
  --shadow: 0 10px 28px rgba(44, 42, 38, 0.18);
  --radius: 16px;
  --font-ui: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  --font-display: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  /* アニメ速度 66% → 時間倍率 */
  --anim-t: 1.51515;
  /* ワイプ（全体アニメと同倍率） */
  --wipe-t: var(--anim-t);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #1a1814;
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}

.app {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: stretch;
  padding: 0;
  background: #1a1814;
}

.stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 100%;
  border-radius: 0;
  overflow: hidden;
  background: var(--cream);
  isolation: isolate;
  --ui-dock: 156px;
}

/* 広い／横長画面のみ枠付き16:9寄り */
@media (min-width: 900px) and (orientation: landscape) {
  .app {
    place-items: center;
    padding: 12px;
    background:
      radial-gradient(ellipse at 20% 10%, rgba(124, 179, 66, 0.22), transparent 45%),
      radial-gradient(ellipse at 90% 80%, rgba(239, 108, 0, 0.18), transparent 40%),
      linear-gradient(160deg, #2a261f, #1a1814 55%, #232018);
  }
  .stage {
    width: min(100%, 960px);
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
    box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
}

.bg-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sprite-layer {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}

.bg-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: scale(1.02);
  transition: opacity calc(0.45s * var(--anim-t)) ease, filter calc(0.45s * var(--anim-t)) ease;
}

.bg-dim {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 6, 0.55);
  opacity: 0;
  transition: opacity calc(0.5s * var(--anim-t)) ease;
}

.stage.is-dim .bg-dim { opacity: 1; }
.stage.is-dim .bg-layer img { filter: brightness(0.72) saturate(0.9); }

/* 複数キャラ：話者中央・左右へ押し出し（はみ出しOK） */
.sprite-layer {
  z-index: 2;
  display: block;
  padding: 0;
  bottom: var(--ui-dock, 148px);
  top: 0;
  left: 0;
  right: 0;
  overflow: visible;
  transition: bottom calc(0.55s * var(--anim-t)) ease-in-out, opacity calc(0.45s * var(--anim-t)) ease, filter calc(0.45s * var(--anim-t)) ease;
}

.stage.is-choosing {
  --ui-dock: min(56dvh, 440px);
}

/* バストアップ：切れ端を台詞窓の矩形で隠す */
.stage.has-bust:not(.is-choosing) {
  --ui-dock: 72px;
}

.stage.has-bust:not(.is-choosing) .sprite-layer {
  bottom: var(--ui-dock);
  padding-bottom: 0;
  z-index: 5;
}

.stage.has-bust:not(.is-choosing) .sprite-slot.is-bust {
  margin-bottom: -8px;
}

.stage.has-bust:not(.is-choosing) .sprite-slot.is-bust img {
  max-height: var(--sprite-h, min(72vh, 600px));
  max-width: var(--sprite-mw, min(92vw, 540px));
}

.stage.has-bust:not(.is-choosing) .sprite-layer.count-1 .sprite-slot.is-bust img {
  max-height: min(74vh, 620px);
  max-width: min(94vw, 560px);
}

.stage.has-bust:not(.is-choosing) .dialogue {
  z-index: 6;
  background: rgba(255, 253, 248, 0.98);
  box-shadow:
    0 -18px 40px rgba(26, 24, 20, 0.28),
    0 -1px 0 rgba(255, 255, 255, 0.75);
}

.stage.has-bust:not(.is-choosing) .dialogue::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
  background: linear-gradient(to top, rgba(255, 253, 248, 0.98), transparent);
  pointer-events: none;
}

.stage.is-choosing .sprite-layer {
  opacity: 1;
  filter: none;
  bottom: var(--ui-dock);
  z-index: 2;
}

/* 設問シーン：幅に均等配置・高さ揃え */
.sprite-layer.is-even .sprite-slot {
  max-width: calc(100% / var(--n, 2) * 1.35);
}

.sprite-layer.is-even .sprite-slot.is-active,
.sprite-layer.is-even .sprite-slot.is-side,
.sprite-layer.is-even .sprite-slot.is-ensemble {
  opacity: 1;
  filter: none;
}

.sprite-layer.is-even .sprite-slot img {
  height: auto;
  width: auto;
  max-height: var(--sprite-h, 40vh);
  max-width: min(var(--sprite-mw, 90%), calc((100vw - 24px) / var(--n, 2) * 1.05));
  object-fit: contain;
  object-position: bottom center;
}

.stage.is-choosing .sprite-layer.is-even .sprite-slot img {
  max-height: min(var(--sprite-h, 36vh), calc(100dvh - var(--ui-dock) - 96px));
}

.stage.is-choosing .sprite-layer.count-1 .sprite-slot img {
  max-height: min(var(--sprite-h), calc(100dvh - var(--ui-dock) - 72px));
}

.sprite-slot {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: max-content;
  max-width: min(96%, var(--sprite-mw, 92vw));
  z-index: 1;
  transition: filter calc(0.45s * var(--anim-t)) ease, max-width calc(0.75s * var(--anim-t)) ease-in-out;
  pointer-events: none;
}

.sprite-layer.count-1 .sprite-slot {
  max-width: min(96%, 580px);
}

.sprite-slot.is-exiting {
  z-index: 0;
}

.sprite-mover {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-origin: center bottom;
}

.sprite-face {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  max-width: 100%;
  transform-origin: center bottom;
  /* flip 時のみ。anime の残りと干渉しやすいので transform 遷移は付けない */
}

.sprite-face.is-flipped {
  transform: scaleX(-1);
}

.sprite-slot img {
  display: block;
  width: auto;
  height: auto;
  max-height: var(--sprite-h, min(66vh, 560px));
  max-width: var(--sprite-mw, min(86vw, 480px));
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.28));
  transition: max-height calc(0.75s * var(--anim-t)) ease-in-out, max-width calc(0.75s * var(--anim-t)) ease-in-out;
}

/* 人数別のフォールバック（JSの --sprite-* が無いとき用） */
.sprite-layer.count-1 .sprite-slot img {
  max-height: min(78vh, 640px);
  max-width: min(94vw, 580px);
}

.sprite-layer.count-2 .sprite-slot img {
  max-height: min(66vh, 540px);
  max-width: min(78vw, 440px);
}

.sprite-layer.count-3 .sprite-slot img {
  max-height: min(58vh, 480px);
  max-width: min(64vw, 380px);
}

.sprite-layer.count-4 .sprite-slot img {
  max-height: min(50vh, 420px);
  max-width: min(56vw, 340px);
}

.sprite-layer.count-5 .sprite-slot img,
.sprite-layer.count-6 .sprite-slot img {
  max-height: min(42vh, 360px);
  max-width: min(48vw, 300px);
}

.sprite-layer.count-7 .sprite-slot img,
.sprite-layer.count-8 .sprite-slot img {
  max-height: min(36vh, 300px);
  max-width: min(42vw, 260px);
}

.sprite-slot.is-bust img {
  max-height: var(--sprite-h, min(72vh, 600px));
}

.sprite-slot.is-active {
  z-index: 6;
}

.sprite-slot.is-side {
  z-index: 2;
  opacity: 0.9;
  filter: brightness(0.92) saturate(0.94);
}

.sprite-slot.is-ensemble {
  opacity: 0.96;
}

.sprite-slot.is-active .sprite-face {
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.34));
}

.sprite-layer.count-0 {
  display: none;
}

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.92), rgba(244, 239, 228, 0.88)),
    url("bg/cafeteria-entrance--full.jpg") center / cover;
  animation: fade-in calc(0.6s * var(--anim-t)) ease;
}

.start-inner {
  text-align: center;
  padding: 28px 24px;
  max-width: 520px;
}

.start-kicker {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--green-deep);
  font-weight: 700;
  margin-bottom: 12px;
}

.start-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 5.2vw, 42px);
  line-height: 1.35;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
}

.start-lead {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 28px;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  border-radius: 999px;
  padding: 12px 28px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform calc(0.15s * var(--anim-t)) ease, box-shadow calc(0.15s * var(--anim-t)) ease, background calc(0.15s * var(--anim-t)) ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--orange), #ff8f00);
  color: #fff;
  box-shadow: 0 8px 20px rgba(239, 108, 0, 0.35);
}

.btn-primary:hover { box-shadow: 0 10px 24px rgba(239, 108, 0, 0.45); }

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

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 7;
  pointer-events: none;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 0;
  --hud-accent: #8bc34a;
}

.hud-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 6px 18px rgba(26, 24, 20, 0.16);
  backdrop-filter: blur(8px);
  animation: hud-float calc(3.2s * var(--anim-t)) ease-in-out infinite;
}

.hud-brand {
  font-family: var(--font-display);
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.hud-brand span {
  color: var(--hud-accent);
}

.hud-step {
  flex-shrink: 0;
  max-width: 48%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--hud-accent);
  border-radius: 999px;
  padding: 6px 10px;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.45);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: #8bc34a;
  border-radius: 999px;
  transition: width calc(0.4s * var(--anim-t)) ease, background-color calc(0.35s * var(--anim-t)) ease;
}

/* ステップ切替ワイプ */
.step-wipe {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

.step-wipe-shade {
  position: absolute;
  inset: 0;
  --wipe-color: #8bc34a;
  background: linear-gradient(
    115deg,
    color-mix(in srgb, var(--wipe-color) 42%, #1a1814) 0%,
    var(--wipe-color) 48%,
    color-mix(in srgb, var(--wipe-color) 72%, #fff8e7) 100%
  );
  transform: translateX(-102%);
}

.step-wipe-card {
  position: relative;
  z-index: 1;
  width: min(84vw, 360px);
  padding: 22px 20px 20px;
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 16px 40px rgba(20, 28, 12, 0.28);
  opacity: 0;
  transform: translateX(-28px) scale(0.96);
  text-align: center;
}

.step-wipe-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--wipe-accent, var(--orange));
}

.step-wipe-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.step-wipe-sub {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-soft);
}

.step-wipe.is-in .step-wipe-shade {
  animation: wipe-cover calc(0.7s * var(--wipe-t)) cubic-bezier(0.22, 0.8, 0.28, 1) forwards;
}

.step-wipe.is-in .step-wipe-card {
  animation: wipe-card-in calc(0.55s * var(--wipe-t)) cubic-bezier(0.22, 0.8, 0.28, 1) calc(0.28s * var(--wipe-t)) forwards;
}

.step-wipe.is-out .step-wipe-shade {
  animation: wipe-reveal calc(0.65s * var(--wipe-t)) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.step-wipe.is-out .step-wipe-card {
  animation: wipe-card-out calc(0.35s * var(--wipe-t)) ease-in forwards;
}

@keyframes wipe-cover {
  from { transform: translateX(-102%); }
  to { transform: translateX(0); }
}

@keyframes wipe-reveal {
  from { transform: translateX(0); }
  to { transform: translateX(102%); }
}

@keyframes wipe-card-in {
  from { opacity: 0; transform: translateX(-28px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes wipe-card-out {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(18px) scale(0.98); }
}

@media (prefers-reduced-motion: reduce) {
  .step-wipe.is-in .step-wipe-shade,
  .step-wipe.is-out .step-wipe-shade,
  .step-wipe.is-in .step-wipe-card,
  .step-wipe.is-out .step-wipe-card {
    animation: none !important;
  }
  .step-wipe.is-in .step-wipe-shade { transform: none; }
  .step-wipe.is-in .step-wipe-card { opacity: 1; transform: none; }
}

@keyframes hud-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .hud-banner { animation: none; }
}

.dialogue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  width: 100%;
  z-index: 6;
  background: rgba(255, 253, 248, 0.97);
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  backdrop-filter: blur(8px);
  min-height: 120px;
  animation: fade-up calc(0.35s * var(--anim-t)) ease;
}

.dialogue-speaker {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 8px;
  min-height: 1.6em;
}

.dialogue-name {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--green-deep);
  border-radius: 999px;
  padding: 3px 12px;
}

.dialogue-name.is-all {
  background: var(--orange);
}

.dialogue-role {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.dialogue-text {
  font-size: clamp(15px, 2.4vw, 18px);
  line-height: 1.7;
  min-height: 2.8em;
  white-space: pre-wrap;
}

.dialogue-next {
  position: absolute;
  right: 16px;
  bottom: 10px;
  color: var(--orange);
  font-size: 12px;
  animation: bounce calc(1s * var(--anim-t)) ease infinite;
}

.choice-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: var(--ui-dock);
  max-height: 62dvh;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 253, 248, 0.96);
  border-radius: 22px 22px 0 0;
  border-top: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 -10px 28px rgba(44, 42, 38, 0.16);
  backdrop-filter: blur(10px);
  animation: fade-up calc(0.3s * var(--anim-t)) ease;
  overflow: hidden;
}

.choice-head {
  color: var(--ink);
  margin: 0 auto 10px;
  width: 100%;
  max-width: 520px;
  flex-shrink: 0;
  text-shadow: none;
}

.choice-kicker {
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 4px;
}

.choice-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 4.2vw, 21px);
  line-height: 1.35;
  color: var(--ink);
}

.choice-list {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  overscroll-behavior: contain;
}

.choice-btn {
  appearance: none;
  border: 1.5px solid rgba(124, 179, 66, 0.28);
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  font-family: inherit;
  font-size: clamp(15px, 3.8vw, 17px);
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(44, 42, 38, 0.08);
  transition: transform calc(0.15s * var(--anim-t)) ease, background calc(0.15s * var(--anim-t)) ease, border-color calc(0.15s * var(--anim-t)) ease;
  flex: 1 1 0;
  min-height: 52px;
  display: flex;
  align-items: center;
}

.choice-btn:hover {
  background: var(--green-soft);
  border-color: rgba(124, 179, 66, 0.55);
  transform: translateY(-1px);
}

.choice-btn:active { transform: scale(0.99); }

/* メニュー / 画像選択：パネル高さいっぱいを使う */
.stage.is-choosing.is-vs-pick {
  --ui-dock: min(62dvh, 520px);
}

.stage.is-choosing.is-vs-pick .choice-panel {
  max-height: min(62dvh, 520px);
  height: var(--ui-dock);
  padding-top: 12px;
}

.stage.is-choosing.is-vs-pick .choice-head {
  margin-bottom: 8px;
}

.stage.is-choosing.is-vs-pick .choice-title {
  font-size: clamp(15px, 3.8vw, 18px);
}

.stage.is-choosing.is-vs-pick .choice-list {
  max-width: none;
}

/* VS（2択）: 左右並びで両方見える */
.choice-list.layout-vs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  gap: 12px;
  overflow: hidden;
  align-content: stretch;
}

.choice-btn.vs {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-width: 2px;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  align-items: stretch;
}

.choice-btn.vs img {
  width: 100%;
  flex: 1 1 auto;
  min-height: 120px;
  height: 0;
  aspect-ratio: auto;
  object-fit: cover;
  border-radius: 0;
  background: var(--beige);
}

.choice-btn.vs .choice-label {
  flex: 0 0 auto;
  padding: 10px 10px 12px;
  text-align: center;
  font-size: clamp(14px, 3.6vw, 16px);
  line-height: 1.3;
}

.choice-btn.vs:hover {
  border-color: var(--orange);
}

/* イベント画像（4択）: 2×2 で収める */
.choice-list.layout-image {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  overflow: hidden;
  align-content: stretch;
}

.choice-btn.img-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
}

.choice-btn.img-choice img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 0;
  background: var(--beige);
}

.choice-btn.img-choice .choice-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
  min-height: 0;
  padding: 12px 10px 10px;
  box-sizing: border-box;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(20, 18, 16, 0.15) 38%,
    rgba(20, 18, 16, 0.72) 100%
  );
  color: #fff;
  text-align: left;
}

.choice-btn.img-choice .choice-name {
  font-family: var(--font-display);
  font-size: clamp(14px, 3.6vw, 17px);
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.choice-btn.img-choice .choice-blurb {
  font-size: clamp(11px, 2.8vw, 12px);
  font-weight: 600;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.choice-btn .choice-label {
  flex: 1 1 auto;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1.4;
}

@media (max-height: 700px) {
  .stage.is-choosing { --ui-dock: min(60dvh, 420px); }
  .stage.is-choosing.is-vs-pick { --ui-dock: min(64dvh, 460px); }
  .stage.is-choosing.is-vs-pick .choice-panel { max-height: min(64dvh, 460px); }
  .choice-panel { max-height: 66dvh; padding-top: 10px; }
  .choice-list { gap: 8px; }
  .choice-btn.vs .choice-label { font-size: 13px; padding: 8px 8px 10px; }
  .choice-btn.img-choice .choice-name { font-size: 14px; }
  .choice-btn.img-choice .choice-blurb { font-size: 11px; }
  .choice-btn.img-choice .choice-copy { padding: 10px 8px 8px; }
  .choice-btn { padding: 12px 14px; font-size: 14px; }
  .choice-btn.vs,
  .choice-btn.img-choice { padding: 0; }
  .choice-title { font-size: clamp(14px, 3.6vw, 17px); }
}

.result-panel {
  position: absolute;
  inset: 0;
  z-index: 9;
  overflow: hidden;
  padding: 0;
  background: #1a1814;
  display: flex;
  flex-direction: column;
  animation: fade-in calc(0.4s * var(--anim-t)) ease;
}

.pass-card {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #fffdf8 0%, #f7f0e2 55%, #efe4d0 100%);
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  border: none;
}

.pass-card-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 12px;
  padding-top: max(18px, env(safe-area-inset-top, 0px));
}

.pass-partner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.pass-partner img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  object-position: center bottom;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.06);
}

.pass-partner-meta {
  flex: 1;
}

.pass-partner-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.06em;
}

.pass-partner-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.pass-partner-theme {
  font-size: 13px;
  color: var(--ink-soft);
}

.pass-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--orange);
  margin-bottom: 4px;
}

.pass-univ {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.pass-section + .pass-section { margin-top: 14px; }

.pass-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.pass-cafeteria {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.pass-title {
  font-size: 16px;
  font-weight: 700;
}

.pass-desc {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.5;
}

.pass-section-menus {
  margin-top: 18px;
}

.pass-menus {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.pass-menus.count-2 {
  grid-template-columns: 1fr 1fr;
}

.pass-menus.count-3 {
  grid-template-columns: 1fr 1fr;
}

.pass-menus.count-3 .pass-menu:last-child {
  grid-column: 1 / -1;
  max-width: 70%;
  justify-self: center;
}

.pass-menu {
  text-align: center;
}

.pass-menu img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  background: var(--beige);
  margin-bottom: 8px;
  box-shadow: 0 4px 14px rgba(44, 42, 38, 0.12);
}

.pass-menus.count-1 .pass-menu img {
  aspect-ratio: 16 / 10;
  max-height: 42vh;
}

.pass-menu span {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  display: block;
}

.pass-comments {
  list-style: none;
}

.pass-comments li {
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 10px;
  background: var(--green-soft);
  border-radius: 10px;
}

.pass-comments li + li { margin-top: 6px; }

.result-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(44, 42, 38, 0.08);
  background: rgba(255, 253, 248, 0.92);
}

.result-actions .btn {
  width: min(100%, 320px);
}

.end-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.end-panel {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent 0%, rgba(30, 28, 24, 0.45) 28%, rgba(30, 28, 24, 0.62) 100%);
  animation: fade-up calc(0.35s * var(--anim-t)) ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.feedback-card {
  width: min(440px, 100%);
  background: linear-gradient(165deg, #fffdf8, #f7f0e2 70%, #efe4d0);
  border-radius: 18px;
  padding: 18px 16px 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  margin-top: auto;
}

.feedback-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--orange);
}

.feedback-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(18px, 4.5vw, 22px);
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.feedback-rating {
  margin: 0;
  padding: 0;
  border: none;
}

.feedback-rating legend {
  font-size: 12px;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 8px;
}

.rating-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rating-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid transparent;
  cursor: pointer;
}

.rating-row label:has(input:checked) {
  border-color: rgba(124, 179, 66, 0.55);
  background: var(--green-soft);
}

.feedback-comment-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--green-deep);
}

.feedback-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  border: 1.5px solid rgba(124, 179, 66, 0.28);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: #fff;
  box-sizing: border-box;
}

.feedback-form textarea:focus {
  outline: 2px solid rgba(124, 179, 66, 0.45);
  outline-offset: 1px;
}

.feedback-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-deep);
  text-align: center;
}

.feedback-status.is-error { color: #b44; }
.feedback-status.is-ok { color: var(--green-deep); }

.feedback-form .btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.end-panel .end-actions {
  padding-top: 4px;
  border-top: 1px solid rgba(44, 42, 38, 0.08);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(3px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .sprite-slot,
  .sprite-slot img,
  .bg-layer img,
  .dialogue,
  .choice-panel,
  .result-panel,
  .end-panel,
  .start-screen {
    transition: none !important;
    animation: none !important;
  }
}

[hidden] { display: none !important; }
