:root {
  color-scheme: dark;
  --bg: #0f0b12;
  --bg-2: #17111d;
  --paper: #f0e4c9;
  --paper-d: #cdbd9d;
  --paper-dim: #978a71;
  --line: rgba(240, 228, 201, 0.15);
  --line-strong: rgba(240, 228, 201, 0.28);
  --accent: #b08d44;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--paper);
  font-family: "Shippori Mincho", "Noto Serif JP", serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.9;
  background:
    radial-gradient(circle at 15% 18%, rgba(58, 76, 192, 0.18), transparent 24%),
    radial-gradient(circle at 84% 12%, rgba(181, 49, 74, 0.14), transparent 20%),
    radial-gradient(circle at 72% 82%, rgba(45, 143, 130, 0.16), transparent 24%),
    linear-gradient(180deg, #120d16 0%, #09070b 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

body::after {
  content: "";
  position: fixed;
  inset: -20% -10% auto auto;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(181, 49, 74, 0.14), transparent 60%);
  filter: blur(24px);
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.hero,
.panel,
.note {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  gap: 14px;
  align-items: end;
  padding: 18px 18px 26px;
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0;
  color: var(--paper-dim);
  letter-spacing: 0.34em;
  font-size: 0.68rem;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: clamp(2.1rem, 8vw, 4.9rem);
  line-height: 1.02;
  letter-spacing: 0.08em;
}

.lead {
  margin: 0;
  max-width: 68ch;
  color: var(--paper);
  line-height: 1.95;
  font-size: 0.94rem;
}

/* 企画趣旨（hero） ── タグライン → 掴み（lead） → 開閉式の本文 → 操作ヒント
   文字サイズ切替（.font-size-* p）が hero の段落まで一律に効いてしまうため、
   趣旨まわりだけは .hero 側で明示的に打ち消して階層を保つ。 */
.hero .tagline {
  margin: 0;
  font-family: "Zen Old Mincho";
  color: var(--paper-d);
  font-size: clamp(1rem, 2.6vw, 1.3rem) !important;
  line-height: 1.7 !important;
  letter-spacing: 0.1em;
}

/* 掴みの一文に出す武将名は、各編の themeColor（scenario.json）と同じ色を使う。 */
.hero .lead-name {
  color: var(--lead-name, var(--paper));
  font-weight: 600;
}

.lead-name--uesugi { --lead-name: #ffce3a; }
.lead-name--takeda { --lead-name: #ec6a64; }
.lead-name--oda { --lead-name: #39ff14; }

.about {
  margin: -4px 0 0;
  max-width: 68ch;
}

.about__summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 4px 0;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  list-style: none;
}

.about__summary::-webkit-details-marker {
  display: none;
}

.about__summary::before {
  content: "＋";
  color: var(--paper-dim);
  font-size: 0.9em;
  transition: transform 0.2s ease;
}

.about[open] .about__summary::before {
  content: "－";
}

.about__summary:hover,
.about__summary:focus-visible {
  color: var(--paper);
}

.about__body {
  padding: 4px 0 2px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
  margin-top: 6px;
}

.hero .about__body p {
  margin: 0 0 12px;
  color: var(--paper-d);
  font-size: 0.9rem !important;
  line-height: 1.95 !important;
}

.hero .about__body p:last-child {
  margin-bottom: 0;
}

.hero .about__note {
  color: var(--paper-dim);
  font-size: 0.76rem !important;
  line-height: 1.8 !important;
}

.hero .hero__hint {
  margin: 0;
  color: var(--paper-dim);
  font-size: 0.82rem !important;
  line-height: 1.8 !important;
  letter-spacing: 0.04em;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.panel {
  overflow: hidden;
}

.panel__head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel__title {
  margin: 0;
  font-family: "Zen Old Mincho";
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.panel__hint {
  color: var(--paper-dim);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.panel__tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.font-size-switch {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.size-button {
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: var(--paper-d);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  min-width: 2.6em;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.size-button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--paper);
  background: rgba(176, 141, 68, 0.2);
}

.size-button:hover,
.size-button:focus-visible {
  border-color: var(--accent);
  color: var(--paper);
  outline: none;
}

.scenario-list {
  padding: 14px;
  display: grid;
  gap: 22px;
}

/* カテゴリ（メインストーリー表／裏、サブストーリー東／西／南）ごとの区切り */
.scenario-group {
  display: grid;
  gap: 12px;
}

.scenario-group__head {
  margin: 0;
  font-weight: inherit;
}

/* カテゴリ見出し＝開閉ボタン */
.scenario-group__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font: inherit;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--line);
  padding: 6px 2px 8px;
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.scenario-group__toggle:hover,
.scenario-group__toggle:focus-visible {
  border-bottom-color: var(--accent);
  outline: none;
}

.scenario-group__toggle:hover .scenario-group__title,
.scenario-group__toggle:focus-visible .scenario-group__title {
  color: var(--paper);
}

.scenario-group__marker {
  width: 0;
  height: 0;
  border-left: 7px solid var(--accent);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 0.18s ease;
}

.scenario-group__toggle[aria-expanded="true"] .scenario-group__marker {
  transform: rotate(90deg);
}

.scenario-group__title {
  margin: 0;
  color: var(--paper-d);
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: 0.98rem;
  line-height: 1.4;
  letter-spacing: 0.16em;
  transition: color 0.16s ease;
}

.scenario-group__note {
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.scenario-group__count {
  margin-left: auto;
  color: var(--paper-dim);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
}

.scenario-group__items {
  display: grid;
  gap: 12px;
}

.scenario-group.is-collapsed .scenario-group__items {
  display: none;
}

/* 未作成シナリオの枠。選択・開始はできない */
.scenario-upcoming {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 13px 16px;
  color: var(--paper-dim);
  background: rgba(255, 255, 255, 0.02);
}

.scenario-upcoming__name {
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: 1.02rem;
  line-height: 1.3;
  letter-spacing: 0.05em;
}

.scenario-upcoming__badge {
  font-size: 0.74rem;
  letter-spacing: 0.1em;
}

.scenario {
  display: block;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 16px 16px 14px;
  color: inherit;
  text-decoration: none;
  background: linear-gradient(180deg, rgba(16, 12, 21, 0.92), rgba(23, 17, 29, 0.92));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.scenario:hover,
.scenario:focus-within,
.scenario.is-active {
  transform: translateX(4px);
  border-color: #b08d44;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.03), -6px 0 0 0 #b08d44;
  outline: none;
}

.scenario__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.scenario__order {
  color: #b08d44;
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.26em;
}

.scenario__tag {
  color: var(--paper-dim);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

/* 年号・国名・主人公名 → 編名の順に、各編のテーマカラー（--scenario-theme）で着色する。
   テーマカラー未設定のシナリオは従来の金色にフォールバックする。 */
.scenario__head {
  margin: 0 0 14px;
  color: var(--scenario-theme, #b08d44);
}

/* 年号・国名・主人公名は情報行なので、本文の明朝ではなくゴシックで読みやすく。 */
.scenario__era {
  margin: 0 0 4px;
  color: inherit;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.82rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  opacity: 0.92;
}

.scenario__title {
  margin: 0;
  color: inherit;
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: 1.38rem;
  line-height: 1.24;
  letter-spacing: 0.05em;
}

.scenario__summary {
  margin: 0;
  color: var(--paper-d);
  font-size: 0.88rem;
  line-height: 1.85;
}

.scenario__actions {
  margin-top: 14px;
}

.action-button {
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  color: var(--paper);
  background: rgba(176, 141, 68, 0.16);
  padding: 8px 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.action-button:hover,
.action-button:focus-visible {
  border-color: var(--accent);
  background: rgba(176, 141, 68, 0.26);
  transform: translateY(-1px);
  outline: none;
}

.scenario__foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--paper-dim);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.scenario__foot a {
  color: var(--accent);
  text-decoration: none;
}

/* 画面モード切替表示制御 */
body.is-list-mode .viewer-only {
  display: none !important;
}

body.is-viewer-mode .list-only {
  display: none !important;
}

body.is-viewer-mode {
  overflow: hidden;
}

body.is-viewer-mode .page {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  min-height: 100vh;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
}

body.is-viewer-mode .main {
  margin-top: 0;
}

.scenario {
  cursor: pointer;
}

.viewer-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  padding: 16px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

body.is-viewer-mode .viewer-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 24px);
  margin: 0;
}

.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.viewer-title {
  margin: 0 0 4px;
  font-family: "Zen Old Mincho", serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--paper);
}

.viewer-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.stage-meta {
  margin: 0;
  color: var(--paper-dim);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.rethink-button {
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  color: var(--paper);
  background: linear-gradient(160deg, rgba(176, 141, 68, 0.28), rgba(176, 141, 68, 0.1));
  padding: 7px 16px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.rethink-button:hover,
.rethink-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(176, 141, 68, 0.2);
  outline: none;
}

.scenario-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  height: clamp(520px, 75vh, 850px);
  background: rgba(11, 8, 14, 0.85);
  overflow: hidden;
}

body.is-viewer-mode .scenario-stage {
  flex: 1;
  height: 100%;
  min-height: 0;
}

.scenario-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #09070b;
}

.stage-placeholder {
  margin: 0;
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  color: var(--paper-dim);
  font-size: 0.84rem;
}

.empty {
  padding: 20px;
  color: var(--paper-dim);
}

/* iframe内の文字サイズおよび要素横幅（#app, .stage等）のスケーリング */
html.font-size-small,
body.font-size-small,
.font-size-small {
  font-size: 13px !important;
}

html.font-size-small .stage,
body.font-size-small .stage,
.font-size-small .stage {
  max-width: 680px !important;
}

html.font-size-medium,
body.font-size-medium,
.font-size-medium {
  font-size: 16.5px !important;
}

html.font-size-medium .stage,
body.font-size-medium .stage,
.font-size-medium .stage {
  max-width: 840px !important;
}

html.font-size-large,
body.font-size-large,
.font-size-large {
  font-size: 22px !important;
}

html.font-size-large .stage,
body.font-size-large .stage,
.font-size-large .stage {
  max-width: 1120px !important;
  width: 94% !important;
}

html.font-size-large #app,
body.font-size-large #app,
.font-size-large #app {
  width: 100% !important;
  max-width: 100% !important;
}

/* メインコンテンツ要素に対するフォントサイズおよび幅の補正 */
.font-size-small .narr,
.font-size-small .txt,
.font-size-small .lead,
.font-size-small .choice,
.font-size-small .cast-item,
.font-size-small .p,
.font-size-small p {
  font-size: 0.8rem !important;
  line-height: 1.75 !important;
}
.font-size-small .title h1 {
  font-size: 2.1rem !important;
}

.font-size-medium .narr,
.font-size-medium .txt,
.font-size-medium .lead,
.font-size-medium .choice,
.font-size-medium .cast-item,
.font-size-medium p {
  font-size: 0.96rem !important;
  line-height: 1.95 !important;
}
.font-size-medium .title h1 {
  font-size: 2.8rem !important;
}

.font-size-large .narr,
.font-size-large .txt,
.font-size-large .lead,
.font-size-large .choice,
.font-size-large .cast-item,
.font-size-large p {
  font-size: 1.35rem !important;
  line-height: 2.15 !important;
}
.font-size-large .lead {
  max-width: 85ch !important;
}
.font-size-large .cast {
  max-width: 960px !important;
  width: 100% !important;
}
.font-size-large .title h1 {
  font-size: 3.8rem !important;
}
.font-size-large .who {
  font-size: 1.15rem !important;
}
.font-size-large .next {
  font-size: 1.15rem !important;
  padding: 14px 40px !important;
}
.font-size-large .choice {
  padding: 18px 24px !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 960px) {
  .panel__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel__tools {
    width: 100%;
    justify-content: space-between;
  }

  .scenario__actions {
    grid-template-columns: 1fr;
  }

  .note {
    padding: 14px;
  }
}

.stage {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  background: linear-gradient(rgba(15, 11, 18, 0.96), rgba(15, 11, 18, 0.6), transparent);
  z-index: 5;
  backdrop-filter: blur(2px);
}

.hud .chapter {
  font-family: "Zen Old Mincho";
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  line-height: 1.45;
}

.trust-wrap,
.sync-wrap {
  text-align: right;
  min-width: 150px;
}

.trust-lbl,
.sync-lbl {
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  color: var(--paper-dim);
  margin-bottom: 3px;
}

.trust-bar,
.sync-bar {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.trust-fill,
.sync-fill {
  height: 100%;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 4px;
}

.scene {
  flex: 1;
  padding: 30px 0 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.place {
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 16px;
  font-weight: 600;
}

.narr {
  font-size: 0.95rem;
  color: var(--paper-d)
  ;
  font-weight: 300;
  letter-spacing: 0.03em;
  line-height: 2.1;
  margin-bottom: 18px;
}

.narr.center {
  text-align: center;
}

.narr em {
  color: var(--paper);
  font-style: normal;
}

.speak {
  margin-bottom: 18px;
  padding-left: 15px;
  border-left: 2px solid rgba(255, 255, 255, 0.16);
}

.speak .who {
  font-family: "Zen Old Mincho";
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.who.reika,
.who.akane,
.who.tsubasa {
  color: var(--accent);
}

.who.sessai,
.who.self {
  color: var(--paper);
}

.who.kasumi,
.who.fan,
.who.kata,
.who.yuko {
  color: #a9dcf2;
}

.who.mio,
.who.harukata {
  color: #c2492f;
}

.who.mob,
.who.busou {
  color: var(--paper-dim);
}

.speak .txt {
  font-size: 0.96rem;
  color: var(--paper);
  font-weight: 400;
  line-height: 2;
  letter-spacing: 0.02em;
}

.inner {
  margin-bottom: 18px;
  padding: 10px 16px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.inner .txt {
  font-size: 0.9rem;
  color: var(--paper-dim);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1.95;
}

.inner .txt::before {
  content: "（心の声）　";
  color: var(--accent);
  font-style: normal;
  font-size: 0.72rem;
}

.choices {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.choice {
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 15px 19px;
  color: var(--paper);
  font-size: 0.9rem;
  line-height: 1.7;
  letter-spacing: 0.02em;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s, box-shadow 0.25s;
}

.choice:hover,
.choice:focus-visible {
  transform: translateX(5px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px -14px rgba(0, 0, 0, 0.8);
  outline: none;
}

.choice .c-head {
  font-family: "Zen Old Mincho";
  font-weight: 700;
  color: var(--accent);
  font-size: 0.94rem;
  margin-bottom: 3px;
  display: block;
}

.choice .c-sub {
  font-size: 0.76rem;
  color: var(--paper-dim);
  font-weight: 300;
}

.next {
  margin-top: 26px;
  align-self: flex-start;
  font-family: "Zen Old Mincho";
  font-weight: 700;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  padding: 11px 30px;
  border-radius: 5px;
  font-size: 0.84rem;
  letter-spacing: 0.14em;
  transition: 0.3s;
}

.next:hover,
.next:focus-visible {
  background: var(--accent);
  color: var(--bg);
  outline: none;
}

.scenario-nav-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
  align-items: center;
}

.scenario-nav-inline .next {
  margin-top: 0;
}

.scenario-inline-rethink {
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper-d);
  border-color: rgba(255, 255, 255, 0.28);
}

.scenario-inline-rethink:hover,
.scenario-inline-rethink:focus-visible {
  color: var(--paper);
  border-color: var(--accent);
}

.hint {
  font-size: 0.7rem;
  color: var(--paper-dim);
  font-weight: 300;
  letter-spacing: 0.04em;
  margin-top: 8px;
  font-style: italic;
}

.feedback {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 5px;
  font-style: italic;
}

.feedback.up {
  color: #d6a8c4;
  background: rgba(214, 168, 196, 0.08);
  border: 1px solid rgba(214, 168, 196, 0.2);
}

.feedback.flat {
  color: var(--paper-dim);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.feedback.down {
  color: #c2492f;
  background: rgba(156, 51, 39, 0.06);
  border: 1px solid rgba(156, 51, 39, 0.2);
}

.title {
  text-align: center;
  padding: 50px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.title .seal {
  width: 76px;
  height: 76px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.04);
  transform: rotate(-2deg);
  margin-bottom: 26px;
}

.title h1 {
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: clamp(2rem, 7.5vw, 3.2rem);
  letter-spacing: 0.12em;
  line-height: 1.25;
  margin-bottom: 8px;
}

.title h1 .a {
  color: var(--accent);
}

.title .ed {
  font-size: 0.8rem;
  letter-spacing: 0.34em;
  color: var(--paper-dim);
  margin-bottom: 6px;
  font-weight: 600;
}

.title .lead {
  font-size: 0.88rem;
  color: var(--paper-d);
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 2.05;
  max-width: 450px;
  margin: 22px 0 30px;
}

.cast {
  max-width: 490px;
  margin: 8px 0 30px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), transparent);
}

.cast-ttl {
  font-family: "Zen Old Mincho";
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-align: center;
  margin-bottom: 16px;
}

.cast-item {
  font-size: 0.82rem;
  color: var(--paper-dim);
  font-weight: 300;
  line-height: 1.85;
  letter-spacing: 0.02em;
  margin-bottom: 13px;
}

.cast-item .cn {
  display: block;
  font-family: "Zen Old Mincho";
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent);
  margin-bottom: 2px;
  letter-spacing: 0.04em;
}

.cast-note {
  font-size: 0.72rem;
  color: var(--paper-dim);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.02em;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 12px;
  margin-top: 4px;
}

.chapter-cover {
  text-align: center;
  padding: 74px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chapter-cover .num {
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: var(--paper-dim);
  margin-bottom: 14px;
}

.chapter-cover .ttl {
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: clamp(1.9rem, 6.5vw, 2.8rem);
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 16px;
}

.chapter-cover .sub {
  font-size: 0.82rem;
  color: var(--paper-dim);
  letter-spacing: 0.06em;
  line-height: 1.95;
}

.ending {
  text-align: center;
  padding: 34px 0;
}

.ending .seal-e {
  width: 62px;
  height: 62px;
  margin: 0 auto 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: 0.92rem;
}

.ending .seal-e.good {
  border: 2px solid var(--accent);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.ending h2 {
  font-family: "Zen Old Mincho";
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}

.ending .summary {
  font-size: 0.9rem;
  color: var(--paper-d);
  font-weight: 300;
  line-height: 2.1;
  letter-spacing: 0.03em;
  text-align: left;
  margin-bottom: 22px;
}

.ending .teaser {
  font-size: 0.8rem;
  color: var(--paper-dim);
  font-weight: 300;
  line-height: 2;
  letter-spacing: 0.03em;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 20px;
  font-style: italic;
  text-align: left;
}

.u-hidden {
  display: none;
}

.u-self-center {
  align-self: center;
}

.u-mt-24,
.u-mt-30,
.u-mt-32,
.u-mt-34 {
  margin-top: 24px;
}

.u-mt-30 {
  margin-top: 30px;
}

.u-mt-32 {
  margin-top: 32px;
}

.u-mt-34 {
  margin-top: 34px;
}

.u-text-center {
  text-align: center;
}

.u-next-label {
  font-family: "Zen Old Mincho";
  font-size: 0.76rem;
  letter-spacing: 0.26em;
  color: var(--paper-dim);
  margin-bottom: 8px;
}

.u-next-title {
  font-family: "Zen Old Mincho";
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.u-note-dim {
  font-size: 0.78rem;
  color: var(--paper-dim);
  margin-top: 6px;
}

.u-end-cap {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.u-end-title {
  font-family: "Zen Old Mincho";
  font-size: 1rem;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
}

.u-crimson-strong {
  color: var(--accent);
  font-weight: 700;
}

.fade {
  animation: fade 0.65s ease both;
}

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

@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page { padding: 18px 12px 28px; }
  .hero,
  .panel,
  .note,
  .legacy { border-radius: 18px; }
  .panel__head { align-items: flex-start; flex-direction: column; }
  .scenario__foot { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .scenario,
  .scenario-group__toggle,
  .scenario-group__marker,
  .scenario-group__title,
  .choice,
  .next,
  .fade {
    transition: none;
    animation: none;
  }
}
