/* Wiki — EVA-02 CRT */

.wiki-shell {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 0;
  min-height: calc(100dvh - 280px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(20px);
}

.wiki-nav-pane {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.15);
}

.wiki-nav-top { flex-shrink: 0; padding: 20px 16px 12px; border-bottom: 1px solid var(--glass-border); }
.wiki-nav-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.wiki-nav-head h2 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 500; color: var(--text);
}
.wiki-nav-total { font-size: 11px; color: var(--muted-2); font-weight: 600; }

.wiki-search {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border); background: rgba(0,0,0,0.2);
  color: var(--text); font: inherit; font-size: 14px;
}
.wiki-nav-scroll { flex: 1; overflow-y: auto; padding: 10px 8px 20px; }

.wiki-nav-section-head {
  width: 100%; text-align: left; padding: 10px 10px 6px;
  border: none; background: transparent;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted-2); cursor: pointer;
}
.wiki-nav-section.collapsed .wiki-nav-list { display: none; }

.wiki-nav-item {
  width: 100%; text-align: left; padding: 11px 12px;
  border: none; border-radius: var(--radius); background: transparent;
  color: var(--muted); font: inherit; cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.wiki-nav-item:hover, .wiki-nav-item.active {
  background: rgba(255,255,255,0.06); color: var(--text);
  border-left-color: var(--accent);
}
.wiki-nav-item-title { display: block; font-size: 13px; font-weight: 600; line-height: 1.4; }
.wiki-nav-item-sub { display: block; font-size: 11px; color: var(--muted-2); margin-top: 3px; }

.wiki-doc-pane { min-height: 0; overflow-y: auto; background: transparent; }

.wiki-welcome { max-width: 640px; padding: 40px clamp(20px, 4vw, 48px); }
.wiki-welcome h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 32px); font-weight: 500;
  color: var(--text); margin-bottom: 14px;
}
.wiki-welcome-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}
.wiki-welcome-hint { margin-top: 16px; font-size: 14px; color: var(--muted-2); }

.wiki-doc-head { padding: 32px clamp(20px, 4vw, 48px) 0; max-width: 780px; }
.wiki-doc-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 38px); font-weight: 500;
  color: var(--text); margin: 12px 0 14px; line-height: 1.15;
}
.wiki-doc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.wiki-chip {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border); color: var(--muted); background: rgba(0,0,0,0.2);
}
.wiki-tag { font-size: 11px; color: var(--muted-2); }
.wiki-source-link { font-size: 13px; color: var(--accent); font-weight: 600; text-decoration: none; }
.wiki-back-btn {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-bottom: 12px;
  border: 1px solid var(--glass-border); border-radius: 50%;
  background: var(--glass); color: var(--muted); cursor: pointer;
}

.wiki-doc-body.detail-body {
  max-width: 780px;
  padding: 20px clamp(20px, 4vw, 48px) 40px;
  font-size: 17px; line-height: 1.75; color: var(--muted);
}
.wiki-doc-foot {
  max-width: 780px; padding: 16px clamp(20px, 4vw, 48px) 28px;
  border-top: 1px solid var(--glass-border); color: var(--muted-2); font-size: 11px;
}

.detail-body h1, .detail-body h2, .detail-body h3 {
  font-family: var(--font-display); color: var(--text); font-weight: 500;
  margin: 1.5em 0 0.5em; line-height: 1.25;
}
.detail-body h2 { font-size: 1.3em; }
.detail-body p { margin: 0 0 1em; }
.detail-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.detail-body blockquote {
  margin: 1.2em 0; padding: 0.5em 0 0.5em 1.2em;
  border-left: 2px solid var(--accent); color: var(--muted); font-style: italic;
}
.detail-body pre {
  margin: 1.2em 0; padding: 16px; border-radius: var(--radius);
  background: rgba(0,0,0,0.35); border: 1px solid var(--glass-border); overflow-x: auto;
}
.detail-body th, .detail-body td {
  border: 1px solid var(--glass-border); padding: 10px 12px;
}
.detail-body th { background: rgba(0,0,0,0.25); color: var(--text); }

img.md-img {
  max-width: 100%; border-radius: var(--radius); margin: 1.2em 0;
  border: 1px solid var(--glass-border);
}
.wiki-media {
  margin: 1.4em 0; border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--glass-border); background: #000;
}
.wiki-media iframe, .wiki-media video {
  width: 100%; display: block; max-height: min(50vh, 400px); border: none;
}
.wiki-media--audio audio, .wiki-native-media {
  width: 100%; max-width: 100%; margin: 0.8em 0;
}

.wiki-empty, .wiki-loading { padding: 48px 24px; text-align: center; color: var(--muted); }
.wiki-spinner {
  width: 28px; height: 28px; margin: 0 auto 12px;
  border: 2px solid var(--glass-border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

@media (max-width: 767px) {
  .wiki-shell { grid-template-columns: 1fr; min-height: calc(100dvh - 240px); }
  .wiki-shell.wiki-reading .wiki-nav-pane { display: none; }
  .wiki-shell:not(.wiki-reading) .wiki-doc-pane { display: none; }
  .wiki-shell.wiki-reading .wiki-back-btn { display: inline-flex; }
}
@media (min-width: 1024px) {
  .wiki-shell { grid-template-columns: 300px 1fr; }
}

.entity-sheet-body.detail-body { padding: 8px 24px 32px; }

@media (prefers-reduced-motion: reduce) {
  .wiki-spinner { animation: none; }
}
