/* =====================================================================
 * フェルマータの放課後 — 画面のスタイル
 * ステージは 1920x1080 固定で組み、ウィンドウに合わせて全体を拡縮する。
 * px 指定はすべてステージ上の寸法。
 * ===================================================================== */
:root {
  --ink: #0d1222;
  --ink2: #171d33;
  --paper: #f4efe6;
  --paper-dim: #c9c2b4;
  --gold: #d8bd84;
  --gold-dim: rgba(216, 189, 132, .45);
  --rose: #e3a3a8;
  --line: rgba(244, 239, 230, .22);
  --win-alpha: .82;
  --chr-h: 1330px;
  --chr-top: 56px;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  --latin: "Cormorant Garamond", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

#viewport { position: fixed; inset: 0; background: #000; overflow: hidden; }
/* 余白（レターボックス）。ステージの縁からにじんだ画素を、上から黒で覆う */
.lb { position: absolute; background: #000; z-index: 10; pointer-events: none; }
#game {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px; overflow: hidden; overflow: clip;   /* clip：フォーカス移動でステージがスクロールしないように */
  transform-origin: 0 0;
  background: #000; color: var(--paper);
  font-family: var(--serif);
  cursor: default;
}

/* ---------- 場面 ---------- */
#scene { position: absolute; inset: 0; isolation: isolate; }   /* 立ち絵の z-index をこの中に閉じ込める */
#game.is-title #scene { isolation: auto; }
#scene.shake { animation: shake var(--shake-ms, 500ms) cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translate(calc(var(--p) * -1px), calc(var(--p) * .5px)); }
  20%, 80% { transform: translate(calc(var(--p) * 2px), calc(var(--p) * -1px)); }
  30%, 50%, 70% { transform: translate(calc(var(--p) * -3px), calc(var(--p) * 1px)); }
  40%, 60% { transform: translate(calc(var(--p) * 3px), calc(var(--p) * -1.5px)); }
}
#bg { position: absolute; inset: 0; background: #000; }
#bg .bgl {
  position: absolute; inset: 0; background: #000 center / cover no-repeat;   /* はみ出させない（縁に生の画像が1列見える原因になる） */
  opacity: 0; transition: opacity var(--t, 900ms) ease;
}
#bg .bgl.on { opacity: 1; }
#bg .bgl::after { content: ""; position: absolute; inset: 0; background: #000; opacity: var(--dim, 0); }
/* 時間帯・回想の色調 */
#tone { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s ease, background 1.2s ease; mix-blend-mode: multiply; }
#tone.night { opacity: 1; background: linear-gradient(#5a6cae, #4a548a); }
#tone.dusk { opacity: .55; background: linear-gradient(#9a5a6a, #4a3a6a); }
#tone.sepia { opacity: .9; background: #c9a77a; mix-blend-mode: color; }
#tone.storm { opacity: 1; background: linear-gradient(#5c6f92, #46566e); }
#scene.t-night #bg, #scene.t-storm #bg { filter: brightness(.86) saturate(.6) contrast(1.05); }
#scene.t-sepia #bg, #scene.t-sepia #chars { filter: sepia(.35) brightness(.95); }
#scene.t-night #chars .chr img, #scene.t-storm #chars .chr img { filter: brightness(.78) saturate(.85) hue-rotate(-8deg); }
/* 嵐用に描かれた背景（*_storm）は背景自体が暗いので、背景には何も被せず、立ち絵だけを場の光に合わせる
   gloom … 嵐の日中（雨の窓明かり）　dark … 嵐の夜 */
#scene.t-gloom #chars .chr img { filter: brightness(.9) saturate(.78) hue-rotate(-6deg); }
#scene.t-dark #chars .chr img { filter: brightness(.7) saturate(.72) hue-rotate(-10deg); }
#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0,0,0,.42) 100%); }
#flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: #fff; }
#weather { position: absolute; inset: 0; pointer-events: none; }
/* イベント絵：立ち絵の上に全面で重ねる */
#cg { position: absolute; inset: 0; pointer-events: none; }
#cg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t, 800ms) ease; }
#cg img.on { opacity: 1; }
#game.is-title #weather { z-index: 4; }   /* タイトルでは桜をロゴの手前に降らせる */

/* ---------- 立ち絵 ---------- */
#chars { position: absolute; inset: 0; overflow: hidden; pointer-events: none; isolation: isolate; transition: opacity var(--cg-t, 800ms) ease; }
/* isolation：話者を手前に出す z-index（.chr.front）を立ち絵どうしの中だけに閉じ込める。
   これがないと、話している立ち絵がイベント絵より手前に出てしまう */
#scene.cg-on #chars { opacity: 0; }   /* イベント絵の表示中は立ち絵を出さない */
.chr {
  /* --k：キャラごとの倍率、--eye：目の高さ（表示上の px）。目の位置を中心に拡縮する */
  position: absolute; top: calc(var(--chr-top) + var(--eye, 0px) * (1 - var(--k, 1))); height: calc(var(--chr-h) * var(--k, 1));
  transform: translateX(-50%);
  transition: left var(--mv, 520ms) cubic-bezier(.3,.7,.3,1), filter .28s ease, opacity var(--ft, 420ms) ease;
  opacity: 0;
  will-change: opacity, left;
}
.chr.in { opacity: 1; }
.chr .body { position: relative; height: 100%; transition: transform var(--ft, 420ms) cubic-bezier(.2,.8,.3,1); transform: translateY(18px); }
.chr.in .body { transform: translateY(0); }
.chr img { position: absolute; left: 50%; top: 0; height: 100%; transform: translateX(-50%); transition: opacity .2s ease; }
.chr img.old { opacity: 0; }
.chr.dim { filter: brightness(.66) saturate(.8); }
.chr.front { z-index: 2; }
.chr.act-jump .body { animation: hop .42s cubic-bezier(.3,.7,.3,1); }
.chr.act-shake .body { animation: chrshake .45s ease; }
.chr.act-nod .body { animation: nod .5s ease; }
.chr.act-sink .body { animation: sink .7s ease; }
@keyframes hop { 0% { transform: translateY(0); } 35% { transform: translateY(-30px); } 70% { transform: translateY(4px); } 100% { transform: translateY(0); } }
@keyframes chrshake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-14px); } 40% { transform: translateX(12px); } 60% { transform: translateX(-8px); } 80% { transform: translateX(5px); } }
@keyframes nod { 0%,100% { transform: translateY(0); } 40% { transform: translateY(12px); } }
@keyframes sink { 0% { transform: translateY(0); } 50% { transform: translateY(26px); } 100% { transform: translateY(14px); } }

/* ---------- メッセージ窓 ---------- */
#msg {
  position: absolute; left: 0; right: 0; bottom: 0; height: 340px;
  transition: opacity .35s ease, transform .35s ease;
}
#msg::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(9,12,24,0) 0, rgba(9,12,24,.6) 14%, rgba(9,12,24,.84) 42%, rgba(9,12,24,.92) 100%);
  opacity: var(--win-alpha);
}
#msg::after {
  content: ""; position: absolute; left: 260px; right: 260px; top: 78px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 12%, var(--line) 88%, transparent);
  opacity: calc(var(--win-alpha) + .1);
}
#namebox { position: absolute; left: 300px; top: 26px; height: 46px; display: flex; align-items: center; gap: 14px; opacity: 0; transition: opacity .2s; }
#namebox.on { opacity: 1; }
#namebox::before { content: ""; width: 11px; height: 11px; transform: rotate(45deg); background: var(--nc, var(--gold)); box-shadow: 0 0 12px var(--nc, var(--gold)); }
#namebox .nm { font-size: 31px; font-weight: 600; letter-spacing: .14em; color: var(--paper); text-shadow: 0 2px 8px rgba(0,0,0,.7); }
#text {
  position: absolute; left: 300px; right: 300px; top: 100px;
  font-size: 33px; line-height: 1.82; letter-spacing: .045em;
  color: var(--paper); text-shadow: 0 1px 3px rgba(0,0,0,.85), 0 0 18px rgba(0,0,0,.35);
  font-feature-settings: "palt" 0;
  word-break: break-all; line-break: strict;
}
#text.think { color: #dfe6f2; }
#text .c, .nvl-body .c { opacity: 0; transition: opacity .16s ease; }
#text .c.on, .nvl-body .c.on { opacity: 1; }
#text ruby rt, .nvl-body ruby rt { font-size: .44em; letter-spacing: .08em; color: var(--paper-dim); }
.cursor {
  display: inline-block; width: 18px; height: 18px; margin-left: 10px; vertical-align: -1px;
  border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold);
  transform: rotate(45deg); opacity: 0;
}
.cursor.on { opacity: 1; animation: cur 1.1s ease-in-out infinite; }
@keyframes cur { 0%,100% { transform: translateY(-6px) rotate(45deg); opacity: .4; } 50% { transform: translateY(2px) rotate(45deg); opacity: 1; } }

#qmenu { position: absolute; right: 70px; bottom: 22px; display: flex; gap: 6px; font-family: var(--latin); }
#qmenu button { font-size: 19px; letter-spacing: .14em; color: rgba(244,239,230,.55); padding: 6px 12px; transition: color .2s; }
#qmenu button:hover { color: var(--paper); }
#qmenu button.on { color: var(--gold); }
#modeind { position: absolute; right: 70px; top: 40px; font-family: var(--latin); font-size: 26px; letter-spacing: .3em; color: var(--gold); opacity: 0; transition: opacity .2s; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
#modeind.on { opacity: 1; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }

#game.hide-ui #msg, #game.hide-ui #choices, #game.hide-ui #modeind, #game.hide-ui #toast { opacity: 0 !important; pointer-events: none; }
#game.no-win #msg { opacity: 0; pointer-events: none; }

/* ---------- 全画面の文章 ---------- */
#nvl { position: absolute; inset: 0; background: rgba(6,8,16,.74); opacity: 0; pointer-events: none; transition: opacity .7s ease; }
#nvl.on { opacity: 1; }
.nvl-body { position: absolute; left: 330px; right: 330px; top: 150px; bottom: 140px; font-size: 34px; line-height: 2.05; letter-spacing: .06em; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
.nvl-body p { margin: 0 0 .35em; text-indent: 1em; }
.nvl-body p.say { text-indent: 0; }
.nvl-body p.blank { height: .9em; }
#game.hide-ui #nvl { opacity: 0; }

/* ---------- 選択肢 ---------- */
#choices { position: absolute; left: 0; right: 0; top: 0; bottom: 300px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 22px; pointer-events: none; }
#choices::before { content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: -300px; background: radial-gradient(ellipse at 50% 42%, rgba(5,7,14,.62), rgba(5,7,14,.38) 70%); opacity: 0; transition: opacity .4s ease; }
#choices.on::before { opacity: 1; }
#choices .prompt { position: relative; font-size: 27px; letter-spacing: .3em; color: var(--gold); margin-bottom: 10px; text-shadow: 0 2px 10px #000; }
#choices button {
  pointer-events: auto; position: relative;
  width: 880px; min-height: 82px; padding: 16px 80px;
  font-size: 31px; letter-spacing: .08em; color: var(--paper);
  background: linear-gradient(90deg, rgba(10,14,28,.55), rgba(10,14,28,.86) 20%, rgba(10,14,28,.86) 80%, rgba(10,14,28,.55));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  opacity: 0; transform: translateY(14px);
  transition: opacity .38s ease, transform .38s ease, background .2s, color .2s, border-color .2s;
}
#choices button.in { opacity: 1; transform: none; }
#choices button::before, #choices button::after {
  content: ""; position: absolute; top: 50%; width: 9px; height: 9px; margin-top: -5px;
  transform: rotate(45deg); background: var(--gold); opacity: 0; transition: opacity .2s, left .25s, right .25s;
}
#choices button::before { left: 44px; } #choices button::after { right: 44px; }
#choices button:hover, #choices button.focus { border-color: var(--gold-dim); color: #fff; background: linear-gradient(90deg, rgba(40,36,30,.6), rgba(46,40,30,.9) 20%, rgba(46,40,30,.9) 80%, rgba(40,36,30,.6)); }
#choices button:hover::before, #choices button:hover::after, #choices button.focus::before, #choices button.focus::after { opacity: 1; }
#choices button.seen { color: var(--paper-dim); }
#choices button.seen .k { opacity: .65; }
#choices button .k { position: absolute; left: 0; right: 0; bottom: 6px; font-size: 15px; letter-spacing: .3em; color: var(--gold); opacity: 0; font-family: var(--sans); }
#choices button.picked { color: var(--gold); border-color: var(--gold); }

/* ---------- 場所・日付 ---------- */
#toast { position: absolute; left: 64px; top: 52px; padding: 6px 0 8px 26px; border-left: 2px solid var(--gold); opacity: 0; transform: translateX(-14px); transition: opacity .6s ease, transform .6s ease; pointer-events: none; text-shadow: 0 2px 8px rgba(0,0,0,.9); }
#toast.on { opacity: 1; transform: none; }
#toast .date { font-family: var(--sans); font-size: 21px; letter-spacing: .2em; color: var(--paper-dim); }
#toast .place { font-size: 33px; letter-spacing: .16em; margin-top: 2px; }
#note { position: absolute; left: 50%; top: 120px; transform: translate(-50%, -10px); padding: 14px 44px; font-size: 26px; letter-spacing: .12em; background: rgba(10,14,28,.82); border-top: 1px solid var(--gold-dim); border-bottom: 1px solid var(--gold-dim); opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none; white-space: nowrap; }
#note.on { opacity: 1; transform: translate(-50%, 0); }
#note::before { content: "✦ "; color: var(--gold); }

/* ---------- 章扉 ---------- */
#chapter { position: absolute; inset: 0; background: #05070d; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .9s ease; }
#chapter.on { opacity: 1; pointer-events: auto; }
#chapter .no { font-family: var(--sans); font-size: 24px; letter-spacing: .6em; color: var(--gold); opacity: 0; transform: translateY(8px); transition: all 1s ease .3s; }
#chapter .ttl { font-size: 64px; letter-spacing: .3em; margin-top: 26px; opacity: 0; transform: translateY(10px); transition: all 1.2s ease .6s; }
#chapter .rule { width: 0; height: 1px; margin-top: 40px; background: linear-gradient(90deg, transparent, var(--gold), transparent); transition: width 1.6s ease .5s; }
#chapter.on .no, #chapter.on .ttl { opacity: 1; transform: none; }
#chapter.on .rule { width: 520px; }

#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity var(--t, 800ms) ease; }
#fade.on { opacity: 1; }
#fade.white { background: #fff; }

/* ---------- タイトル ---------- */
#title { position: absolute; inset: 0; display: none; overflow: hidden; }
#game.is-title #title { display: block; }
#game.is-title #msg, #game.is-title #qmenu { display: none; }
.title-bg { position: absolute; inset: 0; background: center / cover no-repeat; animation: drift 40s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.06) translate(-10px, 0); } to { transform: scale(1.1) translate(14px, -8px); } }
.title-veil { position: absolute; inset: 0; background: linear-gradient(100deg, rgba(8,10,20,.0) 28%, rgba(8,10,20,.62) 62%, rgba(8,10,20,.86)), linear-gradient(to top, rgba(8,10,20,.6), transparent 42%); }
.logo { position: absolute; right: 170px; top: 210px; text-align: center; animation: rise 2.2s ease both .4s; }
.logo .fermata { display: block; width: 104px; margin: 0 auto; filter: drop-shadow(0 0 14px rgba(216,189,132,.5)); }   /* 以前と同じ金色の光 */
.logo h1 { margin: 22px 0 0; font-size: 86px; font-weight: 600; letter-spacing: .2em; text-shadow: 0 4px 30px rgba(0,0,0,.6); writing-mode: horizontal-tb; }
.logo .en { margin: 18px 0 0; font-family: var(--latin); font-style: italic; font-size: 34px; letter-spacing: .32em; color: var(--paper-dim); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.title-menu { position: absolute; right: 310px; top: 560px; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: rise 1.6s ease both 1.4s; }
.title-menu button { position: relative; font-size: 34px; letter-spacing: .4em; padding: 8px 10px 8px 24px; color: rgba(244,239,230,.82); text-shadow: 0 2px 12px rgba(0,0,0,.8); transition: color .25s, letter-spacing .25s; }
.title-menu button:hover { color: #fff; letter-spacing: .48em; }
.title-menu button::before { content: ""; position: absolute; left: -26px; top: 50%; width: 8px; height: 8px; margin-top: -4px; transform: rotate(45deg); background: var(--gold); opacity: 0; transition: opacity .25s; }
.title-menu button:hover::before { opacity: 1; }
.title-menu button:disabled { opacity: .3; pointer-events: none; }
.title-foot { position: absolute; left: 60px; bottom: 40px; font-family: var(--latin); font-size: 20px; letter-spacing: .2em; color: rgba(244,239,230,.5); }

/* ---------- スプラッシュ ---------- */
#splash { position: absolute; inset: 0; background: #05070d; display: grid; place-items: center; cursor: pointer; transition: opacity 1s ease; z-index: 50; }
#splash.out { opacity: 0; pointer-events: none; }
#splash .splash-inner { text-align: center; }
#splash .fermata { display: block; width: 84px; margin: 0 auto; opacity: .8; }
#splash .go { font-family: var(--latin); font-size: 30px; letter-spacing: .6em; margin: 28px 0 0 .6em; animation: blink 2.2s ease-in-out infinite; }
#splash .sub { font-family: var(--sans); font-size: 19px; letter-spacing: .3em; color: var(--paper-dim); margin-top: 18px; }

/* ---------- モーダル共通 ---------- */
#modal { position: absolute; inset: 0; display: none; z-index: 40; }
#modal.on { display: block; }
.panel { position: absolute; inset: 0; background: rgba(7,9,18,.93); backdrop-filter: blur(6px); animation: fadein .25s ease; display: flex; flex-direction: column; }
@keyframes fadein { from { opacity: 0; } }
.panel-head { height: 150px; display: flex; align-items: flex-end; padding: 0 120px 22px; border-bottom: 1px solid var(--line); gap: 40px; }
.panel-head h2 { margin: 0; font-family: var(--latin); font-weight: 500; font-size: 58px; letter-spacing: .24em; color: var(--paper); line-height: 1; }
.panel-head h2 small { display: block; font-family: var(--sans); font-size: 18px; letter-spacing: .4em; color: var(--gold); margin-bottom: 12px; }
.panel-head .tabs { display: flex; gap: 6px; margin-left: auto; margin-right: 150px; }
.tabs button { font-family: var(--sans); font-size: 21px; letter-spacing: .14em; padding: 10px 22px; color: var(--paper-dim); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--paper); border-color: var(--gold); }
.panel-body { flex: 1; overflow: hidden; position: relative; }
.panel-close { position: absolute; right: 60px; top: 46px; font-family: var(--latin); font-size: 24px; letter-spacing: .3em; color: var(--paper-dim); padding: 10px 16px; }
.panel-close:hover { color: var(--paper); }
.scroll { overflow-y: auto; height: 100%; scrollbar-width: thin; scrollbar-color: var(--gold-dim) transparent; }
.scroll::-webkit-scrollbar { width: 8px; } .scroll::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }

/* セーブ・ロード */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px 40px; padding: 50px 120px; }
.slot { position: relative; display: flex; flex-direction: column; text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,.025); transition: border-color .2s, background .2s; }
.slot:hover { border-color: var(--gold-dim); background: rgba(255,255,255,.06); }
.slot .thumb { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: #111 center / cover no-repeat; }
.slot .thumb .mini { position: absolute; top: 0; height: 100%; transform: translateX(-50%); }
.slot .thumb .mini img { height: 100%; }
.slot .thumb.empty { display: grid; place-items: center; font-family: var(--latin); font-size: 26px; letter-spacing: .4em; color: rgba(244,239,230,.25); background: repeating-linear-gradient(135deg, rgba(255,255,255,.02) 0 12px, transparent 12px 24px); }
.slot .meta { padding: 14px 18px 16px; min-height: 108px; }
.slot .meta .row { display: flex; justify-content: space-between; font-family: var(--sans); font-size: 17px; letter-spacing: .08em; color: var(--paper-dim); }
.slot .meta .no { color: var(--gold); font-family: var(--latin); font-size: 22px; letter-spacing: .2em; }
.slot .meta .tx { margin-top: 8px; font-size: 19px; line-height: 1.55; color: var(--paper); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.slot .del { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; background: rgba(0,0,0,.6); color: var(--paper-dim); font-size: 18px; opacity: 0; transition: opacity .2s; }
.slot:hover .del { opacity: 1; }
.slot.new-mark { animation: savedflash 1s ease; }
@keyframes savedflash { 30% { border-color: var(--gold); background: rgba(216,189,132,.18); } }

/* バックログ */
.log { padding: 40px 260px 120px; }
.log .ent { position: relative; display: grid; grid-template-columns: 200px 1fr 60px; gap: 24px; padding: 18px 0; border-bottom: 1px solid rgba(244,239,230,.08); }
.log .ent .who { font-size: 24px; letter-spacing: .1em; text-align: right; color: var(--nc, var(--paper-dim)); }
.log .ent .tx { font-size: 26px; line-height: 1.7; letter-spacing: .04em; white-space: pre-wrap; }
.log .ent .back { font-family: var(--sans); font-size: 15px; color: var(--paper-dim); opacity: 0; border: 1px solid var(--line); height: 34px; align-self: center; transition: opacity .2s; }
.log .ent:hover .back { opacity: 1; }
.log .ent .back:hover { color: var(--gold); border-color: var(--gold); }
.log .ent.choice .tx { color: var(--gold); }
.log .empty { text-align: center; color: var(--paper-dim); margin-top: 120px; font-size: 24px; letter-spacing: .2em; }

/* 設定 */
.cfg { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 120px; padding: 70px 200px; }
.cfg .item { display: grid; grid-template-columns: 240px 1fr 80px; align-items: center; gap: 24px; padding: 18px 0; border-bottom: 1px solid rgba(244,239,230,.08); }
.cfg .item label { font-size: 25px; letter-spacing: .12em; }
.cfg .item .val { font-family: var(--latin); font-size: 24px; color: var(--gold); text-align: right; }
.cfg input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 2px; background: var(--line); outline: none; }
.cfg input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; transform: rotate(45deg); background: var(--gold); cursor: pointer; border: 0; }
.cfg input[type=range]::-moz-range-thumb { width: 18px; height: 18px; background: var(--gold); border: 0; border-radius: 0; transform: rotate(45deg); cursor: pointer; }
.cfg .seg { display: flex; gap: 10px; }
.cfg .seg button { font-family: var(--sans); font-size: 19px; padding: 8px 18px; border: 1px solid var(--line); color: var(--paper-dim); letter-spacing: .1em; }
.cfg .seg button.on { border-color: var(--gold); color: var(--paper); background: rgba(216,189,132,.12); }
.cfg .sample { grid-column: 1 / -1; margin-top: 20px; padding: 26px 40px; border: 1px solid var(--line); font-size: 30px; letter-spacing: .05em; min-height: 120px; line-height: 1.8; }
.cfg .danger { grid-column: 1 / -1; text-align: right; }
.cfg .danger button { font-family: var(--sans); font-size: 17px; color: #d08a8a; border: 1px solid rgba(208,138,138,.4); padding: 8px 20px; letter-spacing: .1em; }

/* メニュー */
.gmenu { position: absolute; inset: 0; background: rgba(7,9,18,.7); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: flex-end; animation: fadein .2s; }
.gmenu nav { width: 560px; height: 100%; background: linear-gradient(90deg, rgba(10,13,26,.0), rgba(10,13,26,.95) 30%); display: flex; flex-direction: column; justify-content: center; align-items: flex-end; padding-right: 130px; gap: 14px; }
.gmenu nav .cur { font-family: var(--sans); font-size: 18px; letter-spacing: .2em; color: var(--paper-dim); margin-bottom: 30px; text-align: right; line-height: 1.8; }
.gmenu nav button { font-size: 34px; letter-spacing: .32em; color: rgba(244,239,230,.82); padding: 8px 0; transition: color .2s; }
.gmenu nav button:hover { color: var(--gold); }

/* 確認・名前入力 */
.dialog { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); z-index: 60; animation: fadein .2s; }
.dialog .box { min-width: 760px; padding: 54px 70px 44px; background: var(--ink); border-top: 1px solid var(--gold-dim); border-bottom: 1px solid var(--gold-dim); text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.dialog .box p { margin: 0 0 36px; font-size: 29px; letter-spacing: .08em; line-height: 1.7; }
.dialog .box .btns { display: flex; justify-content: center; gap: 30px; }
.dialog .box .btns button { min-width: 220px; padding: 14px 30px; font-size: 25px; letter-spacing: .3em; border: 1px solid var(--line); }
.dialog .box .btns button:hover, .dialog .box .btns button.primary { border-color: var(--gold); color: #fff; }
.dialog .box .btns button.primary { background: rgba(216,189,132,.14); }
.dialog .namefield { display: flex; align-items: baseline; justify-content: center; gap: 18px; margin-bottom: 40px; }
.dialog .namefield span { font-size: 40px; letter-spacing: .1em; color: var(--paper-dim); }
.dialog input { font: inherit; font-size: 40px; letter-spacing: .1em; width: 300px; padding: 8px 12px; background: transparent; border: 0; border-bottom: 1px solid var(--gold); color: var(--paper); text-align: center; outline: none; -webkit-user-select: text; user-select: text; }

/* エクストラ */
.endings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; padding: 60px 140px; }
.ending { position: relative; padding: 40px 40px 36px; border: 1px solid var(--line); min-height: 240px; background: rgba(255,255,255,.02); }
.ending .no { font-family: var(--latin); font-size: 22px; letter-spacing: .4em; color: var(--gold); }
.ending h3 { margin: 18px 0 16px; font-size: 38px; font-weight: 600; letter-spacing: .18em; }
.ending p { margin: 0; font-size: 21px; line-height: 1.7; color: var(--paper-dim); }
.ending.lock h3 { color: rgba(244,239,230,.25); }
.ending.lock .no { color: rgba(216,189,132,.35); }
.ending .seal { position: absolute; right: 26px; top: 26px; width: 52px; opacity: .8; }
.ending .seal img { display: block; width: 100%; }
.comp { position: absolute; right: 140px; bottom: 50px; font-family: var(--latin); font-size: 26px; letter-spacing: .3em; color: var(--paper-dim); }
.people { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; height: 100%; }
.person { position: relative; overflow: hidden; border-right: 1px solid rgba(244,239,230,.07); background: linear-gradient(#f2ece2, #e3dccf); color: #2a2a35; }
.person .fig { position: absolute; left: 50%; top: 16px; height: 74%; transform: translateX(-50%); mix-blend-mode: multiply; }
.person .info { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 32px 34px; background: linear-gradient(to top, rgba(242,236,226,1) 60%, rgba(242,236,226,0)); }
.person .info .kana { font-family: var(--sans); font-size: 15px; letter-spacing: .3em; color: #7b766c; }
.person .info h3 { margin: 4px 0 2px; font-size: 38px; letter-spacing: .14em; font-weight: 600; }
.person .info .g { font-family: var(--sans); font-size: 16px; letter-spacing: .1em; color: var(--accent, #8a7650); margin-bottom: 12px; }
.person .info p { margin: 0; font-size: 18px; line-height: 1.65; }
.person.lock { background: #12162a; color: var(--paper-dim); }
.person.lock .fig { filter: brightness(0); opacity: .35; mix-blend-mode: normal; }
.person.lock .info { background: linear-gradient(to top, #12162a 60%, rgba(18,22,42,0)); }
.music { display: grid; grid-template-columns: 1fr 1fr; gap: 0 80px; padding: 50px 180px; }
.track { display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: 18px; padding: 16px 10px; border-bottom: 1px solid rgba(244,239,230,.08); text-align: left; transition: background .2s; }
.track:hover { background: rgba(255,255,255,.04); }
.track .n { font-family: var(--latin); font-size: 22px; color: var(--gold); }
.track .tt { font-size: 26px; letter-spacing: .1em; }
.track .fn { font-family: var(--latin); font-size: 18px; color: var(--paper-dim); letter-spacing: .1em; }
.track.lock .tt { color: rgba(244,239,230,.25); }
.track.playing .tt { color: var(--gold); }
.track.playing .n::after { content: " ♪"; }

/* エンディング表示 */
#endcard { position: absolute; inset: 0; z-index: 45; background: #05070d; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity 1.6s ease; }
#endcard.on { opacity: 1; }
#endcard .kind { font-family: var(--latin); font-size: 28px; letter-spacing: .7em; color: var(--gold); }
#endcard h2 { margin: 30px 0 0; font-size: 76px; letter-spacing: .3em; font-weight: 600; }
#endcard .rule { width: 520px; height: 1px; margin: 50px 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
#endcard .thanks { font-family: var(--latin); font-style: italic; font-size: 30px; letter-spacing: .3em; color: var(--paper-dim); }
#endcard .credit { margin-top: 40px; font-family: var(--sans); font-size: 18px; letter-spacing: .25em; color: rgba(244,239,230,.45); line-height: 2; text-align: center; }
#endcard .back { margin-top: 60px; font-family: var(--latin); font-size: 22px; letter-spacing: .4em; color: var(--paper-dim); opacity: 0; transition: opacity 1s; }
#endcard.ready .back { opacity: 1; animation: blink 2.2s ease-in-out infinite; }

/* CG鑑賞 */
.cgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; padding: 50px 140px 120px; }
.cgcell { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--line); background: rgba(255,255,255,.03); overflow: hidden; transition: border-color .2s; }
.cgcell:hover { border-color: var(--gold-dim); }
.cgcell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cgcell span { position: absolute; left: 50%; top: 42%; width: 64px; transform: translate(-50%, -50%); opacity: .25; }
.cgcell span img { position: static; width: 100%; height: auto; }
.cgcell em { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px; font-style: normal; font-size: 20px; letter-spacing: .12em; text-align: left; background: linear-gradient(transparent, rgba(5,7,14,.85)); display: flex; justify-content: space-between; align-items: baseline; }
.cgcell em small { font-family: var(--latin); font-size: 17px; color: var(--gold); }
.cgcell.lock em { color: rgba(244,239,230,.3); }
.cgcell.lock { cursor: default; }
.cgview { position: absolute; inset: 0; background: #000; z-index: 2; cursor: pointer; animation: fadein .3s; }
.cgview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cgview .cap { position: absolute; left: 50px; bottom: 36px; font-size: 22px; letter-spacing: .18em; color: rgba(244,239,230,.7); text-shadow: 0 2px 8px #000; }
