@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;700&display=swap');

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

:root {
  --bg-dark: #09060e;
  --bg-dark-half: rgba(18, 13, 26, 0.75);
  --accent-gold: #d4a359;
  --accent-gold-glow: rgba(212, 163, 89, 0.4);
  --text-white: rgba(255, 255, 255, 0.92);
  --text-dim: rgba(255, 255, 255, 0.55);
  --border-gold: rgba(212, 163, 89, 0.2);
  --border-gold-active: rgba(212, 163, 89, 0.6);
  --font-serif: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-white);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* ── 背景演出レイヤー ── */
#game-bg-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

#game-bg {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.8s ease-in-out, transform 8s ease-out, filter 0.8s ease;
}

/* 背景フィルターエフェクト */
#game-bg.filter-blur  { filter: blur(6px) brightness(0.7); }
#game-bg.filter-dark  { filter: brightness(0.45); }
#game-bg.filter-warm  { filter: brightness(1.1) sepia(0.35) saturate(1.2); }
#game-bg.filter-cold  { filter: brightness(0.9) hue-rotate(200deg) saturate(0.7); }

#game-bg.zoom {
  transform: scale(1.05);
}

#game-bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(9, 6, 14, 0.4) 0%,
    rgba(9, 6, 14, 0.2) 60%,
    rgba(9, 6, 14, 0.85) 100%
  );
  pointer-events: none;
}

/* ── パーティクル演出 ── */
#particle-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.particle {
  position: absolute;
  background: radial-gradient(circle, rgba(212, 163, 89, 0.6) 0%, rgba(212, 163, 89, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-10vh) scale(1.2);
    opacity: 0;
  }
}

/* ── ゲーム画面のレイアウト ── */
#game-root {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ── ヘッダー ── */
#game-header {
  padding: 16px 24px;
  background: linear-gradient(to bottom, rgba(9, 6, 14, 0.8) 0%, rgba(9, 6, 14, 0) 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

#game-header-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

#hub-link {
  color: var(--text-dim);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.3s;
}

#hub-link:hover {
  color: var(--accent-gold);
}

#game-title-label {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
  text-shadow: 0 0 8px var(--accent-gold-glow);
}

#controls {
  display: flex;
  gap: 8px;
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-white);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.05em;
}

.ctrl-btn:hover {
  background: var(--accent-gold-glow);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.ctrl-btn.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-dark);
}

/* ── キャラクターステージ ── */
#character-stage {
  position: absolute;
  inset: 0;
  /* inset の bottom を上書きしてテキストウィンドウ上端まで縮める */
  bottom: 27%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
  z-index: 3;
}

#char-center-wrap {
  width: min(380px, 42vw);
  height: 90%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

#char-center-wrap.show {
  opacity: 1;
  transform: translateY(0);
}

/* キャラクター位置バリアント */
#char-center-wrap.pos-left {
  transform: translateY(20px) translateX(-28%);
}
#char-center-wrap.show.pos-left {
  transform: translateY(0) translateX(-28%);
}
#char-center-wrap.pos-right {
  transform: translateY(20px) translateX(28%);
}
#char-center-wrap.show.pos-right {
  transform: translateY(0) translateX(28%);
}

/* キャラクターアニメーション */
@keyframes charShake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-6px); }
  30%       { transform: translateX(6px); }
  45%       { transform: translateX(-4px); }
  60%       { transform: translateX(4px); }
  75%       { transform: translateX(-2px); }
  90%       { transform: translateX(2px); }
}

@keyframes charBounce {
  0%, 100% { transform: translateY(0); }
  30%       { transform: translateY(-14px); }
  55%       { transform: translateY(-6px); }
  75%       { transform: translateY(-10px); }
  90%       { transform: translateY(-3px); }
}

@keyframes charPulse {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(0,0,0,0.6)); }
  50%       { filter: drop-shadow(0 0 30px rgba(212,163,89,0.5)); }
}

@keyframes charSlideInLeft {
  from { transform: translateX(-120%) translateY(0); opacity: 0; }
  to   { transform: translateX(-28%) translateY(0); opacity: 1; }
}

@keyframes charSlideInRight {
  from { transform: translateX(120%) translateY(0); opacity: 0; }
  to   { transform: translateX(28%) translateY(0); opacity: 1; }
}

#char-center-wrap.anim-shake  { animation: charShake 0.55s ease; }
#char-center-wrap.anim-bounce { animation: charBounce 0.7s ease; }
#char-center-wrap.anim-pulse  { animation: charPulse 2s ease-in-out infinite; }

.char-img {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: bottom center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 15px rgba(0,0,0,0.6));

  /* 四辺の白い余白だけをフェード（キャラクター本体は中央にいるため影響しない） */
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0%, black 6%, black 94%, transparent 100%),
    linear-gradient(to right,  transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent 0%, black 6%, black 94%, transparent 100%),
    linear-gradient(to right,  transparent 0%, black 5%, black 95%, transparent 100%);
  mask-composite: intersect;
}

/* ── 章インジケーター ── */
#chapter-indicator {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: rgba(212, 163, 89, 0.5);
  font-family: var(--font-serif);
  min-width: 60px;
  text-align: center;
  user-select: none;
}

/* ── 選択肢オーバーレイ ── */
#choice-overlay {
  position: absolute;
  inset: 0;
  bottom: 0;
  z-index: 25;
  background: rgba(9, 6, 14, 0.25);
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 6%;
  pointer-events: auto;
}

/* display:none からのトランジションは信頼できないため、表示切替は display のみで制御 */
#choice-overlay.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

#choice-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 90%;
  max-width: 500px;
}

.choice-btn {
  background: rgba(18, 13, 26, 0.85);
  border: 1px solid var(--border-gold);
  color: var(--text-white);
  padding: 18px 24px;
  border-radius: 12px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.6;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  text-align: left;
}

.choice-btn:hover {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, rgba(28, 20, 41, 0.9) 0%, rgba(18, 13, 26, 0.95) 100%);
  transform: translateY(-2px);
  box-shadow: 0 0 15px var(--accent-gold-glow), 0 6px 24px rgba(0, 0, 0, 0.4);
}

/* ── テキストウィンドウ ── */
#text-window {
  position: relative;
  z-index: 20;
  margin: 0 auto 32px;
  width: 92%;
  max-width: 800px;
  min-height: 160px;
  max-height: 38vh;
  background: var(--bg-dark-half);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 24px 32px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -4px 30px rgba(0,0,0,0.5), inset 0 0 20px rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.3s;
  overflow: hidden;
}

#text-window:hover {
  border-color: var(--border-gold-active);
}

#speaker-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  min-height: 24px;
}

#text-content {
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: 0.08em;
  color: var(--text-white);
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.3) transparent;
}

#next-indicator {
  align-self: flex-end;
  font-size: 11px;
  color: var(--accent-gold);
  animation: bounce 1.2s infinite;
  opacity: 0.8;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(4px);
  }
}

/* ── シナリオ選択 / タイトル画面 ── */
#scenario-select {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: radial-gradient(ellipse at center, #1a0a2e 0%, #09060e 70%);
  transition: opacity 0.8s ease-out;
  overflow-y: auto;
}

#scenario-select.fade-out {
  opacity: 0;
  pointer-events: none;
}

#ss-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 680px;
  padding: 48px 24px;
  margin: auto;
}

#ss-logo {
  text-align: center;
}

#ss-deco {
  display: block;
  font-size: 36px;
  color: var(--accent-gold);
  margin-bottom: 16px;
  animation: pulseDeco 3s ease-in-out infinite;
}

@keyframes pulseDeco {
  0%, 100% { opacity: 0.5; text-shadow: none; }
  50% { opacity: 1; text-shadow: 0 0 20px var(--accent-gold-glow); }
}

#ss-game-title {
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  text-shadow: 0 0 24px rgba(212, 163, 89, 0.45), 0 0 60px rgba(212, 163, 89, 0.15);
  margin-bottom: 10px;
}

#ss-tagline {
  font-size: 13px;
  letter-spacing: 0.35em;
  color: rgba(255, 255, 255, 0.45);
}

#ss-divider {
  width: 70%;
  max-width: 380px;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(212, 163, 89, 0.45), transparent);
}

#ss-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.ss-card {
  background: rgba(18, 13, 26, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 22px 28px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: inherit;
  font-family: var(--font-serif);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.ss-card:hover {
  border-color: var(--border-gold-active);
  background: rgba(28, 18, 44, 0.95);
  transform: translateY(-3px);
  box-shadow: 0 0 20px var(--accent-gold-glow), 0 8px 28px rgba(0, 0, 0, 0.45);
}

.ss-card-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

.ss-card-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.58);
  line-height: 1.7;
}

.ss-start-btn {
  background: rgba(18, 13, 26, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 28px 32px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-family: var(--font-serif);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  width: 100%;
}

.ss-start-btn:hover {
  border-color: var(--border-gold-active);
  background: rgba(32, 20, 52, 0.95);
  transform: translateY(-3px);
  box-shadow: 0 0 24px var(--accent-gold-glow), 0 10px 32px rgba(0, 0, 0, 0.5);
}

.ss-start-scenario-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
}

.ss-start-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.7;
  max-width: 440px;
}

.ss-start-cta {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.7);
}

#ss-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 2;
}

.ss-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.05em;
}

/* ── 1シナリオ用：情報カード（非クリック）── */
.ss-info-card {
  background: rgba(18, 13, 26, 0.6);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 22px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ss-info-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-gold);
}

.ss-info-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.52);
  line-height: 1.7;
}

/* ── あらすじカード ── */
.ss-synopsis-card {
  background: rgba(12, 8, 22, 0.55);
  border: 1px solid rgba(212, 163, 89, 0.15);
  border-radius: 12px;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ss-synopsis-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.62);
  line-height: 2;
  letter-spacing: 0.04em;
}

/* ── 登場人物カード ── */
.ss-character-card {
  background: rgba(12, 8, 22, 0.55);
  border: 1px solid rgba(212, 163, 89, 0.15);
  border-radius: 12px;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ss-char-section-label {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  opacity: 0.7;
  text-transform: uppercase;
}

.ss-setting-row {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ss-setting-icon {
  color: var(--accent-gold);
  opacity: 0.5;
  font-size: 10px;
}

.ss-char-profile {
  display: flex;
  flex-direction: row;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid rgba(212, 163, 89, 0.1);
  align-items: flex-start;
}

.ss-char-portrait {
  flex-shrink: 0;
  width: 110px;
  height: 200px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(212, 163, 89, 0.18);
  background: rgba(0, 0, 0, 0.3);
  cursor: zoom-in;
}

.ss-char-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  -webkit-touch-callout: none;
  display: block;
}

.ss-char-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.ss-char-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.ss-char-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.88);
}

.ss-char-role {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  opacity: 0.75;
}

.ss-char-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.52);
  line-height: 1.85;
  letter-spacing: 0.03em;
}

/* ── 画像ライトボックス ── */
#ss-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.88);
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
  animation: lbFadeIn 0.2s ease;
}

#ss-lightbox.open {
  display: flex;
}

#ss-lightbox-img {
  max-width: min(90vw, 600px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(212, 163, 89, 0.3);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── ゴールカード ── */
.ss-goal-card {
  background: rgba(12, 8, 22, 0.55);
  border: 1px solid rgba(212, 163, 89, 0.15);
  border-radius: 12px;
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ss-goal-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.62);
  line-height: 2;
  margin: 0;
}

/* ── セーブあり表示バッジ ── */
.ss-resume-badge {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* ── 標準ボタン（プライマリ / セカンダリ）── */
.ss-btn {
  width: 100%;
  padding: 20px 32px;
  border-radius: 12px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ss-btn-primary {
  background: linear-gradient(135deg, rgba(212, 163, 89, 0.22) 0%, rgba(212, 163, 89, 0.08) 100%);
  border: 1.5px solid var(--accent-gold);
  color: var(--accent-gold);
}

.ss-btn-primary:hover {
  background: linear-gradient(135deg, rgba(212, 163, 89, 0.38) 0%, rgba(212, 163, 89, 0.18) 100%);
  box-shadow: 0 0 28px var(--accent-gold-glow), 0 8px 28px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.ss-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-dim);
}

.ss-btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.32);
  color: var(--text-white);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ── シーンCG（フルスクリーンイラスト） ── */
#scene-cg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 5; /* character-stage(z:3) より前、text-window(z:20) より後 */
}
#scene-cg.cg-show {
  opacity: 1;
}

/* ── スマホ向けレスポンシブ ── */
@media (max-width: 600px) {
  #chapter-indicator { font-size: 9px; letter-spacing: 0.1em; }
  #text-window {
    margin: 0 auto 16px;
    padding: 16px 20px;
    min-height: 120px;
    max-height: 40vh;
  }
  #text-content {
    font-size: 14px;
  }
  .choice-btn {
    padding: 14px 20px;
    font-size: 13px;
  }

  /* モバイル：立ち絵を上部に配置 */
  .ss-char-profile {
    flex-direction: column;
    align-items: center;
  }
  .ss-char-portrait {
    width: 120px;
    height: 200px;
  }
  .ss-char-info {
    width: 100%;
    align-items: center;
    text-align: center;
  }
  .ss-char-header {
    justify-content: center;
  }
}

/* ── 小説ログオーバーレイ ── */
#novel-log-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

#novel-log-overlay.hidden {
  display: none !important;
}

#novel-log-panel {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#novel-log-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid #e0d8c8;
  background: #fdfcf9;
  flex-shrink: 0;
}

#novel-log-scenario-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #332211;
}

#novel-log-controls {
  display: flex;
  gap: 8px;
}

#novel-log-overlay .ctrl-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #332211;
}

#novel-log-overlay .ctrl-btn:hover {
  background: rgba(212, 163, 89, 0.15);
  border-color: #8f6d3b;
  color: #8f6d3b;
}

/* vertical-rl ではコンテンツが右から始まるため direction:rtl でスクロール先頭=右端に */
#novel-log-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 48px 56px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

#novel-log-content {
  direction: ltr;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  height: calc(100vh - 130px);
  max-height: 72vh;
  font-size: 16px;
  line-height: 2.5;
  letter-spacing: 0.1em;
  color: #111111;
  font-family: var(--font-serif);
  column-gap: 56px;
}

.novel-chapter-break {
  display: block;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: #8f6d3b;
  opacity: 0.85;
  margin-block: 2.5em 1em;
  writing-mode: vertical-rl;
}

.novel-scene-speaker {
  display: inline-block;
  font-size: 12px;
  color: #8f6d3b;
  margin-block-end: 0.3em;
}

.novel-scene-text {
  display: block;
  margin-block-end: 1.6em;
}

/* ── エンディング評価オーバーレイ ── */
#eval-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: radial-gradient(ellipse at center, #120828 0%, #06040c 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
}

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

#eval-panel {
  width: 90%;
  max-width: 600px;
  padding: 52px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: evalFadeIn 1s ease-out;
}

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

#eval-ending-label {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--accent-gold);
  opacity: 0.65;
}

#eval-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  text-shadow: 0 0 20px var(--accent-gold-glow);
}

#eval-body {
  font-size: 14px;
  line-height: 2.2;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.82);
  text-align: justify;
  border-top: 1px solid var(--border-gold);
  border-bottom: 1px solid var(--border-gold);
  padding: 26px 0;
}

#eval-axes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.eval-axis {
  background: rgba(18, 13, 26, 0.6);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eval-axis-name {
  font-size: 9px;
  letter-spacing: 0.35em;
  color: var(--accent-gold);
  opacity: 0.7;
}

.eval-axis-text {
  font-size: 12px;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.68);
}

#eval-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 600px) {
  #eval-axes { grid-template-columns: 1fr; }
  #eval-panel { padding: 36px 24px; }
  #novel-log-scroll { padding: 32px 28px; }
  #novel-log-content { font-size: 14px; line-height: 2.2; }
}

/* ── オープニング演出（画像フェードアウト） ── */
#op-overlay {
  position: fixed;
  inset: 0;
  background-color: #09060e;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 1.8s cubic-bezier(0.25, 1, 0.5, 1), visibility 1.8s;
  pointer-events: auto;
}

#op-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#op-poster {
  width: 100%;
  height: 100%;
  background-image: url('../assets/images/op_poster.webp');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 1.5s ease-out, transform 1.8s cubic-bezier(0.25, 1, 0.5, 1);
}

#op-overlay.active #op-poster {
  opacity: 1;
  transform: scale(1);
}

/* ── ギャラリーオーバーレイ ── */
#gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: radial-gradient(ellipse at center, #1a0a2e 0%, #09060e 100%);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

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

#gallery-panel {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

#gallery-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#gallery-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  text-shadow: 0 0 16px var(--accent-gold-glow);
}

#gallery-count {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  flex: 1;
  text-align: center;
}

#gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.gallery-slot {
  background: rgba(18, 13, 26, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 20px 18px;
  text-align: left;
  font-family: var(--font-serif);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  min-height: 88px;
  color: inherit;
}

.gallery-slot.unlocked:hover {
  border-color: var(--border-gold-active);
  background: rgba(28, 18, 44, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 0 16px var(--accent-gold-glow), 0 6px 20px rgba(0, 0, 0, 0.4);
}

.gallery-slot.locked {
  opacity: 0.32;
  cursor: not-allowed;
  background: rgba(9, 6, 14, 0.5);
  border-style: dashed;
  justify-content: center;
  align-items: center;
}

.gallery-slot-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

.gallery-slot-date {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.gallery-slot-locked {
  font-size: 18px;
  letter-spacing: 0.5em;
  color: rgba(255, 255, 255, 0.12);
}

/* ギャラリーボタン（タイトル画面） */
.ss-gallery-btn {
  background: transparent;
  border: 1px solid rgba(212, 163, 89, 0.18);
  border-radius: 10px;
  padding: 14px 24px;
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.18em;
  color: rgba(212, 163, 89, 0.45);
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
}

.ss-gallery-btn:hover {
  border-color: var(--border-gold-active);
  color: var(--accent-gold);
  background: rgba(212, 163, 89, 0.06);
}

/* ── ギャラリーセクションラベル ── */
.gallery-section-label {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  opacity: 0.65;
  text-align: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-gold);
  padding-bottom: 12px;
}

/* ── 立ち絵コレクション ── */
#gallery-char-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gallery-char-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.gallery-char-slot {
  background: rgba(18, 13, 26, 0.6);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  aspect-ratio: 1 / 1.8;
  transition: all 0.25s ease;
}

.gallery-char-slot:hover {
  border-color: var(--border-gold-active);
  transform: translateY(-2px);
  box-shadow: 0 0 12px var(--accent-gold-glow);
}

.gallery-char-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  pointer-events: none;
}

@media (max-width: 600px) {
  #gallery-grid {
    grid-template-columns: 1fr;
  }
  .gallery-char-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
