/* 体験デモの画面。サイト本体とは別世界（紙・墨・朱） */
.demo {
  --paper: #f3eee3;
  --ink-d: #141210;
  --ink-soft: #55504a;
  --red: #9e2019;
  --line: 3px;
  position: fixed; inset: 0; z-index: 100;
  background: var(--ink-d);
  display: none;
}
.demo.open { display: block; }
.demo { --demo-head: 56px; }
.demo-head {
  position: absolute; inset: 0 0 auto 0; z-index: 30; height: var(--demo-head);
  display: flex; align-items: center; gap: clamp(10px, 2vw, 24px);
  padding: 0 clamp(14px, 4vw, 40px);
  background: #fff; border-bottom: 1px solid #e4e9e3;
}
.demo-head .logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: #23303a; }
.demo-head .logo img { height: 28px; width: auto; display: block; }
.demo-head .logo span { font-family: var(--sans); font-weight: 900; font-size: 15px; }
.demo-head .label { font-family: var(--sans); font-size: 12px; font-weight: 700; color: #5a6470; letter-spacing: .06em; }
.demo-head .label b { font-weight: 900; color: #23303a; }
.demo-head nav { margin-left: auto; display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); font-family: var(--sans); font-size: 13px; font-weight: 700; color: #3c4750; }
.demo-head nav a { text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.demo-head nav a:hover { border-bottom-color: #00a4e3; }
.demo-head nav .cta { background: #00a4e3; color: #fff; padding: .55em 1.1em; border-radius: 999px; border: 0; }
.demo-head nav .cta:hover { background: #8ec31f; }

.demo .stage { position: absolute; inset: var(--demo-head) 0 0 0; overflow: hidden; background: var(--paper); }
.demo .art { position: absolute; inset: 0; background-size: cover; background-position: center 92%; opacity: 0; transform: scale(1.16); transition: opacity .9s ease; }
.demo .art.on { opacity: 1; animation: demo-push 18s ease-out forwards; }
@keyframes demo-push { from { transform: scale(1.16); } to { transform: scale(1.26); } }
.demo .art.shake { animation: demo-shake .45s steps(2) 1, demo-push 18s ease-out forwards; }
@keyframes demo-shake { 0% { translate: 6px -4px; } 25% { translate: -6px 4px; } 50% { translate: 4px 3px; } 75% { translate: -3px -4px; } 100% { translate: 0 0; } }
.demo .veil { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(20,18,16,.72) 0%, rgba(20,18,16,.15) 42%, transparent 60%); }

.demo .hud { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: clamp(10px, 2vw, 20px); pointer-events: none; z-index: 5; }
.demo .chapter { font-family: var(--serif); font-weight: 800; font-size: clamp(11px, 1.15vw, 14px); background: var(--paper); border: 2px solid var(--ink-d); padding: .2em .6em; color: var(--ink-d); }
.demo .stats { display: flex; gap: 6px; font-family: var(--serif); font-weight: 800; font-size: clamp(11px, 1.2vw, 15px); }
.demo .stat { background: var(--paper); border: 2px solid var(--ink-d); padding: .25em .6em; min-width: 5.5em; text-align: center; color: var(--ink-d); transition: background .2s; }
.demo .stat small { display: block; font-size: .72em; color: var(--ink-soft); letter-spacing: .1em; }
.demo .stat.up { background: #fff; animation: demo-pop .5s; }
.demo .stat.down { background: var(--red); color: var(--paper); animation: demo-pop .5s; }
.demo .stat.down small { color: var(--paper); }
@keyframes demo-pop { 50% { transform: scale(1.12); } }

.demo .say { position: absolute; left: 50%; bottom: clamp(84px, 16%, 140px); transform: translateX(-50%); width: min(88%, 900px); z-index: 4; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.demo .box { background: var(--paper); color: var(--ink-d); border: var(--line) solid var(--ink-d); box-shadow: 6px 6px 0 var(--ink-d); padding: clamp(10px, 1.4vw, 18px) clamp(14px, 1.8vw, 24px); font-family: var(--serif); font-weight: 800; font-size: clamp(15px, 2vw, 26px); line-height: 1.6; max-width: 100%; opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; }
.demo .box.on { opacity: 1; transform: none; }
.demo .box .who { display: inline-block; margin-bottom: .3em; font-family: var(--sans); font-weight: 700; font-size: .6em; letter-spacing: .15em; background: var(--ink-d); color: var(--paper); padding: .1em .6em; }
.demo .box.narr { background: var(--ink-d); color: var(--paper); box-shadow: 6px 6px 0 var(--red); }
.demo .box.speech { border-radius: 28px; align-self: flex-end; }
.demo .box.result { border-color: var(--red); box-shadow: 6px 6px 0 var(--red); }
.demo .box em { font-style: normal; color: var(--red); }

.demo .choices { position: absolute; left: 50%; bottom: clamp(14px, 3%, 30px); transform: translateX(-50%); width: min(92%, 1000px); z-index: 6; display: flex; gap: clamp(8px, 1.2vw, 16px); justify-content: center; flex-wrap: wrap; }
.demo .choice { flex: 1 1 0; min-width: 200px; display: flex; align-items: center; gap: .6em; background: var(--ink-d); color: var(--paper); border: var(--line) solid var(--ink-d); padding: .75em 1em; font-weight: 900; font-size: clamp(14px, 1.6vw, 20px); text-align: left; line-height: 1.35; text-decoration: none; clip-path: polygon(0 0, 100% 0, 97% 100%, 0 100%); opacity: 0; transform: translateY(12px); transition: opacity .3s, transform .3s, background .15s; }
.demo .choice.on { opacity: 1; transform: none; }
.demo .choice .k { color: var(--red); font-size: 1.4em; line-height: 1; font-family: var(--serif); }
.demo .choice:hover, .demo .choice:focus-visible { background: var(--red); }
.demo .choice:hover .k, .demo .choice:focus-visible .k { color: var(--ink-d); }
.demo .next { background: var(--paper); color: var(--ink-d); clip-path: none; flex: 0 0 auto; min-width: 0; font-size: clamp(14px, 1.5vw, 18px); }
.demo .next:hover { background: var(--ink-d); color: var(--paper); }

/* 右下：スキップと音声 */
.demo .tools { position: absolute; right: clamp(12px, 2vw, 24px); bottom: clamp(12px, 2vw, 22px); z-index: 20; display: flex; gap: 10px; align-items: center; }
.demo .tools .hint { font-size: 11px; color: rgba(243, 238, 227, .75); }
.demo .tools button { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .06em; padding: .75em 1.3em; border-radius: 2px; background: rgba(243, 238, 227, .9); color: var(--ink-d); border: 1px solid transparent; }
.demo .tools button:hover { background: #fff; }
.demo .tools .skip { background: rgba(18, 24, 28, .72); color: var(--paper); border: 1px solid rgba(243, 238, 227, .55); }
.demo .tools .skip:hover { background: var(--paper); color: #12181c; }

.demo .cover { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; text-align: center; background: rgba(20, 18, 16, .58); color: var(--paper); transition: opacity .8s; padding: 0 clamp(18px, 5vw, 72px); }
.demo .cover.hide { opacity: 0; pointer-events: none; }
.demo .cover { background: rgba(10, 12, 13, .62); }
.demo .cover .eyebrow { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .3em; opacity: .8; margin-bottom: 2em; }
.demo .cover .title { font-family: var(--serif); font-weight: 800; font-size: clamp(46px, 8vw, 104px); line-height: 1.2; letter-spacing: .12em; text-shadow: 0 2px 30px rgba(0, 0, 0, .55); }
.demo.film-mode .cover .title { font-family: var(--sans); font-weight: 900; font-size: clamp(34px, 5.6vw, 78px); letter-spacing: .2em; }
.demo .cover .lead { margin: 1.4em 0 2.2em; font-family: var(--serif); font-weight: 800; font-size: clamp(15px, 1.7vw, 21px); letter-spacing: .08em; }
.demo .cover .lead small { display: block; margin-top: .9em; font-family: var(--sans); font-size: .62em; font-weight: 500; letter-spacing: .1em; opacity: .75; }
.demo .cover .choices { position: static; transform: none; width: auto; }
.demo .cover .choice {
  opacity: 1; transform: none; min-width: 0; flex: 0 0 auto;
  clip-path: none; border-radius: 2px;
  background: transparent; border: 1px solid rgba(243, 238, 227, .75); color: var(--paper);
  font-family: var(--sans); font-weight: 700; font-size: 14px; letter-spacing: .08em;
  padding: 1em 2.2em; justify-content: center;
}
.demo .cover .choice .k { display: none; }
.demo .cover .choice:hover { background: var(--paper); color: var(--ink-d); border-color: var(--paper); }
.demo .cover .choice.alt { background: transparent; color: var(--paper); }
.demo .cover .choice.alt:hover { background: var(--paper); color: var(--ink-d); }

.demo .reveal { position: absolute; inset: 0; z-index: 8; display: none; grid-template-columns: 1fr; align-content: center; justify-items: center; background: rgba(243, 238, 227, .96); color: var(--ink-d); padding: clamp(14px, 3vw, 36px); overflow-y: auto; }
.demo .reveal.on { display: grid; }
.demo .reveal h2 { font-family: var(--serif); font-weight: 800; font-size: clamp(24px, 3.6vw, 46px); line-height: 1.25; text-align: center; }
.demo .reveal h2 em { font-style: normal; color: var(--red); }
.demo .map { width: min(100%, 980px); margin: clamp(12px, 2.2vw, 24px) 0; border-top: var(--line) solid var(--ink-d); }
.demo .row { display: grid; grid-template-columns: 1fr auto 1.35fr; gap: clamp(8px, 1.4vw, 20px); align-items: center; padding: clamp(7px, 1vw, 12px) 0; border-bottom: 1px solid var(--ink-soft); opacity: 0; transform: translateX(-10px); transition: opacity .4s, transform .4s; }
.demo .row.on { opacity: 1; transform: none; }
.demo .row .old { font-family: var(--serif); font-weight: 800; font-size: clamp(13px, 1.5vw, 19px); position: relative; justify-self: start; }
.demo .row .old::after { content: ""; position: absolute; left: -2px; right: -2px; top: 55%; height: 3px; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .5s .35s; }
.demo .row.on .old::after { transform: scaleX(1); }
.demo .row .arrow { color: var(--red); font-family: var(--serif); }
.demo .row .new { font-size: clamp(13px, 1.45vw, 18px); line-height: 1.6; }
.demo .row .new b { font-weight: 900; margin-right: .5em; }
.demo .row.mine { background: #fff; }
.demo .row.mine .old::before { content: "あなたの判断"; position: absolute; top: -1.4em; left: 0; font-size: .62em; font-weight: 700; color: var(--paper); background: var(--red); padding: 0 .4em; }
.demo .closing { text-align: center; font-family: var(--serif); font-weight: 800; font-size: clamp(15px, 1.9vw, 24px); line-height: 1.7; opacity: 0; transition: opacity .6s; }
.demo .closing.on { opacity: 1; }
.demo .closing .choices { position: static; transform: none; width: auto; margin-top: .9em; }
.demo .closing .choice { opacity: 1; transform: none; flex: 0 0 auto; }
.demo .closing .choice.alt { background: var(--paper); color: var(--ink-d); }
.demo .closing .choice.alt:hover { background: var(--ink-d); color: var(--paper); }

@media (max-width: 720px) {
  .demo { --demo-head: 50px; }
  .demo-head .label, .demo-head nav a:not(.cta) { display: none; }
  .demo .stats { flex-direction: column; align-items: flex-end; gap: 4px; }
  .demo .stat { min-width: 4.6em; padding: .15em .45em; }
  .demo .say { bottom: auto; top: 26%; }
  .demo .choice { min-width: 100%; }
  .demo .row { grid-template-columns: 1fr; gap: 2px; }
  .demo .row .arrow { display: none; }
  .demo .tools .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .demo .art.on, .demo .art.shake { animation: none; transform: none; }
}

/* 準備中などの小さな知らせ */
.wg-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px);
  z-index: 200; background: #23303a; color: #fff;
  font-size: 13px; font-weight: 700; padding: .9em 1.6em; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.wg-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 入口の映像 */
.demo .film { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; z-index: 2; }
.demo.film-mode .stage { background: #000; }
.demo.film-mode .veil { background: linear-gradient(to top, rgba(0,0,0,.55), transparent 42%); z-index: 3; }

/* ---- 終幕のCTA：表紙と同じ静かな作り ---- */
.demo .closing .choice {
  clip-path: none; border-radius: 2px; min-width: 0;
  background: var(--ink-d); color: var(--paper); border: 1px solid var(--ink-d);
  font-family: var(--sans); font-weight: 700; font-size: 14px; letter-spacing: .08em;
  padding: 1em 2.2em; justify-content: center; box-shadow: none;
}
.demo .closing .choice .k { display: none; }
.demo .closing .choice:hover { background: transparent; color: var(--ink-d); }
.demo .closing .choice.alt { background: transparent; color: var(--ink-d); border-color: rgba(18, 24, 28, .35); }
.demo .closing .choice.alt:hover { background: var(--ink-d); color: var(--paper); border-color: var(--ink-d); }
.demo .closing { letter-spacing: .06em; }

/* ---- 画面紹介（gallery）：UIは切らずに全体を見せる ---- */
.demo.shot-mode .stage { background: #101416; }
.demo.shot-mode .art { background-size: contain; background-repeat: no-repeat; background-position: center 40%; transform: none; }
.demo.shot-mode .art.on { animation: none; }
.demo.shot-mode .veil { background: linear-gradient(180deg, rgba(16, 20, 22, .55) 0%, rgba(16, 20, 22, 0) 28%, rgba(16, 20, 22, .2) 62%, rgba(16, 20, 22, .82) 100%); }
.demo.shot-mode .box.narr { background: rgba(12, 16, 18, .88); box-shadow: none; border: 1px solid rgba(243, 238, 227, .28); font-size: clamp(14px, 1.6vw, 19px); }
.demo.shot-mode .box em { color: #cfe3ee; }
.demo.shot-mode .choice {
  clip-path: none; border-radius: 2px; background: transparent; color: var(--paper);
  border: 1px solid rgba(243, 238, 227, .75); font-family: var(--sans);
  font-weight: 700; font-size: 13px; letter-spacing: .08em; padding: .9em 1.8em; justify-content: center;
}
.demo.shot-mode .choice .k { display: none; }
.demo.shot-mode .choice:hover { background: var(--paper); color: var(--ink-d); }
.demo.shot-mode .chapter { background: rgba(12, 16, 18, .8); color: var(--paper); border: 1px solid rgba(243, 238, 227, .3); border-radius: 2px; font-family: var(--sans); letter-spacing: .1em; }

/* 自動で始まったときの「音を出す」 */
.demo.auto .tools .mute { background: #fff; color: #12181c; font-weight: 700; border-color: #fff; animation: wg-pulse 2.4s ease-in-out infinite; }
@keyframes wg-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .5); } 50% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } }

/* ---- ページの中の枠で動かす（inline）：全画面にしない ---- */
.demo.inline { position: absolute; inset: 0; z-index: 6; --demo-head: 0px; }
.demo.inline .demo-head { display: none; }
.demo.inline:fullscreen { --demo-head: 0px; }
@media (max-width: 720px) {
  .demo.inline .box { font-size: 14px; box-shadow: 3px 3px 0 var(--ink-d); }
  .demo.inline .choice { font-size: 14px; padding: .6em .8em; }
  .demo.inline .say { top: 18%; }
}

/* サイト側の「段落は濃い色」を、デモの中には持ち込まない */
.demo p, .demo li { color: inherit; }
/* 枠の中では、道具（音声・全画面・閉じる）を上の中央へ。下の選択肢と重ねない */
.demo.inline .tools { top: clamp(10px, 2vw, 20px); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); }
.demo.inline .tools .hint { display: none; }
@media (max-width: 720px) { .demo.inline .tools { top: auto; bottom: 10px; } .demo.inline .choices { bottom: 56px; } .demo.inline .tools button { padding: .6em 1em; } }
.demo.inline .tools button { white-space: nowrap; }
@media (max-width: 720px) {
  .demo.inline .tools { left: auto; right: 10px; transform: none; }
  .demo.inline .stats { flex-direction: row; gap: 4px; }
  .demo.inline .stat { min-width: 0; font-size: 11px; }
  .demo.inline .say { top: 24%; width: calc(100% - 24px); }
}

/* ==== 型 "game"（戦国経営シリーズ） ==== */
/* 砂時計：兵糧の日数が援軍までの日数を下回ったら赤く点滅 */
.demo .stats { flex-wrap: wrap; justify-content: flex-end; }
.demo .stat.clock span { font-size: 1.05em; }
.demo .stat.warn { background: var(--red); color: var(--paper); animation: demo-warn 1.1s ease-in-out infinite; }
.demo .stat.warn small { color: var(--paper); }
@keyframes demo-warn { 50% { background: #5e110c; } }
.demo .stat.merit { background: #1b1916; color: #f0c040; border-color: #1b1916; }
.demo .stat.merit small { color: rgba(240, 192, 64, .8); }

/* 選択肢の補足（数字の条件）と、選べない選択肢 */
.demo .choice small { display: block; margin-top: .3em; font-family: var(--sans); font-weight: 500; font-size: .66em; letter-spacing: .02em; opacity: .8; }
.demo .choice.off { opacity: .35 !important; pointer-events: none; }

/* 武功・称号：真ん中に大きく一瞬 */
.demo .flash { position: absolute; left: 50%; top: 38%; z-index: 9; transform: translate(-50%, -50%); pointer-events: none;
  font-family: var(--serif); font-weight: 900; font-size: clamp(30px, 6vw, 72px); color: #f0c040; letter-spacing: .08em; white-space: nowrap;
  text-shadow: 0 0 0 transparent, 4px 4px 0 var(--ink-d); animation: demo-flash 1.1s cubic-bezier(.2, .9, .3, 1) forwards; }
.demo .flash b { font-size: 1.3em; }
.demo .flash.title { color: var(--paper); text-align: center; }
.demo .flash.title small { display: block; font-size: .35em; letter-spacing: .4em; color: #f0c040; }
@keyframes demo-flash { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

/* 総攻撃の天秤 */
.demo .panel { position: absolute; left: 50%; top: 42%; z-index: 7; transform: translate(-50%, -50%); width: min(86%, 620px); display: none; }
.demo .panel.on { display: block; }
.demo .scale { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 10px; background: var(--paper); border: var(--line) solid var(--ink-d); box-shadow: 6px 6px 0 var(--ink-d); padding: clamp(12px, 2vw, 22px); color: var(--ink-d); }
.demo .scale .side { text-align: center; font-family: var(--serif); font-weight: 800; transition: transform .8s cubic-bezier(.3, 1.4, .5, 1); }
.demo .scale .side small { display: block; font-size: 12px; letter-spacing: .2em; color: var(--ink-soft); }
.demo .scale .side b { display: block; font-size: clamp(28px, 4.4vw, 52px); line-height: 1.1; }
.demo .scale .side span { display: block; font-family: var(--sans); font-size: 11px; font-weight: 500; color: var(--ink-soft); min-height: 1.4em; }
.demo .scale .beam { height: 6px; background: var(--ink-d); border-radius: 3px; transition: transform .8s cubic-bezier(.3, 1.4, .5, 1); animation: demo-sway 1.2s ease-in-out infinite; }
@keyframes demo-sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.demo .scale.hold .beam { animation: none; transform: rotate(-8deg); }
.demo .scale.fall .beam { animation: none; transform: rotate(8deg); background: var(--red); }
.demo .scale.hold .side:first-child { transform: translateY(12px); }
.demo .scale.fall .side:last-child { transform: translateY(12px); color: var(--red); }

/* 種明かし：あなたの城の決算書 */
.demo .reveal .map { border-top: 0; }
.demo .verdict { font-family: var(--serif); font-weight: 800; font-size: clamp(15px, 1.9vw, 22px); line-height: 1.8; max-width: 44em; margin: 0 auto 1.2em; text-align: center; }
.demo .verdict em, .demo .reveal h2 em { font-style: normal; color: var(--red); }
.demo .ledger-h { font-family: var(--serif); font-weight: 800; font-size: clamp(14px, 1.5vw, 18px); margin: 1.2em 0 .6em; padding-top: .8em; border-top: var(--line) solid var(--ink-d); }
.demo .ledger-h small { font-family: var(--sans); font-weight: 500; font-size: 11px; color: var(--ink-soft); margin-left: .8em; }
.demo .ledger { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(10px, 1.6vw, 20px); align-items: start; }
.demo .ledger table { width: 100%; border-collapse: collapse; background: #fff; font-size: clamp(12px, 1.2vw, 14px); }
.demo .ledger caption { text-align: left; font-family: var(--serif); font-weight: 800; font-size: 1.05em; padding: 0 0 .4em; }
.demo .ledger th, .demo .ledger td { padding: .45em .7em; border-bottom: 1px solid #ddd6c8; text-align: left; font-weight: 500; }
.demo .ledger td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.demo .ledger tr.sub th { background: #efe9dc; font-size: .85em; color: var(--ink-soft); }
.demo .ledger tr.sum th, .demo .ledger tr.sum td { font-weight: 900; border-top: 2px solid var(--ink-d); border-bottom: 0; }
.demo .ledger .plus { color: #1d6b2f; }
.demo .ledger .minus { color: var(--red); }
@media (max-width: 720px) {
  .demo .ledger { grid-template-columns: 1fr; }
  .demo .flash { font-size: 30px; }
  .demo .scale .side b { font-size: 28px; }
}
/* 種明かしの間は、上の道具を隠す（種明かしに閉じるボタンがある）。判断の行は打ち消し線なし */
.demo .reveal.on ~ .tools { display: none; }
.demo .picks .row .old::after { display: none; }
.demo .picks .row { grid-template-columns: minmax(10em, 1fr) auto 2fr; }
@media (max-width: 720px) { .demo .picks .row { grid-template-columns: 1fr; } }
/* 選択肢：名前の下に補足。枠の中の道具は、左上の章名の下へ（右上の数字とぶつけない） */
.demo .choice .lbl small { display: block; }
.demo.inline .tools { top: calc(clamp(10px, 2vw, 20px) + 42px); left: clamp(10px, 2vw, 20px); right: auto; bottom: auto; transform: none; }
.demo.inline .tools button { padding: .5em 1em; }
/* ゲーム型：絵はほぼ等倍（16:9の枠で端を切らない） */
.demo.game-mode .art { transform: scale(1.02); background-position: center; }
.demo.game-mode .art.on { animation: demo-push-s 18s ease-out forwards; }
.demo.game-mode .art.shake { animation: demo-shake .45s steps(2) 1, demo-push-s 18s ease-out forwards; }
@keyframes demo-push-s { from { transform: scale(1.02); } to { transform: scale(1.06); } }
/* 種明かし：枠の中なら、枠ごと中身の長さに伸ばす */
.demo.inline.revealing { position: relative; inset: auto; }
.demo.inline.revealing .stage { position: relative; inset: auto; min-height: 100%; }
.demo.inline.revealing .reveal { position: relative; inset: auto; overflow: visible; padding: clamp(24px, 4vw, 56px) clamp(16px, 4vw, 56px); }
/* 兵糧の欄：日数の下に米の石数 */
.demo .stat i { display: block; font-style: normal; font-family: var(--sans); font-weight: 700; font-size: .68em; letter-spacing: .02em; opacity: .85; }
/* 城の決まり */
.demo .rules { background: var(--paper); color: var(--ink-d); border: var(--line) solid var(--ink-d); box-shadow: 6px 6px 0 var(--red); padding: clamp(14px, 2.4vw, 28px) clamp(16px, 2.8vw, 34px); }
.demo .rules-h { font-family: var(--serif); font-weight: 900; font-size: clamp(16px, 2vw, 24px); letter-spacing: .2em; margin-bottom: .6em; }
.demo .rules ol { list-style: none; counter-reset: r; display: grid; gap: .55em; }
.demo .rules li { counter-increment: r; display: grid; grid-template-columns: 1.8em 1fr; font-size: clamp(12px, 1.3vw, 15px); line-height: 1.6; }
.demo .rules li::before { content: counter(r, cjk-ideographic); font-family: var(--serif); font-weight: 900; color: var(--red); }
.demo .rules li b { font-family: var(--serif); font-weight: 900; font-size: 1.12em; margin-right: .4em; }
@media (max-width: 720px) { .demo .panel { top: 46%; width: 92%; } .demo .stat i { display: none; } .demo .stat.clock i { display: block; } }
.demo .rules li { display: block; position: relative; padding-left: 1.8em; }
.demo .rules li::before { position: absolute; left: 0; top: 0; }
@media (max-width: 720px) { .demo.inline .tools { top: auto; bottom: 10px; left: auto; right: 10px; } .demo.inline .choices { bottom: 52px; } }
@media (max-width: 720px) { .demo.inline.game-mode .say { top: 27%; } }
/* 全画面：抜けるボタンをはっきり見せ、種明かしの間も出したままにする。種明かしは画面の中でスクロール */
.demo .tools .full.exit { background: var(--ink-d); color: var(--paper); border: 1px solid rgba(243, 238, 227, .7); }
.demo:fullscreen .reveal.on ~ .tools { display: flex; }
.demo.inline.revealing:fullscreen { position: absolute; inset: 0; }
.demo.inline.revealing:fullscreen .stage { position: absolute; inset: 0; min-height: 0; }
.demo.inline.revealing:fullscreen .reveal { position: absolute; inset: 0; overflow-y: auto; padding-top: 72px; }

/* ==== 千対三千：戦の棒（両軍が同時に減っていく） ==== */
.demo .war { background: var(--paper); color: var(--ink-d); border: var(--line) solid var(--ink-d); box-shadow: 6px 6px 0 var(--ink-d); padding: clamp(12px, 2vw, 22px) clamp(14px, 2.4vw, 28px); }
.demo .war-h { font-family: var(--serif); font-weight: 900; font-size: clamp(18px, 2.4vw, 28px); letter-spacing: .12em; margin-bottom: .6em; }
.demo .war-h small { display: block; font-family: var(--sans); font-weight: 500; font-size: 12px; letter-spacing: .04em; color: var(--ink-soft); margin-top: .3em; }
.demo .war-h small b { color: var(--red); font-weight: 700; }
.demo .war-row { display: grid; grid-template-columns: 6.5em 1fr 3.4em; align-items: center; gap: 10px; margin: .45em 0; }
.demo .war-row .who { font-family: var(--serif); font-weight: 800; font-size: 15px; line-height: 1.2; }
.demo .war-row .who small { display: block; font-family: var(--sans); font-weight: 500; font-size: 11px; color: var(--ink-soft); }
.demo .war-row .bar { height: 22px; background: #e2dccd; border: 2px solid var(--ink-d); position: relative; overflow: hidden; }
.demo .war-row .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-d); }
.demo .war-row.foe .bar i { background: var(--red); }
.demo .war-row b { font-family: var(--serif); font-weight: 900; font-size: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.demo .war-end { margin-top: .5em; font-family: var(--serif); font-weight: 900; font-size: 22px; letter-spacing: .3em; text-align: center; }
.demo .war.won .war-end { color: var(--ink-d); }
.demo .war.lost .war-end { color: var(--red); }
.demo .flash small { display: block; font-size: .32em; letter-spacing: .2em; color: var(--paper); }

/* 種明かし：戦の記録・法則・原則 */
.demo .ledger.one { grid-template-columns: 1fr; }
.demo .ledger.one td { text-align: left; }
.demo .ledger.one small { display: block; font-size: .78em; color: var(--ink-soft); font-weight: 500; }
.demo .law { margin: 1em auto 0; padding: 1em 1.2em; background: #fff; border-left: 6px solid var(--red); font-size: clamp(13px, 1.4vw, 16px); line-height: 1.9; }
.demo .law em { font-style: normal; color: var(--red); font-weight: 900; }
.demo .law .law-name { margin-top: .4em; font-family: var(--serif); font-weight: 900; font-size: 1.1em; }
.demo .picks .row.miss { opacity: .45; background: transparent; }
.demo .map-note { margin-top: 1em; font-size: 12px; color: var(--ink-soft); line-height: 1.9; }
@media (max-width: 720px) {
  .demo .war-row { grid-template-columns: 4.6em 1fr 3em; gap: 6px; }
  .demo .war-row .who { font-size: 13px; }
  .demo .war-row b { font-size: 17px; }
  .demo .war-h small { font-size: 11px; }
}
.demo .rules li small { display: block; font-family: var(--sans); font-size: .85em; color: var(--ink-soft); }
/* 決まりの札は、上の数字と下のボタンの間に置く */
.demo .panel:has(.rules) { top: 53%; }
@media (max-width: 720px) { .demo .panel:has(.rules) { top: 50%; } .demo .rules { padding: 12px 14px; } .demo .rules li { font-size: 11.5px; line-height: 1.5; } .demo .rules-h { margin-bottom: .3em; } .demo .rules ol { gap: .35em; } }

/* ==== 種明かし：ページでめくる（枠に収める） ==== */
.demo .reveal.paged { align-content: center; padding: clamp(12px, 2.4vw, 30px) clamp(14px, 4vw, 56px); }
.demo .reveal.paged h2 { font-size: clamp(20px, 2.6vw, 34px); }
.demo .reveal.paged .map { margin: clamp(6px, 1vw, 12px) 0 0; width: min(100%, 980px); }
.demo .reveal.paged .verdict { font-size: clamp(13px, 1.5vw, 18px); margin: 0 auto .5em; line-height: 1.7; }
.demo .reveal.paged .ledger-h { margin: .6em 0 .4em; padding-top: .5em; font-size: clamp(13px, 1.3vw, 16px); }
.demo .reveal.paged .ledger-h.first { border-top: 0; padding-top: 0; margin-top: 0; }
.demo .battles { list-style: none; display: grid; gap: 4px; }
.demo .battles li { display: grid; grid-template-columns: 5em 1fr auto; gap: 10px; align-items: baseline; background: #fff; padding: .45em .8em; font-size: clamp(12px, 1.2vw, 14px); }
.demo .battles li b { font-family: var(--serif); font-weight: 800; }
.demo .battles li small { font-size: .8em; color: var(--ink-soft); margin: 0 .3em 0 .15em; }
.demo .battles li em { font-style: normal; font-weight: 700; white-space: nowrap; }
.demo .battles li.w em { color: #1d6b2f; }
.demo .battles li.l em { color: var(--red); }
.demo .reveal.paged .law { margin-top: .6em; padding: .6em 1em; font-size: clamp(12px, 1.25vw, 15px); line-height: 1.75; }
.demo .reveal.paged .picks .row { padding: .35em 0; }
.demo .reveal.paged .picks .row .old { font-size: clamp(12px, 1.25vw, 15px); }
.demo .reveal.paged .picks .row .new { font-size: clamp(12px, 1.2vw, 14px); line-height: 1.5; }
.demo .reveal.paged .picks .row.mine .old::before { top: -1.25em; }
.demo .reveal.paged .map-note { margin-top: .5em; font-size: 11px; line-height: 1.6; }
.demo .reveal.paged .closing { font-size: clamp(14px, 1.6vw, 20px); line-height: 1.5; margin-top: .6em; }
.demo .reveal.paged .closing .choices { margin-top: .5em; gap: 8px; }
.demo .reveal.paged .closing .choice { padding: .7em 1.4em; font-size: 13px; }
.demo .rv-nav { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: clamp(8px, 1.4vw, 16px); }
.demo .rv-nav button { font-family: var(--sans); font-weight: 700; font-size: 13px; letter-spacing: .06em; padding: .6em 1.4em; border: 1px solid var(--ink-d); background: var(--ink-d); color: var(--paper); border-radius: 2px; }
.demo .rv-nav .rv-prev { background: transparent; color: var(--ink-d); }
.demo .rv-nav button:disabled { opacity: .3; }
.demo .rv-nav .rv-no { font-family: var(--serif); font-weight: 800; font-size: 13px; color: var(--ink-soft); }
@media (max-width: 720px) {
  .demo .battles li { grid-template-columns: 1fr auto; }
  .demo .battles li span { grid-column: 1 / -1; grid-row: 2; }
  .demo .reveal.paged .picks .row { grid-template-columns: 1fr; gap: 0; }
  .demo .reveal.paged .picks .row .arrow { display: none; }
  .demo .reveal.paged .closing .choices { flex-direction: column; }
}
@media (max-width: 720px) {
  .demo .reveal.paged { padding: 10px 12px; }
  .demo .reveal.paged .map-note { display: none; }
  .demo .reveal.paged .closing { margin-top: .3em; font-size: 14px; }
  .demo .reveal.paged .closing .choices { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .demo .reveal.paged .closing .choice { flex: 1 1 40%; padding: .55em .6em; font-size: 12px; letter-spacing: .02em; }
  .demo .rv-nav { margin-top: 6px; gap: 10px; }
  .demo .rv-nav button { padding: .45em 1em; font-size: 12px; }
  .demo .reveal.paged .picks .row { padding: .2em 0; }
  .demo .reveal.paged .picks .row .new { font-size: 11.5px; line-height: 1.45; }
  .demo .reveal.paged .picks .row .old { font-size: 12px; }
  .demo .reveal.paged .picks .row.mine .old::before { font-size: 9px; }
  .demo .battles li { padding: .35em .6em; font-size: 11.5px; }
  .demo .reveal.paged .law { padding: .45em .7em; font-size: 11.5px; line-height: 1.6; }
  .demo .reveal.paged h2 { font-size: 19px; }
  .demo .reveal.paged .verdict { font-size: 12.5px; }
}
@media (max-width: 720px) { .demo .reveal.paged .ledger-h { margin: .4em 0 .3em; padding-top: .35em; font-size: 13px; } .demo .battles { gap: 3px; } }
/* 台詞：タップ待ちの印 */
.demo .box.wait::after { content: "▼"; display: inline-block; margin-left: .5em; font-size: .6em; color: var(--red); vertical-align: middle; animation: demo-tap 1s ease-in-out infinite; }
.demo .box.narr.wait::after { color: #f0c040; }
@keyframes demo-tap { 50% { transform: translateY(3px); opacity: .4; } }
/* ▼は文の流れに入れず右下の角に置く（後から出ても吹き出しの大きさを変えない）。余白は最初から取っておく */
.demo.game-mode .say .box { position: relative; padding-right: calc(clamp(14px, 1.8vw, 24px) + 1.1em); }
.demo .box.wait::after { position: absolute; right: .55em; bottom: .45em; margin: 0; }
/* 称号の札 */
.demo .titlecard { background: var(--ink-d); color: var(--paper); border: var(--line) solid var(--ink-d); box-shadow: 6px 6px 0 var(--red); text-align: center; padding: clamp(18px, 3vw, 36px) 20px; animation: demo-stamp .5s cubic-bezier(.2, 1.4, .4, 1); }
.demo .titlecard small { display: block; font-family: var(--sans); font-weight: 700; font-size: 12px; letter-spacing: .5em; color: #f0c040; }
.demo .titlecard .t { font-family: var(--serif); font-weight: 900; font-size: clamp(28px, 4.6vw, 56px); letter-spacing: .1em; margin: .2em 0 .3em; }
.demo .titlecard.win .t { color: #f0c040; }
.demo .titlecard .more { font-size: 12px; color: rgba(243, 238, 227, .75); }
@keyframes demo-stamp { from { transform: scale(1.4); opacity: 0; } to { transform: none; opacity: 1; } }
/* 称号の札：紙の地に墨（勝ちは朱） */
.demo .titlecard { background: var(--paper); color: var(--ink-d); border: var(--line) solid var(--ink-d); box-shadow: 6px 6px 0 var(--ink-d); }
.demo .titlecard small { color: var(--red); }
.demo .titlecard .t { color: var(--ink-d); }
.demo .titlecard.win { box-shadow: 6px 6px 0 var(--red); }
.demo .titlecard.win .t { color: var(--red); }
.demo .titlecard .more { color: var(--ink-soft); }
/* 決まりの札：項目の書体をゴシックにそろえる（太字部分だけ明朝になっていた） */
.demo .rules li, .demo .rules li b, .demo .rules li small { font-family: var(--sans); }
.demo .rules li { font-weight: 500; }
.demo .rules li b { font-weight: 700; font-size: 1em; margin-right: .3em; }
.demo .rules li small { font-weight: 500; }
