/* M1 段一 · 天裂开 — 样式。黑底刻白；字是主角。 */
:root {
  --bg: #0f0f0f;
  --ink: #f5f1e8;
  --ink-dim: rgba(245, 241, 232, 0.62);
  --ink-faint: rgba(245, 241, 232, 0.38);
  --serif: "Noto Serif CJK TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --refrain-glow: 0;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); height: 100%; }
body { font-family: var(--sans); color: var(--ink); overflow: hidden; }

#stage { position: fixed; inset: 0; background: var(--bg); overflow: hidden; }
#plate-holder { position: absolute; inset: 0; }
#plate-holder svg { display: block; width: 100%; height: 100%; filter: brightness(calc(1 + var(--refrain-glow) * 0.08)); }
#veil { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 900ms ease; pointer-events: none; }
#veil.dim { opacity: 0.72; }
#veil.dark { opacity: 0.88; }
#glow { position: absolute; inset: 0; pointer-events: none; opacity: calc(var(--refrain-glow) * 0.55);
  background: radial-gradient(ellipse 60% 45% at 78% 50%, rgba(245, 241, 232, 0.20), transparent 70%); }

.layer { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 8vw; }
.hidden { display: none !important; }

/* 经文屏：满版大字，中英上下 */
#scripture-zh { font-family: var(--serif); font-size: clamp(30px, 5.4vw, 68px); line-height: 1.35; margin: 0 0 0.5em; font-weight: 600; }
#scripture-en { font-family: var(--serif); font-size: clamp(17px, 2.2vw, 26px); line-height: 1.5; margin: 0; color: var(--ink-dim); font-style: italic; }
#scripture-cite { font-size: clamp(13px, 1.4vw, 16px); color: var(--ink-faint); margin: 1.6em 0 0; letter-spacing: 0.12em; }
#scripture strong { font-weight: 800; }

/* 字幕：底部安全区，距底 10%；中文在上，英文在下 */
#subtitle { inset: auto 0 10% 0; padding: 0 10vw; }
#subtitle-zh { font-family: var(--serif); font-size: clamp(19px, 2.6vw, 30px); line-height: 1.5; margin: 0 0 0.35em; }
#subtitle-en { font-size: clamp(14px, 1.7vw, 19px); line-height: 1.5; margin: 0; color: var(--ink-dim); }
#subtitle-note { font-size: clamp(12px, 1.3vw, 15px); color: var(--ink-faint); margin: 0.9em 0 0; letter-spacing: 0.08em; }
#subtitle strong { font-weight: 700; }

/* 收藏：经文屏右下角，小而不抢 */
#collect { position: absolute; right: 5vw; bottom: 6vh; background: transparent; border: 1px solid var(--ink-faint); color: var(--ink-dim);
  font-family: var(--sans); font-size: 14px; letter-spacing: 0.2em; padding: 0.55em 1.1em; border-radius: 999px; cursor: pointer; }
#collect.kept { border-color: var(--ink); color: var(--ink); }
#collect:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* 看门人标记（E19）：031 之后一直有效 */
#doorkeeper { position: absolute; right: 18px; bottom: 16px; display: flex; align-items: center; gap: 6px;
  color: var(--ink-faint); font-size: 12px; letter-spacing: 0.25em; opacity: 0.85; pointer-events: none; }

/* 叠句触发提示（E8）：极淡的呼吸圆，不写字 */
#refrain-hint { position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px;
  border: 1px solid rgba(245, 241, 232, 0.35); border-radius: 50%; animation: breathe 3.2s ease-in-out infinite; pointer-events: none; }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.35; } 50% { transform: scale(1.12); opacity: 0.7; } }

/* 停留闸门的呼吸（不显示时间，只显示还活着） */
#stage.dwelling #glow { animation: breathe 6s ease-in-out infinite; }

/* 模式切换：右上角，小 */
#mode-toggle { position: absolute; top: 14px; right: 16px; display: flex; gap: 6px; }
#mode-toggle button { background: rgba(15, 15, 15, 0.45); border: 1px solid var(--ink-faint); color: var(--ink-dim);
  font-size: 12px; letter-spacing: 0.2em; padding: 0.4em 0.9em; border-radius: 999px; cursor: pointer; }
/* 亮底（001 灯焰特写、叠句留白）上仍可读，故按钮带半透明深底 */
#mode-toggle button.active { border-color: var(--ink); color: var(--ink); }

/* 入场与终卡 */
#entry, #endcard { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 8vw; background: rgba(15, 15, 15, 0.82); }
#entry h1, #endcard h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(40px, 8vw, 84px); margin: 0 0 0.2em; letter-spacing: 0.08em; }
.entry-sub { font-size: clamp(16px, 2.2vw, 22px); color: var(--ink-dim); margin: 0.2em 0; letter-spacing: 0.3em; }
.entry-sub-en { font-family: var(--serif); font-style: italic; color: var(--ink-faint); margin: 0.2em 0 1.6em; }
.entry-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.entry-actions button { background: transparent; border: 1px solid var(--ink); color: var(--ink); font-size: 16px;
  letter-spacing: 0.18em; padding: 0.8em 1.6em; border-radius: 999px; cursor: pointer; font-family: var(--sans); }
.entry-note { color: var(--ink-faint); font-size: 13px; margin-top: 2em; letter-spacing: 0.06em; }
#kept-count { color: var(--ink-dim); }

/* 静态版（无 JS）：可 13:31 版 */
#static-version { position: absolute; inset: 0; overflow: auto; padding: 8vh 10vw; background: var(--bg); }
#static-version h1 { font-family: var(--serif); font-size: 28px; }
#static-version li { margin: 0.9em 0; line-height: 1.7; font-family: var(--serif); }

@media (max-width: 560px) {
  #subtitle { bottom: 8%; padding: 0 6vw; }
  #collect { right: 4vw; bottom: 4vh; font-size: 12px; }
  #scripture { padding: 0 6vw; }
}
@media (prefers-reduced-motion: reduce) {
  #refrain-hint, #stage.dwelling #glow { animation: none; }
  #veil { transition: none; }
}
