:root {
  --bg: #0d0f13;
  --panel: #14171c;
  --panel-alt: #1b1f26;
  --border: #262b33;
  --text: #e7e9ec;
  --muted: #8b93a1;
  --gold: #f5c34d;
  --gold-dim: #caa03f;
  --link: #7fb0ff;
  --code-bg: #10131780;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  background: var(--panel);
}

.site-header .brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.site-header .brand .accent {
  color: var(--gold);
}

.site-header .brand .wiki-tag {
  color: var(--muted);
  font-weight: 400;
  font-size: 1rem;
  margin-left: 4px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 7px 10px 7px 14px;
  cursor: pointer;
}

.search-trigger:hover {
  border-color: var(--gold-dim);
  color: var(--text);
}

.search-trigger kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
}

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 7, 0.72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  z-index: 100;
}

.search-overlay[hidden] {
  display: none;
}

.search-modal {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 1.05rem;
  padding: 16px 18px;
  outline: none;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.search-result a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text);
}

.search-result a:hover {
  text-decoration: none;
}

.search-result.active a,
.search-result a:hover {
  background: var(--panel-alt);
}

.search-result-title {
  font-weight: 600;
}

.search-result.active .search-result-title {
  color: var(--gold);
}

.search-result-snippet {
  color: var(--muted);
  font-size: 0.85rem;
}

.search-empty {
  padding: 16px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .search-trigger span {
    display: none;
  }
}

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1100px;
  margin: 0 auto;
  min-height: calc(100vh - 130px);
}

.sidebar {
  flex: 0 0 220px;
  padding: 24px 16px;
  position: sticky;
  top: 0;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar li {
  margin: 2px 0;
}

.sidebar a {
  display: block;
  padding: 7px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.sidebar a:hover {
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.sidebar a.active {
  background: var(--panel-alt);
  color: var(--gold);
  font-weight: 600;
  border: 1px solid var(--border);
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 32px 24px 64px;
}

.content h1 {
  font-size: 1.9rem;
  margin-top: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.content h2 {
  font-size: 1.35rem;
  margin-top: 2.2em;
  color: var(--gold);
}

.content h3 {
  font-size: 1.1rem;
  margin-top: 1.8em;
}

.content p,
.content li {
  color: var(--text);
}

.content code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.content pre {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
}

.content pre code {
  background: none;
  border: none;
  padding: 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}

.content th,
.content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.content th {
  background: var(--panel);
  color: var(--gold-dim);
}

.content blockquote {
  border-left: 3px solid var(--gold-dim);
  margin: 1.2em 0;
  padding: 0.2em 1em;
  color: var(--muted);
  background: var(--panel);
  border-radius: 0 6px 6px 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    width: 100%;
    padding: 12px 16px;
  }

  .sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
}
