:root {
  --ink: #f4ecdc;
  --ink-dim: #c9bda4;
  --gold: #d8b46a;
  --gold-hi: #f6dc9c;
  --gold-dk: #8c6a2c;
  --wine: #6b1d35;
  --wine-dk: #36101d;
  --navy: #10142a;
  --navy-2: #1a2142;
  --teal: #7fd0d6;
  --mem: #9fe3ff;
  --serif: 'Shippori Mincho B1', 'Yu Mincho', serif;
  --sans: 'Zen Kaku Gothic New', 'Yu Gothic', sans-serif;
  --latin: 'Cormorant Garamond', serif;
  --fs: 1;
  --win-alpha: 0.82;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05060c; overflow: hidden; }
body { font-family: var(--serif); color: var(--ink); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; color: inherit; }

#viewport { position: fixed; inset: 0; display: grid; place-items: center; }
.stage {
  position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; overflow: hidden;
  transform-origin: center center; background: #000;
  box-shadow: 0 0 60px rgba(0,0,0,.8);
}
.layer { position: absolute; inset: 0; }
.hidden { display: none !important; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; color: var(--gold); font-family: var(--latin); font-size: 28px; letter-spacing: .2em; background: #05060c; z-index: 100; transition: opacity .6s; }
.boot.done { opacity: 0; pointer-events: none; }

/* ---- 背景・立ち絵・CG ---- */
#layer-bg .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
#layer-bg .bg.on { opacity: 1; }
#layer-bg.night .bg { filter: brightness(.72) saturate(.85); }
#layer-bg { z-index: 0; }
#layer-chars { pointer-events: none; z-index: 1; }
#layer-cg { z-index: 2; }
#layer-fx { z-index: 3; }
.char {
  position: absolute; bottom: -40px; height: 112%; transform: translateX(-50%);
  transition: left .45s cubic-bezier(.2,.8,.2,1), opacity .35s ease, filter .3s ease;
  opacity: 0; filter: drop-shadow(0 6px 18px rgba(0,0,0,.45));
}
.char.on { opacity: 1; }
.char img { height: 100%; display: block; }
.char.dim { filter: brightness(.62) saturate(.8) drop-shadow(0 6px 18px rgba(0,0,0,.45)); }
.char.bob { animation: bob .35s ease; }
@keyframes bob { 0%{ transform: translateX(-50%) translateY(0);} 40%{ transform: translateX(-50%) translateY(-10px);} 100%{ transform: translateX(-50%) translateY(0);} }
#layer-cg { opacity: 0; transition: opacity .9s ease; pointer-events: none; }
#layer-cg.on { opacity: 1; }
#layer-cg img { width: 100%; height: 100%; object-fit: cover; }
#layer-fx { pointer-events: none; }
.fx-flash { position: absolute; inset: 0; background: #fff; animation: flash .5s ease forwards; }
.fx-blood { position: absolute; inset: 0; background: radial-gradient(circle, transparent 30%, rgba(120,0,20,.75)); animation: flash 1.4s ease forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.fx-black { position: absolute; inset: 0; background: #000; transition: opacity .8s ease; }
.stage.shake { animation: shake .45s linear; }
@keyframes shake { 0%,100%{transform:translate(0,0) scale(var(--scale,1));} 20%{transform:translate(-10px,4px) scale(var(--scale,1));} 40%{transform:translate(8px,-6px) scale(var(--scale,1));} 60%{transform:translate(-6px,2px) scale(var(--scale,1));} 80%{transform:translate(4px,-2px) scale(var(--scale,1));} }
.fx-leap { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(160,230,255,.0) 0%, rgba(120,200,255,.35) 40%, rgba(10,14,40,1) 75%); animation: leap 2.4s ease forwards; mix-blend-mode: normal; }
.fx-leap .ring { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; border: 2px solid rgba(190,240,255,.9); border-radius: 50%; transform: translate(-50%,-50%); animation: ring 2.2s ease-out forwards; box-shadow: 0 0 30px rgba(150,230,255,.8), inset 0 0 20px rgba(150,230,255,.6); }
.fx-leap .ring:nth-child(2) { animation-delay: .3s; }
.fx-leap .ring:nth-child(3) { animation-delay: .6s; }
.fx-leap .leap-text { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 30px; letter-spacing: .4em; color: #dff6ff; text-shadow: 0 0 18px #6cd3ff; opacity: 0; animation: leaptext 2.4s ease forwards; }
@keyframes ring { from { width: 40px; height: 40px; opacity: 1; } to { width: 1800px; height: 1800px; opacity: 0; } }
@keyframes leap { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 1; } }
@keyframes leaptext { 0%,20% { opacity: 0; letter-spacing: .1em; } 50% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; letter-spacing: .6em; } }
.fx-heart { position: absolute; inset: 0; box-shadow: inset 0 0 160px rgba(140,0,30,.7); animation: heart 1s ease 2; }
@keyframes heart { 0%,100% { opacity: 0; } 15% { opacity: 1; } 30% { opacity: .2; } 45% { opacity: .9; } }

/* ---- HUD ---- */
.hud-time, .hud-loop {
  position: absolute; top: 16px; padding: 6px 18px 6px 14px; font-size: 18px; letter-spacing: .12em;
  background: linear-gradient(90deg, rgba(16,20,42,.85), rgba(16,20,42,0)); color: var(--gold-hi);
  border-left: 3px solid var(--gold); text-shadow: 0 1px 4px #000; z-index: 5;
}
.hud-time { left: 0; }
.hud-loop { right: 0; left: auto; border-left: 0; border-right: 3px solid var(--mem); background: linear-gradient(270deg, rgba(16,20,42,.85), rgba(16,20,42,0)); color: var(--mem); font-family: var(--latin); font-size: 20px; padding: 6px 14px 6px 22px; }

/* ---- テキストウィンドウ ---- */
.textbox {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: 1220px; height: 196px;
  background:
    linear-gradient(180deg, rgba(14,17,36,calc(var(--win-alpha) - .1)), rgba(10,12,26,var(--win-alpha))),
    radial-gradient(ellipse at 20% 0%, rgba(216,180,106,.12), transparent 60%);
  border: 1px solid rgba(216,180,106,.55);
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.55), inset 0 0 0 4px rgba(10,12,26,.4), inset 0 0 0 5px rgba(216,180,106,.18);
  z-index: 10;
}
.textbox::before, .textbox::after {
  content: ''; position: absolute; width: 26px; height: 26px; border: 2px solid var(--gold); opacity: .8; pointer-events: none;
}
.textbox::before { left: -3px; top: -3px; border-right: 0; border-bottom: 0; }
.textbox::after { right: -3px; bottom: -3px; border-left: 0; border-top: 0; }
.tb-face { position: absolute; left: 16px; bottom: 14px; width: 150px; height: 150px; display: none; }
.tb-face { overflow: hidden; border-radius: 6px; border: 1px solid rgba(232,196,106,.45); background: radial-gradient(circle at 50% 30%, #2a3566, #0b0f24); box-shadow: 0 0 18px rgba(0,0,0,.5); }
.tb-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transform: scale(1.75); transform-origin: 50% 8%; }
.textbox.with-face .tb-face { display: block; }
.textbox.with-face .tb-text { left: 186px; }
.tb-name {
  position: absolute; left: 34px; top: -22px; min-width: 180px; height: 40px; padding: 0 28px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #7b2440, var(--wine-dk));
  border: 1px solid var(--gold); border-radius: 3px;
  font-size: 22px; font-weight: 700; letter-spacing: .14em; color: #fff4dc;
  box-shadow: 0 4px 12px rgba(0,0,0,.5); text-shadow: 0 1px 2px #000;
}
.tb-name.empty { display: none; }
.tb-name.player { background: linear-gradient(180deg, #24406f, #121d3b); }
.tb-text {
  position: absolute; left: 44px; right: 44px; top: 34px; bottom: 18px;
  font-size: calc(25px * var(--fs)); line-height: 1.72; letter-spacing: .04em;
  text-shadow: 0 1px 3px rgba(0,0,0,.9); white-space: normal; overflow: hidden;
}
.tb-text .kw { color: #ffd98a; font-style: normal; font-weight: 700; text-shadow: 0 0 10px rgba(255,200,100,.35), 0 1px 3px #000; }
.tb-text ruby rt { font-size: .48em; letter-spacing: 0; }
.tb-text.thought { color: #cfe9ff; }
.tb-next { position: absolute; right: 30px; bottom: 44px; width: 14px; height: 14px; border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: rotate(45deg); opacity: 0; }
.tb-next.on { opacity: 1; animation: nextblink 1s ease-in-out infinite; }
@keyframes nextblink { 0%,100% { transform: rotate(45deg) translate(0,0); opacity: 1; } 50% { transform: rotate(45deg) translate(3px,3px); opacity: .5; } }
@keyframes softblink { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.quick { position: absolute; right: 14px; bottom: -2px; transform: translateY(100%); display: flex; gap: 2px; padding-top: 2px; }
.quick button {
  background: none; border: 0; color: var(--ink-dim); font-family: var(--sans); font-size: 13px; letter-spacing: .08em; padding: 2px 8px; cursor: pointer;
  text-shadow: 0 1px 3px #000;
}
.quick button:hover { color: var(--gold-hi); }
.quick button.on { color: var(--mem); }
.textbox { bottom: 30px; }

.mode-badge { position: absolute; right: 18px; top: 62px; padding: 4px 14px; font-family: var(--latin); font-size: 18px; letter-spacing: .2em; color: var(--mem); border: 1px solid var(--mem); background: rgba(10,14,30,.7); z-index: 12; }

/* ---- 選択肢 ---- */
.choice-layer { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(5,6,14,.35); z-index: 20; padding-bottom: 120px; }
.choice-prompt { font-size: 22px; color: var(--gold-hi); letter-spacing: .1em; margin-bottom: 6px; text-shadow: 0 2px 6px #000; }
.choice {
  position: relative; width: 760px; min-height: 60px; padding: 12px 40px; font-size: 22px; letter-spacing: .06em; cursor: pointer;
  background: linear-gradient(90deg, rgba(16,20,42,.0), rgba(16,20,42,.92) 12%, rgba(16,20,42,.92) 88%, rgba(16,20,42,0));
  border: 0; border-top: 1px solid rgba(216,180,106,.5); border-bottom: 1px solid rgba(216,180,106,.5);
  color: var(--ink); transition: transform .15s ease, background .2s ease; text-align: center;
  animation: choiceIn .35s ease both;
}
.choice:hover, .choice.focus { background: linear-gradient(90deg, rgba(107,29,53,0), rgba(107,29,53,.95) 12%, rgba(107,29,53,.95) 88%, rgba(107,29,53,0)); transform: scale(1.02); }
.choice.read { color: var(--ink-dim); }
.choice.knowledge { border-color: var(--mem); color: #e6f8ff; }
.choice.knowledge::before { content: '記憶'; position: absolute; left: 70px; top: 50%; transform: translateY(-50%); font-family: var(--sans); font-size: 12px; padding: 1px 6px; border: 1px solid var(--mem); color: var(--mem); letter-spacing: .1em; }
@keyframes choiceIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- トースト ---- */
.toasts { position: absolute; left: 0; top: 70px; display: flex; flex-direction: column; gap: 8px; z-index: 30; pointer-events: none; }
.toast {
  min-width: 320px; max-width: 560px; padding: 10px 22px 10px 16px; font-size: 18px; display: flex; gap: 12px; align-items: center;
  background: linear-gradient(90deg, rgba(14,30,52,.95), rgba(14,30,52,.6) 80%, transparent);
  border-left: 3px solid var(--mem); color: #e6f8ff; animation: toastIn 4s ease forwards;
}
.toast img { width: 44px; height: 44px; object-fit: contain; }
.toast .t-kind { font-family: var(--sans); font-size: 12px; color: var(--mem); letter-spacing: .15em; display: block; }
.toast.secret { border-left-color: var(--gold); background: linear-gradient(90deg, rgba(60,20,30,.95), rgba(60,20,30,.6) 80%, transparent); }
.toast.secret .t-kind { color: var(--gold); }
@keyframes toastIn { 0% { opacity: 0; transform: translateX(-30px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---- 共通の全画面パネル ---- */
.screen {
  position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 50% 0%, rgba(60,40,80,.55), transparent 60%), linear-gradient(180deg, #0a0c1c, #06070f);
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.screen-head { display: flex; align-items: center; gap: 18px; padding: 22px 36px 12px; border-bottom: 1px solid rgba(216,180,106,.35); }
.screen-head h2 { margin: 0; font-size: 30px; letter-spacing: .2em; color: var(--gold-hi); font-weight: 700; }
.screen-head .en { font-family: var(--latin); font-style: italic; color: var(--gold); font-size: 20px; letter-spacing: .1em; }
.screen-head .spacer { flex: 1; }
.btn {
  background: linear-gradient(180deg, rgba(40,46,80,.9), rgba(20,24,46,.95)); border: 1px solid rgba(216,180,106,.6); color: var(--ink);
  padding: 8px 22px; font-size: 17px; letter-spacing: .1em; cursor: pointer; border-radius: 2px; font-family: var(--serif);
}
.btn:hover { border-color: var(--gold-hi); color: var(--gold-hi); background: linear-gradient(180deg, rgba(107,29,53,.95), rgba(54,16,29,.95)); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { border-color: var(--gold); background: linear-gradient(180deg, #7b2440, var(--wine-dk)); }
.screen-body { flex: 1; overflow: auto; padding: 18px 36px 26px; }
.screen-body::-webkit-scrollbar { width: 8px; }
.screen-body::-webkit-scrollbar-thumb { background: rgba(216,180,106,.4); border-radius: 4px; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 16px; font-size: 18px; cursor: pointer; color: var(--ink-dim); letter-spacing: .1em; }
.tabs button.on { color: var(--gold-hi); border-bottom-color: var(--gold); }

/* バックログ */
.log-item { padding: 10px 0; border-bottom: 1px dashed rgba(216,180,106,.15); display: grid; grid-template-columns: 160px 1fr; gap: 16px; font-size: 19px; line-height: 1.7; }
.log-item .ln { color: var(--gold); text-align: right; font-weight: 700; }
.log-item.choice .lt { color: var(--mem); }
.log-item .kw { color: #ffd98a; font-style: normal; }

/* 設定 */
.cfg { display: grid; grid-template-columns: 220px 1fr 80px; gap: 18px 24px; align-items: center; max-width: 900px; margin: 10px auto; font-size: 19px; }
.cfg label { color: var(--gold-hi); letter-spacing: .1em; }
.cfg input[type=range] { width: 100%; accent-color: var(--gold); }
.cfg .val { font-family: var(--latin); font-size: 20px; color: var(--ink-dim); }
.cfg-sample { grid-column: 1 / -1; min-height: 90px; padding: 16px 24px; border: 1px solid rgba(216,180,106,.35); background: rgba(10,12,26,.8); font-size: calc(24px * var(--fs)); line-height: 1.7; }

/* セーブ・ロード */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.slot { position: relative; height: 150px; border: 1px solid rgba(216,180,106,.35); background: rgba(16,20,42,.85); cursor: pointer; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 8px 10px; font-size: 14px; }
.slot:hover { border-color: var(--gold-hi); }
.slot .thumb { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .55; }
.slot .no { position: absolute; left: 8px; top: 6px; font-family: var(--latin); color: var(--gold); font-size: 20px; text-shadow: 0 1px 3px #000; }
.slot .meta { position: relative; text-shadow: 0 1px 3px #000; }
.slot .meta b { display: block; color: var(--gold-hi); font-size: 15px; }
.slot .meta small { color: var(--ink-dim); font-family: var(--sans); }
.slot.empty { color: var(--ink-dim); justify-content: center; align-items: center; }

/* ダイアログ */
.dialog-wrap { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.dialog { min-width: 460px; max-width: 820px; padding: 28px 36px; background: linear-gradient(180deg, #1a2142, #0e1226); border: 1px solid var(--gold); box-shadow: 0 20px 60px rgba(0,0,0,.7); text-align: center; font-size: 20px; line-height: 1.7; }
.dialog .row { display: flex; gap: 14px; justify-content: center; margin-top: 22px; }
.dialog input[type=text] { width: 100%; font-size: 24px; padding: 10px 14px; margin-top: 14px; background: #070912; border: 1px solid var(--gold-dk); color: var(--ink); font-family: var(--serif); text-align: center; letter-spacing: .1em; }
.dialog input[type=text]:focus { outline: none; border-color: var(--gold-hi); }

/* 章タイトル */
.titlecard { position: absolute; inset: 0; z-index: 35; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(4,5,12,.92); animation: tcard 3.2s ease forwards; pointer-events: none; }
.titlecard .t1 { font-size: 46px; letter-spacing: .4em; color: var(--gold-hi); text-shadow: 0 0 20px rgba(216,180,106,.4); }
.titlecard .t2 { margin-top: 14px; font-size: 20px; letter-spacing: .3em; color: var(--ink-dim); }
.titlecard .line { width: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); margin: 18px 0; animation: tline 3.2s ease forwards; }
@keyframes tcard { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tline { 0% { width: 0; } 40% { width: 520px; } 100% { width: 520px; } }

/* エラー */
.err { position: absolute; left: 20px; right: 20px; top: 20px; z-index: 99; background: #400; color: #fff; padding: 14px; font: 14px monospace; white-space: pre-wrap; }

/* ---- タイトル ---- */
.title-screen { position: absolute; inset: 0; z-index: 30; overflow: hidden; }
.title-bg { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; animation: kenburns 40s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1) translate(0,0); } to { transform: scale(1.08) translate(-14px,-8px); } }
.title-veil { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,8,20,.88) 0%, rgba(6,8,20,.55) 42%, rgba(6,8,20,0) 70%), linear-gradient(0deg, rgba(6,8,20,.7), transparent 40%); }
.title-logo { position: absolute; left: 80px; top: 92px; width: 640px; }
.title-logo h1 { margin: 0; font-size: 60px; line-height: 1.25; letter-spacing: .08em; font-weight: 800; color: #fff4dc;
  text-shadow: 0 0 24px rgba(216,180,106,.45), 0 3px 8px rgba(0,0,0,.9); }
.title-logo h1 small { display: block; font-size: 26px; letter-spacing: .3em; color: var(--gold-hi); font-weight: 700; margin-bottom: 8px; }
.title-sub { font-size: 16px; letter-spacing: .5em; color: var(--gold); margin-bottom: 14px; }
.title-en { margin-top: 14px; font-family: var(--latin); font-style: italic; font-size: 24px; color: var(--gold); letter-spacing: .12em; }
.title-menu { position: absolute; left: 80px; bottom: 90px; display: flex; flex-direction: column; gap: 6px; }
.title-item { display: flex; align-items: baseline; gap: 16px; background: none; border: 0; padding: 6px 0 6px 20px; cursor: pointer; text-align: left; border-left: 2px solid transparent; transition: all .2s; }
.title-item .ja { font-size: 26px; letter-spacing: .25em; color: var(--ink); text-shadow: 0 2px 6px #000; }
.title-item .en { font-family: var(--latin); font-style: italic; font-size: 17px; color: var(--gold); opacity: .8; }
.title-item:hover:not(:disabled) { border-left-color: var(--gold); padding-left: 30px; }
.title-item:hover:not(:disabled) .ja { color: var(--gold-hi); }
.title-item:disabled { opacity: .35; cursor: default; }
.title-foot { position: absolute; right: 26px; bottom: 18px; font-family: var(--sans); font-size: 13px; color: var(--ink-dim); text-shadow: 0 1px 3px #000; }
.title-foot .star { color: var(--gold-hi); }

/* ---- エンディング ---- */
.ending-card { position: absolute; inset: 0; z-index: 45; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(4,5,12,.9); animation: fadeIn 1.2s ease; text-align: center; }
.ending-card .ek { font-family: var(--latin); font-size: 26px; letter-spacing: .5em; color: var(--gold); }
.ending-card.bad .ek { color: #d26a7e; }
.ending-card.true .ek { color: var(--mem); text-shadow: 0 0 16px rgba(159,227,255,.7); }
.ending-card .et { font-size: 48px; letter-spacing: .25em; margin: 14px 0 6px; color: #fff4dc; text-shadow: 0 0 20px rgba(216,180,106,.4); }
.ending-card .en { font-family: var(--latin); color: var(--ink-dim); font-size: 18px; letter-spacing: .3em; }
.ending-card .new { margin-top: 10px; font-family: var(--latin); color: #ffd98a; letter-spacing: .3em; animation: softblink 1.2s infinite; }
.ending-card .ed { max-width: 760px; margin: 24px 0 8px; font-size: 19px; line-height: 1.8; color: var(--ink-dim); }
.ending-card .row { display: flex; gap: 14px; margin-top: 22px; }

/* ---- 記録の間 ---- */
.coll-summary { display: grid; grid-template-columns: 150px 1fr 220px; gap: 24px; align-items: center; padding: 6px 0 16px; }
.coll-summary .pct { font-family: var(--latin); font-size: 30px; color: var(--gold); text-align: center; }
.coll-summary .pct b { font-size: 68px; color: var(--gold-hi); }
.bars { display: grid; gap: 5px; }
.bar { display: grid; grid-template-columns: 120px 1fr 70px; align-items: center; gap: 10px; font-size: 15px; }
.bar i { height: 6px; background: rgba(255,255,255,.08); position: relative; border-radius: 3px; overflow: hidden; }
.bar u { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--gold-dk), var(--gold-hi)); }
.bar em { font-style: normal; font-family: var(--latin); color: var(--ink-dim); }
.true-badge { padding: 14px; text-align: center; border: 1px solid rgba(255,255,255,.2); color: var(--ink-dim); letter-spacing: .1em; }
.true-badge.on { border-color: var(--mem); color: var(--mem); box-shadow: 0 0 20px rgba(159,227,255,.3); text-shadow: 0 0 10px rgba(159,227,255,.6); }
.coll-pane { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 14px; }
.coll-pane.cg { grid-template-columns: repeat(4, 1fr); }
.coll-pane.node { display: block; }
.coll-card { position: relative; padding: 12px 14px; background: rgba(16,20,42,.85); border: 1px solid rgba(216,180,106,.3); font-size: 15px; line-height: 1.6; min-height: 90px; }
.coll-card b { display: block; font-size: 18px; color: var(--gold-hi); margin: 2px 0 4px; }
.coll-card p { margin: 0; color: var(--ink-dim); font-size: 14px; }
.coll-card .no { font-family: var(--latin); color: var(--gold); margin-right: 8px; }
.coll-card .kind { font-family: var(--sans); font-size: 12px; padding: 1px 6px; border: 1px solid currentColor; color: var(--ink-dim); }
.coll-card.end.true .kind { color: var(--mem); }
.coll-card.end.bad .kind { color: #d26a7e; }
.coll-card.locked { opacity: .55; }
.coll-card.locked b { color: var(--ink-dim); }
.coll-card.clue { display: grid; grid-template-columns: 56px 1fr; gap: 4px 12px; }
.coll-card.clue img, .coll-card.clue .ph { grid-row: span 2; width: 56px; height: 56px; object-fit: contain; }
.coll-card .ph { display: grid; place-items: center; background: rgba(255,255,255,.05); color: var(--ink-dim); font-size: 26px; }
.coll-card.cg { padding: 6px; cursor: pointer; }
.coll-card.cg img, .coll-card.cg .ph { width: 100%; aspect-ratio: 16/9; object-fit: cover; height: auto; }
.coll-card.cg b { font-size: 14px; margin-top: 4px; }
.coll-note { color: var(--ink-dim); }
.coll-big { font-family: var(--latin); font-size: 64px; color: var(--gold-hi); text-align: center; margin-top: 30px; }
.cg-view { position: absolute; inset: 0; z-index: 70; background: #000; cursor: pointer; }
.cg-view img { width: 100%; height: 100%; object-fit: contain; }

/* ---- 手帳 ---- */
.nb { display: flex; flex-direction: column; height: 100%; }
.nb-prompt { padding: 10px 18px; margin-bottom: 10px; border-left: 3px solid #d26a7e; background: rgba(107,29,53,.35); font-size: 20px; }
.nb-pane.clue { flex: 1; display: grid; grid-template-columns: 340px 1fr; gap: 20px; padding-top: 12px; min-height: 0; }
.nb-list { overflow: auto; padding-right: 6px; max-height: 520px; }
.nb-cathead { font-size: 13px; letter-spacing: .2em; color: var(--gold); margin: 10px 0 4px; font-family: var(--sans); }
.nb-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; cursor: pointer; border-left: 2px solid transparent; font-size: 17px; }
.nb-item img { width: 34px; height: 34px; object-fit: contain; }
.nb-item .g { width: 34px; text-align: center; color: var(--gold); }
.nb-item:hover { background: rgba(216,180,106,.08); }
.nb-item.on { border-left-color: var(--gold); background: rgba(216,180,106,.14); color: var(--gold-hi); }
.nb-detail { position: relative; padding: 18px 26px; background: linear-gradient(180deg, rgba(239,230,210,.07), rgba(239,230,210,.02)); border: 1px solid rgba(216,180,106,.25); overflow: auto; max-height: 520px; }
.nb-detail h3 { font-size: 28px; margin: 4px 0 12px; color: var(--gold-hi); letter-spacing: .08em; }
.nb-icon { float: right; width: 180px; height: 180px; margin: 0 0 10px 16px; }
.nb-icon img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(0,0,0,.5)); }
.nb-glyph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 80px; color: var(--gold); opacity: .6; }
.nb-cat { font-family: var(--sans); font-size: 13px; color: var(--gold); letter-spacing: .15em; }
.nb-loop { color: var(--mem); }
.nb-text { font-size: 19px; line-height: 1.85; white-space: pre-wrap; }
.nb-text .kw { color: #ffd98a; font-style: normal; }
.nb-empty { color: var(--ink-dim); }
.nb-pick { position: sticky; bottom: 0; display: block; margin: 18px 0 0 auto; font-size: 20px; padding: 10px 30px; }
.nb-people { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 12px; }
.nb-person { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 12px; background: rgba(16,20,42,.85); border: 1px solid rgba(216,180,106,.25); }
.nb-person img { width: 110px; height: 110px; object-fit: cover; border: 1px solid rgba(216,180,106,.4); background: #222842; }
.nb-person h3 { margin: 0 0 6px; font-size: 21px; color: var(--gold-hi); }
.nb-person h3 small { margin-left: 10px; font-size: 13px; color: var(--ink-dim); font-weight: 400; }
.nb-person ul { margin: 0; padding-left: 18px; font-size: 15px; line-height: 1.6; }
.nb-person li.new { color: #e6f8ff; }
.present-mode .screen-head h2 { color: #ffb3c1; }

/* ---- 時の樹 ---- */
.chart { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 10px; }
.chart-scroll { overflow: auto; border: 1px solid rgba(216,180,106,.2); min-height: 0;
  background: radial-gradient(circle at 30% 30%, rgba(80,120,200,.12), transparent 50%), rgba(8,10,24,.6); }
.chart-canvas { position: relative; }
.chart-lines { position: absolute; left: 0; top: 0; pointer-events: none; }
.chart-lines path { fill: none; stroke-width: 2.5; opacity: .55; }
.chart-lines path.cur { stroke-width: 4; opacity: 1; filter: drop-shadow(0 0 4px currentColor); }
.chart-col { position: absolute; top: 6px; text-align: center; font-size: 14px; color: var(--gold-hi); letter-spacing: .08em; font-family: var(--latin); font-weight: 700; }
.chart-col.end { color: var(--mem); }
.chart-row { position: absolute; left: 8px; display: flex; align-items: center; justify-content: flex-end; font-size: 14px; color: var(--ink-dim); border-bottom: 1px dashed rgba(255,255,255,.06); }
.cdot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 1px dashed rgba(255,255,255,.28); }
.cdot.seen { border-color: rgba(216,180,106,.45); }
.cnode { position: absolute; transform: translate(-50%,-50%); min-width: 88px; max-width: 108px; height: 32px; padding: 0 10px; display: grid; place-items: center;
  font-size: 13px; line-height: 1.1; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(180deg, #2a3360, #161c3a); border: 1px solid rgba(216,180,106,.7); color: var(--ink); border-radius: 16px; z-index: 2; transition: transform .15s; }
.cnode span { overflow: hidden; text-overflow: ellipsis; }
.cnode:hover { transform: translate(-50%,-50%) scale(1.08); }
.cnode.end.bad { background: linear-gradient(180deg, #5a1a2e, #2a0c16); border-color: #d26a7e; }
.cnode.end.normal { background: linear-gradient(180deg, #2d4a5a, #12232e); border-color: var(--mem); }
.cnode.end.true { background: linear-gradient(180deg, #e8d49a, #9c7a36); color: #1a1205; font-weight: 700; border-color: #fff4dc; }
.cnode.cur { box-shadow: 0 0 0 3px rgba(159,227,255,.75), 0 0 18px rgba(159,227,255,.6); }
.cnode.sel { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.chart-info { min-height: 120px; max-height: 190px; overflow: auto; padding: 12px 20px; background: rgba(16,20,42,.92); border: 1px solid rgba(216,180,106,.3); }
.chart-info h3 { margin: 0 0 4px; font-size: 22px; color: var(--gold-hi); }
.chart-info p { margin: 4px 0; font-size: 16px; color: var(--ink-dim); line-height: 1.6; }
.chart-info .ci-help b { color: var(--mem); font-weight: 400; }
.chart-info .ci-kind { font-family: var(--sans); font-size: 12px; color: var(--mem); letter-spacing: .2em; }
.chart-info > .btn { margin-top: 6px; }
.ci-list { display: grid; gap: 6px; }
.ci-entry { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 12px; font-size: 15px; padding: 4px 0; border-bottom: 1px dashed rgba(255,255,255,.08); }
.ci-entry .lp { font-family: var(--latin); font-size: 18px; font-weight: 700; }
.ci-entry .st { color: var(--ink-dim); }

/* ---- 推理 ---- */
.deduce { position: absolute; inset: 0; z-index: 42; display: flex; flex-direction: column; align-items: center; padding: 40px 60px; background: radial-gradient(ellipse at 50% 30%, rgba(60,30,60,.75), rgba(5,6,14,.96)); animation: fadeIn .4s ease; }
.dd-head { text-align: center; }
.dd-head .en { font-family: var(--latin); font-style: italic; color: var(--gold); font-size: 22px; letter-spacing: .2em; }
.dd-head h2 { margin: 4px 0; font-size: 34px; letter-spacing: .2em; color: #fff4dc; }
.dd-head p { color: var(--ink-dim); font-size: 18px; margin: 4px 0; }
.dd-sentence { margin: 30px 0 20px; font-size: 26px; line-height: 2.3; text-align: center; max-width: 1080px; }
.dd-slot { display: inline-block; min-width: 140px; padding: 2px 16px; margin: 0 6px; font-size: 24px; cursor: pointer; background: rgba(10,12,26,.8); border: 1px dashed var(--gold); color: var(--ink-dim); font-family: var(--serif); }
.dd-slot.filled { border-style: solid; color: #ffd98a; }
.dd-slot.on { box-shadow: 0 0 0 2px var(--mem), 0 0 14px rgba(159,227,255,.6); }
.dd-options { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 1080px; }
.dd-optlabel { width: 100%; text-align: center; font-size: 15px; color: var(--mem); letter-spacing: .15em; font-family: var(--sans); margin-bottom: 4px; }
.dd-opt { padding: 10px 22px; font-size: 19px; cursor: pointer; background: linear-gradient(180deg, rgba(40,46,80,.9), rgba(20,24,46,.95)); border: 1px solid rgba(216,180,106,.5); color: var(--ink); font-family: var(--serif); }
.dd-opt:hover { border-color: var(--gold-hi); }
.dd-opt.on { background: linear-gradient(180deg, #7b2440, var(--wine-dk)); border-color: var(--gold-hi); }
.dd-foot { margin-top: auto; }
.dd-foot .btn { font-size: 22px; padding: 12px 44px; }

/* ---- 場所選択 ---- */
.placemenu { position: absolute; inset: 0; z-index: 42; padding: 34px 60px; background: linear-gradient(180deg, rgba(5,6,14,.75), rgba(5,6,14,.92)); animation: fadeIn .35s ease; }
.pm-head { text-align: center; margin-bottom: 20px; }
.pm-head .en { font-family: var(--latin); font-style: italic; color: var(--gold); font-size: 20px; letter-spacing: .2em; }
.pm-head h2 { margin: 2px 0; font-size: 32px; letter-spacing: .2em; color: #fff4dc; }
.pm-head p { margin: 4px 0; color: var(--ink-dim); font-size: 17px; }
.pm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pm-card { position: relative; height: 176px; padding: 0; border: 1px solid rgba(216,180,106,.45); background: #0c0f20; cursor: pointer; overflow: hidden; text-align: left; animation: choiceIn .35s ease both; }
.pm-img { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .7; transition: transform .3s, opacity .3s; }
.pm-card:hover .pm-img { transform: scale(1.05); opacity: .9; }
.pm-card:hover { border-color: var(--gold-hi); }
.pm-txt { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px; background: linear-gradient(0deg, rgba(5,6,14,.92), rgba(5,6,14,0)); }
.pm-txt b { display: block; font-size: 22px; letter-spacing: .1em; color: #fff4dc; text-shadow: 0 1px 4px #000; }
.pm-txt small { font-size: 14px; color: var(--ink-dim); font-family: var(--sans); }
.pm-card.done .pm-img { opacity: .35; filter: grayscale(.6); }
.pm-done { position: absolute; right: 10px; top: 8px; font-size: 14px; padding: 2px 8px; border: 1px solid var(--ink-dim); color: var(--ink-dim); background: rgba(0,0,0,.5); }
.pm-card.knowledge { border-color: var(--mem); box-shadow: 0 0 12px rgba(159,227,255,.35); }

img:not([src]), img[src=''] { visibility: hidden; }

/* ---- 手帳（記憶・所持品・組み合わせ） ---- */
.nb-left { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.nb-left .nb-list { flex: 1; max-height: none; }
.nb-pane.clue { height: 520px; }
.nb-item.fresh span:last-child::after { content: ' new'; font-family: var(--latin); font-size: 12px; color: var(--mem); }
.nb-item.picked { box-shadow: inset 0 0 0 1px var(--mem); }
.nb-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; clear: both; }
.nb-actions .nb-pick { margin: 0; }
.nb-comb.on { border-color: var(--mem); color: var(--mem); }
.nb-combbar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px 8px; align-items: center; padding: 10px; border: 1px solid rgba(159,227,255,.3); background: rgba(14,30,52,.5); font-size: 14px; }
.nb-combbar .cb-label { grid-column: 1 / -1; font-family: var(--sans); font-size: 12px; letter-spacing: .15em; color: var(--mem); }
.nb-combbar .cb-glow { margin-left: 10px; font-style: normal; color: #ffd98a; animation: softblink 1.4s infinite; }
.nb-combbar .cb-slot { padding: 4px 8px; background: rgba(0,0,0,.35); border: 1px dashed rgba(159,227,255,.4); min-height: 28px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-combbar .cb-x { color: var(--mem); }
.nb-combbar .btn { grid-column: 1 / -1; padding: 6px; }
.nb-counts { margin-left: auto; align-self: center; font-family: var(--sans); font-size: 13px; color: var(--ink-dim); }
.choice.knowledge.item { border-color: #f0b46a; }
.choice.knowledge.item::before { content: '所持品'; border-color: #f0b46a; color: #f0b46a; }
.toast.item { border-left-color: #f0b46a; }
.toast.item .t-kind { color: #f0b46a; }
.toast.update { border-left-color: var(--ink-dim); }
.toast.update .t-kind { color: var(--ink-dim); }
.quick button.glow { color: #ffd98a; text-shadow: 0 0 8px rgba(255,217,138,.8); }

/* ---- かなパネル・ダイヤル ---- */
.inputpanel { position: absolute; inset: 0; z-index: 42; display: flex; flex-direction: column; align-items: center; padding: 30px 40px; gap: 14px; background: radial-gradient(ellipse at 50% 30%, rgba(30,40,80,.85), rgba(5,6,14,.96)); animation: fadeIn .3s ease; }
.ip-q { font-size: 22px; line-height: 1.7; text-align: center; max-width: 1000px; color: #fff4dc; }
.ip-disp { display: flex; gap: 8px; min-height: 58px; }
.ip-disp span { width: 52px; height: 58px; display: grid; place-items: center; font-size: 32px; border-bottom: 2px solid rgba(216,180,106,.5); color: var(--gold-hi); }
.ip-disp span.on { border-bottom-color: var(--gold-hi); }
.ip-grid { display: grid; grid-template-columns: repeat(10, auto); grid-auto-flow: row; gap: 6px 14px; direction: rtl; }
.ip-row { display: flex; flex-direction: column; gap: 3px; direction: ltr; }
.ip-k { width: 40px; height: 30px; font-size: 18px; cursor: pointer; background: rgba(30,36,70,.9); border: 1px solid rgba(216,180,106,.35); color: var(--ink); font-family: var(--serif); padding: 0; }
.ip-k:hover { border-color: var(--gold-hi); color: var(--gold-hi); }
.ip-k.blank { visibility: hidden; }
.ip-text { width: 420px; font-size: 18px; padding: 8px 12px; background: #070912; border: 1px solid var(--gold-dk); color: var(--ink); font-family: var(--serif); text-align: center; }
.ip-ctl { display: flex; gap: 14px; }
.ip-ctl .btn { font-size: 19px; padding: 10px 28px; }
.dial .ip-q { margin-top: 70px; }
.dial-row { display: flex; gap: 18px; margin: 30px 0; padding: 26px 34px; background: linear-gradient(180deg, #2b2a30, #121116); border: 2px solid #6b5a3a; border-radius: 10px; box-shadow: inset 0 0 30px rgba(0,0,0,.8), 0 10px 40px rgba(0,0,0,.6); }
.dial-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dial-col.focus .dial-num { box-shadow: 0 0 0 2px var(--mem), 0 0 14px rgba(159,227,255,.5); }
.dial-num { width: 84px; height: 104px; display: grid; place-items: center; font-family: var(--serif); font-size: 72px; font-weight: 700; color: #f4e2b0; background: linear-gradient(180deg, #0c0b0f, #2a2630 50%, #0c0b0f); border: 1px solid #8a7448; border-radius: 6px; cursor: ns-resize; }
.dial-btn { width: 84px; height: 34px; background: rgba(60,52,40,.8); border: 1px solid #8a7448; color: #f4e2b0; cursor: pointer; font-size: 16px; }
.dial-btn:hover { background: rgba(107,29,53,.9); }

/* 段階ヒント */
.tb-text.hint { color: #f3dfa8; }
.tb-text.hint::before {
  content: attr(data-hint); display: block; margin-bottom: 4px; font: 600 13px/1.2 'Cormorant Garamond', serif;
  letter-spacing: .18em; color: #e8c46a; text-shadow: 0 0 8px rgba(232,196,106,.6);
}
