/* ===================================================================
   더 킹덤 (The Kingdom) 공식 위키 & 백과사전 커스텀 스타일시트
   Fantasy RPG & Modern Docs Hybrid Design
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=Pretendard:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg-primary: #070a12;
  --bg-secondary: #0c1222;
  --bg-card: rgba(18, 25, 43, 0.75);
  --bg-card-hover: rgba(28, 38, 65, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(245, 158, 11, 0.3);
  --gold-glow: rgba(245, 158, 11, 0.15);
  --accent-gold: #f59e0b;
  --accent-gold-light: #fbbf24;
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --sidebar-w: 280px;
  --toc-w: 240px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow-x: hidden;
}

.font-fantasy {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.05em;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* 커스텀 스크롤바 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 15, 25, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* 글래스모피즘 */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
}

.glass-nav {
  background: rgba(7, 10, 18, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

/* 사이드바 메뉴 아이템 */
.nav-article-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

.nav-article-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.nav-article-link.active {
  color: var(--accent-gold-light);
  background: rgba(245, 158, 11, 0.12);
  font-weight: 600;
  border-left: 3px solid var(--accent-gold);
}

.nav-article-link.active::after {
  content: '';
  position: absolute;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

/* 마크다운 본문 타이포그래피 */
.wiki-prose {
  color: #d1d5db;
  font-size: 15.5px;
  line-height: 1.8;
}

.wiki-prose h1, .wiki-prose h2, .wiki-prose h3, .wiki-prose h4 {
  color: #fff;
  font-weight: 700;
  scroll-margin-top: 90px;
}

.wiki-prose h2 {
  font-size: 1.65rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiki-prose h3 {
  font-size: 1.35rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #f3f4f6;
}

.wiki-prose h4 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--accent-gold-light);
}

.wiki-prose p {
  margin-top: 0.8rem;
  margin-bottom: 1.2rem;
}

.wiki-prose hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 2.5rem 0;
}

.wiki-prose ul {
  list-style-type: none;
  padding-left: 0;
  margin-bottom: 1.5rem;
}

.wiki-prose ul > li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 0.65rem;
}

.wiki-prose ul > li::before {
  content: '▸';
  position: absolute;
  left: 0.3rem;
  color: var(--accent-gold);
  font-size: 1rem;
}

.wiki-prose strong {
  color: #fff;
  font-weight: 700;
}

/* 인용구 / 콜아웃 */
.wiki-prose blockquote {
  background: rgba(30, 41, 59, 0.5);
  border-left: 4px solid var(--accent-gold);
  border-radius: 0 10px 10px 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: #cbd5e1;
}

.wiki-prose blockquote strong {
  color: var(--accent-gold-light);
}

/* 직업 인포 카드 */
.job-intro-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--accent-gold);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 20px 0 15px 0;
}

.job-avatar {
  width: 52px;
  height: 52px;
  object-fit: contain;
  image-rendering: pixelated;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.job-meta h4 {
  margin: 0 0 4px 0;
  font-size: 17px;
  font-weight: 700;
}

.job-pos {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* 스킬 인터랙티브 카드 그리드 */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
  margin: 18px 0 30px 0;
}

.skill-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  transition: all 0.2s ease;
}

.skill-card:hover {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(245, 158, 11, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.skill-card.ultimate-skill {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.7) 0%, rgba(67, 20, 7, 0.5) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
}

.skill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.skill-level-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #93c5fd;
}

.skill-card.ultimate-skill .skill-level-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.skill-cooldown-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.skill-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px 0;
}

.skill-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.6;
  margin: 0;
}

/* 우측 On-This-Page TOC 목차 */
.toc-link {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-link:hover {
  color: #fff;
  border-left-color: rgba(255, 255, 255, 0.3);
}

.toc-link.active {
  color: var(--accent-gold-light);
  font-weight: 600;
  border-left-color: var(--accent-gold);
}

.toc-link.h3-indent {
  padding-left: 22px;
  font-size: 12px;
  color: var(--text-dim);
}

.toc-link.h3-indent:hover {
  color: #cbd5e1;
}

/* 검색 하이라이트 */
mark.wiki-highlight {
  background: rgba(245, 158, 11, 0.35);
  color: #fff;
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* 전역 검색 모달 */
.search-modal-backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

/* =======================================================
 * 실시간 비주얼(WYSIWYG) 위키 편집기 스타일
 * ======================================================= */
.wiki-editor-toolbar {
  position: sticky;
  top: 4.5rem;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: rgba(13, 18, 34, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 16px;
  padding: 8px 12px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.15);
}

.editor-btn-group {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.editor-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.editor-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.editor-tool-btn.active {
  background: rgba(245, 158, 11, 0.25);
  color: var(--accent-gold-light);
  border-color: rgba(245, 158, 11, 0.5);
}

.editor-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.editor-color-dot:hover {
  transform: scale(1.25);
}

/* 편집 활성 영역 스타일 */
.wiki-prose.is-editing {
  outline: 2px dashed rgba(245, 158, 11, 0.45);
  border-radius: 16px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.3);
  transition: outline-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 240px;
  caret-color: var(--accent-gold);
}

.wiki-prose.is-editing:focus {
  outline: 2px solid var(--accent-gold);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.2);
}

.editor-editable-inline {
  outline: 1.5px dashed rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 4px 8px;
  transition: all 0.2s ease;
  caret-color: var(--accent-gold);
}

.editor-editable-inline:focus {
  outline: 2px solid var(--accent-gold);
  background: rgba(245, 158, 11, 0.08);
}

/* 본문 내 이미지 스타일 (복사 붙여넣기 포함) */
.wiki-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  margin: 18px auto;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.wiki-prose.is-editing img {
  cursor: pointer;
  transition: outline 0.2s ease;
}

.wiki-prose.is-editing img:hover {
  outline: 2px solid var(--accent-gold);
}

/* 편집 팁 배너 */
.editor-tip-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  color: #fef3c7;
  font-size: 12px;
}

