@charset "UTF-8";
/* =====================================================================
   灰都の残響 ― 全体スタイル（ui 担当）
   Ruina の仄暗さ ＋ オクトパストラベラーの上品な窓（半透明の墨・細い真鍮の線）
   ===================================================================== */

:root {
  --ink: #0c0e15;
  --ink-2: #141826;
  --ink-3: #1d2233;
  --ash: #8a8f9a;
  --ash-hi: #b9bdc6;
  --brass: #c9a55a;
  --brass-hi: #ecd494;
  --brass-dim: #7d6535;
  --parch: #d8c7a0;
  --parch-dk: #a88f62;
  --sepia: #3b2a18;
  --danger: #b8413a;
  --danger-hi: #e0685e;
  --echo: #6fd3e0;
  --echo-dim: #2f7c86;
  --good: #8fdcaa;
  --text: #ebe2cc;
  --text-hi: #fbf4e2;
  --text-dim: #a9a293;
  --win-bg: linear-gradient(180deg, rgba(24, 29, 46, 0.9) 0%, rgba(12, 14, 22, 0.93) 100%);
  --line: rgba(201, 165, 90, 0.55);
  --font-body: 'Shippori Mincho', 'Yu Mincho', 'YuMincho', 'Hiragino Mincho ProN', 'HGS明朝E', 'MS PMincho', serif;
  --font-ui: 'DotGothic16', 'MS Gothic', 'Osaka-mono', monospace;
  /* 窓の四隅の飾り */
  --corner-tl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M1.5 14V1.5H14' fill='none' stroke='%23c9a55a' stroke-width='1.2'/%3E%3Cpath d='M5.5 3L8 5.5 5.5 8 3 5.5z' fill='%23ecd494'/%3E%3C/svg%3E");
  --corner-tr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M16.5 14V1.5H4' fill='none' stroke='%23c9a55a' stroke-width='1.2'/%3E%3Cpath d='M12.5 3L15 5.5 12.5 8 10 5.5z' fill='%23ecd494'/%3E%3C/svg%3E");
  --corner-bl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M1.5 4V16.5H14' fill='none' stroke='%23c9a55a' stroke-width='1.2'/%3E%3Cpath d='M5.5 10L8 12.5 5.5 15 3 12.5z' fill='%23ecd494'/%3E%3C/svg%3E");
  --corner-br: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M16.5 4V16.5H4' fill='none' stroke='%23c9a55a' stroke-width='1.2'/%3E%3Cpath d='M12.5 10L15 12.5 12.5 15 10 12.5z' fill='%23ecd494'/%3E%3C/svg%3E");
}

/* ---------- 土台 ---------- */
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: #000; overflow: hidden;
}
body {
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#stage { position: fixed; inset: 0; background: #000; overflow: hidden; }
#game {
  position: absolute; left: 50%; top: 50%;
  width: 1280px; height: 720px;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  transform-origin: 50% 50%;
  overflow: hidden;
  background: #05060a;
  font-size: 16px;
}
#game * { box-sizing: border-box; }
:where(#game) button { font: inherit; color: inherit; }
canvas.pix, .pix { image-rendering: pixelated; image-rendering: crisp-edges; }
#errors { position: fixed; left: 0; bottom: 0; margin: 0; max-width: 100%; max-height: 30vh; overflow: auto;
  background: rgba(80, 0, 0, 0.85); color: #fff; font: 12px monospace; z-index: 9999; }
#errors:empty { display: none; }

/* ---------- 層（z 順） ---------- */
#gfx { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
#hud { z-index: 20; }
#textbox { z-index: 30; }
#mapview { z-index: 40; }
#battle-ui { z-index: 45; }
#menu { z-index: 50; }
#hanoi { z-index: 55; }
#title { z-index: 60; }
#overlay { z-index: 80; }
#toasts { z-index: 90; }
#fade { z-index: 100; }

#mapview, #battle-ui, #menu, #hanoi, #title, #overlay { position: absolute; inset: 0; }

/* モードで見せる層を切り替える（G.UI.setMode が #game[data-mode] を設定） */
#hud, #textbox, #mapview, #battle-ui, #menu, #hanoi, #title {
  visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity 0.32s ease, visibility 0s linear 0.32s;
}
#game[data-mode='scene'] #hud, #game[data-mode='scene'] #textbox,
#game[data-mode='map'] #hud, #game[data-mode='map'] #mapview,
#game[data-mode='battle'] #battle-ui,
#game[data-mode='menu'] #menu,
#game[data-mode='hanoi'] #hanoi,
#game[data-mode='title'] #title, #game[data-mode='ending'] #title {
  visibility: visible; opacity: 1; pointer-events: auto;
  transition: opacity 0.32s ease, visibility 0s;
}
#game[data-mode] #hud { pointer-events: none; }
#hud.empty { display: none; }
#mapview.mv-hidden { visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }
#game.is-busy #tb-choices, #game.is-busy .mv-node, #game.is-busy .mv-btns { pointer-events: none; }

/* ---------- 共通の窓（オクトパス風） ---------- */
.win, #textbox {
  position: relative;
  background: var(--win-bg);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.65),
    inset 0 0 0 3px rgba(8, 10, 16, 0.55),
    inset 0 0 0 4px rgba(201, 165, 90, 0.13),
    inset 0 18px 30px -18px rgba(255, 220, 150, 0.08),
    0 14px 36px rgba(0, 0, 0, 0.55);
}
.win::after, #textbox::after {
  content: ''; position: absolute; inset: -5px; pointer-events: none;
  background:
    var(--corner-tl) left top no-repeat, var(--corner-tr) right top no-repeat,
    var(--corner-bl) left bottom no-repeat, var(--corner-br) right bottom no-repeat;
}
.win::before, #textbox::before {
  content: ''; position: absolute; left: 12%; right: 12%; top: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 234, 180, 0.85), transparent);
  opacity: 0.55;
}

/* ボタン */
.btn {
  -webkit-appearance: none; appearance: none;
  position: relative;
  font-family: var(--font-ui); font-size: 15px; letter-spacing: 0.08em;
  color: var(--text);
  background: linear-gradient(180deg, rgba(44, 51, 74, 0.92), rgba(18, 21, 33, 0.96));
  border: 1px solid rgba(201, 165, 90, 0.5);
  border-radius: 2px;
  padding: 7px 18px; min-width: 110px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:hover, .btn.focus {
  border-color: var(--brass-hi); color: var(--text-hi);
  background: linear-gradient(180deg, rgba(74, 66, 44, 0.95), rgba(30, 27, 22, 0.96));
  box-shadow: 0 0 14px rgba(236, 212, 148, 0.35), inset 0 0 12px rgba(201, 165, 90, 0.22);
}
.btn.primary { border-color: var(--brass); color: var(--brass-hi); }
.btn.small { font-size: 12px; padding: 4px 10px; min-width: 0; }
.btn:disabled, .btn.disabled { opacity: 0.4; cursor: not-allowed; }
.btn .key {
  display: inline-block; font-size: 11px; line-height: 1; color: var(--brass);
  border: 1px solid rgba(201, 165, 90, 0.45); padding: 2px 4px 1px; margin-right: 8px; vertical-align: 1px;
}

/* =====================================================================
   HUD（上部の細い帯）
   ===================================================================== */
#hud { position: absolute; left: 0; right: 0; top: 0; height: 40px; font-family: var(--font-ui); }
#hud .hud-bar {
  position: absolute; inset: 0;
  display: flex; align-items: center; gap: 20px;
  padding: 0 18px 0 22px;
  background: linear-gradient(180deg, rgba(7, 9, 15, 0.9), rgba(10, 12, 20, 0.78));
  border-bottom: 1px solid rgba(201, 165, 90, 0.38);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 6px 18px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
#hud .hud-bar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(236, 212, 148, 0.7) 18%, rgba(236, 212, 148, 0.25) 60%, transparent 100%);
}
.hud-place { display: flex; align-items: center; gap: 9px; flex: 0 1 auto; max-width: 440px; min-width: 120px; }
.hud-place i {
  flex: none; width: 7px; height: 7px; background: var(--brass-hi); transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(236, 212, 148, 0.8);
}
.hud-place .v {
  font-family: var(--font-body); font-weight: 600; font-size: 16px; letter-spacing: 0.08em;
  color: var(--brass-hi); overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 2px #000;
}
.hud-time { display: flex; align-items: baseline; gap: 7px; font-size: 14px; color: var(--text); }
.hud-day { color: var(--parch); font-size: 15px; letter-spacing: 0.06em; }
.hud-dot { color: var(--brass-dim); }
.hud-period { color: var(--brass-hi); }
.hud-clock { color: var(--text); letter-spacing: 0.04em; min-width: 3.2em; }
#hud[data-period='夜'] .hud-period, #hud[data-period='深夜'] .hud-period { color: #9fb8ea; }
.hud-eclipse { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ash-hi); }
.hud-moon { display: block; width: 22px; height: 22px; }
.hud-moon svg { display: block; }
.hud-left b { font-weight: normal; font-size: 16px; color: var(--text-hi); margin: 0 2px; }
.hud-eclipse.urgent .hud-left, .hud-eclipse.urgent .hud-left b { color: var(--danger-hi); text-shadow: 0 0 8px rgba(224, 104, 94, 0.55); }
.hud-eclipse.urgent .hud-moon { animation: moon-pulse 2.4s ease-in-out infinite; }
@keyframes moon-pulse { 50% { filter: drop-shadow(0 0 5px rgba(255, 90, 70, 0.8)); } }
.hud-space { flex: 1 1 0; min-width: 0; }
.hud-time, .hud-eclipse, .hud-gold, .hud-party { flex: none; }
.hud-gold { display: flex; align-items: center; gap: 6px; color: #f0d27a; }
.hud-gold svg { width: 16px; height: 16px; }
.hud-gold b { font-weight: normal; font-size: 15px; min-width: 2.6em; text-align: right; color: var(--text-hi); }
.hud-gold small { font-size: 11px; color: var(--ash); }
.hud-gold.bump b { animation: gold-bump 0.6s ease; }
.hud-gold.up b { color: #ffe9a0; }
.hud-gold.down b { color: #e7b2a8; }
@keyframes gold-bump { 30% { transform: translateY(-3px) scale(1.12); } }
.hud-party { display: flex; gap: 12px; }
.hud-mem { display: flex; align-items: center; gap: 6px; }
.hud-face {
  width: 26px; height: 26px; flex: none;
  border: 1px solid rgba(201, 165, 90, 0.55);
  background: radial-gradient(circle at 50% 35%, #2c3450, #0f121c);
  display: grid; place-items: center; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.hud-face canvas { width: 100%; height: 100%; display: block; }
.hud-face span { font-family: var(--font-body); font-size: 13px; color: var(--parch); }
.hud-bars { display: flex; flex-direction: column; gap: 3px; }
.hud-hp {
  width: 62px; height: 5px; background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(138, 143, 154, 0.35); overflow: hidden;
}
.hud-hp i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #3e9a86, #86e0b8);
  box-shadow: 0 0 6px rgba(134, 224, 184, 0.6);
  transition: width 0.4s ease;
}
.hud-mem.mid .hud-hp i { background: linear-gradient(90deg, #a3802c, #f0cf6a); box-shadow: 0 0 6px rgba(240, 207, 106, 0.5); }
.hud-mem.low .hud-hp i { background: linear-gradient(90deg, #8a2a24, #e0685e); box-shadow: 0 0 6px rgba(224, 104, 94, 0.7); }
.hud-mem.ko .hud-face { filter: grayscale(1) brightness(0.55); }
.hud-lp { display: flex; gap: 2px; height: 4px; }
.hud-lp i { width: 3px; height: 3px; background: rgba(138, 143, 154, 0.35); }
.hud-lp i.on { background: #f3c77a; box-shadow: 0 0 3px rgba(243, 199, 122, 0.8); }
.hud-lp.dense { gap: 1px; }
.hud-lp.dense i { width: 3px; }

/* =====================================================================
   本文窓
   ===================================================================== */
#textbox {
  /* 18.5px × 1.8 の本文が 6 行＋段落の間 3 つ入る高さ（150 字・3 段落が 1 頁に収まる。§15.2）。
     高さを変えたら #vn .vn-bust の bottom と、場面での #tips の bottom も合わせる */
  position: absolute; left: 18px; right: 18px; bottom: 10px; height: 260px;
  display: grid; grid-template-columns: minmax(0, 1fr) 440px; column-gap: 0;
  padding: 15px 16px 12px 30px;
}
#textbox.no-choices { grid-template-columns: minmax(0, 1fr) 0; }
/* 戦闘・地図などから戻った直後、次の本文が来るまで前の本文を隠す（ui.js の setMode が付け、showScene が外す） */
#textbox.stale #tb-body, #textbox.stale #tb-choices, #textbox.stale #tb-place,
#textbox.stale .tb-more, #textbox.stale .tb-page, #textbox.stale .tb-scroll, #textbox.stale .tb-cmore { visibility: hidden; }
#textbox.no-choices #tb-choices { display: none; }

#tb-place {
  position: absolute; left: 26px; top: -17px; z-index: 2;
  max-width: 60%;
  font-family: var(--font-body); font-weight: 600; font-size: 15px; letter-spacing: 0.14em;
  color: var(--brass-hi);
  padding: 5px 20px 5px 18px;
  background: linear-gradient(180deg, rgba(34, 38, 56, 0.97), rgba(14, 16, 25, 0.97));
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(8, 10, 16, 0.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 0 10px rgba(236, 212, 148, 0.3);
}
#tb-place::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 11px; vertical-align: 3px;
  background: var(--brass-hi); transform: rotate(45deg); box-shadow: 0 0 6px rgba(236, 212, 148, 0.8);
}
#tb-place.empty { display: none; }

#tb-body {
  position: relative;
  overflow-y: auto; overflow-x: hidden;
  padding: 4px 20px 6px 2px;
  /* §15.2：19.5px・1.9 では窓に 4 行しか入らず頁が細かく割れたので、18.5px・1.8 に戻した */
  font-family: var(--font-body); font-size: 18.5px; line-height: 1.8; letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  /* 上下の端をわずかにぼかす（スクロールするときの切れ目。頁送りでは文字に掛からない幅） */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 4px, #000 calc(100% - 6px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 4px, #000 calc(100% - 6px), transparent 100%);
  scrollbar-width: thin; scrollbar-color: rgba(201, 165, 90, 0.45) transparent;
  cursor: default;
}
#tb-body::-webkit-scrollbar, #tb-choices::-webkit-scrollbar, .mv-tip::-webkit-scrollbar { width: 6px; }
#tb-body::-webkit-scrollbar-thumb, #tb-choices::-webkit-scrollbar-thumb { background: rgba(201, 165, 90, 0.4); border-radius: 3px; }
#tb-body::-webkit-scrollbar-track, #tb-choices::-webkit-scrollbar-track { background: transparent; }

#tb-body .para {
  margin: 0 0 0.3em;
  opacity: 0; transform: translateY(7px); filter: blur(3px);
}
#tb-body .para:last-child { margin-bottom: 0; }
#tb-body .para.in { animation: para-in 0.75s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
#tb-body .para.in.quick { animation-duration: 0.3s; }
/* .done：出し終えた段落（ui.js がアニメの長さの後に付ける）。描画の止まる環境（背景タブ・ヘッドレスの
   仮想時間）でアニメが進まなくても、出した段落は必ず見えるように */
#tb-body .para.in.instant, #tb-body .para.in.done { animation: none; opacity: 1; transform: none; filter: none; }
@keyframes para-in { to { opacity: 1; transform: none; filter: blur(0); } }

/* 本文中の装飾（シーン担当が使えるクラス） */
#game em { font-style: normal; color: var(--brass-hi); }
#tb-body b, #tb-body strong, .en-page b { font-weight: 800; color: var(--text-hi); }
#tb-body .red, .en-page .red { color: var(--danger-hi); }
#tb-body .echo, #tb-body .blue, .en-page .echo { color: var(--echo); text-shadow: 0 0 8px rgba(111, 211, 224, 0.45); }
#tb-body .gold, .en-page .gold { color: #f0d27a; }
#tb-body .dim, .en-page .dim { color: var(--ash); }
#tb-body .item { color: var(--parch); border-bottom: 1px dotted rgba(216, 199, 160, 0.6); }
#tb-body .small { font-size: 0.84em; }
#tb-body .big { font-size: 1.28em; letter-spacing: 0.08em; }
#tb-body .whisper { color: var(--ash-hi); font-size: 0.92em; letter-spacing: 0.12em; }
#tb-body .center { display: block; text-align: center; }
#tb-body hr { border: 0; height: 1px; margin: 0.6em 18%; background: linear-gradient(90deg, transparent, var(--line), transparent); }

/* 台詞行：顔｜［名札］「台詞……」。名札は台詞の 1 行目の頭に載せる（名札だけの行を作らない。§15.2）。
   顔は 1 行ぶん（33px）の高さしか場所を取らない（下にはみ出す分は段落の間に収まる）ので、1 行の台詞も 1 行で済む */
#tb-body .para.line { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; align-items: start; }
#tb-body .para.line.noface { grid-template-columns: minmax(0, 1fr); }
#tb-body .line .face {
  width: 36px; height: 36px; margin: 0 0 -3px;
  border: 1px solid rgba(201, 165, 90, 0.6);
  background: radial-gradient(circle at 50% 35%, #313a58, #10131d);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
#tb-body .line .face canvas { display: block; width: 100%; height: 100%; }
#tb-body .line .lbody { display: block; min-width: 0; }
#tb-body .line .who {
  display: inline-block; max-width: 100%; vertical-align: -0.15em;   /* 名札の中心を本文の字の中心に揃える */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-ui); font-size: 13px; line-height: 21px; letter-spacing: 0.1em;
  color: var(--brass-hi);
  padding: 0 12px 0 8px; margin: 0 10px 0 0;
  border-left: 2px solid var(--brass);
  background: linear-gradient(90deg, rgba(201, 165, 90, 0.28), rgba(201, 165, 90, 0));
  text-shadow: 0 0 6px rgba(236, 212, 148, 0.35);
}
#tb-body .line .say { display: inline; color: #f6eedb; }

/* 文章送りの印・スクロールの印 */
.tb-more {
  position: absolute; left: calc(100% - 494px); bottom: 12px; width: 12px; height: 10px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
#textbox.no-choices .tb-more { left: auto; right: 30px; }
.tb-more.on { opacity: 1; }
.tb-more i {
  display: block; width: 0; height: 0; margin: auto;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--brass-hi);
  filter: drop-shadow(0 0 4px rgba(236, 212, 148, 0.8));
  animation: more-bob 0.9s ease-in-out infinite;
}
@keyframes more-bob { 50% { transform: translateY(3px); opacity: 0.6; } }
/* 頁の最後まで出た：▼ が点滅して次の頁を待つ（§15.2） */
.tb-more.page { width: 14px; height: 12px; bottom: 10px; }
.tb-more.page i {
  border-left-width: 7px; border-right-width: 7px; border-top: 10px solid var(--brass-hi);
  animation: more-blink 1.1s ease-in-out infinite;
}
@keyframes more-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.12; } }
/* 頁番号（頁が 2 つ以上のとき、本文の列の右上） */
.tb-page {
  position: absolute; top: -12px; right: 466px; z-index: 2;
  font-family: var(--font-ui); font-size: 11px; line-height: 1; letter-spacing: 0.14em;
  color: var(--brass);
  padding: 4px 9px 3px;
  background: linear-gradient(180deg, rgba(30, 34, 50, 0.97), rgba(14, 16, 25, 0.97));
  border: 1px solid rgba(201, 165, 90, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.tb-page.on { opacity: 1; }
#textbox.no-choices .tb-page { right: 30px; }
/* 続きが下／上にある印（opacity は .on だけで決める。アニメは位置だけ） */
.tb-scroll {
  position: absolute; left: calc(100% - 500px); bottom: 6px;
  font-family: var(--font-ui); font-size: 10px; line-height: 1; color: var(--brass);
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.tb-scroll.up { bottom: auto; top: 8px; }
#textbox.no-choices .tb-scroll { left: auto; right: 34px; }
.tb-scroll.on { opacity: 0.85; animation: scroll-bob 1.4s ease-in-out infinite; }
.tb-scroll.up.on { animation-name: scroll-bob-up; }
@keyframes scroll-bob { 50% { transform: translateY(3px); } }
@keyframes scroll-bob-up { 50% { transform: translateY(-3px); } }

/* =====================================================================
   選択肢
   ===================================================================== */
#tb-choices {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  overflow-y: auto; overflow-x: hidden;
  margin-left: 12px; padding: 2px 4px 2px 20px;
  border-left: 1px solid transparent;
  border-image: linear-gradient(180deg, transparent, rgba(201, 165, 90, 0.5) 20%, rgba(201, 165, 90, 0.5) 80%, transparent) 1;
  scrollbar-width: thin; scrollbar-color: rgba(201, 165, 90, 0.45) transparent;
}
#tb-choices.many { justify-content: flex-start; gap: 2px; padding-top: 0; padding-bottom: 0; }
.choice {
  -webkit-appearance: none; appearance: none;
  position: relative; flex: none;
  display: grid; grid-template-columns: 22px 18px minmax(0, 1fr) auto; align-items: center; column-gap: 9px;
  width: 100%; min-height: 31px; padding: 4px 10px 4px 6px;
  text-align: left;
  font-family: var(--font-ui); font-size: 15.5px; line-height: 1.35; letter-spacing: 0.02em;
  color: var(--text);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 75%);
  border: 0; border-left: 2px solid rgba(201, 165, 90, 0.18);
  cursor: pointer;
  opacity: 0; transform: translateX(12px);
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
#tb-choices.many .choice { min-height: 26px; padding-top: 1px; padding-bottom: 1px; font-size: 14.5px; }
#tb-choices.lots { gap: 1px; }
#tb-choices.lots .choice { min-height: 23px; font-size: 14px; line-height: 1.25; }
#tb-choices.lots .choice .c-num { width: 19px; height: 19px; }
/* 選択肢がまだ下にある印 */
.tb-cmore {
  position: absolute; right: 26px; bottom: 3px;
  font-family: var(--font-ui); font-size: 10px; line-height: 1; color: var(--brass-hi);
  padding: 1px 6px; background: rgba(12, 14, 22, 0.9); border: 1px solid rgba(201, 165, 90, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.tb-cmore.on { opacity: 0.95; animation: scroll-bob 1.4s ease-in-out infinite; }
#tb-choices.many .choice.disabled .c-tags { display: none; }
#tb-choices.many .choice .c-reason {
  grid-column: 4; grid-row: 1; max-width: 190px; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#tb-choices.shown .choice { animation: choice-in 0.38s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes choice-in { to { opacity: 1; transform: none; } }
/* 出し終えた選択肢（ui.js が付ける。描画が止まる環境でも見えるように。段落の .done と同じ） */
#tb-choices.shown.settled .choice { animation: none; opacity: 1; transform: none; }
/* 最後の頁までは選択肢の代わりに薄い「……」（§15.2）。選択肢は消しておく（押せない・数字も効かない） */
.tb-wait { display: none; }
#tb-choices.waiting .choice { display: none; }
#tb-choices.waiting {
  justify-content: center;
}
#tb-choices.waiting .tb-wait {
  display: block; align-self: center;
  font-family: var(--font-ui); font-size: 20px; line-height: 1; letter-spacing: 0.35em;
  color: var(--brass-dim); opacity: 0.6; text-shadow: none;
  padding: 10px 24px; cursor: pointer;
  animation: wait-breathe 2.4s ease-in-out infinite;
}
@keyframes wait-breathe { 50% { opacity: 0.3; } }
.choice .c-num {
  width: 21px; height: 21px; display: grid; place-items: center;
  font-size: 12px; line-height: 1; color: var(--brass-hi);
  border: 1px solid rgba(201, 165, 90, 0.55);
  background: rgba(10, 12, 19, 0.85);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.choice .c-icon { display: grid; place-items: center; width: 18px; height: 18px; color: var(--brass-dim); }
.choice .c-icon svg { width: 15px; height: 15px; display: block; }
.choice.kind-skill .c-icon { color: var(--echo); }
.choice.kind-battle .c-icon { color: var(--danger-hi); }
.choice.kind-move .c-icon, .choice.kind-map .c-icon { color: var(--parch); }
.choice.kind-rest .c-icon { color: #a9bff0; }
.choice.kind-shop .c-icon { color: #f0d27a; }
.choice.kind-end .c-icon, .choice.kind-hanoi .c-icon { color: var(--brass-hi); }
.choice .c-label { min-width: 0; overflow-wrap: anywhere; }
.choice .c-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.choice .c-reason {
  grid-column: 3 / 5; font-size: 12px; line-height: 1.3; color: #c98f84; letter-spacing: 0.03em;
  text-shadow: none;
}
.choice .c-reason::before { content: '― '; opacity: 0.7; }
.tag {
  font-size: 12px; line-height: 1; white-space: nowrap;
  padding: 3px 6px 2px; border: 1px solid; border-radius: 2px;
  text-shadow: none;
}
.tag-skill { color: var(--echo); border-color: rgba(111, 211, 224, 0.5); background: rgba(111, 211, 224, 0.09); }
.tag-need { color: var(--brass-hi); border-color: rgba(201, 165, 90, 0.55); background: rgba(201, 165, 90, 0.09); }
.tag-time { color: var(--ash-hi); border-color: rgba(138, 143, 154, 0.45); background: rgba(138, 143, 154, 0.08); }
.tag-gold { color: #f0d27a; border-color: rgba(240, 210, 122, 0.45); background: rgba(240, 210, 122, 0.08); }
.tag-danger { color: var(--danger-hi); border-color: rgba(224, 104, 94, 0.5); background: rgba(184, 65, 58, 0.12); }
.tag-misc { color: var(--parch); border-color: rgba(216, 199, 160, 0.35); background: rgba(216, 199, 160, 0.06); }

.choice::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 240, 200, 0.16) 50%, transparent 70%);
  background-size: 250% 100%; background-position: 120% 0;
}
.choice:hover, .choice.sel {
  color: var(--text-hi);
  border-left-color: var(--brass-hi);
  background: linear-gradient(90deg, rgba(201, 165, 90, 0.3), rgba(201, 165, 90, 0.06) 80%, rgba(201, 165, 90, 0));
}
.choice:hover::after, .choice.sel::after { opacity: 1; animation: shine 1.2s ease; }
@keyframes shine { from { background-position: 120% 0; } to { background-position: -30% 0; } }
.choice:hover .c-num, .choice.sel .c-num {
  background: var(--brass-hi); color: var(--ink); border-color: var(--brass-hi);
  box-shadow: 0 0 10px rgba(236, 212, 148, 0.7);
}
.choice.disabled { color: #7c808b; cursor: not-allowed; }
.choice.disabled .c-num { color: #6b6f7a; border-color: rgba(138, 143, 154, 0.3); background: rgba(10, 12, 19, 0.6); }
.choice.disabled .c-icon { color: #555a66; }
.choice.disabled .tag { filter: saturate(0.3); opacity: 0.7; }
.choice.disabled:hover, .choice.disabled.sel {
  color: #9296a0; border-left-color: rgba(138, 143, 154, 0.5);
  background: linear-gradient(90deg, rgba(138, 143, 154, 0.14), rgba(138, 143, 154, 0));
}
.choice.disabled:hover .c-num, .choice.disabled.sel .c-num { background: rgba(138, 143, 154, 0.3); color: #cfd2d8; box-shadow: none; border-color: transparent; }
.choice.disabled::after { display: none; }
.choice.nope { animation: nope 0.35s ease !important; opacity: 1; transform: none; }
@keyframes nope { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
#tb-choices.picked .choice { pointer-events: none; }
#tb-choices.picked .choice:not(.chosen) { opacity: 0.35 !important; transition: opacity 0.2s; }
.choice.chosen { color: #fff; background: linear-gradient(90deg, rgba(236, 212, 148, 0.5), rgba(236, 212, 148, 0.08)); }

/* =====================================================================
   トースト
   ===================================================================== */
#toasts {
  position: absolute; top: 52px; right: 16px; width: 380px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  pointer-events: none;
}
.toast {
  pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  max-width: 380px; padding: 8px 16px 8px 12px;
  font-family: var(--font-ui); font-size: 14px; line-height: 1.4; color: var(--text);
  background: linear-gradient(90deg, rgba(14, 17, 27, 0.94), rgba(22, 26, 40, 0.9));
  border: 1px solid rgba(201, 165, 90, 0.35);
  border-left: 3px solid var(--ash);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateX(30px);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
  text-shadow: 0 1px 2px #000;
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateX(20px); }
.toast .t-icon { flex: none; width: 16px; height: 16px; color: var(--ash-hi); }
.toast .t-icon svg { display: block; width: 16px; height: 16px; }
.toast b { font-weight: normal; color: var(--text-hi); }
.toast.t-good { border-left-color: var(--good); }
.toast.t-good .t-icon { color: var(--good); }
.toast.t-bad { border-left-color: var(--danger-hi); }
.toast.t-bad .t-icon { color: var(--danger-hi); }
.toast.t-item { border-left-color: var(--brass-hi); }
.toast.t-item .t-icon { color: var(--brass-hi); }
.toast.t-spark {
  border-left-color: #ffe27a; border-color: rgba(255, 226, 122, 0.6);
  background: linear-gradient(90deg, rgba(58, 48, 20, 0.95), rgba(22, 24, 36, 0.92));
  box-shadow: 0 0 22px rgba(255, 220, 120, 0.35), 0 6px 18px rgba(0, 0, 0, 0.5);
  color: #fff4cc;
}
.toast.t-spark .t-icon { color: #ffe27a; filter: drop-shadow(0 0 5px rgba(255, 226, 122, 0.9)); }
.toast.t-spark.in { animation: spark-toast 0.9s ease; }
@keyframes spark-toast { 15% { box-shadow: 0 0 40px rgba(255, 236, 160, 0.9); } }

/* =====================================================================
   オーバーレイ：ダイス・確認・バナー
   ===================================================================== */
#overlay { pointer-events: none; }
.ov-dice, .ov-confirm {
  position: absolute; inset: 0; pointer-events: auto;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.62));
  opacity: 0; transition: opacity 0.22s ease;
}
.ov-dice.in, .ov-confirm.in { opacity: 1; }
.ov-dice.out, .ov-confirm.out { opacity: 0; }

.dice-panel {
  width: 540px; padding: 22px 30px 20px; margin-top: -40px;
  text-align: center;
  transform: translateY(10px) scale(0.97); transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.ov-dice.in .dice-panel { transform: none; }
.dice-title { font-family: var(--font-body); font-weight: 600; font-size: 24px; letter-spacing: 0.3em; color: var(--brass-hi); text-shadow: 0 0 12px rgba(236, 212, 148, 0.35); padding-left: 0.3em; }
.dice-title span { color: var(--text-hi); }
.dice-label { margin-top: 4px; font-size: 14px; color: var(--ash-hi); letter-spacing: 0.08em; }
.dice-label::before, .dice-label::after { content: '「'; color: var(--brass-dim); }
.dice-label::after { content: '」'; }
.dice-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0 8px; height: 90px; }
.die-wrap { width: 68px; height: 68px; animation: die-tumble 0.98s cubic-bezier(0.25, 0.6, 0.35, 1) both; }
.die-wrap.d2 { animation-name: die-tumble2; }
.die { display: block; width: 68px; height: 68px; image-rendering: pixelated; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.6)); }
.ov-dice.landed .die-wrap { animation: die-land 0.3s ease both; }
@keyframes die-tumble {
  0% { transform: translate(-150px, -60px) rotate(-270deg); }
  45% { transform: translate(-20px, 8px) rotate(-60deg); }
  65% { transform: translate(6px, -14px) rotate(20deg); }
  82% { transform: translate(0, 4px) rotate(-8deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes die-tumble2 {
  0% { transform: translate(120px, -80px) rotate(300deg); }
  45% { transform: translate(18px, 10px) rotate(80deg); }
  65% { transform: translate(-6px, -12px) rotate(-24deg); }
  82% { transform: translate(0, 3px) rotate(10deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes die-land { 0% { transform: translateY(0) scale(1.08, 0.92); } 60% { transform: translateY(-4px) scale(0.97, 1.03); } 100% { transform: none; } }
.dice-op { font-family: var(--font-body); font-size: 26px; color: var(--brass); margin: 0 2px; }
.dice-val, .dice-total {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 78px; height: 72px; padding: 0 8px;
  border: 1px solid rgba(201, 165, 90, 0.45); background: rgba(0, 0, 0, 0.35);
}
.dice-val small, .dice-total small { font-family: var(--font-ui); font-size: 11px; color: var(--ash); letter-spacing: 0.1em; }
.dice-val b, .dice-total b { font-family: var(--font-ui); font-weight: normal; font-size: 30px; line-height: 1.1; color: var(--text-hi); }
.dice-total { border-color: var(--brass); min-width: 88px; }
.ov-dice.landed .dice-total b { animation: pop 0.35s ease; color: var(--brass-hi); }
@keyframes pop { 40% { transform: scale(1.3); } }
.dice-foot { font-family: var(--font-ui); font-size: 14px; color: var(--ash-hi); letter-spacing: 0.08em; }
.dice-dc b { font-weight: normal; font-size: 18px; color: var(--text-hi); margin: 0 2px; }
.dice-res {
  height: 50px; margin-top: 8px;
  font-family: var(--font-body); font-weight: 800; font-size: 38px; letter-spacing: 0.5em; padding-left: 0.5em;
  opacity: 0; transform: scale(1.6); filter: blur(6px);
}
.dice-res span { display: inline-block; }
.ov-dice.done .dice-res { opacity: 1; transform: none; filter: none; transition: all 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.2); }
.ov-dice.ok .dice-res { color: var(--echo); text-shadow: 0 0 16px rgba(111, 211, 224, 0.85), 0 0 36px rgba(111, 211, 224, 0.4); }
.ov-dice.ng .dice-res { color: var(--danger-hi); text-shadow: 0 0 14px rgba(184, 65, 58, 0.8); }
.ov-dice.ng.done .dice-res span:last-child { animation: crack 0.5s ease 0.25s both; }
@keyframes crack { 30% { transform: translate(2px, 3px) rotate(4deg); } 100% { transform: translate(1px, 4px) rotate(6deg); } }
.ov-dice.ok.done .dice-panel { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 40px rgba(111, 211, 224, 0.25), 0 14px 36px rgba(0, 0, 0, 0.55); border-color: rgba(111, 211, 224, 0.6); }
.dice-note { height: 16px; font-family: var(--font-ui); font-size: 12px; color: var(--brass); letter-spacing: 0.2em; }

.cf-panel { min-width: 440px; max-width: 640px; padding: 26px 34px 22px; text-align: center; transform: scale(0.97); transition: transform 0.22s ease; }
.ov-confirm.in .cf-panel { transform: none; }
.cf-msg { font-family: var(--font-body); font-size: 19px; line-height: 1.8; color: var(--text-hi); margin-bottom: 20px; text-shadow: 0 1px 2px #000; }
.cf-btns { display: flex; gap: 16px; justify-content: center; }
.cf-btns .btn { min-width: 132px; }

.ov-banner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto; cursor: pointer; }
.bn-band {
  position: absolute; left: 0; right: 0; top: 50%; height: 250px; margin-top: -135px;
  background: linear-gradient(180deg, transparent, rgba(4, 5, 9, 0.72) 28%, rgba(4, 5, 9, 0.72) 72%, transparent);
  opacity: 0; transition: opacity 0.6s ease;
}
.bn-inner { position: relative; margin-top: -20px; text-align: center; }
.bn-line {
  width: 560px; height: 1px; margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--brass-hi) 30%, var(--brass-hi) 70%, transparent);
  box-shadow: 0 0 8px rgba(236, 212, 148, 0.6);
  transform: scaleX(0); transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.bn-line.b { width: 420px; }
.bn-text {
  padding: 14px 0 12px 0.34em;
  font-family: var(--font-body); font-weight: 600; font-size: 50px; line-height: 1.2; letter-spacing: 0.34em;
  color: var(--text-hi);
  text-shadow: 0 0 20px rgba(255, 220, 150, 0.35), 0 2px 4px #000;
  opacity: 0; filter: blur(8px); letter-spacing: 0.6em;
  transition: opacity 0.9s ease 0.15s, filter 0.9s ease 0.15s, letter-spacing 1.4s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.bn-sub {
  margin-top: 12px; padding-left: 0.3em;
  font-family: var(--font-body); font-size: 18px; letter-spacing: 0.3em; color: var(--parch);
  opacity: 0; transition: opacity 0.6s ease 0.3s;
  text-shadow: 0 1px 3px #000;
}
/* 絆の段階の帯のハート（G.UI.banner が sub を ♥/♡ だけと見たら .hearts を付ける） */
.bn-sub.hearts { margin-top: 10px; padding-left: 0.28em; font-size: 30px; line-height: 1; letter-spacing: 0.28em; transition-delay: 0.2s; }
.bn-sub.hearts .on { color: #f08aa6; text-shadow: 0 0 12px rgba(240, 138, 166, 0.75), 0 1px 3px #000; }
.bn-sub.hearts .off { color: rgba(216, 199, 160, 0.55); }
.ov-banner.in .bn-band { opacity: 1; }
.ov-banner.in .bn-line { transform: scaleX(1); }
.ov-banner.in .bn-text { opacity: 1; filter: blur(0); letter-spacing: 0.34em; }
.ov-banner.in .bn-sub { opacity: 1; }
.ov-banner.out .bn-band, .ov-banner.out .bn-text, .ov-banner.out .bn-sub { opacity: 0; transition: opacity 0.6s ease; }
.ov-banner.out .bn-line { transform: scaleX(0); opacity: 0; transition: transform 0.6s ease, opacity 0.6s; }

/* ---------- 暗転 ---------- */
#fade {
  position: absolute; inset: 0; background: #000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
}
#fade.on { opacity: 1; pointer-events: auto; }

/* =====================================================================
   地点マップ（羊皮紙）
   ===================================================================== */
#mapview { overflow: hidden; }
.mv-dim {
  position: absolute; left: 0; right: 0; top: 40px; bottom: 0;
  background: radial-gradient(ellipse at 50% 52%, rgba(0, 0, 0, 0.1) 35%, rgba(0, 0, 0, 0.62) 100%);
}
.mv-panel {
  position: absolute; left: 50%; top: 66px; width: 1008px; height: 628px; margin-left: -504px;
}
.mv-panel.enter { animation: mv-in 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
@keyframes mv-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
.mv-frame {
  position: absolute; inset: 0;
  padding: 14px 14px 0;
  background: linear-gradient(180deg, rgba(34, 26, 18, 0.94), rgba(20, 15, 10, 0.95));
  border: 1px solid var(--line);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 4px #120d08, inset 0 0 0 5px rgba(201, 165, 90, 0.35), 0 20px 50px rgba(0, 0, 0, 0.7);
}
.mv-parch {
  position: relative; width: 978px; height: 544px; overflow: hidden;
  background-color: #d9c79c;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .33 0 0 0 0 .22 0 0 0 0 .1 0 0 0 .5 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='400'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .28 0 0 0 0 .1 0 0 0 1.1 -.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E"),
    linear-gradient(90deg, transparent 49.6%, rgba(92, 62, 26, 0.16) 50%, rgba(255, 250, 230, 0.2) 50.25%, transparent 50.7%),
    linear-gradient(180deg, transparent 49.4%, rgba(92, 62, 26, 0.13) 50%, rgba(255, 250, 230, 0.18) 50.3%, transparent 50.9%),
    radial-gradient(ellipse at 30% 25%, rgba(255, 247, 222, 0.6), transparent 55%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(110, 72, 28, 0.42) 100%);
  background-size: 220px 220px, 978px 544px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  box-shadow: inset 0 0 46px rgba(88, 55, 18, 0.6), inset 0 0 8px rgba(50, 30, 10, 0.85);
  color: var(--sepia);
}
.mv-deco {
  position: absolute; inset: 22px; pointer-events: none;
  border: 1px solid rgba(70, 45, 20, 0.35);
  box-shadow: inset 0 0 0 4px rgba(217, 199, 156, 0), inset 0 0 0 5px rgba(70, 45, 20, 0.2);
}
.mv-compass { position: absolute; right: 34px; bottom: 30px; width: 96px; height: 96px; color: rgba(70, 45, 20, 0.35); pointer-events: none; }
.mv-compass svg { width: 100%; height: 100%; }
.mv-compass.dim { opacity: 0.35; }
.mv-links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.mv-links path { fill: none; stroke-linecap: round; }
.mv-links .lk-shadow { stroke: rgba(255, 248, 228, 0.35); stroke-width: 6; }
.mv-links .lk-shadow.lk-locked { stroke: rgba(255, 248, 228, 0.25); }
.mv-links .lk { stroke: rgba(62, 40, 18, 0.72); stroke-width: 2.6; stroke-dasharray: 1 0; }
.mv-links .lk.lk-trod { stroke: rgba(52, 32, 14, 0.9); stroke-width: 3; }
.mv-links .lk.lk-faint { stroke: rgba(62, 40, 18, 0.45); stroke-width: 2.2; stroke-dasharray: 1 7; }
.mv-links .lk.lk-locked { stroke: rgba(128, 40, 26, 0.75); stroke-width: 2.4; stroke-dasharray: 9 7; }
.mv-links .lk.lk-open { stroke: rgba(52, 32, 14, 0.95); stroke-width: 3.2; }
.mv-links .lk.hl { stroke: #8a5a14; stroke-width: 4.4; filter: drop-shadow(0 0 3px rgba(255, 215, 120, 0.9)); stroke-dasharray: 1 0; }
.mv-nodes { position: absolute; inset: 0; }
.mv-lock { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 2px; border-radius: 50%; background: rgba(233, 216, 176, 0.92); box-shadow: 0 0 0 1px rgba(107, 42, 30, 0.6); }
.mv-lock svg { display: block; width: 100%; height: 100%; }

.mv-node {
  -webkit-appearance: none; appearance: none;
  position: absolute; width: 48px; height: 48px; margin: -24px 0 0 -24px; padding: 0;
  border: 0; background: none; cursor: default;
  color: var(--sepia);
}
.mv-node .mv-disc {
  position: absolute; inset: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #f6ebcc, #d2bc8a 70%, #bfa570);
  border: 2px solid rgba(58, 38, 18, 0.85);
  box-shadow: 0 2px 0 rgba(58, 38, 18, 0.35), 0 4px 8px rgba(40, 25, 8, 0.35), inset 0 0 0 2px rgba(255, 250, 235, 0.5);
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.3, 1.4), box-shadow 0.18s, background 0.18s;
}
.mv-node .mv-disc svg { width: 26px; height: 26px; display: block; }
.mv-node.is-visited .mv-disc {
  background: radial-gradient(circle at 40% 35%, #5b4125, #3a2814 75%);
  color: #f0e0bb; border-color: #2a1c0c;
  box-shadow: 0 2px 0 rgba(40, 25, 8, 0.4), 0 4px 8px rgba(40, 25, 8, 0.4), inset 0 0 0 2px rgba(240, 220, 170, 0.25);
}
.mv-node.is-unknown .mv-disc {
  background: rgba(230, 214, 176, 0.55); border: 2px dashed rgba(58, 38, 18, 0.55);
  box-shadow: none;
}
.mv-node .mv-q { font-family: var(--font-body); font-weight: 800; font-size: 22px; color: rgba(58, 38, 18, 0.7); }
.mv-node.ic-boss .mv-disc { color: #7a1c14; border-color: #6b1a12; }
.mv-node.ic-boss.is-visited .mv-disc { color: #ffb4a0; background: radial-gradient(circle at 40% 35%, #6a2618, #3c120b 75%); }
.mv-node.ic-echo .mv-disc { color: #1d6a74; }
.mv-node.ic-echo.is-visited .mv-disc { color: #9ff0fa; }
.mv-node.ic-treasure .mv-disc { color: #7a5410; }
.mv-node.ic-treasure.is-visited .mv-disc { color: #ffd98a; }
.mv-node.is-reach, .mv-node.is-current, .mv-node.is-locked { cursor: pointer; }
.mv-node.is-reach::before {
  content: ''; position: absolute; inset: -7px; border-radius: 50%;
  border: 2px dotted rgba(138, 90, 20, 0.75);
  animation: reach-spin 14s linear infinite;
}
@keyframes reach-spin { to { transform: rotate(360deg); } }
.mv-node.is-reach:hover .mv-disc, .mv-node.is-reach.is-focus .mv-disc, .mv-node.is-current:hover .mv-disc, .mv-node.is-current.is-focus .mv-disc {
  transform: scale(1.14);
  box-shadow: 0 0 0 3px rgba(255, 226, 150, 0.9), 0 0 18px 4px rgba(255, 200, 90, 0.75), 0 6px 10px rgba(40, 25, 8, 0.4);
}
.mv-node.is-locked:hover .mv-disc, .mv-node.is-locked.is-focus .mv-disc { box-shadow: 0 0 0 3px rgba(160, 50, 35, 0.6), 0 4px 8px rgba(40, 25, 8, 0.35); }
.mv-node.is-current .mv-disc { box-shadow: 0 0 0 3px rgba(111, 211, 224, 0.95), 0 0 16px 4px rgba(111, 211, 224, 0.6), 0 4px 8px rgba(40, 25, 8, 0.4); }
.mv-node.is-current::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(111, 211, 224, 0.9);
  animation: here-pulse 1.8s ease-out infinite;
}
@keyframes here-pulse { from { transform: scale(1); opacity: 0.95; } to { transform: scale(1.9); opacity: 0; } }
.mv-node.is-target .mv-disc { transform: scale(1.14); box-shadow: 0 0 0 3px rgba(255, 226, 150, 0.95), 0 0 22px 6px rgba(255, 200, 90, 0.8); }
.mv-node.nope { animation: nope 0.35s ease; }
.mv-name {
  position: absolute; left: 50%; top: 100%; margin-top: 5px; transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-body); font-weight: 600; font-size: 14px; letter-spacing: 0.06em; line-height: 1.2;
  color: #2c1d0c;
  padding: 1px 9px;
  /* 道の線が名前を横切っても読めるよう、羊皮紙色の淡い下地を敷く */
  background: linear-gradient(90deg, rgba(228, 212, 172, 0), rgba(228, 212, 172, 0.86) 14%, rgba(228, 212, 172, 0.86) 86%, rgba(228, 212, 172, 0));
  text-shadow: 0 0 3px #efe3c2, 0 0 6px #efe3c2, 0 0 2px #efe3c2;
  pointer-events: none;
}
.mv-node.label-up .mv-name { top: auto; bottom: 100%; margin: 0 0 5px; }
.mv-node.label-right .mv-name { left: 100%; top: 50%; margin: 0 0 0 4px; transform: translateY(-50%); }
.mv-node.label-left .mv-name { left: auto; right: 100%; top: 50%; margin: 0 4px 0 0; transform: translateY(-50%); }
.mv-node.is-unknown .mv-name { display: none; }
.mv-node.is-current .mv-name { color: #0f4f58; }
.mv-token {
  position: absolute; width: 0; height: 0; pointer-events: none; z-index: 3;
}
.mv-token i {
  position: absolute; left: -9px; top: -52px; width: 18px; height: 24px;
  background: radial-gradient(circle at 50% 40%, #fffbe6 0 22%, #ffd36a 40%, rgba(255, 180, 60, 0) 72%);
  filter: drop-shadow(0 0 6px rgba(255, 200, 90, 0.9));
  animation: token-bob 1.6s ease-in-out infinite;
}
.mv-token i::after {
  content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -5px;
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid #8a5a14;
}
.mv-token.walking i { animation: none; top: -46px; }
@keyframes token-bob { 50% { transform: translateY(-4px); } }

.mv-title {
  position: absolute; left: 50%; top: -1px; transform: translate(-50%, -50%);
  padding: 7px 44px 7px calc(44px + 0.3em);
  font-family: var(--font-body); font-weight: 600; font-size: 21px; letter-spacing: 0.3em;
  color: var(--brass-hi); white-space: nowrap;
  background: linear-gradient(180deg, #2a2016, #16100a);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 0 0 3px #120d08, inset 0 0 0 4px rgba(201, 165, 90, 0.25);
  text-shadow: 0 0 12px rgba(236, 212, 148, 0.4);
  z-index: 4;
}
.mv-title::before, .mv-title::after {
  content: ''; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -4px;
  background: var(--brass-hi); transform: rotate(45deg);
}
.mv-title::before { left: 16px; }
.mv-title::after { right: 16px; }
.mv-foot {
  position: absolute; left: 14px; right: 14px; bottom: 0; height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.mv-info { display: flex; align-items: center; gap: 18px; font-family: var(--font-ui); font-size: 13px; color: var(--ash-hi); }
.mv-leg { display: flex; align-items: center; gap: 6px; }
.mv-leg i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid; }
.mv-leg .lg-cur { border-color: var(--echo); box-shadow: 0 0 6px var(--echo); background: #d6c49b; }
.mv-leg .lg-vis { border-color: #1a1008; background: #4a3420; }
.mv-leg .lg-unk { border-style: dashed; border-color: rgba(216, 199, 160, 0.7); }
.mv-hint { color: var(--parch); margin-left: 6px; }
.mv-btns { display: flex; gap: 12px; }

.mv-tip {
  position: absolute; left: 0; top: 0; width: 250px; z-index: 6;
  padding: 11px 15px 11px;
  pointer-events: none;
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.mv-tip.on { opacity: 1; transform: none; }
.mv-tip .tp-name { font-family: var(--font-body); font-weight: 600; font-size: 17px; color: var(--text-hi); letter-spacing: 0.06em; }
.mv-tip .tp-kind { font-family: var(--font-ui); font-size: 11px; color: var(--brass); letter-spacing: 0.14em; margin-top: 1px; }
.mv-tip .tp-desc { font-family: var(--font-body); font-size: 14px; line-height: 1.6; color: var(--text); margin-top: 6px; }
.mv-tip .tp-status { font-family: var(--font-ui); font-size: 13px; color: var(--ash-hi); margin-top: 7px; }
.mv-tip.locked .tp-status { color: var(--danger-hi); }
.mv-tip.cur .tp-status { color: var(--echo); }
.mv-tip .tp-act { font-family: var(--font-ui); font-size: 12px; color: var(--brass-hi); margin-top: 4px; }
.mv-tip .tp-act::before { content: '▶ '; font-size: 9px; vertical-align: 1px; }

/* =====================================================================
   タイトル層（タイトル・主人公作成・エンディング・ゲームオーバー）
   ===================================================================== */
#title { overflow: hidden; }
.tt-screen { position: absolute; inset: 0; animation: tt-in 0.9s ease both; }
@keyframes tt-in { from { opacity: 0; } }
.tt-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 28%, rgba(0, 0, 0, 0) 52%, rgba(3, 4, 8, 0.72) 100%);
}
.tt-shade.deep { background: radial-gradient(ellipse at 50% 50%, rgba(3, 4, 8, 0.45), rgba(3, 4, 8, 0.82)); }
.tt-halo {
  position: absolute; left: 50%; top: 190px; width: 900px; height: 300px; margin: -150px 0 0 -450px; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 214, 150, 0.14), rgba(255, 214, 150, 0) 65%);
  animation: halo 6s ease-in-out infinite;
}
@keyframes halo { 50% { opacity: 0.55; transform: scale(1.06); } }

/* ロゴ */
.tt-logo { position: absolute; left: 0; right: 0; top: 96px; text-align: center; }
.tt-pre {
  font-family: var(--font-body); font-size: 13px; letter-spacing: 0.72em; padding-left: 0.72em;
  color: rgba(216, 199, 160, 0.75);
  animation: logo-in 2.2s ease 0.2s both;
}
.tt-logo h1 {
  margin: 10px 0 0; padding-left: 0.18em;
  font-family: var(--font-body); font-weight: 800; font-size: 92px; line-height: 1.12; letter-spacing: 0.18em;
  background: linear-gradient(180deg, #fff8e2 0%, #f1dca0 38%, #c99a48 72%, #8c6428 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 196, 110, 0.32)) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.9));
  animation: logo-in 2.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@keyframes logo-in { from { opacity: 0; letter-spacing: 0.34em; filter: blur(10px); } }
.tt-sub {
  display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 16px;
  font-family: var(--font-body); font-weight: 600; font-size: 22px; letter-spacing: 0.46em;
  color: var(--parch); text-shadow: 0 1px 4px #000, 0 0 14px rgba(0, 0, 0, 0.8);
  animation: logo-in 2.2s ease 0.7s both;
}
.tt-sub span {
  padding: 2px 0.4em 2px calc(0.46em + 0.4em);
  /* 背景の塔の尖塔が文字に重なっても読めるよう、淡い墨の帯を敷く */
  background: radial-gradient(ellipse 60% 70% at 50% 50%, rgba(6, 7, 14, 0.62), rgba(6, 7, 14, 0) 100%);
}
.tt-sub i { display: block; width: 130px; height: 1px; background: linear-gradient(90deg, transparent, var(--brass-hi)); position: relative; }
.tt-sub i:last-child { transform: scaleX(-1); }
.tt-sub i::after { content: ''; position: absolute; right: -3px; top: -3px; width: 6px; height: 6px; background: var(--brass-hi); transform: rotate(45deg); }

/* タイトルのメニュー */
.tt-menu {
  position: absolute; left: 50%; top: 432px; width: 360px; margin-left: -180px;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  animation: logo-in 1.4s ease 1.1s both;
}
.vm-item {
  -webkit-appearance: none; appearance: none;
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 7px 20px; border: 0; background: none; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 21px; letter-spacing: 0.32em;
  color: rgba(235, 226, 204, 0.72);
  isolation: isolate;
  text-shadow: 0 1px 3px #000, 0 0 12px rgba(0, 0, 0, 0.9);
  transition: color 0.2s;
}
.vm-item .vm-label { padding-left: 0.32em; }
.vm-item .vm-sub { font-family: var(--font-ui); font-size: 11px; letter-spacing: 0.2em; color: var(--ash); margin-top: 1px; }
.vm-item::before {
  content: ''; position: absolute; inset: 2px 0; z-index: -1; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(201, 165, 90, 0.26) 30%, rgba(201, 165, 90, 0.26) 70%, transparent);
  border-top: 1px solid transparent; border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(236, 212, 148, 0.6), transparent) 1;
  transition: opacity 0.2s;
}
.vm-item.sel { color: var(--text-hi); text-shadow: 0 0 14px rgba(255, 214, 140, 0.7), 0 1px 3px #000; }
.vm-item.sel::before { opacity: 1; }
.vm-item.sel .vm-label::before, .vm-item.sel .vm-label::after {
  content: ''; display: inline-block; width: 7px; height: 7px; margin: 0 18px; vertical-align: 5px;
  background: var(--brass-hi); transform: rotate(45deg); box-shadow: 0 0 8px rgba(236, 212, 148, 0.9);
}
.vm-item.disabled { color: rgba(138, 143, 154, 0.45); cursor: default; }
.vm-item.ng { color: rgba(236, 212, 148, 0.8); }
.tt-hint, .tt-credit {
  position: absolute; bottom: 18px;
  font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.14em; color: rgba(216, 199, 160, 0.6);
  text-shadow: 0 1px 2px #000;
}
.tt-hint { left: 26px; }
.tt-credit { right: 26px; color: rgba(216, 199, 160, 0.8); }

/* 記録の選択パネル */
.sl-wrap {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 5;
  background: rgba(3, 4, 8, 0.74);
  opacity: 0; transition: opacity 0.22s;
}
.sl-wrap.in { opacity: 1; }
.sl-wrap.out { opacity: 0; }
.sl-panel { width: 760px; padding: 20px 26px 16px; background: linear-gradient(180deg, rgba(24, 29, 46, 0.97), rgba(12, 14, 22, 0.98)); }
.sl-head { text-align: center; font-family: var(--font-body); font-weight: 600; font-size: 20px; letter-spacing: 0.4em; color: var(--brass-hi); margin-bottom: 14px; }
.sl-list { display: flex; flex-direction: column; gap: 6px; }
.sl-list .vm-item.sl-row {
  display: grid; grid-template-columns: 84px 110px 170px minmax(0, 1fr) 128px; align-items: center; column-gap: 12px;
  padding: 10px 14px; text-align: left;
  font-family: var(--font-ui); font-size: 14px; letter-spacing: 0.04em; font-weight: normal;
  color: var(--text); background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid rgba(201, 165, 90, 0.25);
}
.sl-list .vm-item.sl-row::before { inset: 0; }
.sl-slot { color: var(--brass-hi); }
.sl-hero { font-family: var(--font-body); font-weight: 600; font-size: 16px; color: var(--text-hi); }
.sl-day { color: var(--parch); }
.sl-place { color: var(--ash-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-time { color: var(--ash); font-size: 12px; text-align: right; }
.sl-none { grid-column: 2 / 6; color: rgba(138, 143, 154, 0.55); letter-spacing: 0.3em; }
.sl-list .vm-item.sl-row.sel { border-left-color: var(--brass-hi); }
.sl-list .vm-item.sl-row.sel .vm-label::before, .sl-list .vm-item.sl-row.sel .vm-label::after { display: none; }
.sl-list .vm-item.sl-back { margin-top: 6px; font-size: 17px; }
.sl-hint { margin-top: 12px; text-align: center; font-family: var(--font-ui); font-size: 11px; color: var(--ash); letter-spacing: 0.14em; }

/* ---------- 主人公作成 ---------- */
.cr-panel {
  position: absolute; left: 50%; top: 50%; width: 1100px; height: 628px; margin: -314px 0 0 -550px;
  display: flex; flex-direction: column;
  animation: tt-in 0.6s ease both;
}
.tt-create.leaving .cr-panel { opacity: 0; transform: scale(0.99); transition: opacity 0.35s, transform 0.35s; }
.cr-head {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 30px;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(201, 165, 90, 0.5) 15%, rgba(201, 165, 90, 0.5) 85%, transparent) 1;
}
.cr-title { font-family: var(--font-body); font-weight: 600; font-size: 22px; letter-spacing: 0.34em; color: var(--brass-hi); text-shadow: 0 0 12px rgba(236, 212, 148, 0.3); }
.cr-title small { font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.1em; color: var(--echo); margin-left: 14px; }
.cr-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; font-family: var(--font-ui); font-size: 13px; }
.cr-steps li { display: flex; align-items: center; gap: 6px; color: var(--ash); padding: 4px 10px; }
.cr-steps li + li::before { content: ''; width: 16px; height: 1px; background: rgba(138, 143, 154, 0.4); margin-right: 6px; }
.cr-steps li b { position: relative; isolation: isolate; display: grid; place-items: center; width: 22px; height: 22px; font-weight: normal; font-size: 11px; }
.cr-steps li b::before { content: ''; position: absolute; inset: 4px; z-index: -1; border: 1px solid rgba(138, 143, 154, 0.5); transform: rotate(45deg); }
.cr-steps li.done { color: var(--parch); }
.cr-steps li.done b { color: var(--brass-hi); }
.cr-steps li.done b::before { border-color: var(--brass); }
.cr-steps li.on { color: var(--text-hi); }
.cr-steps li.on b { color: var(--ink); }
.cr-steps li.on b::before { border-color: var(--brass-hi); background: var(--brass-hi); box-shadow: 0 0 10px rgba(236, 212, 148, 0.7); }
.cr-body { flex: 1; display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: 0; }
.cr-left {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  border-right: 1px solid transparent;
  border-image: linear-gradient(180deg, transparent, rgba(201, 165, 90, 0.4), transparent) 1;
}
.cr-stage {
  position: relative; width: 250px; height: 300px;
  display: flex; align-items: flex-end; justify-content: center;
  background: radial-gradient(ellipse at 50% 88%, rgba(255, 210, 140, 0.18), rgba(0, 0, 0, 0) 60%), rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(201, 165, 90, 0.3);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}
.cr-stage canvas { position: relative; z-index: 2; display: block; width: 192px; height: 208px; margin-bottom: 26px; image-rendering: pixelated; }
.cr-light {
  position: absolute; left: 50%; top: 0; width: 160px; height: 100%; margin-left: -80px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 236, 190, 0.16), rgba(255, 236, 190, 0) 80%);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
}
.cr-plinth {
  position: absolute; left: 50%; bottom: 22px; width: 150px; height: 22px; margin-left: -75px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0) 70%);
}
.cr-stage.no-sprite::after {
  content: '姿'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -60%);
  font-family: var(--font-body); font-size: 64px; color: rgba(201, 165, 90, 0.18);
}
.cr-who { text-align: center; }
.cr-who-name { font-family: var(--font-body); font-weight: 800; font-size: 28px; letter-spacing: 0.2em; color: var(--text-hi); padding-left: 0.2em; min-height: 40px; }
.cr-who-origin { font-family: var(--font-ui); font-size: 13px; color: var(--parch); letter-spacing: 0.06em; }
.sep { margin: 0 7px; color: var(--brass-dim); }
i.el { display: inline-block; width: 9px; height: 9px; margin-right: 5px; vertical-align: 0; background: var(--c); transform: rotate(45deg); box-shadow: 0 0 6px var(--c); }
.cr-main { padding: 22px 36px 10px 38px; display: flex; flex-direction: column; min-height: 0; }
.cr-q h2 { margin: 0; font-family: var(--font-body); font-weight: 600; font-size: 24px; letter-spacing: 0.24em; color: var(--text-hi); }
.cr-q p { margin: 4px 0 18px; font-family: var(--font-body); font-size: 15px; color: var(--ash-hi); letter-spacing: 0.06em; }
.cr-content { flex: 1; min-height: 0; animation: tt-in 0.4s ease both; }
.cr-cards { display: grid; gap: 12px; }
.cr-cards.two { grid-template-columns: 1fr 1fr; max-width: 520px; }
.cr-cards.four { grid-template-columns: 1fr 1fr; }
.cr-card {
  -webkit-appearance: none; appearance: none;
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px;
  padding: 12px 18px; text-align: left; cursor: pointer;
  background: linear-gradient(180deg, rgba(40, 46, 68, 0.6), rgba(14, 16, 26, 0.7));
  border: 1px solid rgba(201, 165, 90, 0.28);
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.cr-card:hover { border-color: rgba(236, 212, 148, 0.65); }
.cr-card.sel {
  border-color: var(--brass-hi);
  background: linear-gradient(180deg, rgba(92, 78, 44, 0.55), rgba(28, 24, 18, 0.75));
  box-shadow: 0 0 16px rgba(236, 212, 148, 0.28), inset 0 0 18px rgba(201, 165, 90, 0.18);
}
.cr-card.sel::after { content: ''; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; margin-top: -4px; background: var(--brass-hi); transform: rotate(45deg); box-shadow: 0 0 8px rgba(236, 212, 148, 0.9); }
.g-card { height: 120px; align-items: center; }
.g-card .big { font-family: var(--font-body); font-weight: 800; font-size: 44px; line-height: 1; color: var(--text-hi); }
.g-card .small { font-family: var(--font-ui); font-size: 13px; color: var(--ash-hi); letter-spacing: 0.2em; }
.g-card.sel::after { display: none; }
.o-card { height: 70px; }
.o-name { font-family: var(--font-body); font-weight: 600; font-size: 20px; letter-spacing: 0.1em; color: var(--text-hi); }
.o-sub { font-family: var(--font-ui); font-size: 12.5px; color: var(--parch); }
.cr-detail { margin-top: 14px; padding: 12px 16px; border-left: 2px solid rgba(201, 165, 90, 0.4); background: rgba(0, 0, 0, 0.22); }
.o-desc { margin: 0 0 10px; font-family: var(--font-body); font-size: 15.5px; line-height: 1.75; color: var(--text); }
.cr-stats { display: grid; grid-template-columns: 170px minmax(0, 1fr); column-gap: 20px; row-gap: 8px; font-family: var(--font-ui); font-size: 13px; }
.cr-res { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; align-content: start; }
.cr-res span { display: flex; justify-content: space-between; color: var(--ash-hi); border-bottom: 1px solid rgba(138, 143, 154, 0.2); padding-bottom: 1px; }
.cr-res b { font-weight: normal; color: var(--text-hi); }
.cr-attrs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px 16px; }
.cr-attrs .at { display: grid; grid-template-columns: 3.6em minmax(0, 1fr) 1.6em; align-items: center; gap: 6px; color: var(--ash-hi); }
.cr-attrs .at i { height: 5px; background: rgba(0, 0, 0, 0.5); position: relative; }
.cr-attrs .at i::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--v) * 100%); background: linear-gradient(90deg, var(--brass-dim), var(--brass-hi)); }
.cr-attrs .at b { font-weight: normal; color: var(--text-hi); text-align: right; }
.cr-skills { grid-column: 1 / 3; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cr-skills em { font-style: normal; color: var(--ash); margin-right: 4px; }
.chip { padding: 2px 8px; border: 1px solid rgba(111, 211, 224, 0.4); color: var(--echo); background: rgba(111, 211, 224, 0.07); }
.chip b { font-weight: normal; color: var(--text-hi); }
.cr-hairs { display: flex; gap: 18px; }
.cr-hair {
  -webkit-appearance: none; appearance: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 116px; padding: 16px 8px 12px; cursor: pointer;
  background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(201, 165, 90, 0.25);
  font-family: var(--font-body); font-size: 16px; color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.cr-hair i { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 45%), var(--c); box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(0, 0, 0, 0.5); }
.cr-hair:hover { border-color: rgba(236, 212, 148, 0.6); }
.cr-hair.sel { border-color: var(--brass-hi); box-shadow: 0 0 14px rgba(236, 212, 148, 0.3); color: var(--text-hi); }
.cr-hair.sel i { box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.35), 0 0 0 2px var(--brass-hi), 0 0 12px rgba(236, 212, 148, 0.6); }
.cr-namebox { position: relative; width: 460px; padding-top: 18px; }
.cr-name {
  width: 100%; padding: 6px 4px; border: 0; outline: none; background: transparent;
  font-family: var(--font-body); font-weight: 800; font-size: 40px; letter-spacing: 0.24em; color: var(--text-hi);
  -webkit-user-select: text; user-select: text; caret-color: var(--brass-hi);
}
.cr-name::selection { background: rgba(201, 165, 90, 0.45); color: #fff; }
.cr-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.cr-sugg em { font-style: normal; font-family: var(--font-ui); font-size: 12px; color: var(--ash); letter-spacing: 0.12em; margin-right: 4px; }
.cr-chip {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding: 4px 12px; font-family: var(--font-body); font-size: 15px; color: var(--text);
  background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(201, 165, 90, 0.3);
  transition: border-color 0.15s, color 0.15s;
}
.cr-chip:hover { border-color: var(--brass-hi); color: var(--text-hi); }
.cr-quote {
  margin: 18px 0 0; padding: 10px 16px; border-left: 2px solid rgba(201, 165, 90, 0.45); background: rgba(0, 0, 0, 0.2);
  font-family: var(--font-body); font-size: 15px; line-height: 1.75; color: var(--text);
}
.cr-underline { height: 1px; background: linear-gradient(90deg, var(--brass-hi), rgba(201, 165, 90, 0.2)); box-shadow: 0 0 8px rgba(236, 212, 148, 0.5); margin-bottom: 16px; }
.cr-note { margin: 16px 0 0; font-family: var(--font-body); font-size: 14px; color: var(--ash); letter-spacing: 0.06em; }
.cr-sum { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px 10px; margin: 6px 0 0; font-family: var(--font-body); font-size: 18px; }
.cr-sum dt { color: var(--brass); font-family: var(--font-ui); font-size: 14px; letter-spacing: 0.14em; padding-top: 4px; }
.cr-sum dd { margin: 0; color: var(--text-hi); border-bottom: 1px solid rgba(201, 165, 90, 0.15); padding-bottom: 6px; }
.cr-sum dd.nm { font-weight: 800; font-size: 26px; letter-spacing: 0.2em; }
i.hairdot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.cr-foot {
  height: 64px; padding: 0 26px 0 30px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(201, 165, 90, 0.4) 15%, rgba(201, 165, 90, 0.4) 85%, transparent) 1;
}
.cr-hint { font-family: var(--font-ui); font-size: 12px; color: var(--ash); letter-spacing: 0.12em; }
.cr-btns { display: flex; gap: 14px; }
.cr-btns .btn { min-width: 130px; }

/* ---------- エンディング ---------- */
.tt-ending { cursor: default; }
.en-veil {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 62% 70% at 50% 44%, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.14) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.15) 35%, rgba(0, 0, 0, 0.2) 65%, rgba(0, 0, 0, 0.7));
}
.en-card { position: absolute; left: 0; right: 0; top: 50%; margin-top: -90px; text-align: center; pointer-events: none; }
.en-pre, .en-name, .en-line { opacity: 0; }
.en-pre { font-family: var(--font-body); font-size: 16px; letter-spacing: 0.8em; padding-left: 0.8em; color: var(--parch); margin-bottom: 14px; transition: opacity 1.2s ease; }
.en-line { width: 620px; height: 1px; margin: 0 auto; background: linear-gradient(90deg, transparent, var(--brass-hi) 30%, var(--brass-hi) 70%, transparent); transform: scaleX(0); transition: transform 1.6s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 1s; }
.en-line.b { width: 460px; }
.en-name {
  padding: 16px 0 14px 0.3em;
  font-family: var(--font-body); font-weight: 800; font-size: 56px; letter-spacing: 0.3em;
  color: var(--text-hi); text-shadow: 0 0 26px rgba(255, 214, 150, 0.45), 0 2px 4px #000;
  filter: blur(8px); transition: opacity 1.6s ease 0.3s, filter 1.6s ease 0.3s;
}
.tt-ending.show-card .en-pre, .tt-ending.show-card .en-name, .tt-ending.show-card .en-line { opacity: 1; }
.tt-ending.show-card .en-line { transform: scaleX(1); }
.tt-ending.show-card .en-name { filter: none; }
.en-head {
  position: absolute; left: 0; right: 0; top: 64px; text-align: center;
  font-family: var(--font-body); font-weight: 600; font-size: 18px; letter-spacing: 0.6em; color: var(--brass-hi);
  opacity: 0; transition: opacity 0.8s;
}
.en-head span::before, .en-head span::after { content: '―'; margin: 0 0.8em; color: var(--brass-dim); letter-spacing: 0; }
.en-head.on { opacity: 1; }
.en-page {
  position: absolute; left: 50%; top: 116px; width: 820px; height: 500px; margin-left: -410px;
  overflow: hidden;
  font-family: var(--font-body); font-size: 21px; line-height: 2.05; letter-spacing: 0.06em;
  color: var(--text-hi);
  text-shadow: 0 2px 6px #000, 0 0 16px rgba(0, 0, 0, 0.9);
  transition: opacity 0.6s ease;
}
.en-page.clearing { opacity: 0; }
.en-page p { margin: 0 0 0.9em; opacity: 0; transform: translateY(8px); filter: blur(4px); }
.en-page p.in { animation: para-in 1.3s ease forwards; }
.en-who {
  display: block; width: fit-content;
  font-family: var(--font-ui); font-size: 14px; line-height: 22px; letter-spacing: 0.14em; color: var(--brass-hi);
  padding: 0 16px 0 10px; margin-bottom: 2px;
  border-left: 2px solid var(--brass);
  background: linear-gradient(90deg, rgba(201, 165, 90, 0.25), rgba(201, 165, 90, 0));
}
.en-next { position: absolute; left: 50%; bottom: 44px; margin-left: -8px; width: 16px; height: 12px; opacity: 0; transition: opacity 0.4s; }
.en-next i { display: block; width: 0; height: 0; margin: auto; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid var(--brass-hi); animation: more-bob 1s ease-in-out infinite; filter: drop-shadow(0 0 4px rgba(236, 212, 148, 0.8)); }
.tt-ending.can-next .en-next { opacity: 1; }
.en-credits { position: absolute; inset: 0; overflow: hidden; opacity: 0; pointer-events: none; transition: opacity 0.9s; }
.en-credits.on { opacity: 1; }
.en-credits.off { opacity: 0; }
.en-roll { position: absolute; left: 0; right: 0; top: 100%; text-align: center; }
.en-roll.run { animation: roll linear forwards; }
@keyframes roll { from { transform: translateY(0); } to { transform: translateY(calc(-100% - 760px)); } }
.en-credits .cr-block { margin-bottom: 120px; }
.en-credits .cr-block.logo .t { font-family: var(--font-body); font-weight: 800; font-size: 54px; letter-spacing: 0.2em; color: var(--brass-hi); text-shadow: 0 0 20px rgba(255, 200, 120, 0.35); }
.en-credits .cr-block.logo .s { font-family: var(--font-body); font-size: 19px; letter-spacing: 0.4em; color: var(--parch); margin-top: 8px; }
.en-credits .h { font-family: var(--font-ui); font-size: 13px; letter-spacing: 0.5em; color: var(--brass); margin-bottom: 14px; }
.en-credits .v { font-family: var(--font-body); font-size: 22px; line-height: 1.9; color: var(--text-hi); letter-spacing: 0.12em; text-shadow: 0 2px 4px #000; }
.en-credits .v.big { font-size: 26px; letter-spacing: 0.3em; }
.en-credits .cr-block.last { margin-bottom: 0; }
.en-fin { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 1.6s ease; }
.en-fin.on { opacity: 1; }
.fin-kanji { font-family: var(--font-body); font-weight: 800; font-size: 120px; line-height: 1; color: var(--text-hi); text-shadow: 0 0 40px rgba(255, 214, 150, 0.35), 0 3px 6px #000; }
.fin-name { margin-top: 26px; font-family: var(--font-body); font-size: 22px; letter-spacing: 0.24em; color: var(--brass-hi); }
.fin-count { margin-top: 14px; font-family: var(--font-ui); font-size: 14px; letter-spacing: 0.16em; color: var(--parch); }
.fin-hint { position: absolute; bottom: 40px; font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.2em; color: var(--ash); animation: more-bob 2s ease-in-out infinite; }

/* ---------- ゲームオーバー ---------- */
.go-veil {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 42%, rgba(30, 10, 8, 0.45), rgba(0, 0, 0, 0.9) 85%);
}
/* ゲームオーバー中は背景を灰色に沈める（G.UI.setMode で解除） */
#game.fx-ashen #gfx { filter: grayscale(1) brightness(0.5) contrast(1.05); transition: filter 2.4s ease; }
.go-ash { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.go-ash i {
  position: absolute; top: -10px; width: var(--s); height: var(--s);
  background: rgba(200, 196, 188, 0.7); box-shadow: 0 0 4px rgba(255, 255, 255, 0.25);
  animation: ash-fall var(--d) linear var(--dl) infinite;
}
@keyframes ash-fall { to { transform: translate(var(--dx), 760px) rotate(220deg); } }
.go-box { position: absolute; left: 0; right: 0; top: 176px; text-align: center; }
.go-title {
  padding-left: 0.5em;
  font-family: var(--font-body); font-weight: 800; font-size: 76px; letter-spacing: 0.5em;
  color: #c9c2b4; text-shadow: 0 0 34px rgba(184, 65, 58, 0.45), 0 3px 6px #000;
  animation: go-in 3s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@keyframes go-in { from { opacity: 0; letter-spacing: 0.9em; filter: blur(12px); } }
.go-line { width: 520px; height: 1px; margin: 18px auto 20px; background: linear-gradient(90deg, transparent, rgba(184, 65, 58, 0.8), transparent); animation: tt-in 2s ease 1s both; }
.go-reason { font-family: var(--font-body); font-size: 18px; letter-spacing: 0.12em; color: var(--ash-hi); text-shadow: 0 1px 3px #000; animation: tt-in 2s ease 1.4s both; }
.go-menu { width: 340px; margin: 54px auto 0; display: flex; flex-direction: column; gap: 4px; animation: tt-in 1.6s ease 2s both; }

/* =====================================================================
   ポートレート（G.Portraits：アニメ調の立ち絵・顔。無ければ従来のドット絵）
   ===================================================================== */
.pt-img { display: block; -webkit-user-drag: none; user-select: none; }
img.pt-face { width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }

/* ---- 会話の立ち絵（#vn：背景より手前、HUD・本文窓より奥） ---- */
#vn {
  position: absolute; inset: 0; z-index: 10; overflow: hidden; pointer-events: none;
  visibility: hidden; opacity: 0;
  transition: opacity 0.32s ease, visibility 0s linear 0.32s;
}
#game[data-mode='scene'] #vn { visibility: visible; opacity: 1; transition: opacity 0.32s ease, visibility 0s; }
#vn .vn-bust {
  position: absolute; bottom: 216px; height: 440px; width: auto; max-width: 440px;   /* 本文窓（高さ 260）の上端より 54px 下まで */
  /* 下端を本文窓の上端へ溶かす（窓の奥に沈む） */
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 79%, rgba(0, 0, 0, 0.62) 89%, transparent 99%);
  mask-image: linear-gradient(to bottom, #000 0, #000 79%, rgba(0, 0, 0, 0.62) 89%, transparent 99%);
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)) brightness(0.97);
  opacity: 0;
  transition: opacity 0.42s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}
#vn .vn-bust.left { left: 22px; transform: translateX(-18px); }
#vn .vn-bust.right { right: 22px; transform: translateX(18px); }
#vn .vn-bust.swap { transform: none; }
#vn .vn-bust.in { opacity: 1; transform: none; }
#vn .vn-bust.out { opacity: 0; transition: opacity 0.34s ease, transform 0.4s ease; }
#vn .vn-bust.left.out:not(.swap) { transform: translateX(-10px); }
#vn .vn-bust.right.out:not(.swap) { transform: translateX(10px); }
/* 場面では案内カード（tips.css の bottom: 254px）を、高くした本文窓（260px＋下 10px）の上へ */
#game[data-mode='scene'] #tips { bottom: 282px; }
/* 夕は少し温かく、夜・深夜は少し沈める（背景の時間帯に馴染ませる） */
#vn[data-period='夕'] .vn-bust { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)) sepia(0.12) brightness(0.96); }
#vn[data-period='夜'] .vn-bust, #vn[data-period='深夜'] .vn-bust { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)) brightness(0.9) saturate(0.92); }

/* ---- 台詞行の顔（丸い額縁・真鍮の細線） ---- */
#tb-body .line .face.pt-on {
  width: 38px; height: 38px; margin: 0 0 -5px 0;   /* 場所を取るのは 1 行ぶん（33px）。はみ出す 5px は段落の間へ */
  border-radius: 50%;
  border: 1px solid rgba(236, 212, 148, 0.8);
  background: radial-gradient(circle at 50% 38%, #414b6c, #151925 72%);
  box-shadow: 0 0 0 2px rgba(10, 12, 19, 0.92), 0 0 0 3px rgba(201, 165, 90, 0.38), 0 3px 8px rgba(0, 0, 0, 0.6);
}
#tb-body .para.line:has(> .face.pt-on) { grid-template-columns: 38px minmax(0, 1fr); }

/* ---- HUD の顔 ---- */
.hud-face.pt-on {
  border-radius: 50%; border-color: rgba(236, 212, 148, 0.75);
  background: radial-gradient(circle at 50% 38%, #414b6c, #151925 72%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.hud-face img { width: 100%; height: 100%; }

/* ---- 主人公作成：立ち絵（台を立ち絵の大きさに。ドット絵は足もとに小さく） ---- */
.cr-stage.tall { width: 286px; height: 388px; }
.cr-bust { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.cr-bust .cr-bustimg {
  position: absolute; left: 50%; bottom: 0; height: 372px; width: auto; max-width: none;
  transform: translateX(-50%) translateY(8px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 76%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 76%, transparent 100%);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6));
  opacity: 0; transition: opacity 0.34s ease, transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.cr-bust .cr-bustimg.in { opacity: 1; transform: translateX(-50%); }
.cr-bust .cr-bustimg.out { opacity: 0; transition-duration: 0.3s; }
.cr-stage.pt canvas {
  position: absolute; right: -14px; bottom: 2px; z-index: 2;
  width: 144px; height: 156px; margin: 0;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.7));
}
.cr-stage.pt .cr-plinth { left: auto; right: 6px; width: 104px; margin-left: 0; bottom: 0; z-index: 1; }
.cr-stage.tall:not(.pt) canvas { margin-bottom: 40px; }
