
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  background: #0b0e1a; color: #efe6d0; overflow-x: hidden; line-height: 1.7;
}
.bg {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 60% 45% at 20% 15%, rgba(60,30,90,.55), transparent 60%),
    radial-gradient(ellipse 55% 40% at 80% 30%, rgba(120,40,30,.45), transparent 60%),
    radial-gradient(ellipse 70% 55% at 50% 90%, rgba(20,50,90,.5), transparent 65%),
    linear-gradient(160deg, #0b0e1a, #141028 45%, #1a0f14);
  animation: aurora 16s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { filter: hue-rotate(0deg) brightness(1); }
  50% { filter: hue-rotate(18deg) brightness(1.12); }
  100% { filter: hue-rotate(-8deg) brightness(.95); }
}
.stars { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.star { position: absolute; border-radius: 50%; background: #fff; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: .15; } 50% { opacity: .9; } }
.wrap { max-width: 1000px; margin: 0 auto; padding: 40px 20px 80px; }
header { text-align: center; margin-bottom: 20px; }
header h1 {
  font-size: 2.4rem; letter-spacing: .14em; color: #ffd700;
  text-shadow: 0 0 12px rgba(255,215,0,.5), 0 0 40px rgba(255,120,0,.3);
}
header h1 .red { color: #ff5f4d; text-shadow: 0 0 12px rgba(255,95,77,.6); }
header p { margin-top: 10px; color: #b8a888; font-size: .92rem; }
.stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 20px 0 10px; }
.stat {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,215,0,.25);
  border-radius: 999px; padding: 6px 16px; font-size: .82rem; color: #ffd700;
}
.stat b { font-size: 1rem; }
.legend {
  margin: 12px 0 24px; font-size: .85rem; color: #e8dfc8; text-align: left;
  display: flex; flex-direction: column; gap: 8px; line-height: 1.6;
  background: rgba(16,20,38,.75); border: 1px solid rgba(255,215,0,.25); border-radius: 12px; padding: 14px 18px;
}
.legend .legend-title { font-size: .78rem; color: #ffd700; font-weight: 700; letter-spacing: .06em; margin-top: 4px; }
.legend .legend-title:first-child { margin-top: 0; }
.legend .legend-row { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .legend-hint { color: #b8a888; font-size: .78rem; border-top: 1px dashed rgba(255,215,0,.2); padding-top: 8px; margin-top: 2px; }

/* ライフライン帯 */
.life-strip {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 34px;
}
.mile {
  background: linear-gradient(135deg, rgba(255,215,0,.14), rgba(255,95,77,.1));
  border: 1px solid rgba(255,215,0,.4); border-radius: 12px; padding: 10px 16px;
  font-size: .82rem; text-align: center; min-width: 180px;
  box-shadow: 0 0 18px rgba(255,200,60,.15);
}
.mile .y { color: #ffd700; font-size: .95rem; font-weight: 700; letter-spacing: .05em; }
.mile .m { font-weight: 600; margin-top: 2px; }
.mile .d { color: #b8a888; font-size: .72rem; margin-top: 2px; }

/* 縦タイムライン */
.tl { position: relative; padding: 10px 0; }
.tl::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 3px;
  transform: translateX(-50%);
  background: rgba(255,215,0,.18);
  box-shadow: 0 0 12px rgba(255,180,60,.35);
  border-radius: 3px;
}
/* 中央バー: 各イベントの区間を元号色で塗る（時代の流れをバーで表現） */
.item::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 3px;
  transform: translateX(-50%);
  background: var(--era, rgba(255,215,0,.3));
  z-index: 1;
}
.item.left::after { left: 100%; }   /* 左側カードの右端 = 中央線 */
.item.right::after { left: 0; }     /* 右側カードの左端 = 中央線 */
.item {
  position: relative; width: 50%; padding: 12px 42px 12px 0; margin: 6px 0;
}
.item.right { left: 50%; padding: 12px 0 12px 42px; }
.item .dot {
  position: absolute; top: 26px; width: 16px; height: 16px; border-radius: 50%;
  background: #ffd700; box-shadow: 0 0 12px #ffd700, 0 0 30px rgba(255,215,0,.6);
  z-index: 2;
}
.item.left .dot { right: -8px; }
.item.right .dot { left: -8px; }
.card {
  background: rgba(16,20,38,.92); border: 1px solid rgba(255,215,0,.25);
  border-radius: 12px; padding: 12px 16px; font-size: .82rem; line-height: 1.55;
  transition: transform .18s ease, box-shadow .18s ease;
  opacity: 0; transform: translateY(24px);
}
.card.show { opacity: 1; transform: translateY(0); }
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(255,180,60,.18); }
.card.flash {
  animation: flash 2.2s ease;
  border-color: #ffd700;
}
@keyframes flash {
  0%, 60% { box-shadow: 0 0 0 3px rgba(255,215,0,.75), 0 0 30px rgba(255,215,0,.5); background: rgba(60,50,20,.95); }
  100% { box-shadow: none; }
}
.card .top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 3px; }
.card .no { font-size: .72rem; color: #b8a888; font-family: monospace; }
.card .role { font-size: .68rem; border-radius: 4px; padding: 1px 7px; border: 1px solid; }
.card .age {
  margin-left: auto; font-size: .7rem; color: #0b0e1a; font-weight: 700;
  background: #ffd700; border-radius: 999px; padding: 1px 10px;
  box-shadow: 0 0 8px rgba(255,215,0,.55);
}
.card .age.pre { background: #5a6b78; color: #cfd8dc; box-shadow: none; }
.card .title { font-size: 1rem; font-weight: 700; color: #ffe9a8; }
.card .title a { color: inherit; text-decoration: none; }
.card .title a:hover { text-decoration: underline; text-shadow: 0 0 8px rgba(255,215,0,.7); }
.card .date { color: #d8cdb8; font-size: .84rem; margin-top: 3px; }
.card .date .span-badge {
  background: linear-gradient(90deg, rgba(255,215,0,.3), rgba(255,95,77,.3));
  border-radius: 4px; padding: 0 6px; margin-left: 6px; color: #ffd700; font-size: .76rem;
}
.card .note { color: #c9bc9c; font-size: .8rem; margin-top: 5px; }
.card .rel { margin-top: 6px; font-size: .78rem; color: #b8a888; }
.card .rel a {
  color: #ffd700; text-decoration: none; border-bottom: 1px dashed rgba(255,215,0,.5);
  margin-right: 8px; cursor: pointer;
}
.card .rel a:hover { color: #fff; text-shadow: 0 0 8px rgba(255,215,0,.8); }
.item.unknown { opacity: .75; }
.item.unknown .dot { background: #95a5a6; box-shadow: none; }
.unknown-sec { margin-top: 40px; }
.unknown-head {
  display: inline-block; background: #5a6b78; color: #e8edf0; font-size: 1rem;
  padding: 4px 20px; border-radius: 999px; margin-bottom: 10px; letter-spacing: .1em;
  box-shadow: 0 0 14px rgba(149,165,166,.35);
}
.unknown-sec .tl-note { color: #8f8062; font-size: .78rem; margin: 6px 0 14px; }

footer { text-align: center; margin-top: 40px; font-size: .82rem; color: #a89a7c; }
@media (max-width: 700px) {
  header h1 { font-size: 1.6rem; }
  .item { width: 100%; padding: 10px 0 10px 34px; left: 0 !important; }
  .item .dot { left: 4px !important; right: auto !important; }
  .tl::before { left: 12px; }
  .item::after, .item.left::after, .item.right::after { left: 12px; }
  .card .age { margin-left: 0; }
}

/* ===== サイト共通ナビ ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,14,26,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,215,0,.25);
  display: flex; justify-content: center; flex-wrap: wrap; gap: 4px;
  padding: 10px 12px; margin-bottom: 24px;
}
.nav a {
  color: #e8dfc8; text-decoration: none; font-size: .88rem;
  padding: 5px 14px; border-radius: 999px; border: 1px solid transparent;
  transition: all .15s ease;
}
.nav a:hover, .nav a.active {
  color: #0b0e1a; background: #ffd700; border-color: #ffd700;
  box-shadow: 0 0 12px rgba(255,215,0,.5);
}
.page-title { text-align: center; font-size: 1.8rem; color: #ffd700; letter-spacing: .1em; margin-bottom: 6px; text-shadow: 0 0 12px rgba(255,215,0,.4); }
.page-desc { text-align: center; color: #c9bc9c; font-size: .92rem; margin-bottom: 26px; }
/* データテーブル */
.data-table { width: 100%; border-collapse: collapse; background: rgba(16,20,38,.9); border-radius: 10px; overflow: hidden; font-size: .86rem; }
.data-table th { background: rgba(255,215,0,.15); color: #ffd700; padding: 8px 10px; text-align: left; font-weight: 600; }
.data-table td { padding: 7px 10px; border-top: 1px solid rgba(255,215,0,.12); color: #e8dfc8; }
.data-table tr:hover td { background: rgba(255,215,0,.06); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.mini-card {
  background: rgba(16,20,38,.9); border: 1px solid rgba(255,215,0,.25); border-radius: 10px;
  padding: 12px 14px; font-size: .8rem;
}
.mini-card h3 { color: #ffe9a8; font-size: .92rem; margin-bottom: 4px; }
.mini-card .cnt { color: #ffd700; font-size: .78rem; }
.mini-card .lst { color: #c9bc9c; font-size: .78rem; margin-top: 4px; }
.tag { display: inline-block; font-size: .72rem; border-radius: 4px; padding: 1px 7px; margin: 1px 2px; border: 1px solid; }
/* 出番マップ: セクション折りたたみ */
.map-summary {
  cursor: pointer; font-size: 1rem; color: #ffd700; letter-spacing: .05em;
  padding: 10px 16px; margin: 14px 0 8px; list-style: none;
  background: rgba(255,215,0,.08); border: 1px solid rgba(255,215,0,.25);
  border-radius: 10px;
}
.map-summary:hover { background: rgba(255,215,0,.15); }
.map-summary::-webkit-details-marker { display: none; }
.map-summary::before { content: "▸ "; color: #ffd700; }
details[open] .map-summary::before { content: "▾ "; }
.map-cards { padding: 2px 2px 8px; }
/* 人物相関図: コンテナに合わせて縮小（SVG単体では属性サイズが効く） */
.family-svg { width: 100%; height: auto; max-width: 100%; }
/* 相関図ページの説明カード: タイムライン用 .card の opacity:0 を打ち消す */
.fam-card { opacity: 1; transform: none; }
/* キーボード操作のフォーカス表示 */
a:focus-visible { outline: 2px solid #ffd700; outline-offset: 2px; border-radius: 4px; }
/* 動きを減らす設定 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* ===== モバイルナビ改善 ===== */
#nav-toggle {
  display: none; position: fixed; top: 8px; right: 12px; z-index: 300;
  width: 44px; height: 44px; font-size: 1.25rem; line-height: 1;
  background: rgba(11,14,26,.92); color: #ffd700;
  border: 1px solid rgba(255,215,0,.45); border-radius: 10px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.45);
  transition: transform .2s ease, opacity .2s ease;
}
#top-btn {
  display: none; position: fixed; right: 12px; bottom: 16px; z-index: 300;
  width: 48px; height: 48px; font-size: 1.2rem; line-height: 1;
  background: rgba(11,14,26,.94); color: #ffd700;
  border: 1px solid rgba(255,215,0,.55); border-radius: 50%; cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}
@media (max-width: 700px) {
  #nav-toggle { display: block; }
  .nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 250;
    transform: translateY(-110%);
    transition: transform .25s ease;
    flex-direction: column; align-items: stretch;
    max-height: 72vh; overflow-y: auto;
    background: rgba(11,14,26,.97);
    border-bottom: 1px solid rgba(255,215,0,.35);
    margin-bottom: 0;
  }
  .nav.open { transform: translateY(0); }
  .nav.nav-hide { transform: translateY(-110%); }
  .nav a { display: block; text-align: center; padding: 11px 14px; border-bottom: 1px solid rgba(255,215,0,.08); }
  #nav-toggle.nav-hide { transform: translateY(-70px); opacity: 0; pointer-events: none; }
  #top-btn.show { display: block; }
}
