body {
  margin: 0;
  font-family: sans-serif;
}

body.intro-locked {
  overflow: hidden;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2em 1.5em;
  box-sizing: border-box;
  z-index: 200;
}

.intro-overlay:not(.is-visible) {
  display: none;
}

.intro-content {
  position: relative;
  max-width: 960px;
  width: 100%;
  background: #fff;
  color: #222;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 2.5em 2em 2em;
  box-sizing: border-box;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.intro-scroll {
  overflow-y: auto;
  padding-right: 0.5em;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 1.5em;
}

.intro-heading {
  margin-top: 0;
  margin-bottom: 1em;
  font-size: clamp(1.5rem, 2vw + 1rem, 2.4rem);
  line-height: 1.3;
}

.intro-header {
  text-align: center;
}

.intro-header .intro-heading {
  margin-bottom: 0.2em;
}

.author-name {
  margin: 0;
  font-size: 1rem;
  color: #444;
  letter-spacing: 0.05em;
}

.intro-header .author-name {
  font-weight: 600;
}

.intro-copy {
  margin: 0 auto;
  width: min(100%, 72ch);
  display: flex;
  flex-direction: column;
  gap: 2em;
}

.intro-body {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  text-align: left;
}

.intro-body .intro-h2 {
  margin: 1.5em 0 0.5em;
  font-size: 1rem;
  font-weight: normal;
}

.intro-body .intro-h2:first-child {
  margin-top: 0;
}

.intro-body .author-name {
  font-weight: 600;
  color: #444;
}

.intro-body p {
  margin: 0;
  line-height: 1.7;
  font-size: 1rem;
}

.intro-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.5em;
  flex-shrink: 0;
}

.intro-btn {
  padding: 0.75em 2.5em;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: bold;
  background: #222;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s ease-in-out;
}

.intro-btn:hover,
.intro-btn:focus {
  opacity: 0.85;
}

.intro-close {
  position: absolute;
  top: 0.4em;
  right: 0.4em;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

.intro-close:hover,
.intro-close:focus {
  color: #000;
}

.intro-reopen {
  position: fixed;
  bottom: 1em;
  right: 1em;
  padding: 0.6em 1.4em;
  border: none;
  border-radius: 999px;
  background: rgba(34, 34, 34, 0.85);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  z-index: 150;
  display: none;
}

.intro-reopen.is-visible {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

@media (max-width: 768px) {
  .intro-overlay {
    padding: 1.5em;
  }

  .intro-content {
    padding: 2em 1.2em 1.5em;
  }

  .intro-copy {
    width: 100%;
  }

  .intro-btn {
    width: 100%;
  }

  .intro-reopen {
    bottom: 0.75em;
    right: 0.75em;
    font-size: 0.9rem;
  }
}

@media (max-height: 640px) {
  .intro-overlay {
    align-items: flex-start;
  }

  .intro-content {
    margin-top: 1.5em;
    max-height: calc(100vh - 3em);
  }
}

#title-container {
  position: fixed;
  top: 15px;
  left: 20px;
  font-size: 18px;
  font-weight: bold;
  z-index: 100;
}

/* デスクトップ全体ビュー */
#desktop-view {
  width: 100%;
  height: 100vh;
  min-height: 1080px;
  overflow-x: scroll;
}

/* モバイル：年代ごとページ送り */
#mobile-view {
  display: none;
  position: relative;
}
#mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5em;
  background: rgba(255,255,255,0.9);
  z-index: 10;
  box-sizing: border-box;
}
#decade-label {
  font-size: 1em;
  font-weight: bold;
}
#mobile-view #mobile-container {
  position: absolute;
  top: 2.5em; left: 0;
  width: 100%; 
  /* height: calc(90vh); */
  height: 900;
  overflow-x: scroll; overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
#mobile-view svg {
  display: block;
}
#mobile-view .btn {
  background: rgba(255,255,255,0.8);
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 2.5em;
  height: 2.5em;
  font-size: 1em;
  cursor: pointer;
}
#prev-btn { left: 0.5em; }
#next-btn { right: 0.5em; }

/* レスポンシブ切り替え */
@media (max-width: 768px) {
  #desktop-view { display: none; }
  #copyright-desktop { display: none; }
  #mobile-view { display: block; }
  #legend-container { display: none; }
  #title-container { display: none; }
}

.tooltip {
  position: absolute;
  pointer-events: none;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 12px;
  border-radius: 4px;
  transition: opacity 0.1s ease-in-out;
  opacity: 0;
}

/* 共通スタイル */
.axis path,
.axis line { stroke: #999; }
.link { opacity: 0.8; }
.node circle { stroke: #333; stroke-width: 1px; }
.node text { pointer-events: none; }
.legend rect { width: 12px; height: 12px; }
.legend text { font-size: 12px; alignment-baseline: middle; }

.nav-center {
  display: flex;
  align-items: center;
  gap: 1em;
}

#info-btn {
  position: absolute;
  right: 0.5em;
}

/* Info Panel */
#info-panel {
  display: none;
  position: fixed;
  top: 3.5em; /* nav の高さに合わせる */
  left: 0;
  right: 0;
  padding: 1em;
  background: rgba(255, 255, 255, 0.95);
  z-index: 9;
  box-sizing: border-box;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  text-align: center;
}

#info-panel.is-visible {
  display: block;
}

#copyright-desktop {
  position: fixed;
  top: 10px;
  right: 2em;
  font-size: 14px;
  z-index: 100;
  background: rgba(255,255,255,0.7);
  padding: 2px 5px;
  border-radius: 3px;
}

#legend-container {
  position: fixed;
  top: 45px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}
