/* ===== ベース設定 ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.7;
  color: #111;
  background: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== ヘッダー・ナビ ===== */
header {
  border-bottom: 1px solid #e5e5e5;
  background: #fff;
}

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.site-title span {
  font-size: 0.8rem;
  font-weight: 400;
  margin-left: 6px;
  color: #666;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 18px;
  font-size: 0.9rem;
}

nav li {
  position: relative;
}

nav a {
  padding-bottom: 4px;
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 0;
  background: #000;
  transition: width 0.2s ease;
}

nav a:hover::after {
  width: 100%;
}

/* ===== メインレイアウト ===== */
main {
  max-width: 1040px;
  margin: 24px auto 48px;
  padding: 0 16px;
}

.section {
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 16px;
}

/* ===== トップページ：スライダー ===== */
.hero {
  margin-top: 16px;
  margin-bottom: 32px;
}

.slider {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide.active {
  opacity: 1;
}

/* スライダーのキャプション（必要なら） */
.slide-caption {
  position: absolute;
  left: 16px;
  bottom: 16px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
}

/* スライダーの矢印 */
.slider-nav {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.slider-btn {
  pointer-events: auto;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  padding: 6px 10px;
  margin: 0 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

/* ===== トップページ：コンテンツパネル ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid #eee;
  padding: 16px;
  border-radius: 8px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-text {
  font-size: 0.9rem;
  color: #444;
}

.card-link {
  margin-top: 8px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ===== 汎用 ===== */
.text-small {
  font-size: 0.88rem;
  color: #555;
}

/* ===== フッター ===== */
footer {
  border-top: 1px solid #eee;
  padding: 16px 0 24px;
  text-align: center;
  font-size: 0.8rem;
  color: #777;
}

/* ===== レスポンシブ ===== */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  nav ul {
    flex-wrap: wrap;
    gap: 10px;
  }

  .slider-btn {
    font-size: 0.8rem;
    padding: 4px 8px;
  }
}

/* ===== WORLDページ用 ===== */
.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.world-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 16px;
  background: #fafafa;
}

.world-card-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 4px;
}

.world-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.world-card-text {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 8px;
}

.world-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  color: #555;
}

/* ===== CHARACTERS PAGE ===== */

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.char-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 16px;
  background: #fafafa;
}

.char-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ddd;
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}

.char-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.char-role {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 8px;
}

.char-text {
  font-size: 0.85rem;
  color: #444;
}

.profile-body {
  margin-left: 1em;
  line-height: 1.6;
}

.profile-row{
  display:flex;
  gap:12px;
  margin:4px 0;
}
.profile-row span:first-child{
  width:4em;
  opacity:.8;
}

.profile-tags{
  margin-top:10px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: #ddd;
  font-size: 12px;
}

.tag:hover {
  background: #555;
  color: #fff;
}

.soukanzu-wrap{
  width: min(980px, 100%);
  margin: 24px auto;
  overflow: hidden;
  border-radius: 12px;
}

.soukanzu-track{
  display: flex;
  gap: 0;
animation: soukanzuSlide 50s ease-in-out infinite;
}

.soukanzu-track img{
  width: 100%;
  flex: 0 0 100%;
  display: block;
}

@keyframes soukanzuSlide{
  0%   { transform: translateX(0); }
  33%  { transform: translateX(-200%); }
  66% { transform: translateX(-200%); }
}

/* 苦手なら動きを止められる保険 */
@media (prefers-reduced-motion: reduce){
  .soukanzu-track{ animation: none; }
}

/* 属性別カラー */
.tag[data-filter="attr"][data-value="雷"] {
  background: #ec6800;
  border-color: #cc6600;
  color: #663300;
}

.tag[data-filter="attr"][data-value="樹"] {
  background: #ff69b4;
  border-color: #ff69b4;
  color: #c71585;
}

.tag[data-filter="attr"][data-value="水"] {
  background: #cfe9ff;
  border-color: #6aa8e8;
  color: #1f4e79;
}

.tag[data-filter="attr"][data-value="炎"] {
  background: #ffd6d6;
  border-color: #ff6b6b;
  color: #7a1f1f;
}

.tag[data-filter="attr"][data-value="氷"] {
  background: #4169e1;
  border-color: #0000ff;
  color: #00008b;
}

.tag[data-filter="attr"][data-value="鋼"] {
  background: #f3f3f3;
  border-color: #808080;
  color: #000000;
}

.tag[data-filter="attr"][data-value="地"] {
  background: #cd853f;
  border-color: #d2691e;
  color: #800000;
}

.tag[data-filter="attr"][data-value="風"] {
  background: #90ee90;
  border-color: #32cd32;
  color: #9006400;
}

.tag[data-filter="attr"][data-value="光"] {
  background: #ffff33;
  border-color: #72640c;
  color: #d2691e;
}

.tag[data-filter="attr"][data-value="闇"] {
  background: #e5ccff;
  border-color: #9370db;
  color: #6633cc;
}

.tag[data-filter="weapon"] {
  background: #f3f3f3;
  border-color: #bbb;
  color: #333;
}

.tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* ===== 年表 ===== */
.timeline {
  position: relative;
  margin: 3rem 0;
  padding-left: 2rem;
  border-left: 2px solid #444;
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 0.4rem;
  width: 14px;
  height: 14px;
  background: #222;
  border: 2px solid #aaa;
  border-radius: 50%;
}

.timeline-era {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #eee;
  margin-bottom: 0.5rem;
}

.timeline-content {
  padding-left: 1rem;
  color: #ddd;
  line-height: 1.8;
}

.timeline-content p {
  margin: 0;
  line-height: 1.9;
}

.timeline-content p {
  color: #555;   /* ← まずはここ */
}

.timeline-era {
  color: #333;
  font-weight: 600; /* 太すぎないのが黒王国っぽい */
}

.timeline-content p {
  line-height: 1.9;
}

.timeline-item.recent::before {
  background: #600;
  border-color: #c99;
}

.timeline-item.recent .timeline-era {
  color: #f0c0c0;
}

.timeline-section {
  margin-top: 5rem;
  margin-bottom: 5rem;
}

.timeline-content p {
  line-height: 1.9;
}

.keyword {
  font-weight: 600;
  white-space: nowrap;
}

/* タイムライン：マーカーと文字が重ならないように左レーンを確保 */
.timeline {
  position: relative;
}

/* 1項目ごとに左の余白を作る（ここが効く） */
.timeline-item {
  position: relative;
  padding-left: 56px; /* ← ここを増やすほど文字が右へ */
}

/* 「年代」ラベルがマーカーに近い場合はさらに微調整 */
.timeline-era {
  display: inline-block;
  margin-left: 0;
}

/* もし ::before で丸を作ってるなら位置を左に固定 */
.timeline-item::before {
  left: 18px;        /* 丸のX位置（左レーン内に置く） */
  top: 0.35em;       /* 文字の高さに合わせて上下調整 */
}

/* ===== WORKS ===== */

.works-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.work-item {
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 18px;
  background: #f2f2f2;
}

.work-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.work-meta {
  margin: 0;
  display: grid;
  grid-template-columns: 80px 1fr;
  row-gap: 6px;
  column-gap: 16px;
}

/* dl内にdivが混ざってても崩れない保険 */
.work-meta > div {
  display: contents;
}

.work-meta dt {
  margin: 0;
  font-weight: 600;
  color: #666;
  font-size: 0.9rem;
}

.work-meta dd {
  margin: 0;
  line-height: 1.6;
  font-size: 0.95rem;
  color: #111;
}

.work-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn-link {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
  text-decoration: none;
}

.btn-link:hover {
  opacity: 0.9;
}

@media (max-width: 600px) {
  .work-meta {
    grid-template-columns: 1fr;
  }
  .work-meta dt {
    margin-top: 8px;
  }
}


/* dl内のdivラッパーがあっても grid に流し込む */
.work-meta > div {
  display: contents;
}

.read-buttons {
  flex-wrap: wrap;
  justify-content: center;
}

.read-buttons a {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: #fff;
  text-decoration: none;
  font-size: 0.95rem;
}

.read-buttons a:hover {
  opacity: 0.9;
}

.novel-body {
  max-width: 720px;
  line-height: 1.9;
  font-size: 1rem;
}

/* 目次ページ：導線ボタン */
.read-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 8px;
}

/* 目次リスト */
.novel-toc {
  margin-top: 12px;
}

.toc-list {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.9;
}

.toc-list a {
  text-decoration: none;
}

.toc-list a:hover {
  opacity: 0.85;
}

.novel-hero {
  max-width: 900px;
  margin: 24px auto 32px;
}

.novel-hero img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  border-radius: 16px;
}

@media (max-width: 600px) {
  .novel-hero {
    margin: 16px auto 24px;
  }

  .novel-hero img {
    max-height: 260px;
    border-radius: 12px;
  }
}

.section-title {
  margin-top: 0;
}

.section p {
  max-width: 720px;
}

