@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Noto+Serif+JP:wght@400;500;700;900&display=swap');

:root {
  --bg-deep: #0d0a14;
  --bg-panel: #1a1025;
  --bg-card: #231832;
  --bg-card-hover: #2d1f42;
  --border-subtle: rgba(201,169,53,0.15);
  --border-accent: rgba(201,169,53,0.4);
  --gold: #c9a935;
  --gold-light: #e8d47a;
  --gold-dim: #8a7323;
  --crimson: #8b0000;
  --crimson-light: #c41e3a;
  --text-primary: #e8e0d0;
  --text-secondary: #a89b8a;
  --text-dim: #6b5f52;
  --purple-deep: #4a1a6b;
  --purple-accent: #7b3fa0;
  --shadow-glow: rgba(201,169,53,0.08);
  --nav-width: 280px;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) var(--bg-deep);
}

body {
  font-family: 'Noto Serif JP', serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.9;
  font-size: 15px;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(74,26,107,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,0,0,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(201,169,53,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ==================== PROGRESS BAR ==================== */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--crimson), var(--gold), var(--purple-accent));
  z-index: 10000;
  transition: width 0.15s ease;
}

/* ==================== SIDE NAVIGATION ==================== */
#side-nav {
  position: fixed;
  top: 0; left: 0;
  width: var(--nav-width);
  height: 100vh;
  background: linear-gradient(180deg, #110d1a 0%, #1a1328 50%, #0f0b16 100%);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  z-index: 1000;
  padding: 20px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}

#side-nav .nav-header {
  text-align: center;
  padding: 20px 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

#side-nav .nav-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 4px;
}

#side-nav .nav-subtitle {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.nav-section {
  padding: 4px 0;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dim);
  padding: 12px 20px 6px;
}

.nav-link {
  display: block;
  padding: 8px 20px 8px 28px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  border-left: 3px solid transparent;
  transition: all var(--transition-smooth);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(201,169,53,0.05);
  border-left-color: var(--gold-dim);
}

.nav-link.active {
  color: var(--gold);
  background: rgba(201,169,53,0.08);
  border-left-color: var(--gold);
  font-weight: 500;
}

.nav-link.sub {
  padding-left: 40px;
  font-size: 12px;
  color: var(--text-dim);
}

.nav-link.sub:hover, .nav-link.sub.active {
  color: var(--gold-light);
}

/* ==================== MAIN CONTENT ==================== */
#main-content {
  margin-left: var(--nav-width);
  position: relative;
  z-index: 1;
}

/* ==================== HERO SECTION ==================== */
.hero {
  position: relative;
  height: 70vh;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(180deg, #0d0a14 0%, #1a0a2e 50%, #0d0a14 100%);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: 
    radial-gradient(circle at 50% 50%, rgba(201,169,53,0.06) 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(201,169,53,0.02) 2px, rgba(201,169,53,0.02) 4px);
  animation: heroShimmer 8s ease-in-out infinite;
}

@keyframes heroShimmer {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero h1 {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 16px;
}

.hero .main-title {
  font-size: 48px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 8px;
  margin-bottom: 24px;
  text-shadow: 0 0 40px rgba(201,169,53,0.2);
}

.hero .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 4px;
  font-family: 'Cinzel', serif;
}

.hero-divider {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 20px auto;
}

/* ==================== SECTION STYLES ==================== */
.section {
  padding: 80px 60px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-number {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 5px;
  color: var(--gold-dim);
  text-transform: uppercase;
  display: block;
  margin-bottom: 12px;
}

.section-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 4px;
  margin-bottom: 16px;
}

.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

.divider {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 16px auto;
}

/* ==================== TAB NAVIGATION ==================== */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 40px;
}

.tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 10px 24px;
  font-family: 'Noto Serif JP', serif;
  font-size: 13px;
  cursor: pointer;
  border-radius: 2px;
  transition: all var(--transition-smooth);
  letter-spacing: 1px;
}

.tab-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.tab-btn.active {
  background: var(--bg-card-hover);
  color: var(--gold);
  border-color: var(--gold);
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== CHARACTER CARD ==================== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.char-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
  transition: all var(--transition-smooth);
  cursor: default;
}

.char-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px var(--border-accent);
}

.char-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-bottom: 1px solid var(--border-subtle);
}

.char-card-body {
  padding: 20px;
}

.char-card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.char-card-title {
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.char-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ==================== DETAIL PANEL (for main characters) ==================== */
.detail-panel {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 32px;
  margin-bottom: 32px;
  transition: all var(--transition-smooth);
}

.detail-panel:hover {
  border-color: var(--border-accent);
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

.detail-img {
  width: 100%;
  border-radius: 2px;
  border: 1px solid var(--border-subtle);
}

.detail-info h3 {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.detail-info .char-epithet {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 1px;
  margin-bottom: 16px;
  display: block;
}

.detail-info .stat-table {
  margin-bottom: 16px;
}

.stat-table td {
  padding: 4px 0;
  font-size: 13px;
  vertical-align: top;
}

.stat-table td:first-child {
  color: var(--gold-dim);
  padding-right: 16px;
  white-space: nowrap;
  font-weight: 500;
}

.detail-info p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 12px;
}

/* ==================== ENEMY PANEL ==================== */
.enemy-panel {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 40px;
  background: var(--bg-card);
  border: 1px solid rgba(139,0,0,0.3);
  border-radius: 3px;
  padding: 32px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.enemy-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(139,0,0,0.05) 0%, transparent 50%);
  pointer-events: none;
}

.enemy-panel:hover {
  border-color: rgba(139,0,0,0.5);
  box-shadow: 0 4px 24px rgba(139,0,0,0.1);
}

.enemy-img {
  width: 100%;
  border-radius: 2px;
  border: 1px solid rgba(139,0,0,0.2);
  position: relative;
  z-index: 1;
}

.enemy-info {
  position: relative;
  z-index: 1;
}

.enemy-info h3 {
  font-size: 24px;
  font-weight: 900;
  color: var(--crimson-light);
  margin-bottom: 6px;
}

.enemy-info .enemy-epithet {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 1px;
  margin-bottom: 16px;
  display: block;
}

.enemy-info p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 12px;
}

/* ==================== NATION PANEL ==================== */
.nation-panel {
  margin-bottom: 48px;
}

.nation-img-container {
  width: 100%;
  height: 300px;
  overflow: hidden;
  border-radius: 3px;
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
}

.nation-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.nation-panel:hover .nation-img {
  transform: scale(1.03);
}

.nation-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.nation-subtitle {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.nation-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 2;
  column-count: 2;
  column-gap: 40px;
}

/* ==================== DUNGEON FLOOR PANEL ==================== */
.floor-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
  transition: all var(--transition-smooth);
}

.floor-panel:nth-child(even) {
  direction: rtl;
}

.floor-panel:nth-child(even) > * {
  direction: ltr;
}

.floor-panel:hover {
  border-color: var(--border-accent);
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

.floor-img-container {
  overflow: hidden;
}

.floor-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 280px;
  transition: transform 0.6s ease;
}

.floor-panel:hover .floor-img {
  transform: scale(1.05);
}

.floor-info {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.floor-number {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--gold-dim);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.floor-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.floor-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.9;
}

/* ==================== LORE BOX (for Whisperer section) ==================== */
.lore-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--gold);
  padding: 28px 32px;
  margin-bottom: 24px;
  border-radius: 0 3px 3px 0;
}

.lore-box h4 {
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 12px;
}

.lore-box p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 2;
}

.lore-img-wide {
  width: 100%;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

/* ==================== FOOTER ==================== */
footer {
  text-align: center;
  padding: 60px;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 2px;
  border-top: 1px solid var(--border-subtle);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
  .detail-panel, .enemy-panel {
    grid-template-columns: 300px 1fr;
  }
  .nation-desc { column-count: 1; }
}

@media (max-width: 900px) {
  #side-nav { display: none; }
  #main-content { margin-left: 0; }
  .section { padding: 48px 24px; }
  .detail-panel, .enemy-panel {
    grid-template-columns: 1fr;
  }
  .floor-panel {
    grid-template-columns: 1fr;
  }
  .floor-panel:nth-child(even) { direction: ltr; }
  .hero .main-title { font-size: 32px; letter-spacing: 4px; }
  .char-grid { grid-template-columns: 1fr; }
}

/* ==================== FLAVOR TEXT ==================== */
.flavor-cite {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--gold-dim);
  margin-top: 12px;
  letter-spacing: 1px;
}
