/* 시대 지도 셸 레이아웃 */
body.map-page { overflow: hidden; }

#philo-map {
  position: fixed; inset: 0;
  background: var(--sea);
  z-index: 1;
  transition: background .35s ease;
}
.leaflet-container { background: var(--sea) !important; font: inherit; }

/* 상단 헤더 */
.map-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.map-header .brand { display: flex; align-items: baseline; gap: 10px; }
.map-header .brand .logo { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.map-header .brand .era-name { font-size: 14px; color: var(--ink-soft); }
.map-header .brand .logo .accent { color: var(--accent); }

/* 좌측 시대개요 패널 = 지역별 목차 + 순간이동 */
.era-panel {
  position: fixed; top: 64px; left: 12px; bottom: 96px;
  width: 300px; z-index: 900;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform .25s ease;
}
.era-panel.collapsed { transform: translateX(-316px); }
.era-panel h2 { font-size: 15px; margin: 0; padding: 14px 16px 8px; }
.era-panel .era-sub { font-size: 12.5px; color: var(--ink-soft); padding: 0 16px 10px; border-bottom: 1px solid var(--line); line-height: 1.5; }
.era-panel .concurrent {
  font-size: 12px; padding: 10px 16px; color: var(--accent-warm);
  border-bottom: 1px solid var(--line); line-height: 1.5; min-height: 20px;
}
.era-panel .region-list { overflow-y: auto; padding: 8px 10px 14px; flex: 1; }
.region-block { margin-bottom: 10px; }
.region-block .region-name {
  font-size: 13px; font-weight: 700; padding: 6px 8px; cursor: pointer;
  border-radius: 8px;
}
.region-block .region-name:hover { background: var(--surface-2); color: var(--accent); }
.region-block .person-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 5px 8px 5px 16px; cursor: pointer; border-radius: 8px;
  color: var(--ink-soft);
}
.region-block .person-item:hover { background: var(--surface-2); color: var(--ink); }
.person-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.panel-empty { font-size: 13px; color: var(--ink-soft); padding: 16px; line-height: 1.6; }

.panel-tab {
  position: fixed; top: 76px; left: 12px; z-index: 899;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; cursor: pointer; box-shadow: var(--shadow);
  font-size: 13px;
}

/* 우측 인물 카드 패널 */
.info-panel {
  position: fixed; top: 64px; right: 12px; bottom: 96px;
  width: 360px; z-index: 950;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow-y: auto;
  transform: translateX(390px);
  transition: transform .25s ease;
}
.info-panel.open { transform: translateX(0); }
.info-panel .close-btn {
  position: sticky; top: 8px; float: right; margin: 8px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; width: 30px; height: 30px; cursor: pointer;
}
.info-panel .card { padding: 18px; }
.card .disc-chip { display: inline-block; font-size: 11px; color: #fff; padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
.card h3 { margin: 0 0 2px; font-size: 21px; }
.card .life { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.card .tagline { font-size: 14px; color: var(--accent-warm); margin-bottom: 14px; }
.card h4 { font-size: 13px; margin: 18px 0 6px; color: var(--accent); letter-spacing: .04em; }
.card .era-context, .card .story { font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.quote-block { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; padding: 12px 14px; margin: 8px 0; }
.quote-block .src { font-size: 13.5px; line-height: 1.65; font-style: italic; }
.quote-block .explain { font-size: 13px; line-height: 1.65; margin-top: 8px; color: var(--ink-soft); }
.quote-block .explain::before { content: "쉽게 말하면 — "; font-weight: 700; color: var(--accent-warm); }
html[data-lang="en"] .quote-block .explain::before { content: "In plain words — "; }
.q-list { padding-left: 18px; margin: 6px 0; font-size: 13.5px; line-height: 1.8; }
.final-q {
  margin-top: 18px; padding: 14px; border-radius: 12px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px dashed var(--accent);
  font-size: 14px; line-height: 1.65; font-weight: 600;
}
.final-q::before { content: "❓ 마지막 질문"; display: block; font-size: 11px; color: var(--accent); margin-bottom: 6px; letter-spacing: .06em; }
html[data-lang="en"] .final-q::before { content: "❓ One last question"; }
.demo-badge { display: inline-block; font-size: 10px; background: var(--accent-warm); color: #fff; border-radius: 6px; padding: 2px 6px; margin-left: 6px; vertical-align: middle; }

/* 하단 타임 슬라이더 */
.time-dock {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 1000; width: min(720px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px 20px 10px;
}
.time-dock .year-label { text-align: center; font-size: 15px; font-weight: 800; color: var(--accent); margin-bottom: 6px; }
.time-dock input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.time-dock .tick-row { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-soft); margin-top: 2px; }

/* 범례 */
.legend {
  position: fixed; right: 12px; bottom: 96px; z-index: 900;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 10px 14px; font-size: 12px;
}
.info-panel.open ~ .legend { display: none; }
.legend .row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.legend .row.absent { opacity: .28; }
.legend .row .sw { width: 10px; height: 10px; border-radius: 50%; }
.legend .cap { font-size: 10.5px; color: var(--ink-soft); margin-top: 6px; max-width: 170px; line-height: 1.45; }

/* 마커 */
.philo-marker {
  width: 100%; height: 100%; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 1px 6px rgba(0,0,0,.35);
}
html[data-theme="night"] .philo-marker { border-color: rgba(233,226,210,.85); }
.philo-marker-label {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 2px 8px; font-size: 11.5px; white-space: nowrap;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .era-panel { width: 260px; }
  .info-panel { width: min(360px, calc(100% - 24px)); }
  .legend { display: none; }
}
