@font-face {
  font-family: "Pirulen";
  src: url("../../fonts/pirulen_rg.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: #0f0f1a url("../../images/Background-Dark.jpg") center center / cover fixed;
  color: #e0e0f0;
  min-height: 100vh;
}
a {
  color: #a78bfa;
  text-decoration: none;
}

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0a0a14;
  border-bottom: 1px solid #1f2937;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 24px;
  gap: 8px;
}
.nav-logo {
  font-family: "Pirulen", sans-serif;
  font-size: 18px;
  font-weight: normal;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  padding: 7px 8px;
}
.nav-center {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
}
.nav-right {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
nav a {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
  transition: all 0.2s;
}
nav a:hover,
nav a.active {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
}

header {
  text-align: center;
  padding: 48px 24px 32px;
  background: linear-gradient(180deg, #1a0a2e 0%, #0f0f1a 100%);
}
header h1 {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #a78bfa, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
header p {
  color: #6b7280;
  margin-top: 8px;
  font-size: 15px;
}

section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
}
.overview-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.overview-body {
  flex: 1;
  min-width: 0;
}
.overview-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
section h2 {
  font-family: "Pirulen", sans-serif;
  font-size: 26px;
  font-weight: normal;
  margin-bottom: 24px;
}
section h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plot-box {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 24px;
  line-height: 1.8;
  color: #d1d5db;
  margin-bottom: 24px;
}
.plot-box p {
  margin: 0 0 1em;
}
.plot-box p:last-child {
  margin-bottom: 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  display: block;
  background: rgba(15, 15, 30, 0.5);
  border-radius: 10px;
  padding: 16px;
  border-top: 3px solid #7c3aed;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  cursor: pointer;
}
.stat-card:hover {
  background: #22224a;
  transform: translateY(-2px);
}
.stat-num {
  font-size: 32px;
  font-weight: 800;
  color: #a78bfa;
}
.stat-label {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.themes-box {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 24px;
}
.theme-item {
  padding: 8px 0 8px 16px;
  border-left: 3px solid #2563eb;
  color: #d1d5db;
  margin-bottom: 8px;
  font-size: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.card {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 16px;
}
.card-name {
  font-weight: 700;
  color: #ffffff;
  font-size: 15px;
  margin-bottom: 4px;
}
.card-meta {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 8px;
}
.card-body {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.6;
}
.card-arc {
  margin-top: 8px;
  font-size: 12px;
  color: #a78bfa;
  font-style: italic;
}

.faction-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.faction-card {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 20px;
}
.faction-name {
  font-weight: 700;
  color: #ffffff;
  font-size: 16px;
  margin-bottom: 4px;
}
.faction-world {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 10px;
}
.faction-body {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.6;
  margin-bottom: 8px;
}
.faction-members {
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
}

.object-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 700px) {
  .card-grid,
  .faction-grid,
  .object-grid,
  .info-grid,
  .source-color-grid {
    grid-template-columns: 1fr;
  }
}

.object-card {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 16px;
  border-top: 3px solid var(--page-color, #f59e0b);
}
.object-name {
  font-weight: 700;
  color: #ffffff;
  font-size: 16px;
  margin-bottom: 8px;
}
.object-body {
  font-size: 13px;
  color: #d1d5db;
  margin-bottom: 8px;
  line-height: 1.6;
}
.object-sig {
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
}

.tab-link {
  color: #60a5fa;
  text-decoration: underline;
  cursor: pointer;
}
.tab-link:hover {
  color: #93c5fd;
}
.book-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #a0aec0;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2d2d4e;
}
.book-get-btn {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a78bfa;
  background: #a78bfa22;
  border: 1px solid #a78bfa55;
  border-radius: 6px;
  padding: 3px 10px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.book-get-btn:hover {
  background: #a78bfa44;
  color: #c4b5fd;
}
.book-synopsis {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 14px 16px;
  color: #c0c0d8;
  line-height: 1.6;
  margin-bottom: 8px;
}
.book-synopsis p + p {
  margin-top: 1em;
}
.chapter-row {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.ch-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.ch-icon {
  font-size: 16px;
}
.ch-num {
  font-weight: 700;
  font-size: 13px;
}
.ch-title {
  font-weight: 600;
  color: #f3f4f6;
  font-size: 14px;
}
.ch-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.ch-synopsis {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.7;
}

.timeline {
  padding: 8px 0;
}
.tl-item {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.tl-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.tl-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.tl-line {
  width: 2px;
  flex: 1;
  background: #1f2937;
  min-height: 16px;
  margin-top: 4px;
}
.tl-chapter {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #a78bfa;
  background: #a78bfa22;
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 4px;
  vertical-align: middle;
}
.tl-text {
  color: #d1d5db;
  font-size: 14px;
  padding-top: 6px;
  line-height: 1.6;
}
.tl-book-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}
.tl-book-separator::before,
.tl-book-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #374151;
}
.tl-book-title {
  font-family: "Pirulen", sans-serif;
  font-size: 12px;
  color: #a78bfa;
  white-space: nowrap;
  letter-spacing: 0.05em;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.info-card {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 16px;
  border-top: 3px solid var(--page-color, #334155);
}
.info-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}
.info-body {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.6;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: #1e293b;
  color: #cbd5e1;
}

.source-color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.source-color-card {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 14px;
  border-top: 3px solid var(--page-color, #7c3aed);
}
.source-color-name {
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  margin-bottom: 6px;
  text-transform: capitalize;
}
.source-color-effect {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.6;
}
.source-color-trigger {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 8px;
}

.icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-title .icon {
  font-size: 16px;
  line-height: 1;
}

.leg-dots {
  display: inline-flex;
  gap: 5px;
  vertical-align: middle;
  margin-left: 6px;
}
.leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
  box-shadow: 0 0 0 1px #111827 inset;
}
.leg-dot.active {
  background: #a78bfa;
  box-shadow:
    0 0 8px #7c3aed99,
    0 0 0 1px #6d28d9 inset;
}

.polyans-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.world-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 14px;
}
.world-header span {
  font-size: 20px;
}
.world-header h3 {
  margin: 0;
  border: none;
  padding: 0;
}

.sub-menu {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid #1f2937;
  padding-bottom: 0;
}
.sub-menu-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  bottom: -2px;
}
.sub-menu-btn:hover {
  color: #f3f4f6;
}
.sub-menu-btn.active {
  color: #fff;
  border-bottom-color: var(--page-color, #7c3aed);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--page-color, #7c3aed) 13%, transparent));
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

.status-msg {
  background: #1a1a2e;
  border-radius: 10px;
  padding: 16px;
  color: #9ca3af;
  font-size: 14px;
}
.status-msg.error {
  border-left: 4px solid #dc2626;
  color: #fca5a5;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 36px;
  }
}
