:root {
  --mp-red: #a4172c;
  --mp-ink: #1c1a17;
  --mp-cream: #f6f1e7;
  --topbar-h: 52px;
  --voice-h: 72px;
  --nav-h: 56px;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.deck-body {
  font-family: "Noto Sans HK", "PingFang HK", sans-serif;
  background: var(--mp-cream);
  color: var(--mp-ink);
}

.title, .subtitle, .brand-title {
  font-family: "Noto Serif HK", serif;
}

/* ---------- 頂欄 / 底欄 ---------- */
.deck-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--mp-ink);
  color: #fff;
}

.deck-topbar .brand-title {
  display: flex;
  align-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--mp-red);
  color: #fff;
  margin-right: 0.55rem;
  font-weight: 900;
}

/* ---------- 旁白控制條 ---------- */
.voice-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--nav-h);
  height: var(--voice-h);
  z-index: 21;
  background: rgba(28, 26, 23, 0.92);
  color: #f6f1e7;
  border-top: 1px solid rgba(184, 159, 116, 0.35);
  backdrop-filter: blur(8px);
}

.voice-bar-main {
  height: calc(var(--voice-h) - 3px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.9rem 0.35rem;
}

.voice-play {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: none;
  background: var(--mp-red);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
}

.voice-play:hover {
  filter: brightness(1.08);
}

.voice-play.is-playing {
  background: #b89f74;
  color: #1c1a17;
}

.voice-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.voice-cues {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.voice-cues::-webkit-scrollbar {
  display: none;
}

.voice-cue {
  flex: 0 0 auto;
  border: 1px solid rgba(246, 241, 231, 0.28);
  background: transparent;
  color: #f6f1e7;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}

.voice-cue.is-active {
  background: #f6f1e7;
  color: #1c1a17;
  border-color: #f6f1e7;
}

.voice-caption {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-auto {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  opacity: 0.9;
  cursor: pointer;
  user-select: none;
}

.voice-auto input {
  accent-color: var(--mp-red);
}

.voice-progress {
  height: 3px;
  background: rgba(246, 241, 231, 0.15);
}

.voice-progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--mp-red);
  transition: width 0.1s linear;
}

@media (max-width: 720px) {
  :root {
    --voice-h: 84px;
  }
  .voice-caption {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .voice-auto span {
    display: none;
  }
}

.deck-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: rgba(246, 241, 231, 0.96);
  border-top: 1px solid #e7ddc9;
  backdrop-filter: blur(6px);
}

.deck-dots {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.deck-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: #d2c4a8;
  cursor: pointer;
}

.deck-dot.is-active {
  background: var(--mp-red);
  transform: scale(1.25);
}

.deck-dot:hover {
  background: #b89f74;
}

/* ---------- 分頁 Deck：同一時間只顯示一頁 ---------- */
.deck {
  position: fixed;
  top: var(--topbar-h);
  bottom: calc(var(--nav-h) + var(--voice-h));
  left: 0;
  right: 0;
  overflow: hidden;
}

.page {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--mp-cream);
}

.page.is-active {
  display: flex;
  flex-direction: column;
}

.page-inner {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-cover {
  text-align: center;
  align-items: center;
  color: #fff8ef;
  max-width: none;
}

.page-stage {
  justify-content: space-evenly;
  padding: clamp(1.25rem, 4vh, 2.75rem) clamp(1.5rem, 6vw, 4.5rem);
  min-height: 100%;
  height: 100%;
  box-sizing: border-box;
}

.page[data-page="cover"] .page-inner,
.page[data-page="closing"] .page-inner {
  background:
    radial-gradient(ellipse 90% 55% at 50% 18%, rgba(196, 78, 58, 0.22), transparent 62%),
    radial-gradient(ellipse 70% 50% at 50% 88%, rgba(224, 185, 138, 0.1), transparent 55%),
    linear-gradient(165deg, #1a1613 0%, #2c241e 48%, #1f1a16 100%);
  color: #fff8ef;
  max-width: none;
  text-align: center;
  align-items: stretch;
  justify-content: space-evenly;
}

.page[data-page="closing"] {
  background: #1a1613;
}

.page[data-page="cover"] {
  background: #1a1613;
}

.stage-brand {
  flex: 0 0 auto;
  margin: 0;
  font-family: "Noto Serif HK", serif;
  font-weight: 900;
  font-size: clamp(1.75rem, 4vw, 2.85rem);
  letter-spacing: 0.2em;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.stage-brand-soft {
  font-size: clamp(1.05rem, 2.3vw, 1.45rem);
  letter-spacing: 0.16em;
  color: #ffe7c2;
}

.stage-core {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(1.5rem, 4vh, 2.85rem);
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.eyebrow {
  letter-spacing: 0.22em;
  color: #ffd89a;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  font-weight: 600;
  margin: 0;
  line-height: 1.7;
}

.hero-title {
  color: #fff !important;
  font-family: "Noto Serif HK", serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 5.8vw, 4.35rem) !important;
  line-height: 1.42 !important;
  letter-spacing: 0.04em;
  margin: 0 !important;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.4);
}

.hero-subtitle {
  color: #fff6e8 !important;
  max-width: 42em;
  margin: 0 auto !important;
  font-size: clamp(1.12rem, 2vw, 1.42rem) !important;
  line-height: 2.15 !important;
  font-weight: 500;
  opacity: 1;
}

.stage-cta {
  flex: 0 0 auto;
  align-self: center;
  min-width: 12rem;
  height: 3.25rem;
  font-size: 1.08rem !important;
  font-weight: 700 !important;
  background: var(--mp-red) !important;
  border-color: var(--mp-red) !important;
  color: #fff !important;
  box-shadow: 0 10px 28px rgba(164, 23, 44, 0.35);
}

.stage-cta:hover {
  filter: brightness(1.08);
}

.closing-path {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.65rem 1rem;
  margin: 0;
  font-family: "Noto Serif HK", serif;
  font-weight: 800;
  font-size: clamp(1.7rem, 3.6vw, 2.65rem);
  letter-spacing: 0.14em;
  color: #ffd89a;
  line-height: 1.55;
}

.closing-path-sep {
  color: rgba(255, 216, 154, 0.65);
  font-weight: 500;
}

.closing-title {
  margin: 0;
  font-family: "Noto Serif HK", serif;
  font-weight: 900;
  font-size: clamp(2.15rem, 4.6vw, 3.5rem);
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.4);
}

.closing-subtitle {
  max-width: 36em;
}

.closing-foot {
  flex: 0 0 auto;
  margin: 0;
  color: #ffe7c2;
  font-size: clamp(1.08rem, 1.9vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.8;
}

/* 進入封面／收尾時輕微浮現 */
.page[data-page="cover"].is-active .stage-brand,
.page[data-page="closing"].is-active .stage-brand,
.page[data-page="cover"].is-active .stage-core,
.page[data-page="closing"].is-active .stage-core,
.page[data-page="cover"].is-active .stage-cta,
.page[data-page="closing"].is-active .closing-foot {
  animation: stageIn 0.7s ease both;
}

.page[data-page="cover"].is-active .stage-core,
.page[data-page="closing"].is-active .stage-core {
  animation-delay: 0.08s;
}

.page[data-page="cover"].is-active .stage-cta,
.page[data-page="closing"].is-active .closing-foot {
  animation-delay: 0.16s;
}

@keyframes stageIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.act-header-compact {
  text-align: center;
  margin: 0 auto 1rem;
  flex-shrink: 0;
}

.act-header-compact .title {
  font-weight: 800;
  color: var(--mp-ink);
  margin-bottom: 0.35rem !important;
}

.act-header-compact .subtitle {
  margin-bottom: 0 !important;
  color: #6b5d48 !important;
}

/* ---------- Intro ---------- */
.mingpao-founding-img img {
  border: 5px solid #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  transform: rotate(-1deg);
  max-height: 58vh;
  width: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain;
}

.intro-text {
  color: #4a3f2f;
  line-height: 1.75;
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
}

/* ---------- Act 1 ---------- */
.photo-row {
  flex-shrink: 0;
  margin-bottom: 0.75rem !important;
}

.photo-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.photo-card.is-active {
  border-color: var(--mp-red);
}

.card-image {
  position: relative;
}

.era-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(164, 23, 44, 0.9);
  color: #fff;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.ai-panel {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e7ddc9;
  padding: 0.9rem 1.15rem;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05);
  min-height: 7.5rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.ai-panel.is-idle {
  background: #faf7f1;
  border-style: dashed;
}

.ai-panel-placeholder {
  color: #9a8a6b;
  font-size: 0.95rem !important;
}

.ai-panel-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.ai-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--mp-red);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
}

.ai-panel-title {
  font-weight: 700;
  color: #7a6a4f;
  font-size: 0.9rem;
}

.ai-panel-text {
  font-size: 1rem;
  line-height: 1.7;
  min-height: 2.8rem;
  white-space: pre-wrap;
  max-height: 16vh;
  overflow: auto;
}

.ai-source {
  margin-top: 0.4rem;
  color: #9a8a6b;
  font-size: 0.72rem;
}

.quiz-box-compact {
  background: #eef6f6;
  border: 1px dashed #7fb3ac;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  flex-shrink: 0;
}

.quiz-options .quiz-opt {
  background: #fff;
}

.quiz-opt.is-correct-answer {
  background: #48c78e !important;
  color: #fff !important;
  border-color: #48c78e !important;
}

.quiz-opt.is-wrong-answer {
  background: #f14668 !important;
  color: #fff !important;
  border-color: #f14668 !important;
}

.quiz-feedback {
  margin-top: 0.25rem;
  font-weight: 600;
  min-height: 1.2rem;
  font-size: 0.9rem;
}

/* ---------- Act 2 ---------- */
.page[data-page="act2"] {
  background: #fff;
}

.act2-layout {
  flex: 1;
  min-height: 0;
  align-items: stretch !important;
}

.act2-layout > .column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tsang-page {
  flex: 1;
  min-height: 0;
}

.tsang-page img {
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  width: 100%;
  height: 100%;
  max-height: 58vh;
  object-fit: contain;
  object-position: top;
  background: #f3eee4;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex-shrink: 0;
}

.chip-btn {
  background: var(--mp-cream);
  border: 1px solid #e7ddc9;
  color: var(--mp-ink);
}

.chip-btn:hover {
  border-color: var(--mp-red);
  color: var(--mp-red);
}

.tsang-chat {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-top: 0.75rem;
  padding-right: 0.25rem;
}

.chat-bubble {
  border-radius: 12px;
  padding: 0.75rem 1rem;
  max-width: 95%;
  line-height: 1.65;
  white-space: pre-wrap;
  font-size: 0.95rem;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--mp-ink);
  color: #fff;
}

.chat-bubble.ai {
  align-self: flex-start;
  background: var(--mp-cream);
  border: 1px solid #e7ddc9;
}

.chat-source {
  align-self: flex-start;
  max-width: 95%;
  margin: -0.15rem 0 0.35rem;
  color: #9a8a6b;
  font-size: 0.72rem;
  line-height: 1.4;
}

.debate-box {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: #fff8ec;
  border: 1px dashed #d8a34a;
  flex-shrink: 0;
}

.debate-box.is-hidden {
  display: none;
}

/* ---------- Act 3 ---------- */
.page[data-page="act3"] {
  background: #faf7f1;
}

.lesson-swiper-wrap {
  position: relative;
  flex-shrink: 0;
  margin: 0 0 0.55rem;
  padding: 0 2.4rem;
}

.lesson-swiper {
  width: 100%;
  padding: 0.6rem 0 1rem;
  overflow: hidden;
}

.lesson-swiper .swiper-slide {
  width: 11rem;
  height: auto;
}

.lesson-card {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  height: 100%;
  box-shadow: 0 6px 16px rgba(28, 26, 23, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lesson-card.is-active,
.swiper-slide-active .lesson-card {
  border-color: var(--mp-red);
  box-shadow: 0 10px 22px rgba(28, 26, 23, 0.14);
}

.lesson-card .card-image {
  position: relative;
  background: #f3eee4;
}

.lesson-card .card-content {
  padding-left: 0.55rem !important;
  padding-right: 0.55rem !important;
}

.lesson-card .card-content p {
  line-height: 1.35;
  min-height: 2.3em;
}

.lesson-card .lesson-thumb {
  height: 20vh;
  min-height: 130px;
  max-height: 180px;
  overflow: hidden;
}

.lesson-card .lesson-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
}

.lesson-swiper-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-60%);
  z-index: 5;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 50%;
  background: rgba(28, 26, 23, 0.55);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.lesson-swiper-prev { left: 0.15rem; }
.lesson-swiper-next { right: 0.15rem; }

.lesson-swiper-nav:hover {
  background: rgba(28, 26, 23, 0.78);
}

.lesson-swiper-nav.swiper-button-disabled {
  opacity: 0.35;
  cursor: default;
}

.lesson-panel {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e7ddc9;
  padding: 0.9rem 1.1rem;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05);
  flex: 1;
  min-height: 8rem;
  display: flex;
  flex-direction: column;
}

.lesson-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}

.lesson-panel-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audience-switch .button.is-selected {
  background: var(--mp-ink);
  color: #fff;
  border-color: var(--mp-ink);
}

.lesson-output {
  white-space: pre-wrap;
  font-family: "Noto Sans HK", "PingFang HK", sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
  background: #faf7f1;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0;
  color: var(--mp-ink);
  border: 1px solid #efe6d6;
  flex: 1;
  min-height: 3.2rem;
  overflow: auto;
}

.page[data-page="act3"] .page-inner {
  justify-content: flex-start;
}

.lesson-output.is-idle {
  color: #9a8a6b;
}

.typing-cursor::after {
  content: "▍";
  animation: blink 1s steps(1) infinite;
  color: var(--mp-red);
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (max-width: 900px) {
  .page-inner {
    padding: 0.85rem 1rem;
    justify-content: flex-start;
    overflow: auto;
  }
}
