:root {
  --purple: #585ae0;
  --purple-600: #4648b3;
  --purple-tint: rgba(88, 90, 224, 0.07);
  --purple-line: rgba(88, 90, 224, 0.2);
  --green: #1a9d58;

  /* Callout — アプリ src/components/ui/callout.tsx と同じ配色（neutral / green / orange） */
  --tip-bg: #dcfce7;
  --tip-line: #bbf7d0;
  --tip-icon: #22c55e;
  --tip-fg: #116932;
  --warn-bg: #ffedd5;
  --warn-line: #fed7aa;
  --warn-icon: #f97316;
  --warn-fg: #92310a;

  --canvas: #eeece6;
  --grid-fine: rgba(64, 58, 46, 0.05);
  --grid-rule: rgba(64, 58, 46, 0.09);
  --rail: #e9e6e0;
  --paper: #ffffff;
  --wash: #f5f4f1;
  --hover: rgba(40, 38, 30, 0.05);
  --fg: #2b2825;
  --fg-muted: #6d6a61;
  --fg-faint: #a4a093;
  --border: rgba(40, 38, 30, 0.08);
  --border-strong: rgba(40, 38, 30, 0.13);
  --ring: 0 0 0 1px hsl(40 16% 38% / 0.08);
  --paper-shadow: 0 0 0 1px hsl(40 16% 38% / 0.07), 0 1px 2px hsl(40 16% 38% / 0.05),
    0 10px 30px hsl(40 16% 38% / 0.07);

  /* スライドは 1280x720 の固定サイズで組み、画面に合わせて --fit で縮小する（常に1画面に収める） */
  --stage-w: 1280px;
  --stage-h: 720px;
  --fit: 1;
  /* hotspot はキャプチャが主役。紙の高さのほとんどを画像に渡す */
  --hot-max-h: 452px;
  /* 縦長は凡例が横に並ぶので、高さを全部使える */
  --hot-tall-h: 496px;
  /* 番号なしは凡例も無いので、さらに高さを使える */
  --hot-bare-h: 512px;
  /* 注記を横に回した組み。画像は紙の高さをほぼ全部使う */
  --hot-split-h: 540px;
  --topbar-h: 54px;
  --rail-w: 264px;
  --side-w: var(--rail-w);
  --font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

:root[data-theme='dark'] {
  --purple: #8b8df0;
  --purple-600: #a8a9ff;
  --purple-tint: rgba(124, 126, 240, 0.18);
  --purple-line: rgba(124, 126, 240, 0.3);
  --green: #4dd68a;

  --tip-bg: #042713;
  --tip-line: #124a28;
  --tip-icon: #4ade80;
  --tip-fg: #86efac;
  --warn-bg: #3b1106;
  --warn-line: #6c2710;
  --warn-icon: #fb923c;
  --warn-fg: #fdba74;

  --canvas: #1c1913;
  --grid-fine: rgba(255, 250, 240, 0.035);
  --grid-rule: rgba(255, 250, 240, 0.055);
  --rail: #211d16;
  --paper: #2c2820;
  --wash: rgba(255, 250, 240, 0.05);
  --hover: rgba(255, 250, 240, 0.06);
  --fg: #ece7dd;
  --fg-muted: #a59f93;
  --fg-faint: #6f6a5e;
  --border: rgba(255, 250, 240, 0.12);
  --border-strong: rgba(255, 250, 240, 0.2);
  --ring: 0 0 0 1px rgba(255, 250, 240, 0.1);
  --paper-shadow: 0 0 0 1px rgba(255, 250, 240, 0.09), 0 4px 12px rgba(0, 0, 0, 0.4),
    0 18px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--canvas);
  background-image: linear-gradient(var(--grid-rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-rule) 1px, transparent 1px), linear-gradient(var(--grid-fine) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-fine) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  color: var(--fg);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

kbd {
  font-family: var(--font);
  font-size: 10.5px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg-faint);
  background: transparent;
}

/* ---------- progress ---------- */
.progress-rail {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 60;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--purple);
  transition: width 0.25s ease;
}

/* ---------- topbar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--rail);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
}
.brand-logo {
  height: 23px;
  width: auto;
}
:root[data-theme='dark'] .brand-logo {
  filter: brightness(1.4);
}
.brand-divider {
  width: 1px;
  height: 15px;
  background: var(--border-strong);
}
.brand-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}

.topbar-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.status-track {
  padding: 3px 11px;
  border-radius: 9999px;
  background: var(--wash);
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 12px;
}
.status-count {
  font-variant-numeric: tabular-nums;
  color: var(--fg-faint);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 33px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn {
  width: 33px;
}
.ghost-btn {
  padding: 0 14px;
}
.icon-btn:hover,
.ghost-btn:hover {
  background: var(--hover);
  color: var(--fg);
}

/* 詳細度スイッチ。OFF=サマリ、ON=詳細ページも表示 */
.detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 33px;
  padding: 0 13px 0 10px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.detail-toggle:hover {
  background: var(--hover);
  color: var(--fg);
}
.detail-track {
  position: relative;
  width: 26px;
  height: 15px;
  border-radius: 9999px;
  background: var(--border-strong);
  transition: background 0.18s;
}
.detail-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform 0.18s;
}
.detail-toggle[aria-checked='true'] {
  border-color: var(--purple);
  color: var(--purple);
}
.detail-toggle[aria-checked='true'] .detail-track {
  background: var(--purple);
}
.detail-toggle[aria-checked='true'] .detail-thumb {
  transform: translateX(11px);
}

.rail-btn {
  border-color: transparent;
}
.menu-btn {
  display: none;
  border-color: transparent;
}
.icon-moon {
  display: none;
}
:root[data-theme='dark'] .icon-sun {
  display: none;
}
:root[data-theme='dark'] .icon-moon {
  display: block;
}

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  background: var(--rail);
  border-right: 1px solid var(--border);
  z-index: 40;
  transition: transform 0.2s ease;
}
:root.rail-off .sidebar {
  transform: translateX(-100%);
}
:root.rail-off {
  --side-w: 0px;
}

.track-tabs {
  display: flex;
  gap: 2px;
  padding: 12px 12px 10px;
}
.track-tab {
  flex: 1;
  padding: 6px 2px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.track-tab:hover {
  background: var(--hover);
}
.track-tab[aria-selected='true'] {
  background: var(--paper);
  color: var(--purple);
  box-shadow: var(--ring);
}

.toc {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 24px;
  scrollbar-width: thin;
}
.toc-chapter {
  margin-bottom: 16px;
}
.toc-chapter-label {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-faint);
}
.toc-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.toc-item:hover {
  background: var(--hover);
  color: var(--fg);
}
.toc-item[aria-current='true'] {
  background: var(--purple-tint);
  color: var(--purple);
  font-weight: 600;
}
.toc-dot {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--border-strong);
  font-size: 0;
  color: transparent;
}
.toc-item[aria-current='true'] .toc-dot {
  background: var(--purple);
}
.toc-item.done .toc-dot {
  background: var(--green);
}
.toc-tag {
  font-size: 10.5px;
  color: var(--fg-faint);
  margin-left: 5px;
}
.toc-tag.detail {
  color: var(--purple);
}

.sidebar-foot {
  padding: 10px 16px 14px;
}
.reset-btn {
  width: 100%;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: transparent;
  color: var(--fg-faint);
  font-family: var(--font);
  font-size: 11.5px;
  cursor: pointer;
}
.reset-btn:hover {
  color: var(--fg-muted);
  background: var(--hover);
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.35);
  z-index: 35;
}

/* ---------- deck / paper ---------- */
.deck {
  position: absolute;
  top: var(--topbar-h);
  left: var(--side-w);
  right: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  outline: none;
  transition: left 0.2s ease;
}

.slide {
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  scroll-snap-align: center;
}
.slide-inner {
  flex: none;
  width: var(--stage-w);
  height: var(--stage-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 52px;
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--paper-shadow);
  overflow: hidden;
  transform: scale(var(--fit));
  /* scale はレイアウト上のサイズを変えないため、縮小分を負マージンで相殺して中央に置く */
  margin: calc((var(--fit) - 1) * var(--stage-h) / 2) calc((var(--fit) - 1) * var(--stage-w) / 2);
}

.slide-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-faint);
  margin-bottom: 8px;
}
.slide-kicker .num {
  color: var(--purple);
  font-variant-numeric: tabular-nums;
}
.kicker-badge {
  padding: 1px 7px;
  border: 1px solid var(--purple);
  border-radius: 9999px;
  color: var(--purple);
  font-size: 10.5px;
  font-weight: 600;
}
.slide-kicker .num::after {
  content: '';
  display: inline-block;
  width: 1px;
  height: 10px;
  margin-left: 9px;
  background: var(--border-strong);
  vertical-align: -1px;
}
.slide h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.3vw, 29px);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.slide-lead {
  margin: 0 0 20px;
  font-size: 14.5px;
  color: var(--fg-muted);
  max-width: 76ch;
  text-wrap: pretty;
}

.slide-body {
  display: grid;
  gap: 22px;
}
/* キャプチャを左に、注記を右に。画像が紙の高さを使い切れて、
   文章の行長も読みやすい幅で止まる（狭い画面では下に積み直す） */
/* 左はキャプチャの実寸に合わせて縮める。固定比で割ると、縦長のキャプチャのときに
   左半分の大半が空く。右は読みやすい行長で頭打ちにする */
.slide-body.split {
  grid-template-columns: minmax(0, auto) minmax(280px, 560px);
  justify-content: center;
  gap: 30px;
  align-items: start;
}
.split-media {
  min-width: 0;
}
.split-media .hotspot-frame img {
  max-height: var(--hot-split-h);
}
.slide-fit {
  width: 100%;
}

/* ---------- route（この画面への行き方） ----------
   やることが分かっても、そこへどう辿り着くかが抜けていると手が止まる。
   サイドバーからボタンまでを1行で示し、末尾から本体アプリの該当画面へ渡す */
.route {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0 0 15px;
  padding: 5px 6px 5px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--wash);
}
.route-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
}
.route-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 7px;
  min-width: 0;
  line-height: 1.7;
}
.route-step {
  font-size: 12.5px;
  font-weight: 600;
}
.route-sep {
  font-size: 12.5px;
  color: var(--fg-faint);
}
.route-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 11px;
  border-radius: 9999px;
  border: 1px solid var(--purple-line);
  background: var(--paper);
  color: var(--purple);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.route-open:hover {
  background: var(--purple-tint);
}
.route-open svg {
  width: 12px;
  height: 12px;
}

/* キャプチャが読み込めなかったときの差し替え表示 */
.shot-missing {
  display: grid;
  place-items: center;
  gap: 4px;
  aspect-ratio: 16 / 10;
  max-height: 300px;
  color: var(--fg-faint);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}
.shot-missing strong {
  font-weight: 600;
  color: var(--fg-muted);
}

/* ---------- hotspot（番号を打ったキャプチャ） ----------
   キャプチャを主役に置き、説明は番号に対応した一行だけにする。
   位置を文章で説明するより、画面のその場所を指すほうが早い */
.hotspot {
  margin: 0;
  display: grid;
  gap: 16px;
  justify-items: center;
  width: 100%;
}
.hotspot-frame {
  position: relative;
  width: fit-content;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--wash);
  overflow: hidden;
  line-height: 0;
}
.hotspot-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: var(--hot-max-h);
  cursor: zoom-in;
}
/* キャプチャ未配置。番号は乗せられないので凡例だけで読ませる */
.hotspot-frame.missing {
  width: 100%;
  line-height: 1.6;
}
.hotspot-frame.missing .pin {
  display: none;
}
/* 縦長のキャプチャ（メニューなど）を上下に積むと、幅に合わせて潰れて字が読めなくなる。
   紙は横長なので、縦長のときだけ凡例を右へ回して高さを画像に使い切らせる */
.hotspot.tall {
  grid-template-columns: auto minmax(200px, 420px);
  justify-content: center;
  align-items: center;
  gap: 28px;
  justify-items: stretch;
}
.hotspot.tall .hotspot-frame img {
  max-height: var(--hot-tall-h);
}
.hotspot.tall .hotspot-legend {
  grid-template-columns: 1fr;
  gap: 12px;
}
/* 縦長は表示幅が狭い。バッジの大きさは固定なので、そのままだと画像を覆ってしまう */
.hotspot.tall .pin {
  width: 21px;
  height: 21px;
  font-size: 11.5px;
}
/* 番号を振らない場合。画像に高さを全部渡す */
.hotspot.bare .hotspot-frame img {
  max-height: var(--hot-bare-h);
}
.hotspot-caption {
  font-size: 12px;
  color: var(--fg-muted);
  text-align: center;
}
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 25px;
  height: 25px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--purple);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
/* 横長の対象（入力欄など）を囲って示したいとき */
.pin.wide {
  width: 25px;
}
.hotspot-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 20px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: pin;
}
.hotspot-legend li {
  position: relative;
  padding-left: 28px;
  counter-increment: pin;
}
.hotspot-legend li::before {
  content: counter(pin);
  position: absolute;
  left: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: var(--purple);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
}
.hotspot-legend strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.55;
}
.hotspot-legend span {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.65;
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 3vh 3vw;
  background: rgba(20, 18, 14, 0.78);
  cursor: zoom-out;
}
.lightbox[hidden] {
  display: none;
}
.lightbox img {
  max-width: 100%;
  max-height: 94vh;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

/* ---------- blocks ---------- */
.blocks {
  display: grid;
  gap: 18px;
  min-width: 0;
}
/* グリッド項目の既定は min-width: auto。表を包む .block-group がここで広がると
   .table-wrap の overflow-x が効かず、紙ごと横に溢れる */
.blocks > * {
  min-width: 0;
}
.block-title {
  margin: 0 0 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-faint);
}

/* steps */
.steps {
  display: grid;
  gap: 15px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  position: relative;
  padding-left: 33px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 3px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: var(--purple-tint);
  color: var(--purple);
  font-size: 11.5px;
  font-weight: 700;
}
.steps .step-title {
  display: block;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 1px;
}
.steps .step-text {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.8;
}

/* table */
.table-wrap {
  overflow-x: auto;
}
.g-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.g-table th,
.g-table td {
  padding: 10px 14px 10px 0;
  text-align: left;
  vertical-align: top;
  line-height: 1.75;
  border-bottom: 1px solid var(--border);
}
.g-table th {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-faint);
  white-space: nowrap;
  border-bottom-color: var(--border-strong);
  padding-bottom: 7px;
}
.g-table tr:last-child td {
  border-bottom: none;
}
.g-table th:first-child,
.g-table td:first-child {
  width: 1%;
  white-space: nowrap;
  padding-right: 26px;
}
.g-table td:first-child {
  font-weight: 600;
}

/* cards */
/* 紙を縮めると実効幅が広がり、8枚が1行に並んで各カードが細くなる。
   4列で折り返させて、1枚あたりの幅を読める大きさに保つ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(190px, 23%)), 1fr));
  gap: 8px;
}
.card {
  padding: 13px 15px;
  border-radius: 10px;
  background: var(--wash);
}
.card h4 {
  margin: 0 0 3px;
  font-size: 13.5px;
  font-weight: 600;
}
.card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.75;
}

/* flow */
.flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.flow-item {
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--wash);
}
.flow-step {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  font-variant-numeric: tabular-nums;
}
.flow-item h4 {
  margin: 3px 0 7px;
  font-size: 14.5px;
  font-weight: 600;
}
.flow-owner {
  display: inline-block;
  margin-bottom: 8px;
  padding: 1px 9px;
  border-radius: 9999px;
  background: var(--paper);
  box-shadow: var(--ring);
  font-size: 11px;
  color: var(--fg-muted);
}
.flow-item p {
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.75;
}

/* callout — アプリの Callout に合わせ、地色＋全周1px＋アイコン */
.note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--wash);
}
.note > svg {
  flex: none;
  width: 19px;
  height: 19px;
  margin-top: 2px;
  color: var(--fg-muted);
}
.note h4 {
  margin: 0 0 2px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
}
.note p {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.8;
}
.note.tip {
  border-color: var(--tip-line);
  background: var(--tip-bg);
}
.note.tip > svg {
  color: var(--tip-icon);
}
.note.tip h4 {
  color: var(--tip-fg);
}
.note.warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
}
.note.warn > svg {
  color: var(--warn-icon);
}
.note.warn h4 {
  color: var(--warn-fg);
}
:root[data-theme='dark'] .note p {
  color: var(--fg-muted);
}

/* compare */
.compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}
.compare-col {
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--wash);
}
.compare-col.accent {
  background: var(--purple-tint);
}
.compare-col h4 {
  margin: 0 0 2px;
  font-size: 14.5px;
  font-weight: 600;
}
.compare-sub {
  display: inline-block;
  margin-bottom: 12px;
  padding: 1px 9px;
  border-radius: 9999px;
  background: var(--paper);
  box-shadow: var(--ring);
  font-size: 11px;
  color: var(--fg-muted);
}
.compare-col.accent .compare-sub {
  color: var(--purple);
}
.compare-col ul {
  margin: 0;
  padding-left: 16px;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.compare-col li {
  margin-bottom: 6px;
  line-height: 1.75;
}

/* checklist */
.checklist {
  display: grid;
  border-top: 1px solid var(--border);
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.check-row:hover {
  background: var(--hover);
}
.check-row input {
  appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--paper);
  cursor: pointer;
  position: relative;
}
.check-row input:checked {
  background: var(--green);
  border-color: var(--green);
}
.check-row input:checked::after {
  content: '';
  position: absolute;
  left: 5.5px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check-row.checked .check-body strong {
  color: var(--fg-faint);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}
.check-body strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}
.check-body span {
  display: block;
  font-size: 12.5px;
  color: var(--fg-faint);
  line-height: 1.75;
}

/* choice */
.choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
}
.choice-card {
  display: block;
  padding: 26px 28px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: transparent;
  text-align: left;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.choice-card:hover {
  background: var(--purple-tint);
  border-color: var(--purple-line);
}
/* 「読む深さ」ページで、いま選ばれている側 */
.choice-card.current {
  background: var(--purple-tint);
  border-color: var(--purple);
}
.choice-card h4 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}
.choice-meta {
  display: inline-block;
  margin-bottom: 12px;
  padding: 2px 10px;
  border-radius: 9999px;
  background: var(--wash);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-muted);
}
.choice-card p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.8;
}
.choice-go {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: 9999px;
  background: var(--purple);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
}
:root[data-theme='dark'] .choice-go {
  color: #1c1913;
}
.choice-go svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

/* code */
.code-block {
  border-radius: 10px;
  background: var(--wash);
  overflow: hidden;
}
.code-block header {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}
.code-block pre {
  margin: 0;
  padding: 13px 16px;
  font-family: var(--font);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--fg-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

/* agenda */
.agenda {
  border-top: 1px solid var(--border);
}
.agenda-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.agenda-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple);
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.agenda-row h4 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
}
.agenda-row p {
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.75;
}

/* examples */
.examples h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-faint);
}
.examples ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}
.examples li {
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--wash);
  font-size: 13px;
  color: var(--fg);
  line-height: 1.7;
}

/* tips */
.tips {
  display: grid;
  gap: 8px;
}
.tip-row {
  padding: 15px 18px;
  border-radius: 10px;
  background: var(--wash);
}
.tip-row h4 {
  margin: 0 0 9px;
  font-size: 14px;
  font-weight: 600;
}
.tip-pair {
  display: grid;
  gap: 6px;
}
.tip-line {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: baseline;
  font-size: 12.5px;
  line-height: 1.75;
}
.tip-label {
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  padding: 2px 0;
  border-radius: 9999px;
}
.tip-line.bad .tip-label {
  background: var(--paper);
  box-shadow: var(--ring);
  color: var(--fg-faint);
}
.tip-line.good .tip-label {
  background: var(--tip-bg);
  border: 1px solid var(--tip-line);
  color: var(--tip-fg);
}
.tip-line.bad span:last-child {
  color: var(--fg-faint);
}

/* faq */
.faq {
  border-top: 1px solid var(--border);
}
.faq-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.faq-item h4 {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  gap: 9px;
}
.faq-item h4::before {
  content: 'Q';
  color: var(--purple);
  font-weight: 700;
}
.faq-item p {
  margin: 0;
  padding-left: 21px;
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.8;
}

/* links */
.linklist {
  border-top: 1px solid var(--border);
}
.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.link-card:hover {
  background: var(--hover);
}
.link-card strong {
  font-size: 13.5px;
  font-weight: 600;
}
.link-card span {
  display: block;
  font-size: 12px;
  color: var(--fg-faint);
}
.link-card svg {
  margin-left: auto;
  color: var(--fg-faint);
  width: 16px;
  height: 16px;
}

/* contact */
.contact {
  padding: 20px 22px;
  border-radius: 10px;
  border: 1px solid var(--purple-line);
  background: var(--purple-tint);
}
.contact h4 {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 600;
  color: var(--purple);
}
.contact p {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--fg-muted);
}

/* slide links */
.slide-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.slide-links-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
}
.slide-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.slide-links a:hover {
  color: var(--purple);
  background: var(--purple-tint);
  border-color: var(--purple-line);
}
.slide-links a svg {
  width: 13px;
  height: 13px;
}

/* cover */
.slide.cover h2 {
  font-size: clamp(26px, 3.2vw, 38px);
  margin-bottom: 10px;
}
.cover-meta {
  display: flex;
  gap: 18px;
  margin-top: 28px;
  font-size: 12px;
  color: var(--fg-faint);
}

/* pager */
.deck-foot {
  position: fixed;
  right: 20px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 32;
}
.pager {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 9999px;
  background: var(--paper);
  box-shadow: 0 0 0 1px hsl(40 16% 38% / 0.08), 0 4px 14px hsl(40 16% 38% / 0.1);
}
:root[data-theme='dark'] .pager {
  box-shadow: 0 0 0 1px rgba(255, 250, 240, 0.1), 0 4px 14px rgba(0, 0, 0, 0.4);
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pager-btn:hover {
  background: var(--purple-tint);
  color: var(--purple);
}
.pager-btn[disabled] {
  color: var(--fg-faint);
  opacity: 0.4;
  cursor: default;
  background: transparent;
}
.pager-count {
  min-width: 62px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* hint bar */
.hint-bar {
  padding: 6px 14px;
  border-radius: 9999px;
  background: var(--paper);
  box-shadow: var(--ring);
  font-size: 11.5px;
  white-space: nowrap;
  color: var(--fg-faint);
  transition: opacity 0.4s;
}
/* フェードしきってから visibility を落とす。opacity だけだと透明な帯が残り、
   紙をクリックしてページを送る操作を横取りする */
.hint-bar.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0s 0.4s;
}

/* search */
.modal[hidden],
.scrim[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 18, 14, 0.35);
  display: grid;
  place-items: start center;
  padding-top: 12vh;
}
.modal-panel {
  width: min(600px, 92vw);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--border), 0 20px 48px rgba(20, 18, 14, 0.18);
  overflow: hidden;
}
.search-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-faint);
}
.search-head input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--fg);
}
.search-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}
.search-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-family: var(--font);
  cursor: pointer;
}
.search-item:hover,
.search-item.active {
  background: var(--purple-tint);
}
.search-item strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
}
.search-item span {
  display: block;
  font-size: 11.5px;
  color: var(--fg-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-empty {
  padding: 28px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-faint);
}

/* responsive */
/* 狭い画面ではスライドを諦め、縦スクロールの読み物に切り替える */
@media (max-width: 860px) {
  .deck {
    scroll-snap-type: y proximity;
    padding: 12px 12px 24px;
  }
  .slide {
    height: auto;
    display: block;
    overflow: visible;
    scroll-snap-align: start;
    margin-bottom: 12px;
  }
  .slide-inner {
    width: auto;
    height: auto;
    min-height: calc(100vh - var(--topbar-h) - 40px);
    transform: none;
    margin: 0;
    overflow: visible;
    padding: 26px 20px 32px;
    border-radius: 14px;
  }
  .slide-fit {
    zoom: 1 !important;
    width: 100% !important;
  }
  .hotspot-frame img {
    max-height: none;
  }
  /* 画面が狭いと横並びの凡例が潰れる。積み直す */
  .hotspot.tall,
  .slide-body.split {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .route-open {
    margin-left: 0;
  }
  .hotspot.tall .hotspot-frame img {
    max-height: 60vh;
  }
  .menu-btn {
    display: inline-flex;
  }
  .rail-btn {
    display: none;
  }
  .sidebar {
    transform: translateX(-100%);
    --rail-w: 288px;
  }
  .sidebar.open {
    transform: none;
  }
  .deck {
    left: 0;
  }
  .topbar {
    padding: 0 12px;
  }
  .topbar-status {
    display: none;
  }
  .hide-sm {
    display: none;
  }
  /* 詳細度スイッチを置く幅を作る。この画面幅で印刷することはまずない */
  #printBtn {
    display: none;
  }
  .hint-bar {
    display: none;
  }
  .deck-foot {
    right: 12px;
    bottom: 12px;
  }
}

/* スマートフォン幅。ロゴだけ残してトップバーの行を守る */
@media (max-width: 480px) {
  .brand-divider,
  .brand-text {
    display: none;
  }
}

/* print */
@media print {
  :root {
    --canvas: #fff;
    --paper: #fff;
    --wash: #f6f5f2;
    --fg: #2b2825;
    --fg-muted: #55524b;
    --fg-faint: #8b877d;
    --border: rgba(40, 38, 30, 0.14);
    --border-strong: rgba(40, 38, 30, 0.2);
    --ring: 0 0 0 1px rgba(40, 38, 30, 0.14);
    --paper-shadow: none;
  }
  body {
    overflow: visible;
    background: #fff;
    background-image: none;
  }
  .topbar,
  .sidebar,
  .deck-foot,
  .progress-rail,
  .modal,
  .scrim,
  .lightbox,
  .slide-links,
  /* 紙の上では押せない。道順そのものは残す */
  .route-open {
    display: none !important;
  }
  .deck {
    position: static;
    overflow: visible;
    scroll-snap-type: none;
    padding: 0;
  }
  .slide {
    height: auto;
    display: block;
    overflow: visible;
    page-break-after: always;
    break-after: page;
  }
  .slide-inner {
    width: auto;
    height: auto;
    transform: none;
    margin: 0;
    overflow: visible;
    padding: 0 0 16px;
    border-radius: 0;
    box-shadow: none;
    display: block;
  }
  .slide:last-child {
    page-break-after: auto;
  }
  .slide-fit {
    zoom: 1 !important;
    width: 100% !important;
  }
  .note,
  .card,
  .flow-item,
  .compare-col,
  .check-row,
  .faq-item,
  .tip-row,
  .steps li,
  .hotspot,
  .route {
    break-inside: avoid;
  }
  /* 紙では横幅いっぱいまで伸ばしてよい。画面の 1 枚を読める大きさで刷る */
  .hotspot-frame img {
    max-height: 108mm;
  }
  /* 凡例が無い分、紙でも高さを画像に回せる */
  .hotspot.tall .hotspot-frame img,
  .hotspot.bare .hotspot-frame img,
  .split-media .hotspot-frame img {
    max-height: 132mm;
  }
  /* 紙は幅が決まっている。内容合わせで左が痩せないよう、比率で割る */
  .slide-body.split {
    grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
  }
}

@page {
  size: A4 landscape;
  margin: 14mm;
}
