@font-face {
  font-family: 'WenKai';
  src: url('../fonts/wenkai.woff2') format('woff2'),
       url('fonts/wenkai.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-main: 'WenKai', 'LXGW WenKai TC', 'Kaiti TC', 'STKaiti', 'DFKai-SB', serif;
  --bg: #f6e7df;
  --ink: #462c22;
  --accent: #b83724;
  --panel: rgba(255, 251, 247, 0.88);
}

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

html, body {
  width: 100%;
  min-height: 100%;
  font-family: var(--font-main);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================================
   首頁 (index.html) — 柔和插畫水彩風格
   ========================================================= */
body.home-body {
  background-color: #fbf5ef;
  background-image:
    radial-gradient(ellipse 55% 45% at 12% 15%, rgba(247, 206, 200, 0.55) 0%, rgba(247, 206, 200, 0) 70%),
    radial-gradient(ellipse 50% 45% at 88% 22%, rgba(213, 232, 212, 0.55) 0%, rgba(213, 232, 212, 0) 72%),
    radial-gradient(ellipse 60% 50% at 20% 82%, rgba(220, 234, 224, 0.5) 0%, rgba(220, 234, 224, 0) 70%),
    radial-gradient(ellipse 55% 45% at 85% 85%, rgba(250, 224, 198, 0.52) 0%, rgba(250, 224, 198, 0) 70%);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
  padding: 3rem 1.25rem 4.5rem;
}

.watercolor-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.45;
}

.blob-pink {
  width: 380px;
  height: 320px;
  top: -80px;
  left: -90px;
  background: #f4b8b0;
}

.blob-green {
  width: 420px;
  height: 350px;
  top: 18%;
  right: -120px;
  background: #cce3cc;
}

.blob-cream {
  width: 460px;
  height: 360px;
  bottom: -100px;
  left: 15%;
  background: #f7dfc2;
}

.home-container {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
}

.home-header {
  text-align: center;
  margin-bottom: 2.75rem;
}

.home-badge {
  display: inline-block;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  color: #8c5848;
  background: rgba(255, 248, 242, 0.85);
  border: 1px solid rgba(184, 55, 36, 0.16);
  padding: 0.35rem 1.1rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
  box-shadow: 0 4px 14px rgba(110, 65, 45, 0.06);
}

.home-title {
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 700;
  color: #462b20;
  letter-spacing: 0.06em;
  line-height: 1.35;
  margin-bottom: 0.65rem;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.8);
}

.home-subtitle {
  font-size: clamp(1rem, 2vw, 1.18rem);
  color: #77584c;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

.tract-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}

@media (min-width: 640px) {
  .tract-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 980px) {
  .tract-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.25rem;
  }
}

.tract-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 252, 248, 0.9);
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 12px 32px rgba(92, 58, 42, 0.08),
    0 2px 6px rgba(92, 58, 42, 0.04);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.tract-card:nth-child(3n+1) {
  background: linear-gradient(180deg, rgba(255, 247, 244, 0.94) 0%, rgba(255, 253, 250, 0.94) 100%);
}

.tract-card:nth-child(3n+2) {
  background: linear-gradient(180deg, rgba(246, 252, 246, 0.94) 0%, rgba(255, 253, 250, 0.94) 100%);
}

.tract-card:nth-child(3n+3) {
  background: linear-gradient(180deg, rgba(254, 250, 241, 0.94) 0%, rgba(255, 253, 250, 0.94) 100%);
}

.tract-card:hover,
.tract-card:focus-visible {
  transform: translateY(-7px);
  box-shadow:
    0 20px 42px rgba(92, 58, 42, 0.15),
    0 4px 12px rgba(92, 58, 42, 0.06);
  outline: none;
}

.card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  background: linear-gradient(135deg, #f8e4dc 0%, #e7f0e4 55%, #faecd8 100%);
  overflow: hidden;
}

.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.tract-card:hover .card-thumb {
  transform: scale(1.04);
}

.card-number {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 252, 248, 0.92);
  color: #a93826;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(60, 30, 20, 0.14);
}

.card-play-pill {
  position: absolute;
  bottom: 12px;
  right: 14px;
  background: rgba(70, 43, 32, 0.78);
  color: #fffaf5;
  font-size: 0.85rem;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  letter-spacing: 0.05em;
  transition: background 0.25s ease;
}

.tract-card:hover .card-play-pill {
  background: #b83724;
}

.card-body {
  padding: 1.35rem 1.45rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #3f261d;
  line-height: 1.45;
  letter-spacing: 0.03em;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(140, 95, 75, 0.2);
}

.card-ref {
  font-size: 1.02rem;
  color: #9e3d2b;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.card-arrow {
  font-size: 0.95rem;
  color: #8c6b5d;
}

.home-footer {
  text-align: center;
  margin-top: 3.5rem;
  font-size: 0.95rem;
  color: #8c6f63;
  letter-spacing: 0.05em;
}

/* =========================================================
   播放頁 (play.html) — 9:16 邏輯舞台 1080x1920 + Letterbox
   ========================================================= */
body.play-body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 35%, #fdf6f0 0%, var(--bg) 65%, #e5cfc4 100%);
}

.player-wrap {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

body.render-mode {
  overflow: hidden;
}

body.render-mode .player-wrap {
  height: auto;
}

body.render-mode .controls,
body.render-mode .card-section {
  display: none !important;
}

#stage-viewport {
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(45, 24, 14, 0.22);
  background: var(--bg);
}

body.render-mode #stage-viewport {
  box-shadow: none;
}

body.render-mode *,
body.render-mode *::before,
body.render-mode *::after {
  transition: none !important;
  animation: none !important;
}

#stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 1920px;
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-main);
}

#scenes-layer {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  overflow: hidden;
  pointer-events: none;
  /* opaque paper so the incoming scene fully covers the outgoing one (no jump when it is removed) */
  background: var(--bg);
  contain: layout paint;
  will-change: opacity;
}

.scene-cam-layer {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.scene-bg-img {
  display: block;
  max-width: none;
  pointer-events: none;
}

.scene-sprites-layer {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  pointer-events: none;
}

.scene-sprite {
  position: absolute;
  top: 0;
  left: 0;
  background-repeat: no-repeat;
  transform-origin: center center;
  will-change: transform, opacity;
  mix-blend-mode: multiply;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 55%, rgba(0, 0, 0, 0) 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 55%, rgba(0, 0, 0, 0) 100%);
}

/* 紙片文字面板 */
.scene-panel {
  position: absolute;
  background: var(--panel);
  border-radius: 36px;
  padding: 46px 54px;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow:
    0 20px 54px rgba(58, 34, 22, 0.13),
    0 3px 12px rgba(58, 34, 22, 0.06),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

#stage.is-scaled .scene-panel {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.scene-panel.pos-top {
  top: 56px;
  left: 56px;
  right: 56px;
}

.scene-panel.pos-top-left {
  top: 56px;
  left: 56px;
  width: 948px;
}

.scene-panel.pos-top-right {
  top: 56px;
  right: 56px;
  width: 948px;
}

.scene-panel.pos-center {
  top: 50%;
  left: 56px;
  right: 56px;
  transform: translateY(-50%);
}

.scene-panel.pos-bottom {
  bottom: 56px;
  left: 56px;
  right: 56px;
}

.scene-panel.pos-bottom-left {
  bottom: 56px;
  left: 56px;
  width: 948px;
}

.scene-panel.pos-bottom-right {
  bottom: 56px;
  right: 56px;
  width: 948px;
}

.panel-inner {
  position: relative;
  width: 100%;
  color: var(--ink);
  font-size: 56px;
  line-height: 1.75;
  letter-spacing: 0.04em;
  text-align: left;
}

.text-line {
  display: block;
  white-space: nowrap;
}

.scene-verse .panel-inner {
  text-align: left;
}

.char {
  display: inline-block;
  opacity: 0;
}

.char-space {
  display: inline;
}

.char-bold {
  color: var(--accent);
  font-weight: 700;
}

.char-highlight {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2em;
  line-height: 1.2;
}

.verse-ref-wrap {
  display: block;
  text-align: right;
  margin-top: 28px;
  font-size: 0.92em;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
}

/* 筆尖墨點光點 */
.pen-tip {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, var(--accent) 0%, rgba(184, 55, 36, 0.45) 45%, rgba(184, 55, 36, 0) 75%);
  box-shadow: 0 0 18px rgba(184, 55, 36, 0.45);
  transform: translate(-50%, -50%);
}

/* 開頭與結尾全白淡入淡出層 */
#white-overlay {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  background: #ffffff;
  pointer-events: none;
  z-index: 20;
  opacity: 1;
}

/* 互動控制層（?render=1 時完全隱藏） */
#ui-layer {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  z-index: 30;
  pointer-events: none;
}

body.render-mode #ui-layer {
  display: none !important;
}

.ui-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(45, 28, 20, 0.08);
  pointer-events: auto;
}

.ui-overlay.hidden {
  display: none !important;
}

.play-circle-btn {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.92);
  background: rgba(184, 55, 36, 0.92);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 46px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow:
    0 20px 55px rgba(45, 20, 12, 0.35),
    0 0 0 18px rgba(255, 255, 255, 0.22);
  transition: transform 0.2s ease, background 0.2s ease;
}

.play-circle-btn:hover {
  transform: scale(1.05);
  background: #c83d28;
}

.play-circle-btn:active {
  transform: scale(0.97);
}

.play-icon {
  font-size: 72px;
  line-height: 1;
  margin-left: 8px;
}

.play-label {
  font-size: 38px;
  letter-spacing: 0.08em;
}

.end-card {
  background: rgba(255, 252, 248, 0.95);
  padding: 72px 84px;
  border-radius: 44px;
  text-align: center;
  box-shadow: 0 24px 68px rgba(50, 28, 18, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  max-width: 860px;
}

.end-title {
  font-size: 56px;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.4;
}

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

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 26px 54px;
  border-radius: 999px;
  font-family: var(--font-main);
  font-size: 42px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  letter-spacing: 0.06em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn.primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 32px rgba(184, 55, 36, 0.3);
}

.action-btn.secondary {
  background: #f3e5dc;
  color: var(--ink);
  border: 2px solid rgba(90, 55, 40, 0.18);
}

.action-btn:hover {
  transform: translateY(-3px);
}

.top-home-link {
  position: absolute;
  top: 36px;
  left: 36px;
  z-index: 35;
  background: rgba(255, 252, 248, 0.88);
  color: var(--ink);
  text-decoration: none;
  font-size: 32px;
  font-weight: 700;
  padding: 14px 30px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(45, 25, 15, 0.12);
  pointer-events: auto;
  transition: opacity 0.25s ease, transform 0.2s ease;
}

.top-home-link:hover {
  transform: scale(1.04);
}

/* ===== Round 2: image windows / custom text boxes ===== */
.scene-view {
  position: absolute;
  left: 0;
  top: 0;
  width: 1080px;
  height: 1920px;
  overflow: hidden;
  transform-origin: 50% 50%;
  will-change: transform;
}

.scene-view.frame-card {
  box-shadow: 0 26px 60px rgba(58, 34, 22, 0.22), 0 0 0 10px rgba(255, 255, 255, 0.92);
}

.scene-view.frame-polaroid {
  box-shadow: 0 30px 70px rgba(58, 34, 22, 0.26), 0 0 0 18px #fffdf8;
}

.scene-backdrop {
  position: absolute;
  inset: -60px;
  background-size: cover;
  background-position: center;
  /* already blurred: a tiny pre-rendered image upscaled (see softBackdropUrl in player.js) */
  opacity: 0.42;
}

.scene-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 250, 244, 0.25) 0%, rgba(255, 250, 244, 0.55) 100%);
}

.scene-panel.pos-custom {
  right: auto;
}

.scene-panel.panel-soft {
  background: rgba(255, 252, 248, 0.94);
}

/* 主觀禱告：手寫信紙 */
@font-face {
  font-family: 'PrayerHand';
  src: url('../fonts/prayer.woff2') format('woff2');
  font-display: swap;
}

.scene-prayer .scene-panel {
  background: linear-gradient(170deg, #fffdf6 0%, #fff6e8 100%);
  border-radius: 18px 44px 22px 40px;
  box-shadow: 0 24px 60px rgba(58, 34, 22, 0.2), 0 2px 0 rgba(255, 255, 255, 0.9) inset;
}

.scene-prayer .panel-inner {
  font-family: 'PrayerHand', var(--font-main);
  -webkit-text-stroke: 1.5px currentColor;
  letter-spacing: 0.06em;
  color: #4a2e22;
}

.scene-prayer .scene-panel::before {
  content: '♡ 我的禱告';
  position: absolute;
  top: 14px;
  right: 34px;
  font-family: var(--font-main);
  font-size: 30px;
  color: var(--accent);
  opacity: 0.75;
  letter-spacing: 0.1em;
}

/* ===== Controls bar ===== */
.controls {
  height: 76px;
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: rgba(255, 251, 247, 0.96);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 14px 30px rgba(45, 24, 14, 0.14);
  font-family: var(--font-main);
  color: var(--ink);
  touch-action: none;
}

.ctrl-play {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(184, 55, 36, 0.3);
}

.ctrl-play svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.ctrl-play .ic-pause,
.ctrl-play.is-playing .ic-play {
  display: none;
}

.ctrl-play.is-playing .ic-pause {
  display: block;
}

.ctrl-time {
  flex: 0 0 auto;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: center;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  opacity: 0.8;
}

.ctrl-track {
  position: relative;
  flex: 1 1 auto;
  height: 66px;
  cursor: pointer;
  touch-action: none;
  outline: none;
}

.ctrl-rail,
.ctrl-fill {
  position: absolute;
  left: 0;
  top: 70%;
  height: 8px;
  margin-top: -4px;
  border-radius: 999px;
}

.ctrl-rail {
  right: 0;
  background: rgba(70, 44, 34, 0.14);
}

.ctrl-fill {
  width: 0;
  background: linear-gradient(90deg, #f0a080, var(--accent));
}

.ctrl-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ctrl-tick {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 8px;
  margin: -4px 0 0 -1.5px;
  background: rgba(255, 255, 255, 0.85);
  z-index: 2;
}

.ctrl-tick.tick-key {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(184, 55, 36, 0.5);
}

.ctrl-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 3;
  transition: transform 0.15s ease;
}

.controls.is-dragging .ctrl-thumb,
.ctrl-track:focus-visible .ctrl-thumb {
  transform: scale(1.3);
}

/* ===== 圖文卡 section ===== */
.card-section {
  max-width: 560px;
  margin: 0 auto;
  padding: 2.4rem 1.1rem 3.5rem;
  text-align: center;
  font-family: var(--font-main);
  color: var(--ink);
}

.card-heading {
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.card-hint {
  font-size: 1rem;
  opacity: 0.75;
  margin-bottom: 1.2rem;
}

.card-figure {
  margin: 0;
}

.card-img {
  width: 100%;
  height: auto;
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(58, 34, 22, 0.18);
  background: #fffaf3;
}

.card-actions {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.05em;
}

.pill-btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(184, 55, 36, 0.28);
}

.pill-btn.secondary {
  background: #fff7f1;
  color: var(--ink);
  border: 1.5px solid rgba(90, 55, 40, 0.18);
}

/* ===== Round 2: 可愛首頁 ===== */
@font-face {
  font-family: 'Huninn';
  src: url('../fonts/huninn.woff2') format('woff2');
  font-display: swap;
}
.home-body { --font-cute: 'Huninn', 'WenKai', sans-serif; }
.home-body .home-badge, .home-body .home-subtitle, .home-body .card-title,
.home-body .card-play-pill, .home-body .card-arrow, .home-body .card-ref,
.home-body .home-footer, .home-body .card-number { font-family: var(--font-cute); }
.home-header { position: relative; margin-bottom: 2.2rem; }
.home-title {
  font-family: var(--font-cute);
  font-weight: 400;
  font-size: clamp(2rem, 8.4vw, 3.4rem);
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin-bottom: 0.1rem;
  text-shadow: none;
  display: flex; flex-wrap: wrap; justify-content: center;
}
.home-title .tc {
  display: inline-block;
  -webkit-text-stroke: 1px rgba(255,255,255,0.6);
  text-shadow: 0 3px 0 #fff, 0 6px 14px rgba(190, 110, 90, 0.22);
  animation: bob 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.16s);
}
.home-title .tc0 { color: #e8747c; }
.home-title .tc1 { color: #f0a04b; }
.home-title .tc2 { color: #6fb38a; }
.home-title .tc3 { color: #6aa6d6; }
.home-title .tc4 { color: #b58bd6; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-5px) rotate(2deg); } }
.title-wave { display: block; width: min(300px, 70vw); height: 16px; margin: 0.15rem auto 0.7rem; }
.home-badge { border-radius: 999px; background: #fff3ef; color: #c06a62; border: 2px dashed #f4b9b0; }
.home-subtitle { color: #8a6253; }
.hero-art {
  margin: 1.4rem auto 0;
  max-width: 760px;
  border-radius: 34px;
  overflow: hidden;
  border: 6px solid #fff;
  box-shadow: 0 14px 34px rgba(200, 120, 100, 0.22);
  transform: rotate(-1deg);
}
.hero-art img { display: block; width: 100%; height: auto; }
.hero-deco { position: absolute; inset: -1rem 0 auto 0; height: 100%; pointer-events: none; }
.hero-deco .fl { position: absolute; font-size: 1.5rem; opacity: 0.8; animation: floaty 4s ease-in-out infinite; }
.hero-deco .f1 { left: 4%; top: 0.5rem; color: #f29a9f; }
.hero-deco .f2 { right: 6%; top: 0; color: #f6c24f; animation-delay: .6s; }
.hero-deco .f3 { right: 14%; top: 5.5rem; color: #f5b3c0; font-size: 1.1rem; animation-delay: 1.2s; }
.hero-deco .f4 { left: 10%; top: 6.5rem; color: #8fc9a2; animation-delay: 1.8s; }
.hero-deco .f5 { left: 1%; top: 13rem; color: #b9a2e0; font-size: 1.1rem; animation-delay: 2.4s; }
.hero-deco .f6 { right: 2%; top: 12rem; color: #f29a9f; animation-delay: 3s; }
@keyframes floaty { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.12); } }
.home-body .tract-card { border-radius: 28px; border: 4px solid #fff; }
.home-body .card-number { border-radius: 50%; }
.home-body .card-title { font-weight: 400; }
.foot-heart { color: #ef8f96; }
@media (prefers-reduced-motion: reduce) { .home-title .tc, .hero-deco .fl { animation: none; } }
.home-title { flex-direction: column; align-items: center; font-size: clamp(2rem, 9.6vw, 3.6rem); }
.home-title .tl { display: flex; justify-content: center; }
.home-title .tc { -webkit-text-stroke: 0; text-shadow: 0 3px 0 #fff, 0 5px 12px rgba(190,110,90,0.25); }


/* ===== Round 3: 進度條上的「經文／禱告」段落 ===== */
.ctrl-tick { top: 70%; }
.ctrl-thumb { top: 70%; }
.ctrl-segs { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.ctrl-seg {
  position: absolute;
  top: 70%;
  height: 12px;
  margin-top: -6px;
  border-radius: 999px;
  opacity: 0.88;
  box-shadow: 0 0 0 2px #fffaf5;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.ctrl-seg.seg-verse { background: linear-gradient(90deg, #f4c96b, #e2a43a); }
.ctrl-seg.seg-prayer { background: linear-gradient(90deg, #f6a6bd, #e4708f); }
.ctrl-seg.is-on { opacity: 1; transform: scaleY(1.25); }
.ctrl-seg-labels { position: absolute; left: 0; right: 0; top: 2px; height: 26px; z-index: 4; }
.ctrl-seg-label {
  position: absolute;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 0 7px 0 5px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-main);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 2px 6px rgba(80, 40, 20, 0.18);
  transition: transform 0.2s ease;
}
.ctrl-seg-label svg { width: 14px; height: 14px; fill: currentColor; flex: 0 0 auto; }
.ctrl-seg-label.seg-verse { background: #d9962c; }
.ctrl-seg-label.seg-prayer { background: #de5f84; }
.ctrl-seg-label.is-on { transform: translateY(-1px) scale(1.06); }
.ctrl-seg-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 460px) {
  #ctrl-tot { display: none; }
  .controls { gap: 8px; padding: 0 10px; }
}

/* 載入中：先把圖片與聲音全部載入再播放 */
.play-circle-btn.is-loading {
  cursor: progress;
  background: conic-gradient(rgba(255, 255, 255, 0.35) var(--load, 0%), rgba(184, 55, 36, 0.78) 0);
  animation: loadPulse 1.6s ease-in-out infinite;
}
.play-circle-btn.is-loading .play-icon { opacity: 0.55; }
.play-circle-btn.is-loading .play-label { font-size: 30px; }
.play-circle-btn:disabled:hover { transform: none; }
@keyframes loadPulse { 0%, 100% { box-shadow: 0 20px 55px rgba(45, 20, 12, 0.3), 0 0 0 14px rgba(255, 255, 255, 0.18); } 50% { box-shadow: 0 20px 55px rgba(45, 20, 12, 0.3), 0 0 0 26px rgba(255, 255, 255, 0.28); } }

/* 配樂出處（CC BY 4.0） */
.music-credit { margin: 1.6rem auto 0; font-size: 0.78rem; line-height: 1.6; opacity: 0.7; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; }
.music-credit a { color: inherit; }


/* ===== Round 3: 首頁單一暖色系（珊瑚粉） ===== */
.home-body {
  --warm-900: #a9473a;
  --warm-700: #d0654f;
  --warm-500: #e88c76;
  --warm-300: #f5bfae;
  --warm-100: #fde9e2;
}
body.home-body {
  background-color: #fdf6f2;
  background-image:
    radial-gradient(ellipse 55% 45% at 12% 12%, rgba(245, 191, 174, 0.45) 0%, rgba(245, 191, 174, 0) 70%),
    radial-gradient(ellipse 55% 45% at 90% 85%, rgba(253, 222, 210, 0.55) 0%, rgba(253, 222, 210, 0) 70%);
}
.blob-pink { background: var(--warm-300); }
.blob-green { background: var(--warm-100); }
.blob-cream { background: #fbd9cb; }
.hero-deco, .home-badge, .home-subtitle { display: none !important; }
.home-header { margin-bottom: 2rem; }
.title-art { display: block; width: 116px; height: auto; margin: 0 auto 0.2rem; }
.title-art .ta-heart { fill: var(--warm-500); }
.title-art .ta-c2 { fill: var(--warm-700); }
.title-art .ta-c1 { fill: var(--warm-500); }
.title-art .ta-line { fill: none; stroke: var(--warm-300); stroke-width: 4; stroke-linecap: round; }
.title-art .ta-book { fill: #fff; stroke: var(--warm-700); stroke-width: 2.4; }
.title-art .ta-bookline { stroke: var(--warm-300); stroke-width: 1.6; stroke-linecap: round; }
.home-title {
  display: block;
  font-family: var(--font-cute);
  font-weight: 400;
  font-size: clamp(2.1rem, 9.4vw, 3.6rem);
  line-height: 1.25;
  letter-spacing: 0.04em;
  color: var(--warm-700);
  -webkit-text-stroke: 0;
  text-shadow: 0 3px 0 #fff, 0 4px 0 var(--warm-100), 0 8px 18px rgba(208, 101, 79, 0.18);
  white-space: nowrap;
}
.title-wave { color: var(--warm-300); }
.hero-art { box-shadow: 0 14px 34px rgba(208, 101, 79, 0.18); }
.foot-heart { color: var(--warm-500); }
.home-footer { color: var(--warm-900); }
.social-links { display: flex; justify-content: center; gap: 14px; margin-top: 1rem; }
.social-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--warm-700); color: #fff;
  box-shadow: 0 6px 14px rgba(208, 101, 79, 0.25);
  transition: transform 0.2s ease, background 0.2s ease;
}
.social-btn:hover, .social-btn:focus-visible { background: var(--warm-900); transform: translateY(-2px); }
.social-btn svg { width: 24px; height: 24px; fill: currentColor; }

/* ===== Round 4: playful title — Mochiy Pop One (SIL OFL 1.1), subset to 8 title chars ===== */
@font-face { font-family: 'TitleB'; src: url('../fonts/title_b.woff2') format('woff2'); font-display: block; }
.home-header .title-art { display: none; }
.fun-title { display: flex; flex-direction: column; align-items: center; gap: 0.05em; margin: 0.9rem 0 0.2rem; letter-spacing: 0; white-space: nowrap; }
.fun-title .ft-line { display: flex; justify-content: center; align-items: flex-end; }
.fun-title .fc { position: relative; display: inline-block; padding: 0 0.03em; transform: translateY(var(--y)) rotate(var(--r)) scale(var(--s)); }
.fun-title .fd { position: absolute; width: 0.48em; height: 0.48em; fill: var(--warm-500); color: var(--warm-500); overflow: visible; pointer-events: none; }
.fun-title .fd.sm { width: 0.38em; height: 0.38em; }
.fun-title .p-left.sm2, .fun-title .p-right.sm2 { width: 0.4em; height: 0.4em; }
.fun-title .p-left.sm2 { left: -0.5em; bottom: 0.3em; transform: rotate(-10deg); }
.fun-title .p-right.sm2 { right: -0.5em; bottom: 0.3em; }
.fun-title .fd .lt { fill: var(--warm-300); }
.fun-title .p-tr { top: -0.18em; right: -0.12em; transform: rotate(14deg); }
.fun-title .p-tl { top: -0.14em; left: -0.1em; transform: rotate(-12deg); }
.fun-title .p-top { top: -0.36em; left: 50%; margin-left: -0.21em; }
.fun-title .p-br { bottom: -0.12em; right: -0.24em; transform: rotate(10deg); }
.fun-title .p-left { width: 0.62em; height: 0.62em; left: -0.62em; bottom: 0.06em; }
.fun-title .p-right { width: 0.58em; height: 0.58em; right: -0.64em; bottom: 0.08em; transform: rotate(8deg); }
.ft-b { font-family: 'TitleB', var(--font-cute); font-size: clamp(2.9rem, 14vw, 4.8rem); line-height: 1.12; color: var(--warm-700);
  text-shadow: 3px 3px 0 #fff, -3px 3px 0 #fff, 3px -3px 0 #fff, -3px -3px 0 #fff, 0 7px 0 var(--warm-300), 0 12px 18px rgba(208,101,79,0.2); }
.ft-b .fd { filter: drop-shadow(0 2px 0 #fff); }
@media (min-width: 720px) { .fun-title { flex-direction: row; gap: 0; } .fun-title .ft-line + .ft-line { margin-left: 0.55em; } }
