/* ═══════════════════════════════════════════════════════════════
   翠星戰記 · 角色設定畫集 — artbook.css
   3D 翻頁書：封面／書名頁／目錄／設定圖跨頁／封底
   翻頁動畫由 artbook.js 以 rAF 驅動；此檔負責一切靜態質感。
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* 一頁為正方形；跨頁 = 2 × page。扣掉頂列與控制列高度 */
  --page: min(42vw, calc(100dvh - 225px), 600px);
  --ink: #38301f;
  --ink-soft: #5d5138;
  --parchment: #f2ebd8;
  --parchment-deep: #e6dcc0;
  --gold: #b99a55;
  --gold-bright: #e9d391;
  --emerald: #1e4d3e;
  --emerald-deep: #0d2a21;
  --vermilion: #a33b2e;
  --night: #0b0d12;
  --chrome-ink: #d8cfae;
  --shift: 0px; /* JS 控制單頁模式的位移 */
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: "Noto Serif TC", "Songti TC", "PingFang TC", serif;
  background: var(--night);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ───────────────────────── 場景 ───────────────────────── */

.scene {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(90% 60% at 50% 30%, rgba(46, 93, 75, 0.32), transparent 65%),
    radial-gradient(120% 90% at 50% 110%, rgba(185, 154, 85, 0.10), transparent 55%),
    linear-gradient(rgba(7, 9, 14, 0.90), rgba(7, 9, 14, 0.96)),
    url("../assets/title/title-bg.webp") center / cover;
}

.scene::after { /* 暗角 */
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: radial-gradient(115% 100% at 50% 46%, transparent 55%, rgba(0, 0, 0, 0.55));
}

/* 浮塵 */
.dust { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.dust span {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 226, 180, 0.5), rgba(240, 226, 180, 0) 68%);
  animation: dust-float linear infinite;
}
@keyframes dust-float {
  0%   { transform: translate3d(0, 12vh, 0);   opacity: 0; }
  12%  { opacity: var(--dust-o, 0.5); }
  88%  { opacity: var(--dust-o, 0.5); }
  100% { transform: translate3d(var(--dust-x, 4vw), -108vh, 0); opacity: 0; }
}

/* ───────────────────────── 書體結構 ───────────────────────── */

.book-stage {
  position: relative;
  z-index: 1;
  flex-shrink: 0; /* 單頁模式下 stage 寬過 viewport，靠 shift 置中當前頁，唔可以被 flex 壓縮 */
  width: calc(var(--page) * 2);
  height: var(--page);
  margin-bottom: 26px; /* 讓出控制列視覺重量 */
  perspective: calc(var(--page) * 4.4);
  perspective-origin: 50% 42%;
}

.book-tilt {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.35s ease-out;
}

.book {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: translateX(var(--shift));
  transition: transform 0.55s cubic-bezier(0.4, 0.7, 0.3, 1);
  animation: book-enter 1.1s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
.book-pages {
  position: absolute;
  inset: 0;
}
@keyframes book-enter {
  from { opacity: 0; transform: translateY(34px) translateX(var(--shift)); }
  to   { opacity: 1; transform: translateY(0)    translateX(var(--shift)); }
}

/* 書底投影 */
.book-shadow {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: -7%;
  height: 12%;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.62), transparent 72%);
  filter: blur(6px);
  transform: translateZ(-60px);
}

/* 紙疊厚度 —— 右側（未翻）與左側（已翻），用生成的書脊紙邊材質 */
.book::before,
.book::after {
  position: absolute;
  top: 1.1%;
  bottom: 1.1%;
  width: calc(var(--stack, 0) * 1.15px);
  content: "";
  border-radius: 0 4px 4px 0;
  background:
    linear-gradient(90deg, rgba(60, 44, 16, 0.42), rgba(60, 44, 16, 0) 55%, rgba(60, 44, 16, 0.25)),
    url("../assets/artbook/pageedge-side.webp") 50% / 100% 100%;
  box-shadow: 2px 2px 7px rgba(0, 0, 0, 0.38);
  transition: width 0.45s ease;
}
.book::before { /* 右紙疊 */
  left: 100%;
  --stack: var(--stackR, 14);
}
.book::after { /* 左紙疊 */
  right: 100%;
  --stack: var(--stackL, 0);
  border-radius: 4px 0 0 4px;
  background:
    linear-gradient(-90deg, rgba(60, 44, 16, 0.42), rgba(60, 44, 16, 0) 55%, rgba(60, 44, 16, 0.25)),
    url("../assets/artbook/pageedge-side.webp") 50% / 100% 100%;
  box-shadow: -2px 2px 7px rgba(0, 0, 0, 0.38);
}

/* 書底紙邊（跨頁兩側各一，書脊處留缺口） */
.book-edge {
  position: absolute;
  top: calc(100% - 3px);
  height: 10px;
  background:
    linear-gradient(rgba(60, 44, 16, 0.10), rgba(60, 44, 16, 0.34)),
    url("../assets/artbook/pageedge-bottom.webp") 50% / 100% 100%;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);
  transform: translateZ(-6px);
  transition: opacity 0.45s ease;
}
.book-edge.bl { left: 1%; width: 48.1%; }
.book-edge.br { right: 1%; width: 48.1%; }
.book-stage[data-start] .book-edge.bl,
.book-stage[data-end] .book-edge.br { opacity: 0; }

/* ───────────────────────── 書頁 ───────────────────────── */

.sheet {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
}

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background:
    radial-gradient(130% 105% at 50% 0%, rgba(255, 252, 238, 0.42), rgba(255, 252, 238, 0) 52%),
    radial-gradient(120% 100% at 50% 108%, rgba(112, 88, 44, 0.20), rgba(112, 88, 44, 0) 42%),
    url("../assets/artbook/parchment.webp") 50% / cover;
  box-shadow: inset 0 0 42px rgba(120, 96, 50, 0.16);
}

.page.front { border-radius: 3px 9px 7px 2px; }
.page.back {
  border-radius: 9px 3px 2px 7px;
  transform: rotateY(180deg);
}

/* 書脊溝槽＋紙張微彎的光脊（右頁脊在左、左頁脊在右） */
.page::before {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  content: "";
}
.page.front::before {
  background: linear-gradient(90deg,
    rgba(70, 54, 26, 0.32), rgba(70, 54, 26, 0.11) 5.5%,
    rgba(255, 251, 235, 0.15) 10%, transparent 19%,
    transparent 93%, rgba(70, 54, 26, 0.07) 97.5%, rgba(70, 54, 26, 0.17));
}
.page.back::before {
  background: linear-gradient(-90deg,
    rgba(70, 54, 26, 0.32), rgba(70, 54, 26, 0.11) 5.5%,
    rgba(255, 251, 235, 0.15) 10%, transparent 19%,
    transparent 93%, rgba(70, 54, 26, 0.07) 97.5%, rgba(70, 54, 26, 0.17));
}

/* 翻頁動態陰影（JS 控制透明度） */
.shade {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
}
.front > .shade { background: linear-gradient(90deg, rgba(24, 16, 6, 0.85), rgba(24, 16, 6, 0.35) 55%, rgba(24, 16, 6, 0.55)); }
.back  > .shade { background: linear-gradient(-90deg, rgba(24, 16, 6, 0.85), rgba(24, 16, 6, 0.35) 55%, rgba(24, 16, 6, 0.55)); }

/* ───────────────────────── 封面／封底（精裝皮革） ───────────────────────── */

.cover, .back-cover {
  inset: -1.6% -1.9%;           /* 封面比內頁略大 —— 精裝書殼 */
  border-radius: 4px 10px 10px 4px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(233, 211, 145, 0.14), transparent 46%),
    radial-gradient(130% 110% at 50% 115%, rgba(0, 0, 0, 0.42), transparent 52%),
    linear-gradient(105deg, rgba(0, 0, 0, 0.30), rgba(0, 0, 0, 0) 22%, rgba(255, 244, 200, 0.05) 48%, rgba(0, 0, 0, 0.22) 96%),
    url("../assets/artbook/leather.webp") 50% / cover;
  box-shadow:
    inset 0 2px 2px rgba(255, 244, 200, 0.16),
    inset 0 -3px 8px rgba(0, 0, 0, 0.45),
    0 10px 30px rgba(0, 0, 0, 0.5);
}
.back-cover { border-radius: 10px 4px 4px 10px; }

/* 封面左緣的書脊棱線 */
.cover::after {
  position: absolute;
  top: 0; bottom: 0; left: 4.5%;
  width: 2.5%;
  content: "";
  border-left: 1px solid rgba(233, 211, 145, 0.22);
  border-right: 1px solid rgba(0, 0, 0, 0.4);
  background: linear-gradient(90deg, rgba(0,0,0,0.30), rgba(255,255,255,0.05) 55%, rgba(0,0,0,0.22));
}

.cover-leather {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-frame {
  position: relative;
  width: 78%;
  height: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid rgba(233, 211, 145, 0.72);
  border-radius: 2px;
  outline: 1px solid rgba(233, 211, 145, 0.3);
  outline-offset: 5px;
  background: radial-gradient(115% 100% at 50% 46%, rgba(6, 18, 13, 0.34), rgba(6, 18, 13, 0.12) 62%, rgba(6, 18, 13, 0));
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.cover-crest {
  width: 17%;
  margin-bottom: 4.5%;
  fill: none;
  stroke: var(--gold-bright);
  stroke-width: 2.6;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
}
.cover-crest path { fill: rgba(233, 211, 145, 0.12); }
.cover-crest circle { fill: var(--gold-bright); stroke: none; }

.cover-kicker {
  margin: 0 0 2%;
  max-width: 92%;
  color: rgba(233, 211, 145, 0.75);
  font-family: "Cormorant Garamond", serif;
  font-size: calc(var(--page) * 0.0165);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  white-space: nowrap;
}

.cover-title {
  margin: 0;
  font-size: calc(var(--page) * 0.118);
  font-weight: 900;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  line-height: 1.1;
  background: linear-gradient(172deg, #f8ecc0 8%, #d9b96a 38%, #96762f 62%, #ecd794 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.65));
}

.cover-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 56%;
  margin: 5% 0 4%;
  color: rgba(233, 211, 145, 0.8);
  font-size: calc(var(--page) * 0.02);
}
.cover-divider span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(233, 211, 145, 0.7), transparent); }

.cover-sub {
  margin: 0;
  color: #e8dcb4;
  font-size: calc(var(--page) * 0.045);
  font-weight: 700;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
}
.cover-latin {
  margin: 2.2% 0 0;
  color: rgba(233, 211, 145, 0.6);
  font-family: "Cormorant Garamond", serif;
  font-size: calc(var(--page) * 0.019);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
}

/* 封面流光 */
.cover-frame::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(115deg, transparent 42%, rgba(255, 246, 210, 0.14) 50%, transparent 58%);
  background-size: 260% 100%;
  animation: foil-sweep 7s ease-in-out infinite;
}
@keyframes foil-sweep {
  0%, 55% { background-position: 130% 0; }
  85%, 100% { background-position: -60% 0; }
}

.cover-open-hint {
  position: absolute;
  bottom: 5.5%;
  left: 0; right: 0;
  margin: 0;
  color: rgba(240, 226, 175, 0.85);
  font-size: calc(var(--page) * 0.021);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.6);
  animation: hint-breathe 2.6s ease-in-out infinite;
}
@keyframes hint-breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* 封底 */
.bc-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.bc-crest {
  width: 15%;
  margin-bottom: 6%;
  fill: none;
  stroke: rgba(233, 211, 145, 0.7);
  stroke-width: 3;
  stroke-linejoin: round;
}
.bc-crest path { fill: rgba(233, 211, 145, 0.10); }
.bc-title {
  margin: 0 0 2%;
  color: rgba(233, 211, 145, 0.9);
  font-size: calc(var(--page) * 0.052);
  font-weight: 900;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}
.bc-fine {
  margin: 0 0 12%;
  color: rgba(233, 211, 145, 0.6);
  font-size: calc(var(--page) * 0.022);
  letter-spacing: 0.22em;
}
.bc-colophon {
  margin: 0;
  color: rgba(233, 211, 145, 0.42);
  font-size: calc(var(--page) * 0.018);
  letter-spacing: 0.14em;
}

/* ───────────────────────── 書名頁 ───────────────────────── */

.tp-inner {
  position: absolute;
  inset: 9% 12%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.tp-kicker {
  margin: 0;
  color: var(--ink-soft);
  font-size: calc(var(--page) * 0.024);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
}
.tp-rule {
  width: 34%;
  height: 1px;
  margin: 5% 0;
  background: linear-gradient(90deg, transparent, #a78d4f, transparent);
}
.tp-title {
  margin: 0;
  color: var(--ink);
  font-size: calc(var(--page) * 0.085);
  font-weight: 900;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
}
.tp-sub {
  margin: 3% 0 0;
  color: var(--ink-soft);
  font-size: calc(var(--page) * 0.03);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
}
.tp-preface {
  margin: 0;
  color: var(--ink-soft);
  font-size: calc(var(--page) * 0.0245);
  line-height: 2.15;
}
.tp-colophon {
  margin: 0;
  color: #8a7a54;
  font-size: calc(var(--page) * 0.0205);
  line-height: 1.9;
  letter-spacing: 0.18em;
}

/* ───────────────────────── 目錄頁 ───────────────────────── */

.ct-inner {
  position: absolute;
  inset: 6.5% 8.5%;
  display: flex;
  flex-direction: column;
}
.ct-head { text-align: center; }
.ct-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: calc(var(--page) * 0.05);
  font-weight: 900;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
}
.ct-latin {
  margin: 1% 0 0;
  color: var(--ink-soft);
  font-family: "Cormorant Garamond", serif;
  font-size: calc(var(--page) * 0.02);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
}
.ct-head::after {
  display: block;
  width: 42%;
  height: 1px;
  margin: 3.5% auto 0;
  content: "";
  background: linear-gradient(90deg, transparent, #a78d4f, transparent);
}
.ct-section {
  margin: 4% 0 2.5%;
  color: var(--emerald);
  font-size: calc(var(--page) * 0.024);
  font-weight: 900;
  letter-spacing: 0.3em;
}
.ct-section span {
  color: #93814f;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.ct-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4% 2.6%;
}
.ct-group + .ct-group { margin-top: 3.5%; }
.ct-group--enemy { margin-top: 1.5%; }
.ct-group--enemy .ct-section {
  margin-top: 2%;
  margin-bottom: 1.2%;
}
.ct-group--enemy .ct-grid {
  width: 88%;
  margin-inline: auto;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2% 1.8%;
}
.ct-group--enemy .ct-item { gap: 3px; }
.ct-group--enemy .ct-item .ct-plate {
  font-size: calc(var(--page) * 0.0155);
  line-height: 1.2;
}
.ct-group--enemy .ct-item .ct-plate em {
  font-size: 0.8em;
}

.ct-item {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  font: inherit;
  cursor: pointer;
  background: none;
}
.ct-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: top;
  border: 1px solid #b39b62;
  outline: 1px solid rgba(120, 96, 50, 0.35);
  outline-offset: 2px;
  box-shadow: 0 3px 8px rgba(60, 44, 16, 0.3);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.ct-item:hover img, .ct-item:focus-visible img {
  transform: translateY(-3px);
  box-shadow: 0 7px 14px rgba(60, 44, 16, 0.42);
}
.ct-item .ct-plate {
  color: var(--ink);
  font-size: calc(var(--page) * 0.0185);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.05em;
  text-align: center;
}
.ct-item .ct-plate em {
  font-style: normal;
  color: #8a7a54;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.88em;
  letter-spacing: 0.08em;
}
.ct-item.dark img { border-color: #6d4a72; outline-color: rgba(109, 74, 114, 0.5); }
.ct-item.dark .ct-plate, .ct-item.dark .ct-plate em { color: #4a2d4e; }

.ct-note {
  margin: auto 0 0;
  padding-top: 3%;
  color: #93814f;
  font-size: calc(var(--page) * 0.0185);
  letter-spacing: 0.1em;
  text-align: center;
}

/* ───────────────────────── 圖版頁（設定圖全版） ───────────────────────── */

.page.art { background: #efe9d6; }
.page.art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* ───────────────────────── 角色檔案頁 ───────────────────────── */

.dossier { font-size: calc(var(--page) * 0.026); }

.ds-inner {
  position: absolute;
  inset: 6% 8% 7%;
  display: flex;
  flex-direction: column;
  font-size: inherit;
}

.ds-head { text-align: center; }
.ds-fileno {
  margin: 0 0 1.2%;
  color: #93814f;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
}
.ds-name {
  margin: 0;
  color: var(--ink);
  font-size: 1.62em;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1.05;
}
.ds-latin {
  display: block;
  color: #8a7440;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.46em;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
}
.ds-epithet {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  margin: 1.6% 0 0;
  padding: 0.12em 0.85em;
  border-top: 1px solid rgba(120, 96, 50, 0.5);
  border-bottom: 1px solid rgba(120, 96, 50, 0.5);
  color: var(--emerald);
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.22em;
}
.ds-epithet-latin {
  color: #93814f;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.18em;
}

/* 頭像＋資料欄 */
.ds-profile {
  display: flex;
  align-items: center;
  gap: 5%;
  margin-top: 4.2%;
  padding: 3.2% 4%;
  border: 1px solid rgba(120, 96, 50, 0.4);
  background:
    linear-gradient(rgba(255, 252, 238, 0.5), rgba(255, 252, 238, 0.18)),
    repeating-linear-gradient(0deg, rgba(120, 96, 50, 0.045) 0 1px, transparent 1px 4px);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.55), 0 2px 6px rgba(60, 44, 16, 0.12);
}
.ds-portrait {
  flex: 0 0 22%;
  margin: 0;
  border: 2px solid #a5854a;
  outline: 1px solid rgba(120, 96, 50, 0.45);
  outline-offset: 3px;
  background: radial-gradient(circle at 50% 34%, #28443c, #14231f 78%);
  box-shadow: 0 3px 8px rgba(60, 44, 16, 0.35);
}
.ds-portrait img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  /* 唔好用 pixelated —— 頭像係平滑插畫，nearest-neighbor 縮放會起格 */
}
.ds-portrait--concept {
  overflow: hidden;
  background: #1c1621;
}
.ds-portrait--concept img {
  transform: scale(1.55);
  transform-origin: var(--concept-position, 50% 34%);
}
.ds-fields {
  flex: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.42em;
}
.ds-fields > div {
  display: flex;
  align-items: baseline;
  gap: 0.8em;
  border-bottom: 1px dotted rgba(120, 96, 50, 0.45);
  padding-bottom: 0.3em;
}
.ds-fields dt {
  flex: 0 0 auto;
  color: #93814f;
  font-size: 0.66em;
  font-weight: 900;
  letter-spacing: 0.28em;
}
.ds-fields dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.86em;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.ds-desc {
  margin: 4% 0 0;
  color: #4a4030;
  font-size: 0.84em;
  line-height: 1.95;
  text-align: justify;
}

.ds-quote {
  position: relative;
  margin: auto 0 0;
  padding: 2.6% 8% 2.6% 12%;
  color: #37455c;
  font-size: 0.85em;
  line-height: 1.85;
  background: linear-gradient(90deg, rgba(120, 96, 50, 0.10), rgba(120, 96, 50, 0.02));
  border-left: 3px solid var(--gold);
}
.ds-quote::before {
  position: absolute;
  left: 3.5%;
  top: 4%;
  content: "「";
  color: rgba(120, 96, 50, 0.4);
  font-size: 2.2em;
  font-weight: 900;
  line-height: 1;
}
.ds-quote::after {
  position: absolute;
  right: 2.5%;
  bottom: -0.28em;
  content: "」";
  color: rgba(120, 96, 50, 0.4);
  font-size: 1.6em;
  font-weight: 900;
  line-height: 1;
}

.ds-traits {
  display: flex;
  gap: 4%;
  margin-top: 3.6%;
}
.ds-col { flex: 1; }
.ds-col h3 {
  margin: 0 0 0.5em;
  color: #93814f;
  font-size: 0.62em;
  font-weight: 900;
  letter-spacing: 0.34em;
}
.ds-col span {
  display: inline-block;
  margin: 0 0.35em 0.35em 0;
  padding: 0.18em 0.62em;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(46, 93, 75, 0.55);
  color: #20503f;
  background: rgba(46, 93, 75, 0.08);
}
.ds-col.bad span {
  border-color: rgba(163, 59, 46, 0.5);
  color: #8d3327;
  background: rgba(163, 59, 46, 0.07);
}

.ds-folio {
  margin-top: auto;
  padding-top: 3%;
  color: #93814f;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-align: center;
}

/* 莫爾甘檔案 —— 黑卷變體 */
.dossier.villain {
  background:
    radial-gradient(130% 105% at 50% 0%, rgba(86, 60, 100, 0.30), rgba(86, 60, 100, 0) 50%),
    linear-gradient(rgba(43, 30, 51, 0.90), rgba(27, 18, 34, 0.94)),
    url("../assets/artbook/parchment.webp") 50% / cover;
}
.dossier.villain .ds-name { color: #e6d7ef; }
.dossier.villain .ds-latin { color: #a98fc0; }
.dossier.villain .ds-fileno { color: #9a7fae; }
.dossier.villain .ds-epithet {
  border-color: rgba(169, 143, 192, 0.5);
  color: #c9a9e0;
}
.dossier.villain .ds-epithet-latin { color: #9a7fae; }
.dossier.villain .ds-profile {
  border-color: rgba(169, 143, 192, 0.4);
  background: linear-gradient(rgba(22, 14, 28, 0.4), rgba(22, 14, 28, 0.2)),
    repeating-linear-gradient(0deg, rgba(169, 143, 192, 0.06) 0 1px, transparent 1px 4px);
}
.dossier.villain .ds-fields dt { color: #9a7fae; }
.dossier.villain .ds-fields dd { color: #e2d3ec; }
.dossier.villain .ds-fields > div { border-bottom-color: rgba(169, 143, 192, 0.35); }
.dossier.villain .ds-desc { color: #c3b3cf; }
.dossier.villain .ds-quote {
  color: #d9c6e6;
  background: linear-gradient(90deg, rgba(169, 143, 192, 0.14), rgba(169, 143, 192, 0.03));
  border-left-color: #7d5a94;
}
.dossier.villain .ds-quote::before, .dossier.villain .ds-quote::after { color: rgba(169, 143, 192, 0.45); }
.dossier.villain .ds-col h3 { color: #9a7fae; }
.dossier.villain .ds-col span {
  border-color: rgba(169, 143, 192, 0.55);
  color: #cfb2e2;
  background: rgba(125, 90, 148, 0.16);
}
.dossier.villain .ds-col.bad span {
  border-color: rgba(212, 120, 105, 0.5);
  color: #e2a496;
  background: rgba(163, 59, 46, 0.14);
}
.dossier.villain .ds-folio { color: #9a7fae; }
.dossier.villain .ds-portrait { border-color: #7d5a94; background: radial-gradient(circle at 50% 34%, #2c1e33, #140d1a 78%); }

.ds-stamp {
  position: absolute;
  top: 3%;
  right: 4%;
  z-index: 2;
  width: 3.4em;
  height: 3.4em;
  display: grid;
  place-items: center;
  border: 3px double rgba(196, 60, 44, 0.85);
  border-radius: 50%;
  color: rgba(196, 60, 44, 0.9);
  font-size: 0.9em;
  font-weight: 900;
  letter-spacing: 0.12em;
  transform: rotate(14deg);
  mix-blend-mode: screen;
  opacity: 0.85;
}

/* ───────────────────────── 翻頁熱區與頁角 ───────────────────────── */

.hotzone {
  position: absolute;
  top: 6%;
  bottom: 10%;
  width: 11%;
  z-index: 5;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: transparent;
  opacity: 0;
  transition: opacity 0.3s;
}
.hotzone.left  { left: 0; }
.hotzone.right { right: 0; }
.book-stage[data-start] .hotzone,
.book-stage[data-end] .hotzone { display: none; }

/* 頁角微捲提示 */
.page-curl {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 4;
  width: 54px;
  height: 54px;
  pointer-events: none;
  background: linear-gradient(315deg, var(--night) 47%, #d9cda9 49%, #f7f1df 52%, #c8ba90 100%);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  opacity: 0;
  transform: scale(0.4);
  transform-origin: bottom right;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.book-stage[data-open] .page-curl { opacity: 0.9; transform: scale(1); }
.hotzone.right:hover ~ .page-curl,
.book-stage[data-open] .page-curl:hover { transform: scale(1.7); opacity: 1; }

/* ───────────────────────── 介面框架（頂列／控制列） ───────────────────────── */

.chrome-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  pointer-events: none;
}
.chrome-top > * { pointer-events: auto; }

.chrome-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid rgba(216, 207, 174, 0.3);
  border-radius: 4px;
  color: var(--chrome-ink);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-decoration: none;
  background: rgba(8, 10, 15, 0.6);
  backdrop-filter: blur(6px);
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.chrome-chip:hover {
  border-color: rgba(233, 211, 145, 0.75);
  color: #f2e6bb;
  background: rgba(20, 26, 20, 0.75);
}

.chrome-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(216, 207, 174, 0.22);
  border-radius: 6px;
  background: rgba(8, 10, 15, 0.6);
  backdrop-filter: blur(6px);
}
.chrome-tabs a {
  padding: 7px 14px;
  border-radius: 4px;
  color: #93a092;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: color 0.18s, background 0.18s;
}
.chrome-tabs a:hover { color: #f2e6bb; background: rgba(216, 207, 174, 0.12); }
.chrome-tabs a[aria-current="page"] {
  color: #141c10;
  background: linear-gradient(#e6d391, #bfa154);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5);
}

.chrome-bottom {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(216, 207, 174, 0.24);
  border-radius: 999px;
  background: rgba(8, 10, 15, 0.66);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
}

.nav-btn, .tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(216, 207, 174, 0.3);
  color: var(--chrome-ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  background: rgba(216, 207, 174, 0.06);
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.18s;
}
.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.tool-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
}
.tool-btn.icon-only { width: 40px; padding: 0; }
.nav-btn:hover:not(:disabled), .tool-btn:hover {
  border-color: rgba(233, 211, 145, 0.8);
  color: #f2e6bb;
  background: rgba(216, 207, 174, 0.16);
}
.nav-btn:active:not(:disabled) { transform: scale(0.92); }
.nav-btn:disabled { opacity: 0.28; cursor: default; }

.nav-status { width: 168px; text-align: center; }
.nav-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  margin: 0 0 5px;
  color: #e8dcb4;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
}
.nav-label-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-label-page {
  flex: 0 0 auto;
}
.nav-progress {
  height: 3px;
  border-radius: 2px;
  background: rgba(216, 207, 174, 0.18);
  overflow: hidden;
}
.nav-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #8fa98a, #e6d391);
  transition: width 0.45s ease;
}

/* 喇叭圖示開關 */
#btn-sound .spk-off { display: none; }
#btn-sound[aria-pressed="false"] .spk-on { display: none; }
#btn-sound[aria-pressed="false"] .spk-off { display: inline; }
#btn-sound[aria-pressed="false"] { opacity: 0.55; }

/* ───────────────────────── 單頁模式（窄屏） ───────────────────────── */

@media (max-width: 860px) {
  :root { --page: min(96vw, calc(100dvh - 232px)); }
  .book-stage { margin-bottom: 12px; }
  .nav-status { width: 128px; }
  .tool-btn span { display: none; }
  .tool-btn { width: 40px; padding: 0; }
  .chrome-tabs a { padding: 7px 9px; font-size: 11.5px; }
  /* stage 闊過 viewport 並置中，當前頁永遠喺 stage 嘅 [25%, 75%]；
     熱區同頁角要對返 viewport 邊緣，唔係 stage 邊緣 */
  .hotzone { width: 13vw; }
  .hotzone.left  { left: 24%; }
  .hotzone.right { right: 24%; }
  .page-curl { right: 25%; }
}

@media (max-width: 480px) {
  .chrome-tabs { display: none; }   /* 手機只留返回鍵，保持沉浸 */
  .nav-status { width: 104px; }
  .nav-label { font-size: 11px; }
}

/* ───────────────────────── 動態減弱 ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .book { animation: none; }
  .cover-frame::after, .cover-open-hint, .dust span { animation: none; }
  .dust { display: none; }
  .book, .book::before, .book::after, .page-curl, .nav-progress-fill { transition: none; }
}
