:root {
  --bg-obsidian: #0d0c0b;
  --surface-slate: #161412;
  --surface-raised: #1e1a16;
  --border-iron: #352f28;
  --border-brass: #6b5430;
  --gold-brass: #c59b49;
  --gold-bright: #e3c278;
  --crimson-blood: #9e1f24;
  --crimson-hover: #bd282e;
  --ink-parchment: #e4dac8;
  --ink-muted: #9a8f7e;
  --online-jade: #4ea86d;
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-obsidian);
  color: var(--ink-parchment);
}

body {
  margin: 0;
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  background:
    radial-gradient(ellipse 80% 45% at 50% 0%, rgba(158, 31, 36, 0.16), transparent 70%),
    linear-gradient(180deg, #12100e 0%, var(--bg-obsidian) 480px);
  color: var(--ink-parchment);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold-brass);
  outline-offset: 2px;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

/* Top Chronicle Bar */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(13, 12, 11, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-iron);
}

.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Noto Serif KR", serif;
}

.brand-hanja {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-brass);
  background: linear-gradient(180deg, #272018, #14110e);
  color: var(--gold-bright);
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(197, 155, 73, 0.2);
}

.brand-name {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--ink-parchment);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
}

.main-nav a:hover {
  color: var(--gold-bright);
}

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border-iron);
  background: var(--surface-slate);
  font-size: 13px;
  color: var(--ink-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6d655b;
}

.status-dot.is-online {
  background: var(--online-jade);
  box-shadow: 0 0 8px rgba(78, 168, 109, 0.7);
}

/* Hero Stage */
.hero {
  position: relative;
  padding: 88px 0 64px;
  border-bottom: 1px solid var(--border-iron);
  overflow: hidden;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 34%, rgba(197, 155, 73, 0.12), transparent 52%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 96px
    );
  pointer-events: none;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 780px;
}

.hero-seal {
  margin: 0 0 10px;
  font-family: "Noto Serif KR", serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.45em;
  color: var(--gold-brass);
}

.hero-title {
  margin: 0;
  font-family: "Noto Serif KR", serif;
  font-size: clamp(54px, 9vw, 92px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0.14em;
  background: linear-gradient(180deg, #f3e2bc 10%, #c59b49 62%, #7d5b25 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 36px rgba(0, 0, 0, 0.65);
}

.hero-lead {
  margin: 24px auto 0;
  max-width: 560px;
  font-size: 16px;
  color: var(--ink-parchment);
  opacity: 0.9;
}

.hero-actions {
  margin-top: 34px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 196px;
  height: 50px;
  padding: 0 28px;
  font-family: "Noto Serif KR", serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.btn-primary {
  background: linear-gradient(180deg, #b3252b, #7d1519);
  border: 1px solid #d49e4d;
  color: #f9efe0;
  box-shadow: inset 0 1px 0 rgba(255, 224, 178, 0.3), 0 8px 24px rgba(0, 0, 0, 0.5);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #c92d33, #8f181d);
  border-color: var(--gold-bright);
}

.btn-secondary {
  background: var(--surface-slate);
  border: 1px solid var(--border-iron);
  color: var(--ink-parchment);
}

.btn-secondary:hover {
  border-color: var(--border-brass);
  color: var(--gold-bright);
}

.realm-strip {
  margin: 48px auto 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border-iron);
  background: rgba(22, 20, 18, 0.9);
}

.realm-strip > div {
  padding: 16px 14px;
  border-right: 1px solid var(--border-iron);
}

.realm-strip > div:last-child {
  border-right: none;
}

.realm-strip dt {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.realm-strip dd {
  margin: 0;
  font-family: "Noto Serif KR", serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-bright);
}

/* Sections */
.section {
  padding: 76px 0;
  border-bottom: 1px solid var(--border-iron);
}

.section-alt {
  background: #110f0d;
}

.section-head {
  margin-bottom: 32px;
  max-width: 640px;
}

.section-head h2 {
  margin: 0 0 10px;
  font-family: "Noto Serif KR", serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--gold-bright);
}

.section-head p {
  margin: 0;
  color: var(--ink-muted);
}

/* 4-Class Grimoire */
.grimoire {
  border: 1px solid var(--border-iron);
  background: var(--surface-slate);
}

.class-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border-iron);
}

.class-tab {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--border-iron);
  background: #12100e;
  color: var(--ink-muted);
  padding: 18px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background-color 140ms ease, color 140ms ease;
}

.class-tab:last-child {
  border-right: 0;
}

.class-tab:hover {
  background: var(--surface-raised);
  color: var(--ink-parchment);
}

.class-tab.is-active {
  background: var(--surface-slate);
  color: var(--gold-bright);
  box-shadow: inset 0 2px 0 var(--gold-brass);
}

.tab-title {
  font-family: "Noto Serif KR", serif;
  font-size: 18px;
  font-weight: 700;
}

.tab-role {
  font-size: 12px;
  color: var(--ink-muted);
}

.class-sheet {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 36px;
  padding: 32px;
}

.class-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
}

.class-header h3 {
  margin: 0;
  font-family: "Noto Serif KR", serif;
  font-size: 28px;
  color: var(--ink-parchment);
}

.class-badge {
  font-size: 13px;
  color: var(--gold-brass);
}

.class-desc {
  margin: 0 0 24px;
  color: var(--ink-parchment);
  opacity: 0.9;
  max-width: 60ch;
}

.class-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
  border-top: 1px solid var(--border-iron);
  padding-top: 20px;
}

.class-meta-grid h4,
.class-stats h4 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-brass);
}

.class-meta-grid p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-parchment);
}

.full-span {
  grid-column: 1 / -1;
}

.skill-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-list li {
  padding: 4px 10px;
  border: 1px solid var(--border-iron);
  background: var(--surface-raised);
  font-size: 13px;
  color: var(--ink-parchment);
}

.class-stats {
  border-left: 1px solid var(--border-iron);
  padding-left: 28px;
}

.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.stat-row {
  display: grid;
  grid-template-columns: 44px 1fr 30px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.stat-label {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: var(--ink-muted);
}

.stat-track {
  height: 8px;
  background: #0d0c0b;
  border: 1px solid var(--border-iron);
}

.stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #7d1519, var(--gold-brass));
}

.stat-val {
  text-align: right;
  font-weight: 700;
  color: var(--gold-bright);
}

/* Rules Ledger */
.rules-ledger {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--border-iron);
  border-left: 1px solid var(--border-iron);
}

.rule-row {
  padding: 26px 28px;
  border-right: 1px solid var(--border-iron);
  border-bottom: 1px solid var(--border-iron);
  background: var(--surface-slate);
}

.rule-row h3 {
  margin: 0 0 10px;
  font-family: "Noto Serif KR", serif;
  font-size: 19px;
  color: var(--gold-bright);
}

.rule-row p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
}

/* Rankings & Dungeons Split */
.split-ledger {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 28px;
  align-items: start;
}

.ledger-panel {
  border: 1px solid var(--border-iron);
  background: var(--surface-slate);
  padding: 26px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-iron);
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-family: "Noto Serif KR", serif;
  font-size: 22px;
  color: var(--gold-bright);
}

.panel-note {
  font-size: 12px;
  color: var(--ink-muted);
}

.table-wrap {
  overflow-x: auto;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rank-table th,
.rank-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(53, 47, 40, 0.7);
  text-align: left;
}

.rank-table th {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

.empty-cell {
  text-align: center !important;
  padding: 28px 12px !important;
  color: var(--ink-muted);
}

.dungeon-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dungeon-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(53, 47, 40, 0.7);
}

.dungeon-list strong {
  font-family: "Noto Serif KR", serif;
  font-size: 15px;
  color: var(--ink-parchment);
}

.dungeon-list span {
  font-size: 13px;
  color: var(--ink-muted);
}

.siege-box {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid var(--border-brass);
  background: rgba(158, 31, 36, 0.1);
}

.siege-box h3 {
  margin: 0 0 6px;
  font-family: "Noto Serif KR", serif;
  font-size: 16px;
  color: var(--gold-bright);
}

.siege-box p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-parchment);
}

/* Footer */
.site-footer {
  padding: 36px 0 48px;
  color: var(--ink-muted);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.footer-brand {
  margin: 0 0 4px;
  font-family: "Noto Serif KR", serif;
  color: var(--ink-parchment);
  font-weight: 700;
}

.footer-legal {
  margin: 0;
  font-size: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a:hover {
  color: var(--gold-bright);
}

@media (max-width: 860px) {
  .main-nav {
    display: none;
  }
  .realm-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .realm-strip > div:nth-child(2) {
    border-right: none;
  }
  .realm-strip > div:nth-child(1),
  .realm-strip > div:nth-child(2) {
    border-bottom: 1px solid var(--border-iron);
  }
  .class-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  .class-sheet,
  .rules-ledger,
  .split-ledger {
    grid-template-columns: 1fr;
  }
  .class-stats {
    border-left: 0;
    border-top: 1px solid var(--border-iron);
    padding-left: 0;
    padding-top: 20px;
  }
}
