
body {
  margin: 0;
  font-family: 'Segoe UI', 'Pretendard', sans-serif;
  background: linear-gradient(135deg, #23243a 0%, #1a1b2e 100%);
  color: #f5f5f5;
  min-height: 100vh;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: rgba(5,10,20,0.88);
  border-bottom: 1px solid rgba(212,175,55,0.18);
  backdrop-filter: blur(12px);
}

.site-nav .nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: #d4af37;
}

.site-nav ul {
  display: flex;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: #f3f3f3;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus {
  color: #d4af37;
}

.page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 110px 24px 48px;
}

.hero {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 4vw, 5rem);
  line-height: 1.05;
  color: #f8e5aa;
}

.hero p {
  margin: 0;
  max-width: 720px;
  margin-inline: auto;
  color: #d9d9d9;
  font-size: 1.05rem;
}

.small-hero {
  min-height: 36vh;
  padding-top: 36px;
}


.card,
.timeline-section,
.map-overview,
.rating-card {
  margin-top: 28px;
  padding: 32px 28px;
  border-radius: 22px;
  background: linear-gradient(120deg, rgba(255,255,255,0.10) 60%, rgba(212,175,55,0.08) 100%);
  box-shadow: 0 8px 32px rgba(40,40,60,0.18), 0 1.5px 0.5px rgba(212,175,55,0.08);
  border: 1.5px solid rgba(212,175,55,0.18);
  transition: box-shadow 0.3s, transform 0.3s;
}

.card:hover {
  box-shadow: 0 16px 48px rgba(212,175,55,0.18), 0 2px 1px rgba(212,175,55,0.12);
  transform: translateY(-6px) scale(1.02);
}
.timeline-slider-section {
  margin: 40px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-slider-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  margin-top: 8px;
  font-size: 1rem;
  color: #e0c97f;
}

.timeline-slider {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  appearance: none;
  height: 8px;
  border-radius: 6px;
  background: linear-gradient(90deg, #d4af37 0%, #f7e4a4 100%);
  outline: none;
  box-shadow: 0 2px 8px rgba(212,175,55,0.12);
  transition: background 0.3s;
}
.timeline-slider::-webkit-slider-thumb {
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fffbe6;
  border: 3px solid #d4af37;
  box-shadow: 0 2px 8px rgba(212,175,55,0.18);
  cursor: pointer;
  transition: background 0.2s;
}
.timeline-slider:focus::-webkit-slider-thumb {
  background: #ffe066;
}
.timeline-slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fffbe6;
  border: 3px solid #d4af37;
  box-shadow: 0 2px 8px rgba(212,175,55,0.18);
  cursor: pointer;
  transition: background 0.2s;
}
.timeline-slider:focus::-moz-range-thumb {
  background: #ffe066;
}
.timeline-slider::-ms-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fffbe6;
  border: 3px solid #d4af37;
  box-shadow: 0 2px 8px rgba(212,175,55,0.18);
  cursor: pointer;
  transition: background 0.2s;
}
.timeline-slider:focus::-ms-thumb {
  background: #ffe066;
}
.timeline-slider:focus {
  outline: none;
}

/* Book Card Animation for Annals */
.book-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: center;
  margin-top: 40px;
}
.book-card {
  width: 180px;
  height: 240px;
  background: linear-gradient(120deg, #f7e4a4 60%, #d4af37 100%);
  border-radius: 18px 18px 8px 8px;
  box-shadow: 0 8px 32px rgba(40,40,60,0.18), 0 1.5px 0.5px rgba(212,175,55,0.08);
  position: relative;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(.4,2,.6,1), box-shadow 0.3s;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.book-card:hover {
  transform: scale(1.08) rotate(-2deg);
  box-shadow: 0 16px 48px rgba(212,175,55,0.22), 0 2px 1px rgba(212,175,55,0.12);
}
.book-card.open {
  animation: openBook 0.7s cubic-bezier(.4,2,.6,1) forwards;
  z-index: 10;
}
@keyframes openBook {
  0% { transform: scale(1) rotate(0deg); }
  60% { transform: scale(1.15) rotate(2deg); }
  100% { transform: scale(1.2) rotate(0deg); }
}
.book-content {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #fffbe6;
  color: #23243a;
  border-radius: 18px 18px 8px 8px;
  padding: 24px 18px;
  box-shadow: 0 8px 32px rgba(40,40,60,0.18);
  z-index: 20;
  overflow-y: auto;
}
.book-card.open .book-content {
  display: block;
  animation: fadeInBook 0.5s 0.2s both;
}
@keyframes fadeInBook {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

.card h2,
.timeline-display h2,
.rating-card h2 {
  margin-top: 0;
  color: #f7e4a4;
}

.card p,
.map-overview p,
.timeline-display p,
.rating-card p {
  color: #dcdcdc;
  line-height: 1.75;
}

.card ul,
.rating-card ul {
  margin: 16px 0 0;
  padding-left: 20px;
}

.card li,
.rating-card li {
  margin-bottom: 10px;
}

.map-overview {
  display: grid;
  gap: 22px;
}

.map-graphic {
  position: relative;
  height: 240px;
  background: linear-gradient(135deg, #11152a, #0f1b32);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.07);
}

.marker {
  position: absolute;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(212,175,55,0.14);
  color: #f7e4a4;
  font-size: 0.9rem;
  text-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.marker-korea { top: 40%; left: 35%; }
.marker-china { top: 20%; left: 12%; }
.marker-japan { top: 55%; left: 78%; }

.timeline-section {
  display: grid;
  gap: 24px;
}

.timeline-panel {
  display: flex;
  justify-content: center;
}

.timeline-display {
  max-width: 780px;
  text-align: center;
  padding: 32px;
  border-radius: 22px;
  background: rgba(255,255,255,0.08);
}

.timeline-display span {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: #d4af37;
}

.timeline-list {
  display: grid;
  gap: 14px;
}

.timeline-item {
  padding: 18px 22px;
  border-radius: 18px;
  border: 1px solid rgba(212,175,55,0.12);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.timeline-item:hover,
.timeline-item.active {
  background: rgba(212,175,55,0.16);
  transform: translateX(6px);
}

.rating-card {
  display: grid;
  gap: 16px;
}

.rating-stars {
  font-size: 1.2rem;
}

/* Overview Tabs */
.overview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 36px;
  margin-bottom: 4px;
}

.overview-tab {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1.5px solid rgba(212,175,55,0.3);
  background: rgba(255,255,255,0.05);
  color: #c8c8c8;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.overview-tab:hover {
  background: rgba(212,175,55,0.12);
  color: #f7e4a4;
  border-color: rgba(212,175,55,0.5);
}

.overview-tab.active {
  background: rgba(212,175,55,0.2);
  color: #f7e4a4;
  border-color: #d4af37;
  font-weight: 600;
}

.overview-panel {
  display: none;
}

.overview-panel.active {
  display: block;
}

/* Overview Period Grid */
.overview-period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.overview-period-item {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(212,175,55,0.15);
  border-radius: 14px;
  padding: 18px 16px;
}

.overview-period-label {
  font-size: 0.75rem;
  color: #d4af37;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.overview-period-name {
  font-size: 1rem;
  color: #f7e4a4;
  font-weight: 600;
  margin-bottom: 8px;
}

.overview-period-item p {
  font-size: 0.85rem;
  color: #b8b8b8;
  line-height: 1.6;
  margin: 0;
}

/* People Cards */
.people-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px;
  margin-top: 40px;
}

.person-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.10) 60%, rgba(212,175,55,0.12) 100%);
  border: 1.5px solid rgba(212,175,55,0.25);
  border-radius: 22px;
  padding: 32px 20px 24px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(.4,2,.6,1), box-shadow 0.3s;
  box-shadow: 0 8px 32px rgba(40,40,60,0.18);
}

.person-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 20px 48px rgba(212,175,55,0.22);
}

.person-card-icon {
  font-size: 3rem;
  margin-bottom: 14px;
}

.person-card h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: #f7e4a4;
}

.person-card-kingdom {
  font-size: 0.85rem;
  color: #d4af37;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.person-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #c0c0c0;
  line-height: 1.6;
}

/* Person Full-screen Modal */
.person-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.person-modal-inner {
  position: relative;
  background: linear-gradient(135deg, #1e1f33 0%, #23243a 100%);
  border: 1.5px solid rgba(212,175,55,0.3);
  border-radius: 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalSlideUp 0.3s cubic-bezier(.4,2,.6,1);
}

@keyframes modalSlideUp {
  from { transform: translateY(60px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.person-modal-close {
  position: sticky;
  top: 16px;
  left: 100%;
  float: right;
  margin: 16px 16px 0 0;
  background: rgba(212,175,55,0.15);
  border: 1.5px solid rgba(212,175,55,0.35);
  color: #f7e4a4;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}

.person-modal-close:hover {
  background: rgba(212,175,55,0.35);
}

.person-modal-content {
  padding: 12px 40px 40px;
  clear: both;
}

.person-modal-content .modal-icon {
  font-size: 4rem;
  text-align: center;
  margin-bottom: 12px;
}

.person-modal-content h2 {
  margin: 0 0 4px;
  color: #f7e4a4;
  font-size: 1.8rem;
  text-align: center;
}

.person-modal-content .modal-kingdom {
  text-align: center;
  color: #d4af37;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.person-modal-content .modal-lifespan {
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.person-modal-content hr {
  border: 0;
  border-top: 1.5px solid rgba(212,175,55,0.2);
  margin: 20px 0;
}

.person-modal-content .modal-name-ko {
  text-align: center;
  color: #a89060;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.person-modal-content .modal-section-title {
  color: #d4af37;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(212,175,55,0.2);
}

.person-modal-content p {
  color: #dcdcdc;
  line-height: 1.85;
  margin: 0 0 14px;
}

.person-modal-content ul {
  color: #dcdcdc;
  line-height: 1.85;
  padding-left: 20px;
  margin: 0;
}

.person-modal-content ul li {
  margin-bottom: 10px;
}

/* Table of Contents */
.modal-toc {
  background: rgba(212,175,55,0.07);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 20px 0 28px;
}

.modal-toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d4af37;
  margin-bottom: 10px;
}

.modal-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-toc-link {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(212,175,55,0.1);
  border: 1px solid rgba(212,175,55,0.25);
  color: #f0d98a;
  text-decoration: none;
  font-size: 0.82rem;
  transition: background 0.2s, color 0.2s;
}

.modal-toc-link:hover {
  background: rgba(212,175,55,0.28);
  color: #fff8e0;
}

/* Life Timeline Items */
.modal-life-item {
  margin-bottom: 22px;
  padding-left: 16px;
  border-left: 2px solid rgba(212,175,55,0.3);
}

.modal-life-period {
  font-size: 0.82rem;
  font-weight: 700;
  color: #d4af37;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

/* Quote Blocks */
.modal-quote {
  background: rgba(212,175,55,0.06);
  border-left: 3px solid #d4af37;
  border-radius: 0 12px 12px 0;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.modal-quote-original {
  font-size: 1.05rem;
  color: #f7e4a4;
  line-height: 1.7;
  margin-bottom: 10px;
  font-style: italic;
}

.modal-quote-translation {
  color: #dcdcdc;
  line-height: 1.8;
  margin-bottom: 8px;
}

.modal-quote-source {
  font-size: 0.78rem;
  color: #8a7a50;
  font-style: italic;
}

@media (max-width: 820px) {
  .site-nav {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }

  .site-nav ul {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* ── King Timeline (timeline.html) ─────────────────────────── */

.king-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.king-filter {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: #e8e8e8;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.king-filter:hover {
  border-color: var(--kc, #d4af37);
  color: var(--kc, #d4af37);
}

.king-filter.active {
  background: var(--kc, #d4af37);
  border-color: var(--kc, #d4af37);
  color: #1a1b2e;
  font-weight: 700;
}

.king-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 28px;
  font-size: 0.8rem;
  color: #ccc;
}

.king-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.king-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Single-kingdom dynasty sections */
.dynasty-section {
  margin-bottom: 32px;
}

.dynasty-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--kc) 22%, transparent), transparent);
  border: 1.5px solid color-mix(in srgb, var(--kc) 40%, transparent);
  border-bottom: none;
}

.dynasty-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dynasty-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dynasty-name {
  font-size: 1rem;
  font-weight: 700;
  color: #f5f5f5;
}

.dynasty-era {
  font-size: 0.78rem;
  color: #bbb;
  margin-top: 2px;
}

.dynasty-header-note {
  font-size: 0.75rem;
  color: #aaa;
  font-style: italic;
}

.dynasty-kings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 16px;
  border-radius: 0 0 14px 14px;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.07);
  border-top: none;
}

/* King cards */
.king-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.king-card:hover {
  background: color-mix(in srgb, var(--kc) 12%, rgba(255,255,255,0.05));
  border-color: color-mix(in srgb, var(--kc) 50%, transparent);
  transform: translateY(-2px);
}

.king-notable {
  background: color-mix(in srgb, var(--kc) 14%, rgba(255,255,255,0.05));
  border-color: color-mix(in srgb, var(--kc) 45%, transparent);
}

.king-card-reign {
  font-size: 0.7rem;
  color: #aaa;
  margin-bottom: 4px;
}

.king-card-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f0f0f0;
  margin-bottom: 2px;
}

.king-notable .king-card-name {
  color: color-mix(in srgb, var(--kc) 80%, #fff);
}

.king-card-name-ko {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 6px;
}

.king-card-desc {
  font-size: 0.74rem;
  color: #ccc;
  line-height: 1.45;
}

/* Three Kingdoms triple-column section */
.dynasty-triple-section {
  margin-bottom: 32px;
}

.dynasty-header-triple {
  padding: 14px 20px;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, rgba(212,175,55,0.12), transparent);
  border: 1.5px solid rgba(212,175,55,0.22);
  border-bottom: none;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.dynasty-header-label {
  font-size: 1rem;
  font-weight: 700;
  color: #f5f5f5;
}

.dynasty-header-era {
  font-size: 0.78rem;
  color: #bbb;
}

.dynasty-header-note {
  font-size: 0.75rem;
  color: #aaa;
  font-style: italic;
}

.dynasty-triple-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 0;
  border: 1.5px solid rgba(255,255,255,0.07);
  border-top: none;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
}

.dynasty-triple-col {
  border-right: 1px solid rgba(255,255,255,0.07);
}

.dynasty-triple-col:last-child {
  border-right: none;
}

.dynasty-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--kc) 18%, rgba(26,27,46,0.9));
  color: #f0f0f0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: sticky;
  top: 0;
}

.dynasty-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dynasty-col-kings {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255,255,255,0.02);
}

/* ── Responsive tweaks ──────────────────────────────────────── */

@media (max-width: 720px) {
  .page-content {
    padding: 90px 16px 32px;
  }

  .hero {
    padding: 28px 12px;
  }

  .card,
  .timeline-section,
  .map-overview,
  .rating-card {
    padding: 22px;
  }

  .dynasty-triple-grid {
    grid-template-columns: 1fr;
  }

  .dynasty-kings-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
