html[lang="en"] .kana,
html[lang="en"] .mekuru-kana { display: none !important; }

:root {
  /* AI歴史クイズ（かるたアーケード）と同じ配色: 生成りの紙・こげ茶の墨・金の縁・深緑・朱 */
  --bg: #fbf4e4;
  --surface: #fffaf0;
  --ink: #48271b;
  --muted: #7a5a3c;
  --line: #e6d3ad;
  --soft: #f4e7cb;
  --wood: #28180f;
  --gold: #bd8b36;
  --gold-soft: #f1cf7a;
  --jade: #1d523a;
  --shu: #a43e31;
  --serif: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --t1: #e8513a;  /* 中学受験 */
  --t2: #2f7de1;  /* 高校受験 */
  --t3: #7a4fd6;  /* それ以降 */
  --ssr: linear-gradient(135deg, #f7c948, #f08a4b 50%, #e8513a);
  --sr: linear-gradient(135deg, #b7a6f5, #7a4fd6);
  --r: linear-gradient(135deg, #9fd4f7, #2f7de1);
  --n: linear-gradient(135deg, #8d887f, #635e56);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
}
header { padding: 28px 16px 8px; max-width: 1200px; margin: 0 auto; }
header { position: relative; }
header h1, header .lead { padding-right: 88px; }
h1 { margin: 0; font-size: clamp(26px, 5vw, 38px); font-weight: 800; letter-spacing: .02em; }
.lead { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.tabs { display: flex; gap: 8px; margin-top: 16px; }
.tab {
  font: inherit; font-size: 16px; font-weight: 800; padding: 10px 20px; border-radius: 14px 14px 0 0; cursor: pointer;
  border: 3px solid var(--ink); border-bottom: none; background: var(--soft); color: var(--muted);
}
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.tab[data-view="culture"][aria-selected="true"] { background: #1f8a6e; border-color: #1f8a6e; }
.tab[data-view="works"][aria-selected="true"] { background: #b7791f; border-color: #b7791f; }
.tab[data-view="terms"][aria-selected="true"] { background: #52707a; border-color: #52707a; }
.other-tab-wrap { position: relative; }
.other-menu { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; width: max-content; min-width: 220px; padding: 8px; border: 2px solid var(--gold); border-radius: 14px; background: var(--surface); box-shadow: 0 8px 22px #28180f33; }
.other-menu[hidden] { display: none; }
.other-menu button { display: block; width: 100%; min-height: 44px; padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.other-menu a[role="menuitem"] { display: block; width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 9px; color: var(--ink); font-weight: 700; text-align: left; text-decoration: none; }
.other-menu button:hover, .other-menu button:focus-visible { background: var(--soft); outline: 2px solid var(--gold); outline-offset: -2px; }
.other-menu a[role="menuitem"]:hover, .other-menu a[role="menuitem"]:focus-visible { background: var(--soft); outline: 2px solid var(--gold); outline-offset: -2px; }
.other-menu button[aria-current="page"] { background: #e9dfc8; }
.toolbar-count, .view-seg { display: none; }
.menu-divider { height: 1px; margin: 5px 4px; background: var(--line); }
.skin-menu-label { padding: 7px 12px 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
[data-skin-choice][aria-checked="true"]::after,
[data-language-choice][aria-checked="true"]::after { content: "✓"; float: right; color: var(--gold); }
.tabs { flex-wrap: wrap; }
.sticky-nav { position: sticky; top: 0; z-index: 6; }
.sticky-nav.is-stuck { background: rgba(40, 24, 15, .9); backdrop-filter: blur(6px); box-shadow: 0 4px 12px #0004; }
.tabs-row { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.sticky-nav .controls { position: static; }
@media (max-width: 480px) { .tab { font-size: 14px; padding: 8px 12px; } .tab .n { display: none; } .other-menu { left: 0; right: auto; width: min(280px, calc(100vw - 24px)); } }
/* 種類の見分け: 出来事=黒、文化=緑、作品=金 */
.kindtag { font-size: 10px; font-weight: 800; color: #fff; padding: 2px 7px; border-radius: 4px; background: var(--k); }
.kind-event { --k: #23201c; }
.kind-culture { --k: #1f8a6e; }
.kind-work { --k: #b7791f; }
.kind-term { --k: #52707a; }
.ev.kind-culture, .ev.kind-work, .ev.kind-term, .emini.kind-culture, .emini.kind-work, .emini.kind-term { border-color: var(--k); box-shadow: 0 4px 0 var(--k); }
.emini.kind-culture, .emini.kind-work, .emini.kind-term { box-shadow: 0 2px 0 var(--k); }
.emini .mname small { display: block; }
.tab .n { font-size: 12px; font-weight: 700; margin-left: 4px; opacity: .8; }

.controls {
  position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); border-top: 3px solid var(--ink);
}
.controls-inner { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.search {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 14px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
}
.search:focus { outline: none; border-color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  min-height: 38px; font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.t1[aria-pressed="true"] { background: var(--t1); border-color: var(--t1); }
.chip.t2[aria-pressed="true"] { background: var(--t2); border-color: var(--t2); }
.chip.t3[aria-pressed="true"] { background: var(--t3); border-color: var(--t3); }
.count { font-size: 13px; color: var(--muted); }
[hidden] { display: none !important; }
body:has(.tab[data-view="terms"][aria-selected="true"]) #densityControl { display: none; }
#sortChips { column-gap: 16px; }
.filter-trigger { flex: none; min-height: 40px; font: inherit; font-weight: 800; padding: 7px 16px; border: 2px solid var(--ink); border-radius: 999px; background: var(--surface); cursor: pointer; color: var(--ink); }
.filter-trigger[aria-expanded="true"] { background: var(--ink); color: #fff; }
.filter-panel { display: none; position: absolute; z-index: 20; top: calc(100% + 6px); left: max(16px, calc((100% - 1200px) / 2 + 16px)); width: min(640px, calc(100vw - 32px)); max-height: min(75vh, 640px); overflow-y: auto; padding: 18px; border: 2px solid var(--ink); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 30px #23201c33; opacity: 0; transform: translateY(-6px); transition: opacity .18s ease, transform .22s cubic-bezier(.2,.8,.2,1), display .22s allow-discrete; }
.filter-panel.open { display: grid; gap: 14px; opacity: 1; transform: translateY(0); }
@starting-style { .filter-panel.open { opacity: 0; transform: translateY(-6px); } }
.filter-group { display: grid; gap: 6px; }
.filter-group h2 { margin: 0; font-size: 14px; }
.filter-actions { display: flex; justify-content: flex-end; gap: 8px; }
.filter-actions button { min-height: 38px; font: inherit; font-weight: 700; padding: 6px 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.grp { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.density-select { min-width: 0; flex: 1; min-height: 40px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; }
@media (max-width: 640px) {
  .tabs { width: 100%; }
  .controls-inner { gap: 8px; padding: 10px 16px; }
  #densityControl { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
  #densityControl .density-select { flex: 1; width: 0; min-width: 0; }
  .filter-panel { position: fixed; top: auto; bottom: 0; left: 0; width: 100%; max-height: 82dvh; border-radius: 20px 20px 0 0; padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px #23201c33; transform: translateY(14px); }
  .filter-panel.open { transform: translateY(0); }
  @starting-style { .filter-panel.open { transform: translateY(14px); } }
  /* fixedパネルの基準をビューポートに保ち、スクロール後も画面下に固定する */
  .sticky-nav.is-stuck { backdrop-filter: none; }
  html[data-skin="simple"] .sticky-nav.is-stuck { backdrop-filter: none; }
}

main { max-width: 1200px; margin: 0 auto; padding: 16px 16px 60px; }
.browse-head { margin: 4px 0 20px; padding: 20px 22px; border: 3px solid var(--gold); border-radius: 18px; background: linear-gradient(145deg, #fffaf0, #f4e7cb); box-shadow: 0 4px 0 #8b6426; }
.browse-head h2 { margin: 0 0 6px; color: var(--jade); font-family: var(--serif); font-size: clamp(23px, 4vw, 32px); }
.browse-head p { margin: 0; color: var(--muted); line-height: 1.7; text-wrap: pretty; }
.browse-meta { display: flex; align-items: center; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.back-link { min-height: 40px; padding: 7px 14px; border: 2px solid var(--gold); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.theme-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); min-height: 136px; overflow: hidden; border: 3px solid var(--ink); border-radius: 16px; background: var(--surface); box-shadow: 0 4px 0 var(--ink); color: inherit; text-align: left; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.theme-card:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink); }
.theme-card:focus-visible { outline: 3px solid var(--shu); outline-offset: 3px; }
.theme-card img, .theme-card .theme-art-empty { width: 112px; height: 100%; min-height: 136px; object-fit: cover; background: #efe9dc; }
.theme-art-empty { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.theme-copy { display: grid; align-content: center; gap: 6px; min-width: 0; padding: 12px; }
.theme-copy b { color: var(--jade); font-family: var(--serif); font-size: 20px; }
.theme-copy span { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.theme-copy small { color: var(--muted); font-weight: 700; }
.theme-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.pname.theme-member { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-rows: auto; min-height: 46px; }
.pname.theme-member .art { grid-row: 1; }
.pname.theme-member .label { min-height: 0; }
.pname.theme-member.is-term { grid-template-columns: minmax(0, 1fr) auto; min-height: 40px; padding: 6px 8px; }
.theme-kind { display: inline-flex; padding: 2px 7px; border: 1px solid var(--gold); border-radius: 999px; background: #e9dfc8; color: var(--jade); font-size: 10px; font-weight: 800; white-space: nowrap; }
.theme-detail .flows { margin-top: 10px; }
.theme-filter { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 2px; }
.theme-filter-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 3px 10px; border: 1px solid var(--gold); border-radius: 999px; background: #fffaf0; color: #6e4b26; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.theme-filter-chip small { font-size: 10px; opacity: .75; }
.theme-filter-chip[aria-pressed="true"] { background: #1d523a; border-color: #1d523a; color: #fff7e8; }
.theme-detail .era-hero.is-portrait { object-position: center 15%; }
.theme-detail .tl { scroll-margin-top: 8px; }
.theme-detail .tl-label { top: 8px; }
.theme-detail .region-title { font-size: 18px; margin-top: 18px; }
.theme-detail .era-group-title { margin: 18px 0 -6px; color: var(--c); font-size: 16px; }
.flow-reference { margin-top: 16px; padding: 12px; border: 2px solid var(--gold); border-radius: 14px; background: #fffaf0; }
.flow-reference h3 { margin: 0 0 8px !important; color: var(--jade) !important; font-family: var(--serif); font-size: 16px !important; }
.flow-reference-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.flow-reference-open b { display: block; margin-bottom: 6px; color: var(--jade); font-size: 15px; }
.flow-neighbors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.flow-neighbor { min-width: 0; padding: 7px 9px; border: 1px solid var(--gold); border-radius: 9px; background: #fff; color: inherit; font: inherit; font-size: 12px; line-height: 1.45; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.flow-neighbor:disabled { opacity: .42; cursor: default; }
.flow-detail .flow-header { padding: 22px 22px 16px; border-bottom: 2px solid var(--line); background: linear-gradient(135deg, #fffaf0, #f1e5c9); }
.flow-header .kindtag { width: fit-content; }
.flow-detail .flow-header { padding-right: 64px; }
#dlg.has-back .flow-detail .flow-header { padding-top: 58px; }
#dlg.has-back:is(.person-scrolled, .context-scrolled) .dialog-back { width: 36px; padding: 0; justify-content: center; }
#dlg.has-back:is(.person-scrolled, .context-scrolled) .dialog-back span { display: none; }
#dlg.has-back:is(.person-scrolled, .context-scrolled) .detail-sticky { padding-left: 56px; }
#dlg:is(.person-scrolled, .context-scrolled) .dialog-content > .close, #dlg:is(.person-scrolled, .context-scrolled) .dialog-back { z-index: 11; top: 6px; }
.flow-step { scroll-margin-top: 56px; }
.flow-header h2 { margin: 4px 0; color: var(--jade); font-family: var(--serif); font-size: 26px; }
.flow-header p { margin: 8px 0 0; font-size: 14px; line-height: 1.7; }
.flow-path { display: grid; gap: 0; padding: 16px 18px 24px; }
.flow-step { min-width: 0; border: 3px solid var(--ink); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 0 var(--ink); overflow: hidden; }
.flow-step.is-current { border-color: var(--shu); background: #fff3e9; box-shadow: 0 3px 0 var(--shu), 0 0 0 3px #bd4b3150; }
.flow-step-button { display: grid; grid-template-columns: 94px minmax(0, 1fr); width: 100%; min-height: 76px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.flow-step-button.is-term { grid-template-columns: minmax(0, 1fr); border-left: 8px solid var(--jade); }
.flow-step-button.is-term .flow-step-copy { padding-left: 14px; }
.flow-step-art { min-height: 76px; background: #efe9dc; }
.flow-step-art img { display: block; width: 100%; height: 100%; min-height: 76px; object-fit: cover; }
.flow-step-art.is-placeholder { display: grid; place-items: center; background: repeating-linear-gradient(135deg, #efe8d9, #efe8d9 10px, #e6dcc7 10px, #e6dcc7 20px); color: #756248; font-family: var(--serif); font-size: 22px; font-weight: 800; }
.flow-step-copy { display: grid; align-content: center; gap: 3px; min-width: 0; padding: 9px 12px; }
.flow-step-copy small { color: var(--muted); font-size: 11px; }
.flow-step-copy b { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.flow-step-people { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; }
.flow-person { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 700; }
.flow-person img, .flow-person i { flex: none; width: 22px; height: 22px; border: 1.5px solid var(--ink); border-radius: 50%; object-fit: cover; object-position: top; background: #efe9dc; }
.flow-person i { display: grid; place-items: center; font-style: normal; font-size: 10px; color: var(--ink); }
.flow-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }
.flow-arrow { display: grid; justify-items: center; gap: 3px; padding: 9px 20px; color: #75542d; text-align: center; }
.flow-arrow-mark { color: var(--shu); font-size: 23px; font-weight: 900; line-height: 1; }
.flow-arrow span:last-child { max-width: 34em; font-size: 12px; font-weight: 700; line-height: 1.55; }
@media (max-width: 480px) {
  .flow-neighbors { grid-template-columns: 1fr; }
  .flow-detail .flow-header { padding: 18px 16px 14px; }
  .flow-path { padding: 14px 12px 20px; }
  .flow-step-button { grid-template-columns: 82px minmax(0, 1fr); }
  .flow-step-copy { padding: 8px 10px; }
}
.resource-list { display: grid; gap: 14px; }
.resource-panel { padding: 16px; border: 2px solid var(--gold); border-radius: 16px; background: var(--surface); box-shadow: 0 3px 0 #bd8b3644; }
.resource-panel h2 { margin: 0 0 10px; color: var(--jade); font-family: var(--serif); font-size: 20px; line-height: 1.5; overflow-wrap: anywhere; }
.resource-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.resource-links a { display: inline-flex; align-items: center; min-height: 40px; padding: 7px 12px; border: 2px solid var(--gold); border-radius: 999px; background: #fff5dd; color: var(--ink); font-size: 13px; font-weight: 800; text-decoration: none; }
.resource-items { display: flex; flex-wrap: wrap; gap: 8px; }
.resource-item { min-height: 40px; padding: 7px 12px; border: 2px solid var(--line); border-radius: 999px; background: white; color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.resource-item:hover { border-color: var(--jade); background: #f0f5ed; }
.resource-item small { margin-left: 6px; color: var(--muted); }
.goro-tools { display: flex; justify-content: flex-end; margin: -8px 0 16px; }
.goro-tools button { min-height: 40px; padding: 7px 14px; border: 2px solid var(--gold); border-radius: 999px; background: var(--surface); color: var(--jade); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.goro-era { margin: 20px 0 26px; }
.goro-era > h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--jade); font-family: var(--serif); font-size: 19px; }
.goro-era > h3 small { color: var(--muted); font-family: inherit; font-size: 12px; font-weight: 600; }
.goro-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.goro-row, .goro-card { min-width: 0; padding: 14px 16px; border: 2px solid var(--gold); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 0 #bd8b3633; }
.goro-row[data-item] { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.goro-row[data-item]:hover { box-shadow: 0 5px 0 #bd8b3644; }
.goro-row[data-item]:active { transform: translateY(1px); box-shadow: 0 2px 0 #bd8b3633; }
.goro-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.goro-event-link { display: grid; min-width: 0; gap: 3px; padding: 0; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.goro-event-link:hover b { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.goro-year { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.goro-event-link b { font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.goro-text { margin: 10px 0 8px; color: var(--jade); font-size: 16px; font-weight: 800; line-height: 1.55; overflow-wrap: anywhere; }
.goro-readings { display: flex; flex-wrap: wrap; gap: 5px; }
.goro-digit { display: grid; min-width: 34px; min-height: 40px; justify-items: center; align-content: center; gap: 1px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); line-height: 1.1; }
.goro-digit b { font-size: 15px; font-variant-numeric: tabular-nums; }
.goro-digit small { color: var(--muted); font-size: 10px; }
.goro-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.goro-detail { margin: 10px 20px 0; }
.goro-detail .goro-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.goro-detail .goro-text { margin-top: 5px; font-size: 18px; }
@media (max-width: 480px) {
  .goro-list { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .goro-row, .goro-card { padding: 12px; }
  .goro-detail { margin: 10px 12px 0; }
}
main[data-view="theme"] .ev, main[data-view="theme"] .card { cursor: pointer; }
body.utility-view .controls { display: none; }
@media (max-width: 480px) { .theme-grid { grid-template-columns: 1fr; gap: 10px; } .theme-card { grid-template-columns: 94px minmax(0,1fr); min-height: 120px; } .theme-card img, .theme-card .theme-art-empty { width: 94px; min-height: 120px; } .theme-members { grid-template-columns: 1fr; gap: 6px; } .resource-panel { padding: 13px; } .resource-item { width: 100%; text-align: left; } }
.section-title { font-size: 18px; font-weight: 800; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .dot { width: 12px; height: 12px; border-radius: 50%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* 人物カード */
.card {
  position: relative; background: var(--surface); border-radius: 16px; overflow: hidden; cursor: pointer;
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease; text-align: left; padding: 0; font: inherit; color: inherit;
  display: flex; flex-direction: column;
}
.card, .term-row, .ev, .pname { text-decoration: none; }
.card:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink); }
.favorite-card { position: relative; min-width: 0; }
.favorite-card > .card, .favorite-card > .pmini, .favorite-card > .emini, .favorite-card > .pname, .favorite-card > .ev { width: 100%; }
.favorite-star { min-width: 38px; min-height: 38px; border: 2px solid var(--line); border-radius: 999px; background: #fff; color: #8a6b18; cursor: pointer; font: inherit; font-size: 21px; line-height: 1; display: grid; place-items: center; }
.favorite-card > .favorite-star { position: absolute; z-index: 2; top: 40px; right: 8px; box-shadow: 0 2px 6px #0002; }
.favorite-card > .card, .favorite-card > .ev { height: 100%; }
.favorite-card > .ev + .favorite-star { top: auto; bottom: 14px; right: 12px; }
.favorite-card > .pname { padding-right: 40px; }
.favorite-card > .pname + .favorite-star { top: 50%; right: 4px; transform: translateY(-50%); min-width: 30px; min-height: 30px; font-size: 16px; box-shadow: none; }
.favorite-star[aria-pressed="true"] { background: #fff2bf; border-color: #d7a91f; }
.favorite-action { margin: 8px 0 14px; }
.favorite-toggle { display: flex; align-items: center; gap: 8px; }
.favorite-notice { color: var(--muted); font-size: 12px; min-height: 1em; }
.hero-title-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.auth-actions { position: static; }
.auth-button { min-height: 34px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
#loginDialog { width: min(440px, calc(100vw - 28px)); border: 3px solid var(--ink); border-radius: 20px; padding: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px #0004; }
#loginDialog::backdrop { background: #23201c88; }
#loginDialog h2 { margin: 0 42px 4px 0; }
#loginDialog p { color: var(--muted); font-size: 13px; }
#loginForm { display: grid; gap: 12px; }
#loginForm label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; }
#loginForm input { min-height: 42px; width: 100%; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; font: inherit; }
#loginForm button[type="submit"] { min-height: 42px; border: 0; border-radius: 999px; background: var(--ink); color: white; font: inherit; font-weight: 800; cursor: pointer; }
#loginError { color: #a33125; min-height: 1em; font-size: 13px; }
.card:focus-visible, .ev:focus-visible, .mini:focus-visible, .evrow:focus-visible { outline: 3px solid var(--t2); outline-offset: 3px; }
.card .art { aspect-ratio: 1; background: #efe9dc; position: relative; overflow: hidden; }
.card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 54px; font-weight: 800; color: #d5ccbb;
  background: repeating-linear-gradient(45deg, #efe9dc 0 10px, #ebe4d5 10px 20px);
}
.ph small { display: block; font-size: 11px; color: #b4aa97; text-align: center; margin-top: -14px; }
.badge {
  position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 800; color: #fff;
  padding: 3px 8px; border-radius: 999px;
}
.rarity {
  position: absolute; top: 8px; right: 8px; font-size: 12px; font-weight: 800; color: #fff;
  padding: 2px 8px; border-radius: 6px; border: 2px solid #fff; text-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.inline { position: static; display: inline-block; }
.card .body { padding: 10px 12px 12px; border-top: 3px solid var(--ink); flex: 1; }
.kana { font-size: 10px; color: var(--muted); }
.term-reading { font-size: 15px; font-weight: 650; color: var(--muted); margin: -8px 0 10px; }
.card .name { font-size: 16px; font-weight: 800; line-height: 1.25; }
.meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sum { font-size: 12px; line-height: 1.5; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.evcount { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 6px; }

/* 出来事カード */
.evgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .evgrid { grid-template-columns: 1fr; gap: 10px; } }
.ev {
  background: var(--surface); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink);
  padding: 12px 14px; cursor: pointer; text-align: left; font: inherit; color: inherit;
  display: grid; gap: 6px; transition: transform .12s ease, box-shadow .12s ease;
}
.ev:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink); }
.ev.has-art { padding: 0; overflow: hidden; }
.ev.has-art .evbody { padding: 10px 14px 12px; display: grid; gap: 6px; }
.ev .evart { aspect-ratio: 3 / 2; background: #efe9dc; border-bottom: 3px solid var(--ink); }
.ev .evart img { width: 100%; height: 100%; object-fit: cover; display: block; }
.evhero { aspect-ratio: 3 / 2; background: #efe9dc; border-bottom: 3px solid var(--ink); border-radius: 17px 17px 0 0; overflow: hidden; }
.evhero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.illustration-note { margin: 0; padding: 8px 24px 0; font-size: 12px; color: var(--muted); }
.evrow .evthumb { width: 72px; aspect-ratio: 3 / 2; border-radius: 6px; overflow: hidden; border: 2px solid var(--ink); }
.evrow .evthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.evrow.with-thumb { grid-template-columns: auto auto 1fr; }
.ev .top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.year { font-size: 13px; font-weight: 800; background: var(--ink); color: #fff; padding: 2px 8px; border-radius: 6px; }
.cat { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); }
.tierdot { font-size: 10px; font-weight: 800; color: #fff; padding: 2px 7px; border-radius: 999px; margin-left: auto; }
.ev .name { font-size: 17px; font-weight: 800; line-height: 1.3; }
.ev .sum { margin-top: 0; -webkit-line-clamp: 2; }
.faces { display: flex; align-items: center; gap: 4px; min-height: 30px; }
.face {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink); overflow: hidden; background: #efe9dc;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #a99f8c; flex: none;
}
.face img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.faces .more { font-size: 12px; color: var(--muted); margin-left: 4px; }

/* 年表（時代ごと） */
.flows { margin: 6px 0 8px; }
.flow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.flow-label { font-weight: 800; font-size: 13px; flex: none; white-space: nowrap; }
.flow-track { display: flex; align-items: stretch; gap: 3px; overflow-x: auto; padding: 0 0 4px; min-width: 0; }
.flow-track > .flow-label { align-self: center; padding: 0 2px; }
.flow-seg {
  flex: none; border: none; background: var(--c); color: #fff; font: inherit; padding: 6px 10px; border-radius: 8px;
  cursor: pointer; text-align: left; min-width: 66px;
}
.flow-seg:hover { filter: brightness(1.08); transform: translateY(-1px); }
.flow-seg b { display: block; font-size: 12px; line-height: 1.3; }
.flow-seg small { display: block; font-size: 10px; opacity: .9; }
.flow-arrow { color: var(--muted); align-self: center; font-weight: 800; flex: none; }
.flow-group { flex: none; display: flex; flex-direction: column; gap: 3px; }
.flow-group-name { background: var(--c); color: #fff; font-size: 11px; font-weight: 800; text-align: center; padding: 2px 8px; border-radius: 8px 8px 3px 3px; }
.flow-subs { display: flex; gap: 3px; flex: 1; }
.flow-subs .flow-seg { min-width: 60px; border-radius: 3px 3px 8px 8px; }
.era-group-title { margin: 22px 0 -6px; font-size: 19px; font-weight: 800; color: color-mix(in srgb, var(--c), #000 52%); }
.region-title { font-size: 22px; font-weight: 800; margin: 26px 0 4px; }
.tl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; position: relative; scroll-margin-top: calc(var(--sticky-h, 200px) + 8px); }
.tl::before { content: ""; position: absolute; left: 14px; top: 0; bottom: 0; width: 4px; background: var(--c); }
.tl-label {
  position: sticky; top: calc(var(--sticky-h, 200px) - 1px); z-index: 3; margin: 14px 0; padding: 10px 10px 10px 34px;
  background: var(--t); border: 3px solid var(--c); border-radius: 12px;
}
.tl-label::before {
  content: ""; position: absolute; left: 6px; top: 13px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 0 3px #fff;
}
.tl-label b { display: block; font-size: 16px; font-weight: 800; color: color-mix(in srgb, var(--c), #000 52%); line-height: 1.3; }
.tl-label-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tl-label-button:hover b { text-decoration: underline; text-underline-offset: 3px; }
.tl-label-button:focus-visible { outline: 3px solid var(--t2); outline-offset: 3px; border-radius: 5px; }
.tl-label small { display: block; font-size: 11px; color: var(--muted); }
.tl-label span { display: block; font-size: 11px; font-weight: 700; margin-top: 2px; }
.tl-body { padding: 14px 0 26px; min-width: 0; }
@media (max-width: 640px) {
  .tl { grid-template-columns: 1fr; gap: 0; }
  .tl-side { display: contents; }   /* 見出しを section 直下に出して、時代の範囲内で上部に固定する */
  .tl::before { left: 6px; }
  .tl-label { margin: 10px 0 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 6px 10px 6px 28px; }
  .tl-label::before { left: 4px; top: 50%; translate: 0 -50%; }
  .tl-label b { font-size: 15px; }
  .tl-label span { margin: 0 0 0 auto; }
  .tl-body { padding: 10px 0 18px 18px; }
  .flow-track > .flow-label { font-size: 12px; }
}

/* コンパクト表示 */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.cevgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
@media (max-width: 480px) {
  .cgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .cevgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
.pmini, .emini {
  display: block; text-decoration: none;
  border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer;
  padding: 0; font: inherit; color: inherit; text-align: center; box-shadow: 0 2px 0 var(--ink); position: relative;
  transition: transform .1s ease;
}
.pmini:hover, .emini:hover { transform: translateY(-2px); }
.pmini:focus-visible, .emini:focus-visible { outline: 3px solid var(--t2); outline-offset: 2px; }
.pmini .art { aspect-ratio: 1; background: #efe9dc; }
.pmini .art img, .emini .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pmini .ph { font-size: 30px; }
.mname { font-size: 11px; font-weight: 800; padding: 4px 4px 5px; line-height: 1.25; border-top: 2px solid var(--ink); white-space: normal; overflow-wrap: anywhere; }
/* 名前が1行でも2行でもカードの縦幅をそろえる（2行分で固定し、はみ出す分は省略） */
.pmini .mname { height: calc(27.5px + 9px); display: flex; align-items: center; justify-content: center; }
.mname .mtitle { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.pmini .mname.long { font-size: 10px; }
.pmini .mname.xlong { font-size: 9px; }
@media (max-width: 480px) { .pmini .mname { height: calc(41.25px + 9px); } .mname .mtitle { -webkit-line-clamp: 3; line-clamp: 3; } }
.pnamegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 9px; }
.pname { display: grid; grid-template-columns: 32px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 8px; row-gap: 2px; min-width: 0; min-height: 54px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; color: inherit; text-align: left; font: inherit; }
.pname:hover { background: #f5f1e8; }
.pname .art { width: 32px; height: 32px; grid-column: 1; grid-row: 1 / span 2; border-radius: 5px; overflow: hidden; background: #efe9dc; }
.pname .art img { width: 100%; height: 100%; object-fit: cover; }
.pname .ph { font-size: 17px; }
.pname .ph small { font-size: 7px; margin: 0; }
.pname .label { font-size: 11px; font-weight: 800; line-height: 1.25; }
.emini .art { aspect-ratio: 3 / 2; background: #efe9dc; display: grid; place-items: center; }
.emini .ph { font-size: 22px; }
.emini .ph small { font-size: 8px; margin: 0; }
/* カードの左上にレア度、右上にお気に入りの星 */
.pmini .rarity, .emini .rarity { top: 4px; left: 4px; right: auto; font-size: 9px; padding: 1px 5px; }
.favorite-card > .pmini + .favorite-star, .favorite-card > .emini + .favorite-star { top: 4px; right: 4px; min-width: 28px; min-height: 28px; font-size: 16px; border-width: 1.5px; }
.pname:focus-visible { outline: 3px solid var(--t2); outline-offset: 2px; }
.pname .art { width: 32px; height: 32px; overflow: hidden; border-radius: 5px; background: #efe9dc; display: grid; place-items: center; }
.pname .art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pname .ph { font-size: 17px; }
.pname .label { min-width: 0; min-height: 2.5em; overflow-wrap: anywhere; font-size: 11px; font-weight: 800; line-height: 1.25; }
.pname > .rarity { grid-column: 2; grid-row: 2; justify-self: start; }
@media (max-width: 480px) { .pnamegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } }
.org-ph { position: relative; display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; background: radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--org-color) 28%, white), color-mix(in srgb, var(--org-color) 12%, #efe9dc)); color: var(--org-color); }
.org-ph::before, .org-ph::after { content: ""; position: absolute; width: 70%; height: 1px; background: currentColor; opacity: .25; rotate: 45deg; }
.org-ph::after { rotate: -45deg; }
.org-mon { position: absolute; width: 64%; height: 64%; opacity: .55; }
.org-mon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 5; }
.org-ph b { position: relative; z-index: 1; display: grid; place-items: center; width: 42%; aspect-ratio: 1; border: 2px solid currentColor; border-radius: 50%; background: color-mix(in srgb, var(--org-color) 16%, #fffaf0); font-family: var(--serif); font-size: clamp(18px, 3vw, 36px); line-height: 1; }
.org-mini .org-ph b, .org-name-mini .org-ph b { font-size: 15px; }
.org-name-mini .org-ph b { width: 52%; border-width: 1px; }
.org-card .art { position: relative; }
#main .tl[id^="org-era-"] .tl-label > span { display: none; }
.org-detail .org-art { display: grid; place-items: center; min-height: 220px; background: var(--soft); }
.org-detail .org-art > img, .org-detail .org-art > .org-ph { width: 100%; height: 100%; min-height: 220px; object-fit: cover; }
.org-parent-link { margin: 8px 0 14px; max-width: 560px; }
.org-parent-link .related-grid, .org-phase-link .related-grid { grid-template-columns: minmax(0, 1fr); }
.org-structure-section > .related-grid { margin-top: 8px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.org-parent-link .related-art, .org-phase-link .related-art, .org-structure-section .related-art { aspect-ratio: 3 / 1; }
.org-parent-link .org-ph, .org-phase-link .org-ph, .org-structure-section .org-ph { min-height: 100%; }
.org-parent-link .related-copy small, .org-phase-link .related-copy small, .org-structure-section .related-copy small { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.org-phase-link { min-width: 0; }
.org-phase-link .related-grid { margin: 0; }
.org-phase-link .related-card { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.org-detail .profile > .kindtag { width: fit-content; }
.org-detail .profile .meta { margin-top: 8px; font-size: 13px; }
.org-detail .detail-body > h3 { margin-top: 22px; }
.org-detail .flow-neighbors { margin-top: 8px; }
.org-timeline { margin-top: 6px; }
.org-timeline h3 { margin: 0 0 22px; }
.org-timeline ol { position: relative; display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.org-timeline ol::before { content: ""; position: absolute; top: 17px; bottom: 18px; left: 145px; width: 4px; border-radius: 4px; background: linear-gradient(to bottom, var(--jade), #66814b 38%, var(--gold) 68%, var(--shu)); opacity: .65; }
.org-timeline-step { position: relative; display: grid; grid-template-columns: 122px 34px minmax(0, 1fr); align-items: start; gap: 0 8px; min-width: 0; animation: org-timeline-enter .55s both; animation-delay: calc(var(--step-index) * 65ms); }
.org-timeline-step > time { padding-top: 5px; color: var(--jade); font-family: var(--serif); font-size: clamp(18px, 2.2vw, 25px); font-weight: 800; line-height: 1.15; text-align: right; font-variant-numeric: tabular-nums; }
.org-timeline-step > time b { display: block; white-space: nowrap; }
.org-timeline-step > time i { display: block; margin: -2px 0; font-size: .6em; font-style: normal; opacity: .6; }
.org-timeline-step > time small { display: block; margin-top: 2px; font-family: var(--sans, inherit); font-size: 11px; font-weight: 700; color: var(--muted); }
.org-timeline-node { z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; margin: 5px auto 0; border: 3px solid var(--surface); border-radius: 50%; background: var(--jade); box-shadow: 0 0 0 2px var(--jade); }
.org-timeline-step[data-phase="発展"] .org-timeline-node { background: #66814b; box-shadow: 0 0 0 2px #66814b; }
.org-timeline-step[data-phase="転機"] .org-timeline-node { border-radius: 4px; background: var(--gold); box-shadow: 0 0 0 2px var(--gold); transform: rotate(45deg) scale(.82); }
.org-timeline-step[data-phase="衰退"] .org-timeline-node { border-radius: 3px 50% 50%; background: #bd6744; box-shadow: 0 0 0 2px #bd6744; transform: rotate(45deg) scale(.9); }
.org-timeline-step[data-phase="終わり"] .org-timeline-node { border-color: var(--shu); background: var(--surface); box-shadow: inset 0 0 0 3px var(--shu), 0 0 0 2px var(--shu); }
.org-timeline-step > article { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 3px 0 color-mix(in srgb, var(--line) 72%, transparent); }
.org-timeline-step[data-phase="成立"] > article { border-top: 3px solid var(--jade); }
.org-timeline-step[data-phase="転機"] > article { border-top: 3px solid var(--gold); }
.org-timeline-step[data-phase="衰退"] > article { border-top: 3px solid #bd6744; }
.org-timeline-step[data-phase="終わり"] > article { border-top: 3px solid var(--shu); }
.org-timeline-step h4 { margin: 0; color: var(--ink); font-family: var(--serif); font-size: 17px; line-height: 1.45; }
.org-timeline-step p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.75; text-wrap: pretty; }
.org-timeline-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.org-timeline-event { display: grid; grid-template-columns: 56px minmax(0, 1fr) 12px; align-items: center; gap: 8px; width: min(100%, 270px); min-width: 0; padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb, var(--soft) 65%, var(--surface)); color: var(--ink); font: inherit; font-size: 12px; font-weight: 800; line-height: 1.35; text-align: left; cursor: pointer; }
.org-timeline-event.no-image { grid-template-columns: minmax(0, 1fr) 12px; padding-left: 10px; min-height: 42px; }
.org-timeline-event:hover, .org-timeline-person:hover { border-color: var(--gold); }
.org-timeline-event-image { display: grid; place-items: center; width: 56px; height: 42px; overflow: hidden; border-radius: 6px; background: var(--soft); }
.org-timeline-event-image img { width: 100%; height: 100%; object-fit: cover; }
.org-timeline-event small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 600; }
.org-timeline-person { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 3px 9px 3px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.org-timeline-person img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
@keyframes org-timeline-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
  .org-timeline { margin-top: 18px; }
  .org-timeline ol::before { left: 84px; }
  .org-timeline-step { grid-template-columns: 70px 28px minmax(0, 1fr); gap: 0 4px; }
  .org-timeline-step > time { min-width: 0; padding-top: 6px; font-size: 16px; }
  .org-timeline-step > time b { white-space: normal; overflow-wrap: anywhere; }
  .org-timeline-node { width: 16px; height: 16px; border-width: 2px; }
  .org-timeline-step > article { padding: 10px 9px; border-radius: 11px; }
  .org-timeline-step h4 { font-size: 15px; }
  .org-timeline-step p { font-size: 12px; line-height: 1.65; }
  .org-timeline-event { grid-template-columns: 42px minmax(0, 1fr) 10px; gap: 6px; padding-right: 5px; font-size: 11px; }
  .org-timeline-event-image { width: 42px; height: 34px; }
  .org-timeline-event.no-image { grid-template-columns: minmax(0, 1fr) 10px; padding-left: 8px; min-height: 36px; }
}
html[data-skin="simple"] .org-timeline-event-image img,
html[data-skin="simple"] .org-timeline-person img { display: block !important; }
@media (prefers-reduced-motion: reduce) { .org-timeline-step { animation: none; } }
.emini .art { aspect-ratio: 3 / 2; display: grid; place-items: center; background: var(--t, #efe9dc); }
.emini .art .yr { font-size: 20px; font-weight: 800; color: var(--c, var(--muted)); }
.emini .mname { font-size: 12px; text-align: left; padding: 5px 7px 6px; }
.emini .mname small { display: block; font-size: 10px; color: var(--muted); font-weight: 700; }
.emini .mname .mtitle { min-height: 2.5em; }
.emini .mname small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 用語はイラストを使わず、常に文章のリストで表示 */
.term-list { display: grid; gap: 8px; }
.term-row {
  display: grid; grid-template-columns: minmax(88px, 130px) minmax(0, 1fr); align-items: start; gap: 4px 14px;
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid #52707a; border-radius: 10px;
  background: var(--surface); color: inherit; text-align: left; font: inherit; cursor: pointer;
}
.term-row:hover { background: #f5f1e8; }
.term-row:focus-visible { outline: 3px solid var(--t2); outline-offset: 2px; }
.term-row .term-era { grid-column: 1; grid-row: 1 / span 2; color: var(--muted); font-size: 12px; font-weight: 700; }
.term-row .term-name { min-width: 0; font-size: 15px; font-weight: 800; line-height: 1.35; }
.term-row .term-summary { grid-column: 2; color: var(--muted); font-size: 13px; line-height: 1.5; }
@media (max-width: 480px) {
  .term-row { grid-template-columns: 1fr; gap: 3px; padding: 10px 12px; }
  .term-row .term-era, .term-row .term-summary { grid-column: 1; grid-row: auto; }
  .term-row .term-era { font-size: 11px; }
}

/* 詳細 */
dialog {
  border: 3px solid var(--ink); border-radius: 20px; padding: 0; max-width: 760px; width: calc(100% - 32px);
  background: var(--surface); color: var(--ink); box-shadow: 0 8px 0 var(--ink);
}
dialog::backdrop { background: rgba(35, 32, 28, .55); }
.detail { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.detail .profile { min-width: 0; padding-top: 54px; }
.detail .detail-body { grid-column: 1 / -1; border-top: 2px solid var(--line); }
#dlg { box-sizing: border-box; max-height: min(calc(100dvh - 32px), calc(100vh - 32px)); overflow-y: auto; overscroll-behavior: contain; }
.detail-sticky { position: sticky; top: 0; z-index: 3; display: none; align-items: center; gap: 9px; height: 48px; margin-bottom: -48px; padding: 0 54px 0 12px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 800; }
#dlg.context-scrolled .detail-sticky { z-index: 10; }
.detail-sticky img, .detail-sticky .ph { width: 30px; height: 30px; flex: 0 0 30px; object-fit: cover; border-radius: 5px; background: #efe9dc; }
.detail-sticky .ph { font-size: 14px; line-height: 1; }
.detail-sticky span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dlg.person-scrolled .detail-sticky, #dlg.context-scrolled .detail-sticky { display: flex; }
body.detail-open { position: fixed; width: 100%; overflow: hidden; }
html:has(dialog[open]) { overflow: hidden; }
@media (max-width: 640px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail, .detail .profile, .detail .detail-body { min-width: 0; max-width: 100%; }
  .detail .profile { padding-top: 20px; }
  .detail .detail-body { padding-top: 0; border-top: 0; }
  .detail .pquiz { height: auto; flex-direction: column; overflow-x: visible; overflow-y: visible; padding: 0; scroll-snap-type: none; }
  .detail .pquiz-q { flex: 0 0 auto; width: 100%; height: auto; max-height: none; overflow: visible; scroll-snap-align: none; }
  .detail .pquiz-start { align-self: stretch; white-space: normal; text-align: center; }
}
.detail .art { background: #efe9dc; aspect-ratio: 1; }
.detail .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-open { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; margin: 14px 0 0; padding: 0 22px; border: 2px solid var(--ink); border-radius: 999px; background: var(--ink); color: var(--surface); font: inherit; font-weight: 800; cursor: pointer; }
.chat-open:hover { filter: brightness(1.12); }
#dlg:has(.chat-screen) { overflow: hidden; }
.chat-screen { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 100%; height: min(760px, calc(var(--chat-viewport-height, 100dvh) - 36px)); min-height: 300px; }
.chat-header { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-header > img { width: 42px; height: 42px; object-fit: cover; border-radius: 50%; background: var(--soft); }
.chat-header h2 { margin: 0; font-size: 18px; }
.chat-header h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header-action { flex: 0 0 auto; padding: 7px 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.chat-history { position: absolute; z-index: 2; top: 64px; right: 0; bottom: 72px; left: 0; overflow: auto; padding: 8px 14px 18px; background: var(--surface); }
.chat-history ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chat-history li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-history-item { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; text-align: left; font: inherit; cursor: pointer; }
.chat-history-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-item time { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.chat-history-delete { flex: 0 0 auto; padding: 8px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.chat-back { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: inherit; font-size: 26px; line-height: 1; cursor: pointer; }
.chat-messages { display: flex; flex-direction: column; gap: 14px; overflow: auto; padding: 20px 18px; overscroll-behavior: contain; }
.chat-row { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; }
.chat-row.is-user { align-self: flex-end; }
.chat-row.is-persona { align-self: flex-start; }
.chat-avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; object-fit: cover; background: var(--soft); }
.chat-bubble { padding: 11px 14px; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; background: var(--surface); font-size: 15px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.is-user .chat-bubble { border-color: var(--jade); border-radius: 16px 16px 4px 16px; background: var(--soft); }
.chat-disclaimer { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.chat-state, .chat-error { align-self: center; color: var(--muted); font-size: 13px; }
.chat-error button { margin-left: 8px; padding: 4px 11px; border: 1px solid var(--ink); border-radius: 99px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.chat-composer textarea { flex: 1; min-width: 0; max-height: 112px; resize: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; line-height: 1.45; }
@media (min-width: 641px) { .chat-composer textarea { max-height: 168px; } }
.chat-composer textarea:focus-visible { outline: 2px solid var(--jade); outline-offset: 1px; }
.chat-composer button { flex: 0 0 auto; min-height: 42px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 99px; background: var(--ink); color: var(--surface); font: inherit; font-weight: 800; cursor: pointer; }
.chat-composer button:disabled { opacity: .58; cursor: wait; }
.chat-composer .chat-mic { display: grid; place-items: center; width: 42px; padding: 0; border-color: var(--line); background: var(--surface); color: var(--ink); }
.chat-mic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.chat-composer .chat-mic[aria-pressed="true"] { border-color: #d64545; background: #d64545; color: #fff; animation: chat-mic-pulse 1.4s ease-in-out infinite; }
@keyframes chat-mic-pulse { 50% { box-shadow: 0 0 0 6px rgb(214 69 69 / .22); } }
@media (prefers-reduced-motion: reduce) { .chat-composer .chat-mic[aria-pressed="true"] { animation: none; } }
@media (max-width: 640px) {
  #dlg:has(.chat-screen) { height: var(--chat-viewport-height, 100dvh); max-height: none; border-radius: 18px 18px 0 0; }
  .chat-screen { height: calc(var(--chat-viewport-height, 100dvh) - 38px); min-height: 0; }
  .chat-header { min-height: 58px; gap: 7px; padding: 8px 52px 8px 10px; }
  .chat-header h2 { font-size: 16px; }
  .chat-header-action { padding: 7px 8px; font-size: 11px; }
  .chat-history { top: 58px; bottom: 70px; padding-right: 10px; padding-left: 10px; }
  .chat-messages { padding: 16px 12px; }
  .chat-row { max-width: 92%; }
  .chat-composer { padding-right: 10px; padding-left: 10px; }
}
.info { padding: 20px 22px 24px; }
.info h2 { margin: 2px 0 2px; font-size: 26px; font-weight: 800; line-height: 1.25; }
.catch { font-weight: 700; margin: 10px 0; padding: 8px 12px; background: #fff4d6; border-radius: 10px; font-size: 14px; }
.info h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); }
.info ul { margin: 0; padding-left: 1.2em; font-size: 14px; line-height: 1.7; }
.info p { font-size: 14px; line-height: 1.8; margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--soft); }
.tag.link { cursor: pointer; border: 2px solid var(--line); background: var(--surface); font: inherit; font-size: 12px; font-weight: 700; color: inherit; }
.close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; z-index: 2;
  border: 2px solid var(--ink); background: var(--surface); font-size: 18px; cursor: pointer; color: var(--ink);
}
.close::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.dialog-content > .close { position: sticky; float: right; top: 10px; right: auto; z-index: 12; margin: 10px 10px -46px 0; }
.dialog-back { position: sticky; float: left; top: 10px; z-index: 5; display: inline-flex; align-items: center; gap: 4px; max-width: min(55%, 260px); height: 36px; margin: 10px 0 -46px 10px; padding: 0 14px 0 10px; border: 2px solid var(--ink); border-radius: 18px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.dialog-back[hidden] { display: none; }
.dialog-back.astro-detail-back:not([hidden]) { display: inline-flex; }
#dlg.has-astro-panel { height: min(calc(100dvh - 32px), calc(100vh - 32px)); overflow: hidden; }
#dlg.has-astro-panel .dialog-content { position: relative; height: 100%; min-height: 0; box-sizing: border-box; overflow: hidden; }
#dlg.has-astro-panel #dlgBody { position: absolute; inset: 0; overflow: hidden; }
#dlg .astro-detail-panel.astro-in-dialog { position: absolute; inset: 0; width: auto; height: auto; max-height: none; box-sizing: border-box; overflow-y: auto; border: 0; border-radius: 0; box-shadow: none; }
#dlg .detail-swap-layer .astro-detail-panel, #dlg .detail-swap-layer .pquiz-text { overflow: hidden !important; }
.astro-detail-panel .pquiz-text { max-height: none; overflow: visible; }
.dialog-back span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-back b { font-size: 18px; line-height: 1; }
.wip { font-size: 13px; color: var(--muted); background: var(--soft); padding: 10px 12px; border-radius: 10px; margin-top: 14px; }

/* 詳細内のリンク */
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.minis > :only-child { grid-column: 1 / -1; }
.mini {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.mini:hover { background: #fff8e6; }
.mini .face { width: 40px; height: 40px; }
.mini b { display: block; font-size: 13px; line-height: 1.25; }
.mini small { display: block; font-size: 10px; color: var(--muted); }
.evlist { display: grid; gap: 8px; }
.placeholder-art { position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-height: 96px; overflow: hidden; color: #fff9e8; background: linear-gradient(135deg, #426d68, #274c55); }
.placeholder-art::before { position: absolute; inset: 12% 18%; border: 1px solid rgb(255 255 255 / 35%); border-radius: 50%; content: ""; transform: rotate(-24deg) scaleX(1.5); }
.placeholder-art::after { position: absolute; inset: 0; background: repeating-linear-gradient(135deg, transparent 0 22px, rgb(255 255 255 / 7%) 22px 24px); content: ""; }
.placeholder-mark, .placeholder-region { position: relative; z-index: 1; }
.placeholder-mark { font-size: clamp(30px, 6vw, 66px); line-height: 1; text-shadow: 0 2px 6px rgb(0 0 0 / 25%); }
.placeholder-region { position: absolute; right: 10px; bottom: 8px; padding: 3px 8px; border: 1px solid rgb(255 255 255 / 65%); border-radius: 99px; background: rgb(24 48 50 / 62%); font-size: 11px; font-weight: 800; }
.placeholder-event .placeholder-mark { color: #fff0bb; }
.placeholder-culture .placeholder-mark { color: #e8ffde; }
.placeholder-work .placeholder-mark { color: #ffe1c2; }
.placeholder-region-ヨーロッパ { background: linear-gradient(135deg, #526b9a, #33456e); }
.placeholder-region-西アジア-イスラーム { background: linear-gradient(135deg, #a66e32, #70431e); }
.placeholder-region-南北アメリカ { background: linear-gradient(135deg, #8c5661, #5c3549); }
.placeholder-region-東アジア { background: linear-gradient(135deg, #b44c43, #6f302e); }
.placeholder-region-南アジア { background: linear-gradient(135deg, #aa7a37, #6d4e24); }
.placeholder-region-東南アジア { background: linear-gradient(135deg, #42856c, #295c4c); }
.placeholder-region-アフリカ { background: linear-gradient(135deg, #8a693c, #5e4627); }
.pname .placeholder-art { min-height: 0; }
.pname .placeholder-mark { font-size: 18px; }
.pname .placeholder-region { display: none; }
.evart > .placeholder-art { aspect-ratio: 3 / 2; }
.related-art .placeholder-art { min-height: 100%; aspect-ratio: 3 / 2; }
.related-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.related-grid.related-list { grid-template-columns: 1fr; gap: 6px; }
.related-card { min-width: 0; overflow: hidden; border: 2px solid var(--ink); border-radius: 12px; background: var(--surface); color: inherit; cursor: pointer; font: inherit; text-align: left; padding: 0; }
.related-card:hover { background: #fff8e6; }
.related-card:focus-visible { outline: 3px solid var(--t2); outline-offset: 2px; }
.related-art { display: grid; place-items: center; aspect-ratio: 3 / 2; background: #efe9dc; overflow: hidden; color: var(--muted); }
.related-art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.related-placeholder { display: grid; place-items: center; width: 100%; height: 100%; gap: 4px; font-size: 13px; font-weight: 800; }
.related-placeholder small { font-size: 11px; font-weight: 500; }
.related-copy { display: grid; gap: 4px; padding: 9px 10px 11px; }
.related-copy b { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.related-copy small { font-size: 11px; color: var(--muted); line-height: 1.4; }
.related-list .related-card { display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: stretch; }
.related-list .related-card.no-art { grid-template-columns: minmax(0, 1fr); }
.related-list .related-card.kind-term { grid-template-columns: minmax(0, 1fr); }
.related-list .related-art { aspect-ratio: auto; min-height: 66px; }
.related-list .related-placeholder small { display: none; }
.related-list .related-copy { align-content: center; padding: 8px 10px; }
.related-list .related-copy b { font-size: 13px; }
.era-hero { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.era-hero-placeholder { display: grid; place-items: center; min-height: 180px; color: var(--muted); background: var(--soft); font-weight: 800; }
.era-content { padding: 20px 22px 26px; }
.era-content h2 { margin: 4px 0; font-size: 26px; }
.era-content h3 { margin: 20px 0 9px; font-size: 14px; color: var(--muted); }
.era-meta { font-size: 13px; color: var(--muted); }
.era-description { margin: 12px 0; font-size: 14px; line-height: 1.8; }
.era-source { font-size: 12px; }
.era-source a { color: inherit; overflow-wrap: anywhere; }
.feedback-box { min-width: 0; box-sizing: border-box; margin: 24px 22px 24px; padding: 18px; border: 2px solid var(--gold); border-radius: 16px; background: linear-gradient(145deg, #fffaf0, #f4e7cb); box-shadow: 0 3px 0 #bd8b3644; }
.feedback-box h3 { margin: 0 0 6px; color: var(--jade); font-family: var(--serif); font-size: 19px; }
.feedback-page { margin: 0; max-width: 100%; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.feedback-page > .kindtag { width: fit-content; margin-bottom: 6px; }
.feedback-page > h2 { margin: 4px 0 18px; padding-right: 44px; color: var(--jade); font-family: var(--serif); font-size: 25px; }
.feedback-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; color: var(--ink); font-size: 13px; font-weight: 800; }
.feedback-field-label { display: block; margin-bottom: 6px; color: var(--ink); font-size: 13px; font-weight: 800; }
.feedback-subject { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 9px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fffdf8; color: var(--ink); font: inherit; font-size: 14px; }
.feedback-subject:focus { outline: 3px solid #bd8b3655; border-color: var(--gold); }
.feedback-field-label + .feedback-tags { margin-top: 0; }
.feedback-intro { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.feedback-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.feedback-input { display: block; width: 100%; min-width: 0; min-height: 112px; resize: vertical; padding: 11px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fffdf8; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.65; }
.feedback-input:focus { outline: 3px solid #bd8b3655; border-color: var(--gold); }
.feedback-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.feedback-tag { min-height: 34px; padding: 5px 10px; border: 1px solid var(--gold); border-radius: 999px; background: #fffdf8; color: #6e4b26; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.feedback-tag { transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .12s ease; }
.feedback-tag:active { transform: scale(.97); }
.feedback-tag[aria-pressed="true"] { border-color: var(--jade); background: var(--jade); color: #fffaf0; }
.feedback-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.feedback-submit, .feedback-login { min-height: 42px; padding: 8px 17px; border: 2px solid var(--jade); border-radius: 999px; background: var(--jade); color: #fffaf0; font: inherit; font-weight: 800; cursor: pointer; }
.feedback-submit:disabled { opacity: .6; cursor: wait; }
.feedback-voice-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.feedback-status { min-height: 1.4em; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.feedback-status[data-kind="error"] { color: var(--shu); font-weight: 700; }
.feedback-success { padding: 12px; border: 1px solid #9aaf91; border-radius: 12px; background: #f0f5ed; color: var(--jade); font-weight: 800; text-align: center; animation: feedback-arrive .22s ease-out both; }
@keyframes feedback-arrive { from { opacity: 0; translate: 0 5px; } to { opacity: 1; translate: 0 0; } }
@media (max-width: 640px) { .feedback-box { margin-inline: 20px; } .feedback-page { margin-inline: 0; } .feedback-subject, .feedback-input { font-size: 16px; } }
@media (max-width: 480px) { .feedback-box { padding: 14px; } .feedback-actions > button { flex: 1 1 auto; } }
@media (max-width: 640px) { .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .related-list { grid-template-columns: 1fr; } .related-list .related-card { grid-template-columns: 88px minmax(0, 1fr); } .related-copy { padding: 8px; } .era-content { padding: 16px; } }
.resource-card { display: block; color: inherit; text-decoration: none; }
.evrow {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; padding: 8px 10px;
  border: 2px solid var(--ink); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.evrow:hover { background: #fff8e6; }
.resource-links { display: grid; gap: 8px; margin: 10px 0 14px; }
.resource-link { display: block; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 700; }
.site-note { margin: 24px 16px 32px; text-align: center; color: #888; font-size: 11px; }
.resource-note { margin: 6px 0 14px; color: var(--muted); font-size: 12px; }
.resource-link:hover { border-color: var(--ink); background: #fff8e6; }
.resource-link small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.evrow b { display: block; font-size: 14px; }
.evrow small { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
.evhead { padding: 22px 22px 0; }
.evhead .top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-right: 40px; }

/* ===== AI歴史クイズ（かるたアーケード）と見た目をそろえるテーマ =====
   情報設計はそのままに、背景・枠・見出し・案内役のキャラクターだけをクイズ側に寄せる。 */
html { background: var(--wood); }
body {
  background:
    linear-gradient(rgba(40, 24, 15, .78), rgba(40, 24, 15, .9)),
    url("/images/karuta/palace-garden-optimized.webp") center top / cover fixed,
    var(--wood);
  color: var(--ink);
}
h1, .section-title, .region-title, .info h2, .era-content h2, .ev .name, .card .name { font-family: var(--serif); }

/* ヘッダー: 生成りの札に金の縁、左右に案内役 */
header { padding: 20px 16px 0; }
header h1, header .lead { padding-right: 0; }
.hero {
  position: relative; overflow: hidden; display: grid; align-items: center; min-height: 224px;
  padding: 22px clamp(118px, 22vw, 210px) 20px clamp(86px, 13vw, 132px);
  border: 2px solid var(--gold); border-radius: 26px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.9), transparent 62%), linear-gradient(135deg, #fffaef, #efdbb7);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.62), inset 0 0 0 7px rgba(174,126,48,.32), 0 14px 30px rgba(20,10,5,.35);
}
.hero-copy { position: relative; z-index: 2; display: grid; justify-items: center; gap: 6px; text-align: center; }
.hero-kicker { margin: 0; color: #6e4b26; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.hero h1 { color: #48271b; font-size: clamp(30px, 6vw, 46px); font-weight: 800; letter-spacing: .06em; line-height: 1.15; }
.hero .seo-shell-title { color: #48271b; font-size: clamp(30px, 6vw, 46px); font-weight: 800; letter-spacing: .06em; line-height: 1.15; margin: 0; }
.hero-greet {
  position: relative; margin: 8px 0 0; max-width: 30rem; padding: 9px 16px; border: 1px solid #c9a056; border-radius: 16px;
  background: #fffaf0; color: #4d3221; font-size: 14px; font-weight: 700; line-height: 1.5; box-shadow: 0 3px 0 rgba(150,105,45,.25);
}
.hero-greet::after {
  content: ""; position: absolute; right: -9px; bottom: 12px; width: 14px; height: 14px; background: #fffaf0;
  border: solid #c9a056; border-width: 1px 1px 0 0; transform: rotate(45deg);
}
.book-path-cta { display: inline-flex; align-items: center; gap: 6px; justify-self: center; margin-top: 6px; padding: 9px 18px; border: 2px solid #fff3d6; border-radius: 999px; background: linear-gradient(180deg, #f3c65e, var(--gold, #bd8b36)); color: #3a2208; font: inherit; font-size: 14px; font-weight: 800; box-shadow: 0 3px 0 #7a5420, 0 6px 14px #0004; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.book-path-cta[hidden] { display: none; }
.book-path-cta::after { content: "→"; font-weight: 800; transition: transform .15s ease; }
.book-path-cta:hover { background: linear-gradient(180deg, #ffd978, #d09a3c); transform: translateY(-1px); box-shadow: 0 4px 0 #7a5420, 0 8px 16px #0004; }
.book-path-cta:hover::after { transform: translateX(3px); }
.book-path-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 #7a5420; }
.book-path-cta:focus-visible { outline: 3px solid #276247; outline-offset: 2px; }
.hero-mascot { position: absolute; bottom: 0; z-index: 1; height: auto; pointer-events: none; filter: drop-shadow(0 6px 7px rgba(55,30,17,.24)); }
.hero-mascot--aoi { right: clamp(10px, 3vw, 40px); height: 94%; width: auto; }
.hero-mascot--ann { left: clamp(6px, 2vw, 26px); width: clamp(72px, 10vw, 112px); }
.auth-button { border-color: #c9a056; background: #fffaf0; color: #6e4b26; font-weight: 700; }

/* タブ: 札の形。選択中はクイズの「はじめる」ボタンと同じ深緑＋金縁 */
.tabs { margin-top: 14px; gap: 6px; }
.tab { border: 2px solid #c9a056; border-bottom: none; background: #f4e7cb; color: #6e4b26; }
.tab[aria-selected="true"] { background: linear-gradient(155deg, #397b59, #1d523a 62%, #16432f); border-color: #d3aa56; color: #fff7e8; }
.tab[data-view="culture"][aria-selected="true"] { background: #1f8a6e; border-color: #d3aa56; }
.tab[data-view="orgs"][aria-selected="true"] { background: #28634d; border-color: #d3aa56; }
.tab[data-view="works"][aria-selected="true"] { background: #b7791f; border-color: #d3aa56; }
.tab[data-view="terms"][aria-selected="true"] { background: #52707a; border-color: #d3aa56; }
.tabs { position: relative; touch-action: pan-y; }
.tab-indicator { position: absolute; z-index: 2; bottom: -2px; left: 0; width: 0; height: 3px; border-radius: 4px; background: #fff4d6; pointer-events: none; transform: translateX(0); }
.tab { transition: background-color .2s ease, color .2s ease, transform .12s ease; }
.tab:active { transform: translateY(2px) scale(.98); }
.other-menu { transform-origin: top right; }
#main { touch-action: pan-y; }
#main.swipe-tracking { will-change: transform; }
.card, .ev, .pmini, .emini, .theme-card, .related-card, .mini, .evrow, .term-row, .resource-item { transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease; }
.card:active, .ev:active, .pmini:active, .emini:active, .theme-card:active, .related-card:active, .mini:active, .evrow:active, .term-row:active, .resource-item:active { transform: scale(.985); }
main img, dialog img { opacity: 0; transition: opacity .24s ease; }
main img.is-loaded, dialog img.is-loaded { opacity: 1; }

/* 操作欄: 生成りの台紙と金縁のタブになじませる */
.controls { background: transparent; backdrop-filter: none; border: 0; }
.controls-inner {
  width: calc(100% - 32px); max-width: 1168px;
  padding-top: 8px; padding-bottom: 8px;
  border: 1px solid var(--gold); border-radius: 0 14px 14px 14px;
  background: linear-gradient(180deg, #fff8e8, var(--soft));
  box-shadow: inset 0 0 0 1px #fffaf080, 0 4px 0 #8b642633;
}
.controls-inner > .count, #densityControl .count { color: var(--muted); }
.filter-trigger { min-height: 36px; padding-top: 5px; padding-bottom: 5px; border-color: #d3aa56; background: #fffaf0; color: #48271b; }
.filter-trigger[aria-expanded="true"] { background: #a43e31; color: #fff7e8; }
.density-select { min-height: 36px; padding-top: 4px; padding-bottom: 4px; border-color: #d3aa56; background: #fffaf0; }
.filter-panel { border-color: var(--gold); background: var(--surface); }
.chip { border-color: var(--line); }
/* 操作欄はタブより低く。中身は小さめのボタン1列 */
.controls-inner { padding-top: 5px; padding-bottom: 5px; }
.filter-trigger { min-height: 30px; padding: 3px 12px; font-size: 13px; line-height: 1.2; }
.controls-inner .count { font-size: 12px; }
#densitySelect { min-height: 30px; padding: 2px 10px; font-size: 13px; }
/* 375px 前後でもタブを1行に収める */
@media (max-width: 480px) {
  .tabs { flex-wrap: nowrap; gap: 3px; }
  .tab { flex: 0 1 auto; min-width: fit-content; padding: 8px 6px; font-size: 12px; text-align: center; border-radius: 10px 10px 0 0; white-space: nowrap; }
  html[lang="ja"] .tab { flex: 1 1 0; min-width: 0; }
  .other-tab-wrap { display: flex; flex: 1 1 auto; min-width: 0; }
  .other-tab-wrap .tab { width: 100%; }
  .other-menu { left: auto; right: 0; }
  .filter-trigger, #densitySelect { min-height: 28px; }
}

.flow-track > .region-switch { flex: none; position: sticky; left: 0; z-index: 1; box-shadow: 6px 0 6px -4px var(--paper, #fbf3e3); }
.region-switch button { min-height: 28px; padding: 0 12px; }
.flow:has(.world-region-chips) { flex-wrap: wrap; row-gap: 6px; }
.flow:has(.world-region-chips) > .flow-track { flex: 1 1 0; }
.world-region-chips { flex: 1 0 100%; display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.world-region-chips::-webkit-scrollbar { display: none; }
.world-region-chips .chip { flex: none; min-height: 30px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
.lineage-inline { flex: 1 0 100%; min-width: 0; }
.lineage-inline-toggle { width: 100%; min-height: 30px; padding: 2px 3px; display: flex; align-items: center; justify-content: space-between; border: 0; background: transparent; color: var(--jade, #39765e); font: inherit; text-align: left; cursor: pointer; }
.lineage-inline-toggle b { font-size: 12px; }
.lineage-inline-toggle span { font-size: 16px; line-height: 1; }
.lineage-inline-page { max-width: none; margin: 0; padding: 0 0 6px; }
.lineage-inline-page .lineage-hierarchy { max-height: 460px; overflow: auto; }
.lineage-inline-page .lineage-stage-detail { margin: 3px 0 5px 8px; padding: 2px 7px; font-size: 11px; }
.lineage-child-row { display: flex; align-items: center; min-width: 0; }
.lineage-child-row .lineage-mobile-item { flex: 1; min-width: 0; }
.lineage-stage-select.is-selected { border-radius: 8px; background: #dcebdc; color: #234b3a; }
.lineage-stage-expand { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--jade,#39765e); font-size: 16px; cursor: pointer; }
.lineage-stage-expand:hover, .lineage-stage-expand:focus-visible { background: #e5efe4; }

/* 本体: 生成りの紙の台紙 */
main {
  margin: 14px auto 0; width: calc(100% - 32px); max-width: 1168px; padding: 8px 18px 40px;
  border: 2px solid var(--gold); border-radius: 24px; background: var(--bg);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.55), 0 14px 30px rgba(20,10,5,.35);
}
.card, .ev, .pmini, .emini { border-color: #6b4329; }
.card { box-shadow: 0 4px 0 #6b4329; }
.card:hover, .ev:hover { box-shadow: 0 7px 0 #6b4329; }
.card .body { border-top-color: #6b4329; }
.year { background: var(--shu); }
.catch { background: #fff1cf; border: 1px solid #e3c27a; }
.site-note { color: #cdb898; }
.site-note a { color: inherit; }
dialog { border-color: var(--gold); box-shadow: 0 10px 0 #6b4329, 0 20px 50px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(40, 24, 15, .62); }
dialog { opacity: 0; transform: translateY(8px) scale(.985); transition: opacity .22s ease, transform .28s cubic-bezier(.2,.8,.2,1), overlay .28s allow-discrete, display .28s allow-discrete; }
dialog:not([open]) { opacity: 0; transform: translateY(8px) scale(.985); }
dialog[open] { opacity: 1; transform: translateY(0) scale(1); }
dialog::backdrop { opacity: 0; transition: opacity .24s ease, display .24s allow-discrete, overlay .24s allow-discrete; }
dialog[open]::backdrop { opacity: 1; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(8px) scale(.985); } dialog[open]::backdrop { opacity: 0; } }
.detail-swap-layer { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; background: var(--surface); }
@media (max-width: 640px) {
  #dlg { position: fixed; inset: auto 0 env(safe-area-inset-bottom); margin: 0; width: 100%; max-width: none; height: min(calc(100dvh - max(16px, env(safe-area-inset-top)) - env(safe-area-inset-bottom)), calc(100vh - max(16px, env(safe-area-inset-top)) - env(safe-area-inset-bottom))); max-height: none; border-radius: 20px 20px 0 0; transform: translateY(24px); }
  /* 詳細は内容の量にかかわらず画面の上端近くまで引き上げる */
  #dlg[open] { transform: translateY(0); }
  #dlg:not([open]) { transform: translateY(100%); }
  #dlg::backdrop { background: rgba(35, 25, 18, .56); }
  #dlg .dialog-content { touch-action: pan-y; }
  #dlg .sheet-grabber { width: 44px; height: 22px; margin: 0 auto; position: relative; touch-action: none; cursor: grab; }
  #dlg .sheet-grabber::after { content: ""; position: absolute; top: 9px; left: 3px; width: 38px; height: 4px; border-radius: 99px; background: #c8b58e; }
  #dlgBody .detail > .art, #dlgBody .evhero, #dlgBody .era-hero, #dlgBody .flow-header, #dlgBody .evhead { touch-action: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tab, .card, .ev, .pmini, .emini, .theme-card, .related-card, .mini, .evrow, .term-row, .resource-item, .feedback-tag, .filter-panel, main img, dialog, dialog::backdrop { transition-duration: .01ms !important; }
  .filter-panel { transform: none !important; }
  .feedback-success { animation: none; }
  #dlg { transform: none !important; }
}

/* めくる */
.mekuru-fab { position: fixed; z-index: 5; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px)); display: grid; width: 58px; height: 58px; place-items: center; align-content: center; gap: 1px; padding: 0; border: 2px solid var(--gold); border-radius: 50%; background: var(--jade); color: #fff7e8; font: inherit; font-size: 10px; font-weight: 800; line-height: 1; cursor: pointer; box-shadow: 0 3px 0 #16432f, 0 8px 18px rgba(20,10,5,.28); -webkit-tap-highlight-color: transparent; }
.mekuru-fab svg { width: 24px; height: 24px; }
.mekuru-fab:active { transform: translateY(2px); box-shadow: 0 1px 0 #16432f, 0 4px 10px rgba(20,10,5,.24); }
.mekuru-fab:focus-visible { outline: 3px solid #e9c766; outline-offset: 3px; }
body.mekuru-open .mekuru-fab, body.utility-view .mekuru-fab, body.detail-open .mekuru-fab { display: none; }
body.term-page .mekuru-fab { display: none; }
body.mekuru-open { overflow: hidden; }
body.mekuru-open > header, body.mekuru-open > .sticky-nav, body.mekuru-open > footer { display: none !important; }
body.mekuru-open #main { position: fixed; z-index: 40; inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; margin: 0; padding: 0; overflow: hidden; }
.mekuru-screen { position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: #28180f; color: #fff7e8; }
.mekuru-feed { width: 100%; height: 100%; overflow-y: auto; overscroll-behavior-y: contain; scroll-snap-type: y mandatory; scroll-behavior: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.mekuru-feed::-webkit-scrollbar { display: none; }
.mekuru-card { position: relative; display: flex; flex-direction: column; width: 100%; height: calc(100vh - 12px); height: calc(100dvh - 12px); margin: 0 auto 12px; padding: max(14px, env(safe-area-inset-top)) 16px max(62px, calc(env(safe-area-inset-bottom) + 54px)); overflow: hidden; border: 3px solid var(--gold); border-radius: 0 0 24px 24px; background: linear-gradient(155deg, #fff9e9, #f0dfbf); color: var(--ink); text-align: left; font: inherit; cursor: pointer; scroll-snap-align: start; scroll-snap-stop: always; content-visibility: auto; contain-intrinsic-size: auto 100dvh; }
.mekuru-quiz-button { position: absolute; z-index: 3; right: max(16px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); min-width: 76px; min-height: 44px; padding: 8px 16px; border: 2px solid var(--jade); border-radius: 999px; background: var(--jade); color: #fff; font: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 #16432f; }
.mekuru-card:focus-visible { outline: 4px solid #e9c766; outline-offset: -7px; }
.mekuru-era { position: absolute; z-index: 1; top: max(16px, env(safe-area-inset-top)); left: 66px; padding: 5px 11px; border: 1px solid var(--gold); border-radius: 999px; background: #fffaf0ef; color: #6e4b26; font-size: 13px; font-weight: 800; }
.mekuru-art { display: grid; flex: 1 1 auto; min-height: 0; place-items: center; margin: 0 -10px; overflow: hidden; border: 2px solid #d6bd86; border-radius: 17px; background: #f7f0df; }
.mekuru-art img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 1; }
.mekuru-copy { display: grid; flex: 0 0 auto; gap: 3px; max-height: 38%; padding: 10px 4px 2px; overflow: hidden; }
.mekuru-kana { color: #765637; font-size: 13px; font-weight: 700; }
.mekuru-name { overflow: hidden; font-family: var(--serif); font-size: clamp(24px, 7vw, 36px); font-weight: 800; line-height: 1.18; text-overflow: ellipsis; }
.mekuru-date { color: #755534; font-size: 13px; font-weight: 800; }
.mekuru-catch { display: -webkit-box; overflow: hidden; color: #38291d; font-size: 14px; font-weight: 700; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mekuru-points { display: grid; gap: 2px; overflow: hidden; }
.mekuru-points > span { display: -webkit-box; overflow: hidden; color: #5a432b; font-size: 12px; font-weight: 700; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
.mekuru-close { position: absolute; z-index: 4; top: max(12px, env(safe-area-inset-top)); left: 12px; display: grid; width: 42px; height: 42px; place-items: center; border: 2px solid var(--gold); border-radius: 50%; background: #fffaf0; color: var(--ink); font: 32px/1 var(--serif); cursor: pointer; box-shadow: 0 3px 0 #6b4329; }
.mekuru-era ~ .mekuru-art { margin-top: 0; }
.mekuru-empty { display: grid; min-height: 100%; place-items: center; color: #fff7e8; font-weight: 800; }
@media (min-width: 700px) {
  .mekuru-card { width: min(900px, calc(100% - 48px)); height: calc(100vh - 24px); height: calc(100dvh - 24px); margin-bottom: 24px; padding: 24px 34px 20px; border-radius: 24px; }
  .mekuru-art { margin: 0; }
  .mekuru-copy { max-height: 33%; padding-top: 12px; }
  .mekuru-close { top: 18px; left: 18px; }
}
.mekuru-card.is-coach-peek { animation: mekuru-peek 2.2s cubic-bezier(.3, .7, .2, 1) .2s 2 both; }
.mekuru-coach { position: absolute; z-index: 5; left: 50%; bottom: 22%; display: grid; width: 72px; height: 72px; margin-left: -36px; place-items: center; border-radius: 50%; background: #1d140ec4; pointer-events: none; box-shadow: 0 6px 18px #0005; animation: mekuru-coach-hand 2.2s cubic-bezier(.3, .7, .2, 1) .2s 2 both; }
.mekuru-coach svg { display: block; width: 44px; height: 44px; }
@keyframes mekuru-peek { 0%, 12% { transform: translateY(0); } 42%, 64% { transform: translateY(-96px); } 92%, 100% { transform: translateY(0); } }
@keyframes mekuru-coach-hand { 0%, 12% { opacity: 0; transform: translateY(40px); } 20% { opacity: 1; transform: translateY(40px); } 42% { opacity: 1; transform: translateY(-56px); } 64%, 100% { opacity: 0; transform: translateY(-72px); } }
@media (prefers-reduced-motion: reduce) {
  .mekuru-feed { scroll-behavior: auto; }
  .mekuru-card, .mekuru-fab { transition-duration: .01ms !important; }
  .mekuru-card.is-coach-peek { animation: none; transform: translateY(-96px); }
  .mekuru-coach { animation: none; opacity: 1; }
}

/* 詳細の「ひとこと」は案内役が話している吹き出しに */
.catch { position: relative; margin-left: 52px; border-radius: 12px; }
.catch::before {
  content: ""; position: absolute; left: -52px; top: 50%; translate: 0 -50%; width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--gold-soft); background: #fff8e7 url("images/karuta/aoi-happy.webp") 30% 5% / 246% auto no-repeat;
  box-shadow: 0 2px 0 rgba(107,67,41,.35);
}

/* 見つからないとき: 三毛猫がはげます */
.empty { display: grid; justify-items: center; gap: 10px; padding: 36px 0; }
.empty img { width: 110px; height: auto; }
.empty p { margin: 0; padding: 9px 16px; border: 1px solid #c9a056; border-radius: 16px; background: #fffaf0; color: #4d3221; font-weight: 700; }

@media (max-width: 640px) {
  header { padding: 12px 12px 0; }
  header { padding-top: 46px; }
  .hero { min-height: 150px; padding: 14px 84px 14px 14px; border-radius: 20px; }
  .hero-copy { justify-items: start; text-align: left; gap: 4px; }
  .hero-kicker { font-size: 10px; letter-spacing: .02em; }
  html[lang="en"] .hero-kicker { max-width: calc(100% - 84px); }
  .hero h1 { font-size: 28px; }
  .hero .seo-shell-title { font-size: 28px; }
  .hero-greet { font-size: 12px; padding: 7px 11px; }
  .book-path-cta { justify-self: start; margin-top: 2px; padding: 6px 12px; font-size: 12px; box-shadow: 0 2px 0 #7a5420, 0 4px 10px #0004; }
  .hero-mascot--aoi { right: 4px; height: 92%; }
  .hero-mascot--ann { display: none; }
  .hero-title-row { justify-content: flex-start; gap: 8px; }
  .auth-button { min-height: 30px; padding: 3px 9px; font-size: 11px; }
  .controls-inner { width: calc(100% - 24px); padding: 3px 10px; }
  main { width: calc(100% - 24px); padding: 4px 12px 30px; border-radius: 18px; }
}

/* /jinbutsu/ のページに埋め込んだ解説 */
.seo-page { position: relative; max-width: 860px; margin: 0 auto; padding: 16px; line-height: 1.8; }
.seo-page > .seo-detail-close { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; margin: 0; text-decoration: none; }
.seo-page > article > h1 { padding-right: 48px; }
.seo-page .items a { color: var(--jade); text-decoration-color: currentColor; text-underline-offset: 3px; }
.seo-page .items a:hover, .seo-page .items a:focus-visible { color: var(--shu); }
.seo-page .hero { display: flex; gap: 20px; align-items: center; }
.seo-page .portrait { width: 240px; max-width: 100%; height: auto; border: 3px solid var(--gold); border-radius: 16px; }
.seo-page h2 { font-family: var(--serif); border-left: 6px solid var(--shu); padding-left: 10px; }
.seo-page img { max-width: 100%; height: auto; }
.seo-page .related, .seo-page .people { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.seo-page .related img, .seo-page .people img { width: 48px; height: 48px; vertical-align: middle; margin-right: 6px; border-radius: 8px; }
.seo-page { width: 100%; min-width: 0; overflow-wrap: anywhere; }
.seo-page .keywords { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; }
.seo-page .keywords span { display: inline-block; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
@media (max-width: 600px) { .seo-page .hero { flex-direction: column; align-items: flex-start; } }
/* 静的詳細ページは共通の一覧操作を隠し、検索本文を画面上部へ置く。 */
.seo-detail-document { display: flex; flex-direction: column; }
.seo-detail-document > #main { order: 1; }
.seo-detail-document > header { order: 0; }
.seo-detail-document > .sticky-nav { order: 2; }
.seo-detail-document > footer { order: 3; }
.seo-detail-document > header { width: 100%; box-sizing: border-box; padding: 4px 12px 0; }
.seo-detail-document > header .hero { min-height: 42px; padding: 0; display: flex; justify-content: flex-end; border: 0; border-radius: 0; background: none; box-shadow: none; }
.seo-detail-document > header .hero-copy, .seo-detail-document > header .hero-mascot, .seo-detail-document > .sticky-nav { display: none !important; }
.seo-detail-document > header .hero .header-actions { position: relative; top: auto; right: auto; margin: 0; }

/* 人物のクイズ（歴史クイズアプリと同じ4択） */
.pquiz { display: flex; align-items: stretch; gap: 12px; height: auto; overflow-x: auto; overflow-y: hidden; padding: 0 12% 8px 0; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.pquiz-q { display: flex; flex: 0 0 88%; flex-direction: column; min-width: 0; height: auto; overflow: visible; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); padding: 12px; scroll-snap-align: start; }
.pquiz-head { display: flex; flex: 0 0 84px; align-items: flex-start; gap: 6px; }
.quiz-favorite { flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #8a6b18; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.quiz-favorite[aria-pressed="true"] { background: #fff2bf; border-color: var(--gold); }
.pquiz-text { flex: 1; min-width: 0; max-height: 5.2em; overflow: auto; margin: 0 0 10px; font-weight: 700; line-height: 1.6; }
.pquiz-text b { color: var(--shu); margin-right: 8px; }
.pquiz-options { display: grid; flex: 0 0 auto; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pquiz-option { min-height: 44px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; text-align: left; cursor: pointer; }
.pquiz-option:hover:not(:disabled) { border-color: var(--gold); }
.pquiz-option:disabled { cursor: default; opacity: .6; }
.pquiz-option.is-correct { border-color: var(--jade); background: #e7f3ec; opacity: 1; }
.pquiz-option.is-wrong { border-color: var(--shu); background: #f9e6e2; opacity: 1; }
.pquiz-result { display: block; flex: 0 0 26px; margin: 8px 0 0; font-weight: 800; color: var(--shu); visibility: hidden; }
.pquiz-result:not([hidden]) { visibility: visible; }
.pquiz-result.is-correct { color: var(--jade); }
.pquiz-explanation { display: block; flex: 0 0 auto; min-height: 3.1em; overflow: visible; margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); visibility: hidden; }
.pquiz-explanation:not([hidden]) { visibility: visible; }
.pquiz-start { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; align-self: center; box-sizing: border-box; max-width: 88%; min-height: 44px; scroll-snap-align: start; text-wrap: balance; padding: 11px 14px; border: 0; border-radius: 12px; background: var(--jade); color: #fff; font: inherit; font-weight: 800; text-align: center; text-decoration: none; cursor: pointer; }
.seo-page .options { padding-left: 20px; }
@media (max-width: 480px) { .pquiz-head { flex-basis: 78px; } .pquiz-options { grid-template-columns: 1fr; } }
.mekuru-quiz-sheet { position: fixed; inset: auto 0 0; display: flex; flex-direction: column; width: min(100%, 640px); max-width: none; height: min(78dvh, 620px); max-height: 88dvh; margin: 0 auto; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); overflow: hidden; border: 0; border-radius: 24px 24px 0 0; background: var(--paper, #f6f3ec); color: var(--ink); box-shadow: 0 -8px 32px #0005; }
.mekuru-quiz-sheet:not([open]) { display: none; }
.mekuru-quiz-sheet[open] { animation: quiz-sheet-in .28s cubic-bezier(.2, .9, .3, 1); }
@keyframes quiz-sheet-in { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .mekuru-quiz-sheet[open] { animation: none; } }
.mekuru-quiz-sheet::backdrop { background: #120b08a8; }
.quiz-sheet-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.quiz-sheet-head h2 { overflow: hidden; margin: 0; font: 800 20px/1.25 var(--serif); text-overflow: ellipsis; white-space: nowrap; }
.quiz-sheet-head button { width: 40px; height: 40px; flex: 0 0 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 24px; }
.quiz-sheet-progress { display: flex; flex: 0 0 auto; gap: 6px; margin: 4px 0 14px; }
.quiz-sheet-progress i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); transition: background .2s; }
.quiz-sheet-progress i.is-current { background: var(--gold); }
.quiz-sheet-progress i.is-correct { background: var(--jade); }
.quiz-sheet-progress i.is-wrong { background: var(--shu); }
.quiz-sheet-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.quiz-sheet-body .pquiz { display: block; height: auto; padding: 0; overflow: visible; }
.quiz-sheet-body .pquiz-q { height: auto; min-height: 0; overflow: visible; border: 0; background: none; padding: 0; }
.quiz-sheet-body .pquiz-q[hidden] { display: none; }
.quiz-sheet-body .pquiz-head { flex: 0 0 auto; }
.quiz-sheet-body .pquiz-text { max-height: none; overflow: visible; font-size: 17px; }
.quiz-sheet-body .pquiz-options { grid-template-columns: 1fr; gap: 10px; }
.quiz-sheet-body .pquiz-option { min-height: 52px; font-size: 16px; }
.quiz-sheet-body .pquiz-result { flex: 0 0 auto; margin-top: 14px; font-size: 18px; }
.quiz-sheet-body .pquiz-result[hidden], .quiz-sheet-body .pquiz-explanation[hidden] { display: none; }
.quiz-sheet-body .pquiz-explanation { flex: 0 0 auto; font-size: 14px; }
.quiz-sheet-score { padding: 32px 0 8px; text-align: center; }
.quiz-sheet-score[hidden] { display: none; }
.quiz-sheet-score p { margin: 0; font-weight: 800; }
.quiz-sheet-score-num { font: 800 28px/1.2 var(--serif); }
.quiz-sheet-score-num b { font-size: 64px; color: var(--jade); }
.quiz-sheet-foot { flex: 0 0 auto; padding-top: 12px; }
.quiz-sheet-next { display: block; width: 100%; min-height: 52px; border: 0; border-radius: 14px; background: var(--jade); color: #fff; font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; }
.quiz-sheet-next[hidden] { display: none; }
a.quiz-sheet-next { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.quiz-sheet-retry { display: block; width: 100%; min-height: 48px; margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; background: none; color: var(--ink); font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; }
.quiz-sheet-lead { max-width: 24em; margin: 20px auto 0 !important; font-size: 15px; font-weight: 700 !important; line-height: 1.7; }

/* 参照本カード（概要・分かること・注意・推し度） */
.book-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 8px 0 6px; }
.book-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 16px; border: 2px solid var(--gold); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 0 #bd8b3644; }
.book-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.book-format { padding: 2px 9px; border-radius: 999px; background: var(--jade); color: #fff; font-weight: 800; }
.book-stars { color: var(--muted); font-weight: 700; }
.book-stars b { color: var(--gold); font-size: 15px; letter-spacing: 1px; }
.book-title { margin: 0; color: var(--ink); font-family: var(--serif); font-size: 18px; line-height: 1.45; overflow-wrap: anywhere; }
.book-author { margin: -4px 0 0; color: var(--muted); font-size: 13px; }
.book-summary, .book-insight { margin: 0; font-size: 14px; line-height: 1.75; }
.book-insight { padding: 8px 10px; border-left: 4px solid var(--jade); border-radius: 0 8px 8px 0; background: #f0f5ed; }
.book-insight b { display: block; color: var(--jade); font-size: 12px; }
.book-cautions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.book-cautions li { padding: 3px 9px; border: 1.5px solid var(--shu); border-radius: 999px; background: #fdf0ec; color: var(--shu); font-size: 12px; font-weight: 700; }
.book-cautions li::before { content: "注意 "; }
.book-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.book-links a { display: inline-flex; align-items: center; min-height: 38px; padding: 6px 12px; border: 2px solid var(--gold); border-radius: 999px; background: #fff5dd; color: var(--ink); font-size: 13px; font-weight: 800; text-decoration: none; }
.book-links a:hover { border-color: var(--ink); }
.book-card .resource-items { padding-top: 8px; border-top: 1px dashed var(--line); }
.book-era { margin: 0 0 22px; }
.book-era h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; color: var(--jade); font-family: var(--serif); font-size: 21px; }
.book-era h3 small { color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600; }
@media (max-width: 480px) { .book-list { grid-template-columns: 1fr; } .book-card { padding: 12px 13px; } .book-card .resource-item { width: auto; } }
/* 詳細画面では本を1列にして横幅いっぱいに使う（2列だと iPad などで窮屈になる） */
dialog .book-list { grid-template-columns: minmax(0, 1fr); }
/* 書影（images/books/<code>.jpg、幅240px）。題名の左に置き、概要は横幅いっぱいに使う */
.book-top { display: flex; gap: 12px; align-items: flex-start; }
.book-head { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.book-head .book-author { margin: 0; }
.book-cover { flex: none; width: 76px; line-height: 0; border-radius: 4px; box-shadow: 0 2px 6px #0003; overflow: hidden; background: var(--soft); }
.book-cover img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; }

/* 参照本一覧：並べ方・絞り込み・時代ジャンプ */
.book-controls { display: grid; gap: 10px; margin: 0 0 18px; }
.book-switch { display: inline-flex; gap: 0; width: fit-content; border: 2px solid var(--jade); border-radius: 999px; overflow: hidden; }
.book-switch .chip { border: 0; border-radius: 0; margin: 0; min-height: 38px; padding: 6px 16px; background: var(--surface); color: var(--jade); font-weight: 800; }
.book-switch .chip[aria-pressed="true"] { background: var(--jade); color: #fff; }
.book-jumps { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.book-jump { flex: none; display: inline-flex; align-items: baseline; gap: 5px; min-height: 36px; padding: 6px 12px; border: 1.5px solid var(--gold); border-radius: 999px; background: #fff5dd; color: var(--ink); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.book-jump small { color: var(--muted); font-weight: 600; }
.book-era { scroll-margin-top: calc(var(--sticky-h, 0px) + 12px); }

/* 表紙で並べる */
.book-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 16px 12px; padding: 14px 12px 16px; border: 2px solid var(--gold); border-radius: 14px; background: linear-gradient(#fffaf0, #f6ead0); }
.book-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.book-tile-cover { display: block; aspect-ratio: 2 / 3; border-radius: 4px; overflow: hidden; background: var(--soft); box-shadow: 0 3px 8px #0003, 0 1px 0 #0002; transition: transform .15s ease; }
.book-tile:hover .book-tile-cover { transform: translateY(-3px); }
.book-tile-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-tile-blank { display: grid; place-items: center; height: 100%; padding: 8px; background: linear-gradient(160deg, var(--jade), #0f3524); color: #fff; font-family: var(--serif); font-size: 14px; font-weight: 700; line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
.book-tile-stars { margin-top: 2px; color: var(--gold); font-size: 12px; letter-spacing: 1px; }
.book-tile b { font-family: var(--serif); font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.book-tile small { color: var(--muted); font-size: 11px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-tile:focus-visible { outline: 3px solid var(--t2); outline-offset: 3px; border-radius: 6px; }

/* くわしく読む：本に出てくる項目をイラストつきで */
.book-rel-list { padding-top: 10px; border-top: 1px dashed var(--line); }
.book-rel-list h5 { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.book-rels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.book-rel { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 48px; padding: 5px 8px 5px 5px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.book-rel:hover { border-color: var(--jade); background: #f0f5ed; }
.book-rel-art { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 6px; overflow: hidden; background: #efe9dc; color: var(--muted); font-weight: 800; }
.book-rel-art.is-person { border-radius: 50%; }
.book-rel-art img { width: 100%; height: 100%; object-fit: cover; }
.book-rel-name { min-width: 0; font-size: 13px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.book-rel-name small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.book-card.is-flash { animation: book-flash 1.6s ease; }
@keyframes book-flash { 0%, 40% { box-shadow: 0 0 0 4px var(--gold-soft), 0 3px 0 #bd8b3644; } 100% { box-shadow: 0 3px 0 #bd8b3644; } }
@media (max-width: 480px) { .book-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; padding: 12px 10px; } .book-tile b { font-size: 13px; } .book-rels { grid-template-columns: 1fr 1fr; } }
.book-list .book-card { scroll-margin-top: calc(var(--sticky-h, 0px) + 64px); }

/* ===== 両テーマ共通のレイアウト（2026-10-24）: ヘッダーのメニュー、ツールバー、時代の並び =====
   シンプルテーマの配置を正とし、ここでは「ポップ」の色で同じ形を作る。色の上書きは skin-simple.css。 */

/* ヘッダー右上: メニューとログインを同じ形のボタンで並べる */
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 0 0 10px; }
.header-button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 14px;
  border: 1px solid var(--gold); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.header-button:hover { background: #fff3d8; }
.header-button:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; }
.menu-button[aria-expanded="true"], .menu-button.is-current { border-color: var(--jade); color: var(--jade); }
.menu-icon {
  width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M2.5 4h11M2.5 8h11M2.5 12h11'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M2.5 4h11M2.5 8h11M2.5 12h11'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth-actions { display: flex; }
.auth-button[hidden] { display: none; }
.menu-wrap { position: relative; }
.menu-wrap .other-menu { top: calc(100% + 6px); right: 0; left: auto; width: max-content; min-width: 220px; max-width: calc(100vw - 24px); }
/* Keep the complete navigation reachable when the site is shown inside the quiz app's short iframe. */
.menu-wrap .other-menu {
  max-height: calc(100vh - 64px);
  max-height: min(calc(100dvh - 64px), calc(100vh - 64px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* 埋め込み表示ではメニューだけタブの列の右端に置く */
.embed-app .tabs-row { display: flex; align-items: flex-end; gap: 8px; }
.embed-app .tabs-row .tabs { flex: 1; min-width: 0; }
.embed-app .tabs-row .menu-wrap { flex: none; margin-bottom: 4px; }

/* ツールバー: 左に件数、右に「絞り込み」と表示切り替え */
.controls-inner {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--gold); border-radius: 12px;
  background: var(--surface); box-shadow: none;
}
.toolbar-count { display: block; flex: 1; min-width: 0; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-trigger { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid #d3aa56; border-radius: 999px; background: #fffaf0; color: var(--ink); font-size: 13px; font-weight: 700; }
.filter-trigger[aria-expanded="true"] { border-color: var(--jade); background: #eaf2ec; color: var(--jade); }
.filter-icon { width: 16px; height: 16px; font-size: 0; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M2 4h12M4.5 8h7M7 12h2'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M2 4h12M4.5 8h7M7 12h2'/%3E%3C/svg%3E") center / contain no-repeat; }
.filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--shu); color: #fff; font-size: 0; }
.filter-count::after { content: attr(data-n); font-size: 11px; font-weight: 700; }
#densityControl { display: flex; flex: none; margin: 0; }
#densityControl[hidden] { display: none; }
#densityControl > label, #densitySelect { display: none !important; }
.view-seg { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--soft); }
.view-seg button { min-height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.view-seg button[aria-checked="true"] { background: #fffaf0; color: var(--ink); box-shadow: 0 1px 2px #48271b33; }
.view-seg button:focus-visible { outline: 2px solid var(--jade); outline-offset: 1px; }

/* 時代の帯: 1行のチップを横スクロールで並べる */
.flows { margin: 4px 0 6px; }
.flow-track { align-items: center; gap: 6px; padding: 2px 0 6px; scrollbar-width: none; }
.flow-track::-webkit-scrollbar { display: none; }
.flow-track > .flow-label { margin-right: 2px; font-size: 12px; font-weight: 800; }
.flow-track > .flow-arrow { display: none; }
.flow-seg {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 0; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fffaf0; color: var(--ink); white-space: nowrap;
}
.flow-seg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.flow-seg:hover { border-color: var(--c); background: #fff; filter: none; transform: none; }
.flow-seg b { display: inline; font-size: 13px; font-weight: 700; }
.flow-seg small { display: inline; font-size: 0; opacity: 1; }
.flow-seg small::after { content: attr(data-count); color: var(--muted); font-size: 12px; font-weight: 700; }
.flow-group { flex-direction: row; align-items: center; gap: 4px; }
.flow-group-name { padding: 0 2px 0 4px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 700; }
.flow-subs { gap: 4px; }
.flow-subs .flow-seg { min-width: 0; border-radius: 999px; }

/* 年表本体: 時代名の見出しの下にカードを全幅で並べる */
.tl { grid-template-columns: minmax(0, 1fr); gap: 0; }
.tl::before { display: none; }
.tl-side { display: contents; }
.tl-label {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  margin: 18px 0 0; padding: 8px 2px;
  border: 0; border-bottom: 2px solid var(--c); border-radius: 0;
  background: var(--bg);
}
.tl-label::before { display: none; }
.tl-label b { color: color-mix(in srgb, var(--c), #000 52%); font-size: 17px; }
.tl-label-button { width: auto; }
.tl-label small { font-size: 12px; }
.tl-label span { margin: 0 0 0 auto; color: var(--muted); font-size: 12px; }
.tl-body { padding: 12px 0 8px; }
.era-group-title { margin: 26px 0 -8px; color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  .tl-label { margin-top: 14px; padding: 8px 2px; }
  .tl-body { padding: 10px 0 6px; }
}
/* 390px 前後: 3択の切り替えと絞り込みを1行に収める。件数は絞り込みパネル内に出ているので隠す */
@media (max-width: 480px) {
  .controls-inner { padding: 6px 8px; }
  .view-seg button { padding: 0 9px; font-size: 12px; }
  .filter-trigger { padding: 0 10px; font-size: 12px; }
  html:not([data-skin="simple"]) .toolbar-count { display: none; }
  html:not([data-skin="simple"]) .filter-trigger { margin-right: auto; }
}

/* ===== ヘッダーと一覧の台紙をひとつながりにする（2026-10-24） ===== */
/* メニューとログインはヘッダーの札の右上に収め、札の一部に見せる */
/* メニューの吊り下げを札の外まで出す。キャラは札の内側に収まる高さにしてある */
.hero { overflow: visible; }
header { z-index: 8; }
.hero .header-actions { position: absolute; z-index: 3; top: 12px; right: 14px; margin: 0; gap: 6px; }
.hero .header-button {
  min-height: 30px; padding: 0 12px;
  border-color: #d3b073; background: rgb(255 250 240 / 82%);
  color: #6e4b26; font-size: 12px;
  box-shadow: 0 1px 0 rgba(150,105,45,.18);
  backdrop-filter: blur(4px);
}
.hero .header-button:hover { background: #fffaf0; border-color: var(--gold); }
.hero .menu-icon { width: 14px; height: 14px; }
.hero-mascot--aoi { height: 80%; }

/* 絞り込みと表示切り替えは、一覧の台紙の上端に置く（タブ → 台紙の見出し行 → 中身） */
body:not(.utility-view) .controls-inner {
  border: 2px solid var(--gold); border-bottom: 1px solid var(--line);
  border-radius: 0 24px 0 0;
  background: var(--bg);
  box-shadow: inset 0 4px 0 -0px rgba(255,255,255,.55);
}
body:not(.utility-view) main { margin-top: 0; border-top: 0; border-radius: 0 0 24px 24px; }
.sticky-nav.is-stuck .controls-inner { border-bottom: 2px solid var(--gold); border-radius: 0 0 16px 16px; box-shadow: 0 6px 14px rgba(20,10,5,.3); }
@media (max-width: 640px) {
  .hero .header-actions { top: 10px; right: 10px; }
  .hero .header-button { min-height: 28px; padding: 0 10px; font-size: 11px; }
  /* スマホ幅では小見出しと重ならないよう、メニューはアイコンだけにする（読み上げ名は「メニュー」のまま） */
  .hero .menu-button { padding: 0 7px; gap: 0; font-size: 0; }
  .hero .menu-button .menu-icon { width: 15px; height: 15px; }
  .hero-mascot--aoi { height: 74%; }
  .tabs-row { padding: 0 12px; }
  body:not(.utility-view) .controls-inner { border-radius: 0 18px 0 0; }
  body:not(.utility-view) main { border-radius: 0 0 18px 18px; }
}

/* 系譜 */
.connection-map-page { display: grid; grid-template-rows: auto minmax(400px, 50vh); gap: 10px; max-width: 1480px; margin: 0 auto; padding: 10px 0 28px; }
.connection-map-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.connection-map-toolbar .region-switch { display: inline-flex; }
.connection-map-kinds { display: flex; flex: 1 1 600px; flex-wrap: wrap; gap: 5px; }
.connection-map-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 31px; padding: 3px 9px; border: 1px solid color-mix(in srgb,var(--node-color) 60%,var(--line)); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.connection-map-chip i, .connection-map-neighbor i { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--node-color); }
.connection-map-chip[aria-pressed="false"] { opacity: .42; text-decoration: line-through; }
.connection-map-search { flex: 0 1 220px; }
.connection-map-search input { width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
.connection-map-layout { display: grid; grid-template-columns: minmax(0,1fr) 0; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 4px 0 rgba(107,67,41,.12); }
.connection-map-layout.has-selection { grid-template-columns: minmax(0,1fr) 290px; }
.connection-map-panel[hidden] { display: none; }
.connection-map-canvas { min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at center, color-mix(in srgb,var(--surface) 85%,var(--gold)) 0%,var(--surface) 72%); touch-action: none; }
.connection-map-canvas canvas { display: block; }
.connection-map-panel { min-width: 0; overflow: auto; border-left: 1px solid var(--line); }
.connection-map-selected { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 10px; align-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.connection-map-selected > img,.connection-map-placeholder { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 12px; object-fit: cover; background: color-mix(in srgb,var(--node-color) 14%,var(--surface)); color: var(--node-color); font-size: 30px; font-weight: 800; }
.connection-map-selected-copy { min-width: 0; }
.connection-map-kind { display: inline-flex; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb,var(--node-color) 16%,var(--surface)); color: var(--node-color); font-size: 10px; font-weight: 800; }
.connection-map-selected h2 { margin: 4px 0 0; font-family: var(--serif); font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.connection-map-selected p { margin: 3px 0 7px; color: var(--muted); font-size: 12px; }
.connection-map-open { min-height: 30px; padding: 3px 9px; border: 1px solid var(--gold); border-radius: 8px; background: var(--surface); color: var(--jade); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.connection-map-neighbors { display: grid; }
.connection-map-neighbor { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; gap: 7px; align-items: center; min-height: 38px; padding: 5px 10px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.connection-map-neighbor:hover { background: var(--soft); }
.connection-map-neighbor span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-map-neighbor small { color: var(--muted); font-size: 10px; white-space: nowrap; }
@media (max-width: 760px) {
  .connection-map-page { grid-template-rows: auto minmax(400px, 50vh); gap: 7px; padding: 7px 0 18px; }
  .connection-map-toolbar { gap: 7px; }
  .connection-map-toolbar .region-switch { order: 0; }
  .connection-map-kinds { order: 2; flex-basis: 100%; }
  .connection-map-search { order: 1; flex: 1 1 130px; }
  .connection-map-layout,.connection-map-layout.has-selection { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) 0; }
  .connection-map-layout.has-selection { grid-template-rows: minmax(0,1fr) 168px; }
  .connection-map-panel { border-left: 0; border-top: 1px solid var(--line); }
  .connection-map-selected { grid-template-columns: 54px minmax(0,1fr); gap: 8px; padding: 7px 10px; }
  .connection-map-selected > img,.connection-map-placeholder { width: 54px; height: 54px; border-radius: 9px; font-size: 24px; }
  .connection-map-selected h2 { font-size: 15px; }
  .connection-map-selected p { display: inline-block; margin: 2px 7px 0 0; }
  .connection-map-neighbor { min-height: 34px; }
}

.region-switch-wrap { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.lineage-entry, .lineage-back { min-height: 32px; padding: 0 12px; border: 1px solid var(--gold, #bd9a55); border-radius: 999px; background: var(--surface, #fffaf0); color: var(--ink, #382e24); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.lineage-page { max-width: 1320px; margin: 0 auto; padding: 14px 4px 42px; }
.lineage-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.lineage-head h2 { margin: 0; font-family: var(--serif, "Yu Mincho", serif); font-size: 25px; }
.lineage-overview { display: grid; gap: 16px; }
.lineage-band { overflow: hidden; border: 1px solid var(--gold, #bd9a55); border-radius: 16px; background: var(--surface, #fffaf0); box-shadow: 0 4px 0 rgba(107,67,41,.12); }
.lineage-band-open { width: 100%; min-height: 66px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border: 0; background: linear-gradient(90deg, rgba(55,111,91,.13), transparent); color: var(--ink, #382e24); font: inherit; cursor: pointer; text-align: left; }
.lineage-band-islam .lineage-band-open { background: linear-gradient(90deg, rgba(184,119,55,.15), transparent); }
.lineage-band-open b { font-family: var(--serif, "Yu Mincho", serif); font-size: 22px; }
.lineage-band-open span { font-size: 26px; }
.lineage-milestones { position: relative; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; padding: 20px 18px 22px; }
.lineage-milestones::before { content: ""; position: absolute; top: 28px; left: 4%; right: 4%; height: 5px; border-radius: 5px; background: var(--jade, #39765e); opacity: .68; }
.lineage-band-islam .lineage-milestones::before { background: #b87737; }
.lineage-milestones span { position: relative; display: grid; align-content: start; gap: 5px; min-width: 0; }
.lineage-milestones span::before { content: ""; width: 12px; height: 12px; margin: 2px 0 3px; border: 2px solid var(--surface,#fffaf0); border-radius: 50%; background: var(--jade,#39765e); box-shadow: 0 0 0 1px var(--jade,#39765e); }
.lineage-band-islam .lineage-milestones span::before { background: #b87737; box-shadow: 0 0 0 1px #b87737; }
.lineage-milestones small { color: var(--muted,#71685e); font-size: 11px; }
.lineage-milestones b { font-size: 12px; line-height: 1.3; }
.lineage-chart { display: block; width: 100%; height: auto; overflow: visible; }
.lineage-chart-desktop { max-height: 76vh; }
.lineage-axis { stroke: var(--gold,#bd9a55); stroke-width: 1.5; }
.lineage-year { fill: var(--muted,#71685e); font: 11px sans-serif; }
.lineage-marker { stroke: #ab8051; stroke-dasharray: 3 5; stroke-width: 1; opacity: .48; }
.lineage-marker-label { fill: #80694e; font: 9px sans-serif; }
.lineage-link { fill: none; stroke: #967d61; stroke-width: 1.6; opacity: .65; }
.lineage-link-split { stroke-dasharray: 5 4; }
.lineage-link-merge { stroke-dasharray: 2 3; }
.lineage-node { cursor: pointer; }
.lineage-node rect { fill: #e0eddf; stroke: #5d836b; stroke-width: 1; }
.lineage-node:nth-of-type(2n) rect { fill: #f5e7d2; stroke: #bd8953; }
.lineage-node text { fill: var(--ink,#382e24); font: 12px sans-serif; }
.lineage-node:focus rect { stroke: #a33f32; stroke-width: 2.5; }
.lineage-mobile-list { display: none; }
.lineage-hierarchy { display: grid; gap: 2px; min-width: 0; }
.lineage-stage { min-width: 0; border-bottom: 1px solid rgba(130,105,71,.2); }
.lineage-stage-head { display: flex; align-items: center; min-width: 0; }
.lineage-stage-head .lineage-mobile-item { flex: 1; min-width: 0; border-bottom: 0; }
.lineage-stage-toggle b i { color: var(--jade,#39765e); font-style: normal; }
.lineage-stage-detail { flex: none; margin: 0 8px; padding: 6px 9px; border: 1px solid rgba(130,105,71,.28); border-radius: 999px; background: transparent; color: var(--jade,#39765e); font: inherit; font-size: 12px; cursor: pointer; }
.lineage-stage-children { margin: 0 0 6px 26px; padding-left: 9px; border-left: 2px solid rgba(78,126,96,.28); }
.lineage-stage-children .lineage-mobile-item { padding-top: 7px; padding-bottom: 7px; }
.lineage-stage.is-open { background: linear-gradient(90deg, rgba(55,111,91,.06), transparent 70%); }
.lineage-mobile-item { width: 100%; display: flex; align-items: baseline; gap: 12px; padding: 10px 8px; border: 0; border-bottom: 1px solid rgba(130,105,71,.2); background: transparent; color: var(--ink,#382e24); font: inherit; text-align: left; cursor: pointer; }
.lineage-mobile-item span { min-width: 94px; color: var(--muted,#71685e); font-size: 12px; flex: none; white-space: nowrap; }
.lineage-mobile-item b { font-size: 14px; }
.lineage-band-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 14px; }
.lineage-band-actions button, .lineage-read-link { min-height: 34px; padding: 5px 12px; border: 1px solid rgba(130,105,71,.34); border-radius: 999px; background: var(--surface,#fffaf0); color: var(--jade,#39765e); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.lineage-head .lineage-read-link { margin-left: auto; }
.lineage-about { max-width: 920px; }
.lineage-intro { margin: 0 0 30px; padding: 20px 22px; border-left: 4px solid var(--jade,#39765e); border-radius: 0 14px 14px 0; background: linear-gradient(100deg,rgba(55,111,91,.09),transparent); font-size: 16px; line-height: 1.9; }
.lineage-reading-section { margin: 28px 0 34px; }
.lineage-reading-section > h3 { margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(130,105,71,.3); color: var(--jade,#39765e); font-family: var(--serif,"Yu Mincho",serif); font-size: 20px; }
.lineage-periods { display: grid; gap: 0; }
.lineage-period { display: grid; grid-template-columns: 145px minmax(0,1fr); gap: 18px; padding: 18px 0; border-bottom: 1px solid rgba(130,105,71,.2); }
.lineage-period-date { padding-top: 3px; color: var(--muted,#71685e); font-size: 13px; font-variant-numeric: tabular-nums; }
.lineage-period h3 { margin: 0 0 6px; font-size: 17px; }
.lineage-period p, .lineage-key-person p { margin: 0; font-size: 14px; line-height: 1.75; }
.lineage-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lineage-ref, .lineage-milestone button, .lineage-key-person button, .lineage-clash button { border: 0; background: transparent; color: var(--jade,#39765e); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.lineage-ref { padding: 4px 8px; border: 1px solid rgba(130,105,71,.26); border-radius: 999px; font-size: 12px; }
.lineage-milestones { display: grid; gap: 0; }
.lineage-about .lineage-milestones { position: static; grid-template-columns: 1fr; padding: 0; }
.lineage-about .lineage-milestones::before { display: none; }
.lineage-milestone { display: grid; grid-template-columns: 105px minmax(0,1fr); gap: 12px; padding: 12px 4px; border-bottom: 1px solid rgba(130,105,71,.2); }
.lineage-milestone time, .lineage-clash time { color: var(--muted,#71685e); font-size: 13px; }
.lineage-milestone > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lineage-milestone b { font-size: 14px; }
.lineage-dynasties { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.lineage-dynasty { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; min-width: 0; padding: 12px 14px; border: 1px solid rgba(130,105,71,.28); border-radius: 12px; background: var(--surface,#fffaf0); color: var(--ink,#382e24); text-align: left; cursor: pointer; }
.lineage-dynasty span { grid-column: 1; color: var(--muted,#71685e); font-size: 11px; }
.lineage-dynasty b { grid-column: 1; font-size: 14px; }
.lineage-dynasty i { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--jade,#39765e); font-size: 20px; font-style: normal; }
.lineage-key-people { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.lineage-key-person { padding: 14px; border: 1px solid rgba(130,105,71,.26); border-radius: 12px; background: linear-gradient(145deg,var(--surface,#fffaf0),rgba(55,111,91,.05)); }
.lineage-key-person button, .lineage-key-person b { display: inline-block; margin-bottom: 6px; font-size: 15px; }
.lineage-key-person span { display: block; margin-bottom: 6px; color: var(--muted,#71685e); font-size: 11px; }
.lineage-clashes { display: grid; gap: 4px; }
.lineage-clash, .lineage-relation { display: grid; grid-template-columns: 105px minmax(0,1fr); gap: 12px; padding: 10px 4px; border-bottom: 1px solid rgba(130,105,71,.2); }
.lineage-clash > div, .lineage-relation > div { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 13px; }
.lineage-sources ul { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding-left: 18px; font-size: 13px; }
.lineage-sources a { color: var(--jade,#39765e); }
.contact-timeline-section { min-width: 0; }
.contact-timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.contact-timeline-head h3 { margin: 0 0 12px; }
.contact-legend { display: flex; gap: 12px; padding-bottom: 10px; color: var(--muted,#71685e); font-size: 12px; white-space: nowrap; }
.contact-legend span::before { content: ""; display: inline-block; width: 16px; margin: 0 5px 3px 0; border-top: 2px solid #b34c3c; vertical-align: middle; }
.contact-legend .contact-legend-exchange::before { border-color: #39765e; border-top-style: dashed; }
.contact-timeline-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid rgba(130,105,71,.22); border-radius: 12px; background: rgba(255,250,240,.58); }
.contact-timeline-svg { display: block; width: 100%; min-width: 990px; height: auto; }
.contact-tick { stroke: rgba(130,105,71,.16); stroke-width: 1; }
.contact-year { fill: var(--muted,#71685e); font: 12px sans-serif; }
.contact-lane-label { fill: var(--ink,#382e24); font: bold 12px sans-serif; }
.contact-polity rect { opacity: .75; }
.contact-polity-europe rect { fill: #dcebdc; stroke: #6c9279; }
.contact-polity-islam rect { fill: #f2e3cd; stroke: #b88752; }
.contact-polity-first rect { fill: #dcebdc; stroke: #6c9279; }
.contact-polity-second rect { fill: #f2e3cd; stroke: #b88752; }
.contact-polity text { fill: var(--ink,#382e24); font: 10px sans-serif; pointer-events: none; }
.contact-span { opacity: .14; pointer-events: none; }
.contact-span-clash { fill: #b34c3c; }
.contact-span-exchange { fill: #39765e; }
.contact-line { stroke-width: 2; cursor: pointer; }
.contact-line-clash { stroke: #b34c3c; }
.contact-line-exchange { stroke: #39765e; stroke-dasharray: 4 4; }
.contact-mark { cursor: pointer; }
.contact-mark circle { fill: #b34c3c; stroke: #fffaf0; stroke-width: 2; }
.contact-mark-exchange circle { fill: #39765e; }
.contact-mark:focus circle { stroke: #382e24; stroke-width: 3; }
.contact-page-link { display: flex; justify-content: flex-end; margin-top: 9px; }
.contact-pair-links { display: flex; flex-wrap: nowrap; gap: 6px; margin: 0 0 12px; overflow-x: auto; scrollbar-width: none; }
.contact-pair-links::-webkit-scrollbar { display: none; }
.contact-pair-chip { flex: none; white-space: nowrap; padding: 5px 10px; border: 1px solid rgba(130,105,71,.28); border-radius: 999px; background: rgba(255,250,240,.7); color: var(--ink,#382e24); font: inherit; font-size: 12px; line-height: 1.35; cursor: pointer; }
.contact-pair-chip[aria-current="page"] { border-color: var(--jade,#39765e); background: rgba(57,118,94,.12); color: var(--jade,#39765e); }
.contact-mobile-list { display: none; }
.lineage-contact-list { display: grid; }
.lineage-contact { display: grid; grid-template-columns: 112px minmax(0,1fr); gap: 14px; padding: 15px 4px; border-bottom: 1px solid rgba(130,105,71,.2); scroll-margin-top: 20px; }
.lineage-contact > time { padding-top: 3px; color: var(--muted,#71685e); font-size: 13px; font-variant-numeric: tabular-nums; }
.lineage-contact h4 { margin: 0 0 5px; font-size: 16px; }
.lineage-contact h4 button { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 800; text-align: left; cursor: pointer; }
.lineage-contact[data-contact-event] { cursor: pointer; }
.lineage-contact-pair { display: block; margin: 0 0 3px; color: var(--jade,#39765e); font-size: 11px; font-weight: 700; }
.lineage-contact p { margin: 0 0 8px; font-size: 14px; line-height: 1.7; }
.lineage-contact-sides, .lineage-contact-links, .lineage-contact-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.lineage-contact-sides { margin: 4px 0; }
.lineage-contact-sides > span { color: var(--muted,#71685e); }
.lineage-contact-links button { padding: 2px 5px; border: 0; background: transparent; color: var(--jade,#39765e); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.lineage-contact-sources { margin-top: 6px; gap: 8px; }
.lineage-contact-sources a { color: var(--jade,#39765e); font-size: 12px; }
.lineage-contacts-page .lineage-head h2 { font-size: 23px; }
.lineage-event-contacts { display: grid; gap: 10px; }
.lineage-event-contact { padding: 10px 12px; border: 1px solid rgba(130,105,71,.22); border-radius: 12px; background: rgba(255,250,240,.55); }
.lineage-event-contact-head, .lineage-event-neighbors { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lineage-event-contact-head { justify-content: space-between; color: var(--jade,#39765e); }
.lineage-event-contact > p { margin: 6px 0 0; font-size: 13px; line-height: 1.6; }
.lineage-event-contact .lineage-contact-sides { margin: 5px 0 0; }
.lineage-event-contact .lineage-contact-links { margin-top: 3px; }
.lineage-event-neighbors { margin-top: 6px; }
.lineage-event-neighbor { padding: 3px 6px; border: 0; border-radius: 6px; background: rgba(57,118,94,.08); color: var(--jade,#39765e); font: inherit; font-size: 12px; cursor: pointer; }
@media (max-width: 600px) {
  .lineage-event-contact { padding: 9px; }
  .lineage-event-contact-head { gap: 4px; }
  .lineage-event-contact-head > b { font-size: 13px; }
  .lineage-event-contact .lineage-ref { padding: 3px 6px; font-size: 11px; }
  .lineage-event-contact > p { font-size: 12px; }
}
@media (max-width: 600px) {
  .contact-timeline-head { align-items: flex-start; }
  .contact-timeline-head h3 { font-size: 18px; }
  .contact-legend { gap: 7px; font-size: 11px; }
  .contact-timeline-scroll { display: none; }
  .contact-mobile-list { display: grid; border-top: 1px solid rgba(130,105,71,.2); }
  .contact-mobile-row { display: grid; grid-template-columns: 70px minmax(0,1fr); align-items: baseline; gap: 8px; width: 100%; min-width: 0; padding: 9px 4px; border: 0; border-bottom: 1px solid rgba(130,105,71,.2); background: transparent; color: var(--ink,#382e24); font: inherit; text-align: left; cursor: pointer; }
  .contact-mobile-row time { color: var(--muted,#71685e); font-size: 12px; }
  .contact-mobile-row b { font-size: 13px; }
  .contact-mobile-clash b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #b34c3c; }
  .contact-mobile-exchange b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #39765e; }
  .lineage-contact { grid-template-columns: 68px minmax(0,1fr); gap: 8px; }
  .lineage-contact > time { font-size: 12px; }
  .lineage-contact h4 { font-size: 15px; }
  .lineage-contact p { font-size: 13px; }
  .lineage-contacts-page .lineage-head { flex-wrap: wrap; }
  .lineage-contacts-page .lineage-head h2 { font-size: 19px; }
}
.polity-people { display: grid; gap: 14px; }
.polity-people-group h4 { margin: 0 0 5px; color: var(--jade,#39765e); font-size: 14px; }
.polity-people-list { display: grid; }
.polity-person-row { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(130,105,71,.18); }
.polity-person-row > span { color: var(--muted,#71685e); font-size: 12px; }
.polity-person-row button { padding: 0; border: 0; background: transparent; color: var(--jade,#39765e); font: inherit; font-weight: 800; text-align: left; cursor: pointer; }
.polity-person-row p { margin: 3px 0 0; font-size: 13px; line-height: 1.55; }
.polity-detail .evhead { padding: 24px 24px 10px; }
.polity-detail .evhead h2 { margin: 4px 0; font-size: 26px; }
.polity-detail .info { padding: 12px 24px 28px; }
.polity-detail .flow-neighbors { display: grid; gap: 6px; }
.polity-detail .era-source { margin-top: 22px; color: var(--muted,#71685e); font-size: 13px; }
.org-detail .flow-neighbors { margin: 4px 0 18px; }
.org-detail .related-collection { margin-bottom: 20px; }
.org-link { border: 0; cursor: pointer; font: inherit; }
@media (max-width: 600px) {
  .lineage-page { padding: 8px 2px 32px; }
  .lineage-head { margin-bottom: 12px; }
  .lineage-head h2 { font-size: 22px; }
  .lineage-band-open { min-height: 56px; padding: 0 14px; }
  .lineage-band-open b { font-size: 19px; }
  .lineage-band-actions { padding: 0 12px 12px; }
  .lineage-band-actions button { flex: 1; padding: 5px 7px; font-size: 11px; }
  .lineage-head { flex-wrap: wrap; }
  .lineage-head .lineage-read-link { margin-left: 0; }
  .lineage-about .lineage-head .lineage-read-link { margin-left: auto; }
  .lineage-intro { margin-bottom: 24px; padding: 15px; font-size: 14px; }
  .lineage-period { grid-template-columns: 1fr; gap: 4px; padding: 14px 0; }
  .lineage-period-date { font-size: 11px; }
  .lineage-period h3 { font-size: 15px; }
  .lineage-dynasties { grid-template-columns: 1fr; }
  .lineage-key-people { grid-template-columns: 1fr; }
  .lineage-milestone, .lineage-clash, .lineage-relation { grid-template-columns: 82px minmax(0,1fr); gap: 7px; }
  .lineage-milestone time, .lineage-clash time, .lineage-relation time { font-size: 11px; }
  .lineage-sources ul { display: grid; gap: 8px; padding-left: 16px; }
  .polity-person-row { grid-template-columns: 78px minmax(0,1fr); gap: 6px; }
  .polity-person-row > span, .polity-person-row p { font-size: 11px; }
  .lineage-milestones { grid-template-columns: 1fr; gap: 0; padding: 4px 14px 14px 22px; }
  .lineage-milestones::before { top: 10px; bottom: 20px; left: 19px; right: auto; width: 4px; height: auto; }
  .lineage-milestones span { min-height: 57px; grid-template-columns: 14px 70px 1fr; align-items: center; gap: 7px; }
  .lineage-milestones span::before { grid-column: 1; grid-row: 1; margin: 0; }
  .lineage-milestones small { grid-column: 2; grid-row: 1; }
  .lineage-milestones b { grid-column: 3; grid-row: 1; }
  .lineage-chart-desktop { display: none; }
  .lineage-mobile-list { position: relative; display: block; min-height: 240px; margin-left: 5px; border-left: 2px solid rgba(78,126,96,.38); }
  .lineage-mobile-item { position: relative; width: calc(100% - (var(--branch, 0) * 7px)); margin-left: calc(var(--branch, 0) * 7px); gap: 6px; padding: 9px 3px 9px 9px; }
  .lineage-hierarchy { margin-left: 5px; border-left: 2px solid rgba(78,126,96,.38); }
  .lineage-stage-children { margin-left: 14px; }
  .lineage-stage-detail { margin-right: 2px; padding: 5px 7px; font-size: 11px; }
  .lineage-mobile-item::before { content: ""; position: absolute; top: 15px; left: -5px; width: 7px; height: 7px; border-radius: 50%; background: var(--jade,#39765e); box-shadow: 0 0 0 2px var(--paper,#fbf3e3); }
  .lineage-mobile-item span { min-width: 85px; font-size: 11px; }
  .lineage-mobile-item b { font-size: 12px; }
  .polity-detail .evhead { padding: 20px 18px 8px; }
  .polity-detail .info { padding: 8px 18px 24px; }
}
.mekuru-fab { z-index: 52; transition: border-radius .36s cubic-bezier(.2,.9,.25,1.35), transform .36s cubic-bezier(.2,.9,.25,1.35), background-color .2s; }
.mekuru-fab-label, .mekuru-fab-x { transition: opacity .18s, transform .3s cubic-bezier(.2,.9,.25,1.2); }
.mekuru-fab-x { position: absolute; inset: 0; display: grid; place-items: center; }
.mekuru-fab svg { transition: opacity .18s, transform .3s cubic-bezier(.2,.9,.25,1.2); }
.mekuru-fab-x { opacity: 0; transform: rotate(-90deg) scale(.5); font-size: 34px; line-height: 1; }
body.mekuru-menu-open .mekuru-fab { border-radius: 21px; transform: rotate(0) scale(1.04); }
body.mekuru-menu-open .mekuru-fab-label { opacity: 0; transform: rotate(40deg) scale(.5); }
body.mekuru-menu-open .mekuru-fab svg { opacity: 0; transform: rotate(90deg) scale(.5); }
body.mekuru-menu-open .mekuru-fab-x { opacity: 1; transform: rotate(0) scale(1); }
.mekuru-scrim { position: fixed; z-index: 50; inset: 0; background: rgba(25,20,14,.38); opacity: 1; transition: opacity .2s; }
.mekuru-scrim[hidden] { display: none; }
.mekuru-menu { position: fixed; z-index: 51; right: max(16px, env(safe-area-inset-right)); bottom: max(88px, calc(env(safe-area-inset-bottom) + 80px)); display: grid; justify-items: end; gap: 9px; }
.mekuru-menu[hidden] { display: none; }
.mekuru-menu button { display: inline-flex; min-height: 48px; align-items: center; justify-content: flex-end; gap: 11px; padding: 9px 17px 9px 14px; border: 1px solid #d7bf88; border-radius: 999px; background: var(--paper, #f6f3ec); color: var(--ink); font: inherit; font-weight: 800; box-shadow: 0 3px 0 #6b4329, 0 7px 15px #1a100c30; cursor: pointer; transform-origin: 100% 100%; animation: mekuru-action-in .34s cubic-bezier(.2,.9,.25,1.25) both; }
.mekuru-menu button:nth-child(1) { --delay: 100ms; }
.mekuru-menu button:nth-child(2) { --delay: 50ms; }
.mekuru-menu button:nth-child(3) { --delay: 0ms; }
.mekuru-menu button { animation-delay: var(--delay); }
.mekuru-menu button > span { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; background: #e8d9b8; color: #315f49; font-size: 18px; }
.mekuru-menu button:focus-visible, .mekuru-customize button:focus-visible, .mekuru-customize input:focus-visible + span { outline: 3px solid #b7862c; outline-offset: 2px; }
@keyframes mekuru-action-in { from { opacity: 0; transform: translateY(18px) scale(.72); } to { opacity: 1; transform: translateY(0) scale(1); } }
.mekuru-customize { width: min(620px, calc(100vw - 40px)); max-width: none; max-height: min(84dvh, 780px); padding: 0; overflow: hidden; border: 1px solid #d7bf88; border-radius: 24px; background: var(--paper, #f6f3ec); color: var(--ink); box-shadow: 0 18px 60px #160e0c55; }
.mekuru-customize::backdrop { background: rgba(25,20,14,.48); backdrop-filter: blur(2px); }
.mekuru-custom-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px; border-bottom: 1px solid #dfcfad; }
.mekuru-custom-head h2 { margin: 0; font-family: var(--serif); font-size: 23px; }
.mekuru-custom-head button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #eadcbd; color: var(--ink); font-size: 27px; cursor: pointer; }
.mekuru-customize[open] { display: flex; flex-direction: column; }
.mekuru-custom-head, .mekuru-custom-foot { flex: 0 0 auto; }
.mekuru-custom-body { flex: 1 1 auto; min-height: 0; padding: 8px 22px 14px; overflow-y: auto; overscroll-behavior: contain; }
.mekuru-custom-body fieldset { margin: 8px 0; padding: 8px 0 10px; border: 0; border-bottom: 1px solid #e4d8c1; }
.mekuru-custom-body legend { padding: 0 0 6px; font-weight: 850; }
.mekuru-choice-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.mekuru-choice { position: relative; display: inline-flex; min-height: 40px; align-items: center; padding: 5px 13px; border: 1px solid #c9c2b5; border-radius: 999px; background: #f4f0e8; color: #39362f; font-size: 14px; font-weight: 700; cursor: pointer; transition: color .16s, background-color .16s, border-color .16s; }
.mekuru-choice:has(input:checked) { border-color: #55745f; background: #dce8dd; color: #183c2b; }
.mekuru-choice input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.mekuru-choice span { display: inline-flex; align-items: center; gap: 6px; }
.mekuru-choice input:checked + span::before { content: "✓"; display: inline-grid; width: 16px; height: 16px; place-items: center; font-size: 13px; font-weight: 900; }
.mekuru-segmented { display: inline-flex; padding: 3px; border: 1px solid #a9b9aa; border-radius: 14px; background: #eeeae1; }
.mekuru-segment { position: relative; display: inline-flex; min-width: 78px; min-height: 40px; align-items: center; justify-content: center; padding: 7px 14px; border-radius: 11px; color: #443f36; font-size: 14px; font-weight: 750; cursor: pointer; }
.mekuru-segment input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
.mekuru-segment:has(input:checked) { background: #dce8dd; color: #183c2b; box-shadow: 0 1px 3px #312b2020; }
.mekuru-eras { margin: 8px 0; padding: 8px 0 10px; border-bottom: 1px solid #e4d8c1; }
.mekuru-eras summary { position: relative; padding: 2px 24px 6px 0; font-weight: 850; cursor: pointer; list-style: none; }
.mekuru-eras summary::-webkit-details-marker { display: none; }
.mekuru-eras summary::after { content: "⌄"; position: absolute; right: 4px; color: #625b4e; }
.mekuru-eras[open] summary::after { content: "⌃"; }
.mekuru-era-group + .mekuru-era-group { margin-top: 10px; }
.mekuru-era-group h4 { margin: 4px 0 7px; color: #605944; font-size: 13px; }
.mekuru-custom-body .mekuru-era-group .mekuru-choice-grid { gap: 6px; }
.mekuru-polity-toggle { margin-top: 8px; padding: 7px 11px; border: 1px solid #c7b58f; border-radius: 10px; background: #eee4cf; color: var(--ink); font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.mekuru-polities { max-height: 180px; margin-top: 8px; overflow: auto; }
.mekuru-custom-foot { padding: 12px 20px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid #dfcfad; background: var(--paper, #f6f3ec); }
.mekuru-custom-foot button { width: 100%; min-height: 52px; border: 0; border-radius: 999px; background: var(--jade); color: #fff8e8; font: inherit; font-weight: 850; box-shadow: 0 3px 0 #16432f; cursor: pointer; }
.mekuru-custom-foot button:disabled { background: #9b988b; box-shadow: none; cursor: not-allowed; }
@media (max-width: 699px) {
  .mekuru-customize { position: fixed; inset: auto 0 0; width: 100%; max-width: none; max-height: min(88dvh, 820px); margin: 0; border-radius: 24px 24px 0 0; border-bottom: 0; }
  .mekuru-custom-body { padding-inline: 18px; }
  .mekuru-custom-head { padding-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .mekuru-fab, .mekuru-fab-label, .mekuru-fab-x, .mekuru-scrim, .mekuru-menu button, .mekuru-choice { transition: none !important; animation: none !important; }
  .mekuru-menu button { opacity: 1; transform: none; }
}
/* 座右の偉人: 図鑑トップの常設カード列 */
.zayu-shelf{margin:0 0 28px;padding:18px 20px 20px;border:1px solid #cfb67f;border-radius:18px;background:linear-gradient(115deg,#fff9e9,#f6ecd6);box-shadow:0 8px 24px #45300f12}.zayu-shelf-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.zayu-shelf-head h2{margin:0;font-family:var(--font-heading,inherit);font-size:20px;color:#533b1d}.zayu-shelf-head a{color:#76551c;font-weight:700;text-underline-offset:3px}.zayu-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px}.zayu-card{min-width:0;display:grid;grid-template-columns:48px minmax(0,1fr) auto;align-items:center;gap:8px 12px;padding:9px 10px;border:1px solid #e2d2b4;border-radius:13px;background:#fffdf8}.zayu-card>img,.zayu-initial{grid-row:span 2;width:48px;height:56px;object-fit:contain;object-position:center bottom}.zayu-initial{display:grid;place-items:center;color:#795023;font-size:24px;font-weight:700}.zayu-card h3{grid-column:2/4;align-self:end;margin:0;font-size:15px}.zayu-chat,.zayu-remove{padding:5px 9px;border-radius:8px;font:inherit;font-size:13px;cursor:pointer}.zayu-chat{grid-column:2;border:1px solid #8c6e34;background:#8c6e34;color:#fff}.zayu-remove{grid-column:3;border:1px solid #d8c9ae;background:transparent;color:#665c4d}.zayu-chat:hover,.zayu-remove:hover{filter:brightness(.96)}
html[data-skin="simple"] .zayu-shelf{border-color:#cbd2db;background:#edf1f5;box-shadow:none}html[data-skin="simple"] .zayu-shelf-head h2{color:#26384b}html[data-skin="simple"] .zayu-shelf-head a{color:#334e69}html[data-skin="simple"] .zayu-card{border-color:#d7dde5;background:#fff}html[data-skin="simple"] .zayu-chat{border-color:#334e69;background:#334e69}
@media(max-width:640px){.zayu-shelf{margin-bottom:20px;padding:14px}.zayu-shelf-head h2{font-size:18px}.zayu-cards{grid-template-columns:1fr 1fr;gap:8px}.zayu-card{grid-template-columns:38px minmax(0,1fr);gap:7px;padding:8px}.zayu-card>img,.zayu-initial{grid-row:span 1;width:38px;height:44px}.zayu-card h3{grid-column:2;align-self:center;font-size:14px}.zayu-chat{grid-column:2}.zayu-remove{grid-column:2;justify-self:start}}

/* English-only historical travel links */
.travel-section { margin-top: 1.5rem; }
.travel-section .travel-disclosure { margin: .75rem 0 0; color: var(--muted, #715b4a); font-size: .78rem; line-height: 1.5; }
/* Organization hierarchy pilot */
.org-breadcrumb{display:flex;align-items:center;gap:8px;padding:0 0 12px;color:var(--muted,#69746b);font-size:14px}.org-breadcrumb button{border:0;background:none;color:var(--jade,#315d43);font:inherit;padding:0;cursor:pointer}.org-structure-section{margin:24px 0}.org-structure-section h3{margin:0 0 12px}.org-children{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px}.org-child-card{display:flex;flex-direction:column;gap:6px;min-height:86px;padding:12px;border:1px solid #d8d0bd;border-radius:10px;background:#fffdf7;color:inherit;text-align:left;cursor:pointer}.org-child-card:hover{filter:brightness(.97)}.org-child-card>span:last-child{font-size:13px;line-height:1.5}.org-child-years{font-size:11px;color:#69746b}.org-term-card{border-style:dashed}
@media(max-width:640px){.org-breadcrumb{font-size:13px}.org-children{grid-template-columns:1fr}.org-child-card{min-height:auto}}
.org-detail .org-breadcrumb{grid-column:1/-1;padding:16px 60px 0 22px}
.org-breadcrumb[hidden]{display:none}.org-detail .org-breadcrumb.below-back{padding-top:58px}

.org-timeline-phase .org-timeline-node { width: 22px; height: 22px; border-radius: 6px; background: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.org-phase-card { display: grid; grid-template-columns: minmax(0, 1fr) 12px; align-items: center; gap: 8px; min-width: 0; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--gold) 55%, var(--line)); border-left: 5px solid var(--gold); border-radius: 13px; background: color-mix(in srgb, var(--gold) 12%, var(--surface)); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.org-phase-card:hover { border-color: var(--gold); }
.org-phase-card b { font-family: var(--serif); font-size: 17px; line-height: 1.45; }
.org-phase-card small { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.org-phase-card em { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; font-style: normal; line-height: 1.7; }
@media (max-width: 640px) { .org-phase-card { padding: 10px 9px; } .org-phase-card b { font-size: 15px; } .org-phase-card em { font-size: 12px; line-height: 1.6; } }
.org-detail .org-breadcrumb{padding-bottom:12px}

/* 思想の系譜 */
.thought-page { max-width: 1320px; margin: 0 auto; padding: 14px 4px 120px; }
.thought-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; margin: 4px 0 14px; }
.thought-head h2 { margin: 0; font-family: var(--serif); font-size: 25px; }
.thought-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.thought-legend li { display: inline-flex; align-items: center; gap: 5px; }
.thought-stories { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.thought-chart-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); }
.thought-chart { display: block; width: 100%; min-width: 980px; height: auto; }
.th-tick line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; }
.th-tick text { fill: var(--muted); font-size: 11px; font-weight: 700; }
.th-edge { fill: none; opacity: .6; transition: opacity .15s; }
.th-edge.is-on { opacity: 1; }
.th-edge[stroke-dasharray="1.5 4"]:not(.is-on) { opacity: .3; }
.th-edge.is-dim { opacity: .07; }
.th-node { cursor: pointer; outline: none; transition: opacity .15s; }
.th-node.is-dim { opacity: .22; }
.th-hit { fill: transparent; }
.th-dot { fill: var(--soft); }
.th-ring { fill: none; stroke: var(--ink); stroke-width: 2; }
.th-initial { fill: var(--ink); font-size: 11px; font-weight: 800; }
.th-school { fill: var(--gold-soft); stroke: var(--ink); stroke-width: 1.8; }
.th-ext { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.th-name { fill: var(--ink); font-size: 12px; font-weight: 800; paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round; }
.th-years { fill: var(--muted); font-size: 9.5px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.th-node.kind-external .th-name { fill: var(--muted); font-weight: 600; }
.th-node.kind-culture .th-name { fill: var(--jade); }
.th-node.is-sel .th-ring, .th-node.is-sel .th-school { stroke: var(--shu); stroke-width: 3; }
.th-node:focus-visible .th-ring, .th-node:focus-visible .th-school, .th-node:focus-visible .th-ext { stroke: var(--shu); stroke-width: 3; }
.thought-list { display: none; }
.thought-panel { position: fixed; z-index: 30; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(760px, calc(100vw - 24px)); max-height: 40vh; display: flex; flex-direction: column; border: 3px solid var(--ink); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 0 var(--ink), 0 10px 28px #0003; }
.thought-panel-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 10px 44px 8px 16px; border-bottom: 1px solid var(--line); position: relative; }
.thought-panel-head b { font-family: var(--serif); font-size: 18px; }
.thought-panel-head small { color: var(--muted); font-size: 12px; font-weight: 700; }
.thought-close { position: absolute; top: 6px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.thought-close:hover { background: var(--soft); }
.thought-panel-body, .thought-steps { overflow-y: auto; padding: 10px 16px 14px; margin: 0; }
.thought-panel-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 20px; align-content: start; }
.thought-group { margin: 0 0 10px; }
.thought-group h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 13px; color: var(--tc); }
.thought-group h4::before { content: ""; width: 18px; border-top: 3px solid var(--tc); }
.thought-rel { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 8px; width: 100%; padding: 6px 8px; border: 0; border-left: 3px solid var(--tc, var(--line)); border-radius: 0 8px 8px 0; background: transparent; color: var(--ink); font: inherit; text-align: left; }
button.thought-rel { cursor: pointer; }
button.thought-rel:hover { background: var(--soft); }
.thought-rel b { font-size: 14px; }
.thought-rel small { color: var(--muted); font-size: 11px; font-weight: 700; justify-self: end; }
.thought-rel span { grid-column: 1 / -1; margin-top: 2px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.thought-rel.is-external b { color: var(--muted); }
.thought-open { margin: 6px 0 0; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.thought-open:hover { background: var(--soft); }
.thought-panel-head .thought-open { margin: 0; padding: 3px 12px; }
.thought-section h4 { margin: 12px 0 6px; color: var(--ink); font-size: 13px; }
.thought-section h4:first-of-type { margin-top: 0; }
.thought-section .related-list .related-card { grid-template-columns: 72px minmax(0, 1fr); }
.thought-section .related-list .related-art { min-height: 72px; }
.thought-section .related-list .related-art img { object-position: center 8%; }
.thought-section .related-art .ph { font-size: 26px; }
.thought-section .related-copy small { font-size: 12px; line-height: 1.6; }
.thought-section-open { margin-top: 12px; }
.thought-steps { list-style: none; counter-reset: ts; }
.thought-steps li { position: relative; padding-left: 26px; }
.thought-steps li::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; border-left: 2px solid var(--line); }
.thought-steps li:first-child::before { top: 14px; }
.thought-steps li:last-child::before { bottom: calc(100% - 15px); }
.thought-step-note { margin: 0; padding: 4px 0 4px 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.thought-step { position: relative; display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 4px 0 6px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.thought-step b { font-size: 15px; }
.thought-step small { color: var(--muted); font-size: 11px; font-weight: 700; }
.thought-step.kind-culture b { color: var(--jade); }
@media (max-width: 699px) {
  .thought-page { padding: 8px 2px 110px; }
  .thought-head h2 { font-size: 22px; }
  .thought-chart-wrap { display: none; }
  .thought-list { display: block; position: relative; margin-left: 4px; border-left: 2px solid var(--line); }
  .thought-item { position: relative; padding-left: 14px; }
  .thought-item::before { content: ""; position: absolute; left: -7px; top: 17px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
  .thought-item.kind-person::before { background: var(--soft); border-color: var(--ink); }
  .thought-item.kind-culture::before { border-radius: 3px; transform: rotate(45deg); background: var(--gold-soft); border-color: var(--ink); }
  .thought-item.is-dim { opacity: .3; }
  .thought-item-head { display: flex; align-items: baseline; gap: 10px; width: 100%; min-height: 44px; padding: 10px 0; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
  .thought-item-head small { flex: none; width: 82px; color: var(--muted); font-size: 11px; font-weight: 700; }
  .thought-item-head b { font-size: 15px; }
  .thought-item.kind-culture .thought-item-head b { color: var(--jade); }
  .thought-item.kind-external .thought-item-head b { color: var(--muted); font-weight: 600; }
  .thought-item.is-open .thought-item-head b { color: var(--shu); }
  .thought-conn { padding: 0 0 12px; }
  .thought-panel.is-node { display: none; }
  .thought-panel.is-story { bottom: 8px; max-height: 52vh; }
  .thought-panel-head b { font-size: 16px; }
  .thought-panel-body { grid-template-columns: 1fr; }
}

.thought-step::before { content: ""; position: absolute; left: -24px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold-soft); border: 2px solid var(--ink); }
.thought-step.kind-culture::before { border-radius: 3px; transform: rotate(45deg); }
.thought-step.kind-external::before { background: var(--surface); border-color: var(--muted); }

/* 系図（#/thought） */
.thought-modes { display: inline-flex; gap: 6px; }
.thought-page.is-family .thought-head { margin-bottom: 10px; }
.ov-scroll { height: calc(100vh - 150px); height: calc(100svh - 150px); min-height: 420px; overflow: hidden; overflow: clip; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; position: relative; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); }
.ov-canvas { position: relative; transform-origin: 0 0; }
.ov-time-label { position: absolute; z-index: 2; top: 10px; transform: translateX(-50%); color: var(--muted); font-size: 12px; font-weight: 750; white-space: nowrap; pointer-events: none; }
.ov-frame { position: absolute; box-sizing: border-box; border: 1.5px solid color-mix(in srgb, var(--jade) 38%, transparent); border-radius: 16px; background: color-mix(in srgb, var(--jade) 7%, var(--surface)); transition: opacity .12s; }
.ov-frame-name { position: absolute; z-index: 3; left: 8px; top: 4px; width: max-content; max-width: none; padding: 3px 6px; border: 0; border-radius: 7px; background: var(--surface); color: var(--jade); font: inherit; font-size: 13px; font-weight: 800; line-height: 1.3; white-space: nowrap; overflow: visible; text-overflow: clip; cursor: pointer; }
.ov-frame-name:hover { background: color-mix(in srgb, var(--jade) 12%, transparent); }
.ov-canvas.has-emph .ov-frame:not(.is-on) { opacity: .2; }
.ov-card.kind-person .related-art { position: relative; display: block; overflow: hidden; }
.ov-card.kind-person .related-art img { position: absolute; top: 0; left: 50%; width: 150%; max-width: none; height: auto; transform: translateX(-50%); object-fit: initial; object-position: initial; }
.ov-scroll.is-drag { cursor: grabbing; }
.ov-canvas.is-far .ov-x { visibility: hidden; }
.ov-canvas.is-far .ov-card { border-width: 3px; }
.ov-lines { position: absolute; left: 0; top: 0; pointer-events: none; }
.ov-lines path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ov-lines .ov-on-demand { opacity: 0; }
.ov-lines .ov-on-demand.is-on { opacity: .9; }
.ov-edge { opacity: .38; transition: opacity .12s; }
.ov-edge.ov-weight-1 { opacity: .12; }
.ov-edge.ov-weight-2 { opacity: .24; }
.ov-edge.ov-weight-3 { opacity: .4; }
.ov-edge.ov-weight-4 { opacity: .58; }
.ov-edge.ov-down { stroke: var(--ink); }
.ov-edge.ov-weak { opacity: 0; }
.ov-edge.is-on { opacity: 1; }
.ov-edge.ov-down.is-on { opacity: 1; }
.ov-card { position: absolute; display: flex; flex-direction: column; box-sizing: border-box; transition: opacity .12s; }
.ov-card .related-art { flex: none; aspect-ratio: auto; }
.ov-card .related-art img { object-position: center top; }
.ov-card .related-art .ph { font-size: 18px; }
.ov-card .related-copy { gap: 1px; align-content: start; padding: 4px 6px; overflow: hidden; }
.ov-card .related-copy b { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 14px; line-height: 1.25; }
.ov-card .related-copy small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; line-height: 1.3; }
.ov-card.kind-culture { border-color: var(--jade); }
.ov-card.kind-culture .related-copy b { color: var(--jade); }
.ov-card.kind-external { border-style: dashed; border-color: var(--muted); }
.ov-card.is-focus { border-color: var(--shu); box-shadow: 0 0 0 2px var(--shu); }
.ov-x { position: absolute; z-index: 1; transform: translate(-50%, -50%); display: grid; place-items: center; width: 17px; height: 17px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 800; line-height: 1; opacity: .6; pointer-events: none; }
.ov-x.ov-weak { opacity: 0; }
.ov-x.is-on { opacity: 1; }
.ov-canvas.has-emph .ov-card:not(.is-on) { opacity: .2; }
.ov-canvas.has-emph .ov-edge:not(.is-on):not(.ov-weak) { opacity: .08; }
.ov-canvas.has-emph .ov-x:not(.is-on):not(.ov-weak) { opacity: .15; }
@media (max-width: 699px) {
  .ov-scroll { height: calc(100svh - 360px); min-height: 320px; }
  .ov-card .related-copy b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}

/* Feedback detail disclosures, organization links, and pull gestures */
.feedback-disclosure { padding: 0; overflow: hidden; }
.feedback-disclosure > summary { min-height: 44px; display: flex; align-items: center; padding: 0 16px; color: var(--jade); font-weight: 800; cursor: pointer; list-style: none; }
.feedback-disclosure > summary::-webkit-details-marker { display: none; }
.feedback-disclosure > summary::after { content: "＋"; margin-left: auto; color: var(--muted); }
.feedback-disclosure[open] > summary::after { content: "−"; }
.feedback-disclosure-body { padding: 0 16px 16px; }
.feedback-disclosure-body > :first-child { margin-top: 0; }
.org-link { display: inline-flex; align-items: center; justify-content: flex-start; max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; text-align: left; line-height: 1.4; border: 0; cursor: pointer; font: inherit; }
.tags > .org-link { flex: 0 1 auto; }
.mekuru-quick-search { position: sticky; top: -8px; z-index: 2; padding: 8px 0 10px; background: var(--paper, #f6f3ec); }
.mekuru-quick-search > input { width: 100%; min-height: 48px; box-sizing: border-box; padding: 10px 14px; border: 1px solid #c5b795; border-radius: 14px; background: var(--surface, #fff); color: var(--ink); font: inherit; }
.mekuru-quick-results:empty, .mekuru-recent:empty { display: none; }
.mekuru-quick-results, .mekuru-recent-list { display: grid; gap: 4px; margin-top: 6px; }
.mekuru-quick-option { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 7px 12px; border: 0; border-radius: 10px; background: #fff; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.mekuru-quick-option small { flex: 0 0 auto; color: var(--muted); }
.mekuru-quick-option:hover { background: #e9e2d1; }
.mekuru-recent-list { padding-bottom: 4px; border-bottom: 1px solid #dfcfad; }
.pull-indicator { position: fixed; z-index: 200; top: max(8px, env(safe-area-inset-top)); left: 50%; width: 28px; height: 28px; border-radius: 50%; background: var(--surface, #fff); box-shadow: 0 2px 12px #2222; opacity: 0; pointer-events: none; transform: translate(-50%, -42px) scale(.8); transition: opacity .16s ease, transform .16s ease; }
.pull-indicator::before { content: ""; position: absolute; inset: 6px; border: 2px solid #c8c1b4; border-top-color: var(--jade); border-radius: 50%; transform: rotate(calc(var(--pull-progress, 0) * 360deg)); }
.pull-indicator.is-pulling { opacity: 1; transform: translate(-50%, 0) scale(1); }
.pull-indicator.is-preview { opacity: 1; transform: translate(-50%, 4px) scale(1); }
.pull-indicator.is-preview::after { content: attr(data-preview); position: absolute; top: 34px; left: 50%; width: max-content; max-width: min(260px, 80vw); overflow: hidden; padding: 4px 9px; border-radius: 999px; background: var(--surface, #fff); color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; box-shadow: 0 2px 10px #2222; transform: translateX(-50%); }
