/* 🎬 開場動畫（js/prologue.js；2026-10-31 .381）：上下黑邊＝電影，上面寫第幾幕、下面是字幕；最後是片名 */
.pro { position: fixed; inset: 0; z-index: 10050; background: #000; color: #f6ead6; display: grid; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); justify-items: center;
  overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; animation: pro-in 0.6s ease both; }
.pro.out { opacity: 0; transition: opacity 0.55s ease; pointer-events: none; }
@keyframes pro-in { from { opacity: 0; } to { opacity: 1; } }
body.pro-on { overflow: hidden; }
.pro-top { grid-row: 1; align-self: end; width: 100%; display: flex; justify-content: center; padding: 0 16px 12px; }
.pro-stage { grid-row: 2; position: relative; align-self: center; cursor: pointer; box-shadow: 0 0 0 1px rgba(240, 196, 120, 0.08); }
.pro-cv { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.pro-bot { grid-row: 3; align-self: start; width: 100%; display: flex; justify-content: center; padding: 14px 16px 0; }
.pro-vmap { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
.pro-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pro:focus { outline: none; }

/* 上面：第幾幕 */
.pro-cap { display: flex; align-items: center; gap: 12px; font-family: 'Noto Serif TC', serif; color: #f0d49a; opacity: 0; letter-spacing: 0.22em; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9); }
.pro-cap.in { animation: pro-cap 1.5s 0.35s ease both; }
@keyframes pro-cap { from { opacity: 0; transform: translateY(8px); letter-spacing: 0.6em; } to { opacity: 1; transform: none; letter-spacing: 0.22em; } }
.pro-cap-n { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(240, 196, 120, 0.55); font-size: 15px; font-weight: 900; letter-spacing: 0; color: #e8b860;
  box-shadow: inset 0 0 10px rgba(240, 180, 80, 0.25); }
.pro-cap b { font-size: clamp(22px, 5.6vw, 34px); font-weight: 900; }
.pro-cap small { align-self: flex-end; margin-bottom: 4px; font-family: system-ui, sans-serif; font-size: 12px; letter-spacing: 0.12em; color: #b8a080; }
.pro-cap::before, .pro-cap::after { content: ''; width: clamp(18px, 8vw, 70px); height: 1px; background: linear-gradient(90deg, transparent, rgba(240, 196, 120, 0.6)); }
.pro-cap::after { background: linear-gradient(90deg, rgba(240, 196, 120, 0.6), transparent); }
.pro-cap:empty { display: none; }

/* 下面：字幕 */
.pro-sub { width: min(760px, 100%); display: flex; gap: 12px; align-items: flex-start; opacity: 0; transition: opacity 0.35s ease; cursor: pointer; }
.pro-sub.on { opacity: 1; }
.pro-sub.nar { justify-content: center; text-align: center; }
.pro-face { flex: none; width: 54px; height: 54px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, rgba(255, 220, 160, 0.22), rgba(255, 236, 200, 0.05));
  border: 1px solid rgba(240, 196, 120, 0.4); }
.pro-face canvas { width: 48px; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }
.pro-subt { min-width: 0; }
.pro-sub:not(.nar) .pro-subt { flex: 1; }
.pro-who { margin-bottom: 2px; font-size: 14px; font-weight: 700; letter-spacing: 0.14em; color: #ffd27a; }
.pro-say { margin: 0; min-height: 3.3em; font-size: clamp(15px, 3.9vw, 20px); line-height: 1.65; letter-spacing: 0.04em; color: #f6ead6; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95); }
.pro-sub.nar .pro-say { color: #ece0c8; }
.pro-sub.typing .pro-say::after { content: '▍'; margin-left: 1px; color: #ffd27a; animation: pro-blink 0.7s steps(1) infinite; }
@keyframes pro-blink { 50% { opacity: 0; } }

/* 黑邊太窄（橫的手機）：字幕、標題疊在畫面上 */
.pro.tight .pro-top { position: absolute; top: max(6px, env(safe-area-inset-top)); left: 0; right: 0; padding: 0 120px 0 16px; }
.pro.tight .pro-cap b { font-size: 20px; }
.pro.tight .pro-bot { position: absolute; left: 0; right: 0; bottom: max(6px, env(safe-area-inset-bottom)); padding: 0 12px; }
.pro.tight .pro-sub { padding: 16px 14px 6px; border-radius: 12px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72) 32%); }
.pro.tight .pro-say { min-height: 0; font-size: 15px; }
.pro.tight .pro-end { gap: 8px; }
.pro.tight .pro-go, .pro.tight .pro-again { min-height: 40px; padding: 8px 20px; }

/* 開頭的一句（很久很久以前） */
.pro-card { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; font-family: 'Noto Serif TC', serif; font-weight: 900; font-size: clamp(24px, 6.4vw, 44px);
  letter-spacing: 0.32em; color: #f0d49a; text-shadow: 0 0 26px rgba(255, 180, 80, 0.45), 0 2px 8px rgba(0, 0, 0, 0.9); pointer-events: none; opacity: 0; }
.pro-card.show { animation: pro-card 4.6s ease both; }
@keyframes pro-card { 0% { opacity: 0; letter-spacing: 0.7em; filter: blur(4px); } 28% { opacity: 1; filter: none; } 78% { opacity: 1; } 100% { opacity: 0; letter-spacing: 0.32em; } }

/* 右上角：聲音、跳過 */
.pro-tools { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); z-index: 3; display: flex; gap: 8px; }
.pro-btn { min-width: 40px; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(240, 196, 120, 0.45); background: rgba(20, 12, 6, 0.62); color: #f6ead6; font-size: 14px; line-height: 1; cursor: pointer; }
.pro-snd { padding: 6px 10px; }
.pro-btn:hover, .pro-btn:focus-visible { outline: none; border-color: #f0c478; background: rgba(66, 40, 16, 0.88); }

/* 畫面角落：惡魔塔的層數、鳴沙戰場的擊倒數 */
.pro-cnt { position: absolute; right: 10px; top: 8px; padding: 4px 12px; border-radius: 999px; background: rgba(10, 6, 2, 0.55); border: 1px solid rgba(240, 196, 120, 0.4);
  font-family: 'Chakra Petch', system-ui, sans-serif; font-weight: 700; font-size: clamp(14px, 3.6vw, 20px); color: #ffe2a0; text-shadow: 0 0 10px rgba(255, 190, 90, 0.6); pointer-events: none; }
.pro-cnt.max { color: #fff; border-color: #ffd27a; box-shadow: 0 0 16px rgba(255, 200, 100, 0.5); }
.pro-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, 40px); font-size: 13px; color: #c8a878; pointer-events: none; }
.pro-hint { position: absolute; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); transform: translateX(-50%); font-size: 12px; color: rgba(246, 234, 214, 0.55); pointer-events: none; opacity: 0;
  animation: pro-hint 7s 5s ease both; }
@keyframes pro-hint { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.pro.tight .pro-hint, .pro.ended .pro-hint { display: none; }

/* 片名 */
.pro-end { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 16px; text-align: center;
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.62) 75%); animation: pro-in 1.4s ease both; }
.pro.ended .pro-sub, .pro.ended .pro-cap { opacity: 0; transition: opacity 0.6s; }
.pro.ended .pro-skip { display: none; }
.pro-logo { display: grid; justify-items: center; gap: 2px; }
.pro-logo-sub { font-family: 'Noto Serif TC', serif; font-weight: 900; font-size: clamp(14px, 3.6vw, 22px); letter-spacing: 0.9em; padding-left: 0.9em; color: #e8c07a; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  animation: pro-up 1.2s 0.2s ease both; }
.pro-logo b { font-family: 'Noto Serif TC', serif; font-weight: 900; font-size: clamp(34px, min(11.5vw, 15vh), 104px); line-height: 1.12; letter-spacing: 0.08em; color: #ffe2a8;
  text-shadow: 0 3px 0 #6a3a12, 0 -1px 0 #6a3a12, 2px 0 0 #6a3a12, -2px 0 0 #6a3a12, 0 0 30px rgba(255, 170, 60, 0.6), 0 10px 24px rgba(0, 0, 0, 0.7); animation: pro-logo 1.8s ease both; }
@keyframes pro-logo { from { opacity: 0; transform: scale(1.12); filter: blur(6px); letter-spacing: 0.3em; } to { opacity: 1; transform: none; filter: none; letter-spacing: 0.08em; } }
@keyframes pro-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pro-tag { margin: 0; font-size: clamp(14px, min(4vw, 4.6vh), 21px); letter-spacing: 0.32em; padding-left: 0.32em; color: #f0d49a; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9); animation: pro-up 1.2s 0.9s ease both; }
.pro-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; animation: pro-up 1s 1.5s ease both; }
.pro-go { min-height: 46px; padding: 10px 28px; font-size: 17px; letter-spacing: 0.12em; }
.pro-again { min-height: 46px; padding: 10px 18px; }
@media (prefers-reduced-motion: reduce) {
  .pro, .pro-cap.in, .pro-end, .pro-logo b, .pro-logo-sub, .pro-tag, .pro-acts { animation-duration: 0.01s; animation-delay: 0s; }
  .pro-card.show { animation-name: pro-card-calm; }
  @keyframes pro-card-calm { 0%, 100% { opacity: 0; } 20%, 80% { opacity: 1; } }
}
