:root {
  --bg: #0a0e14;
  --bg-2: #11161d;
  --bg-3: #182029;
  --panel: #1a2230;
  --panel-2: #222c3a;
  --border: #2a3543;
  --text: #e6edf3;
  --text-dim: #9aa6b2;
  --text-muted: #6c7a89;
  --accent: #39ff14;
  --accent-2: #00d9ff;
  --warn: #ffb454;
  --bad: #ff5555;
  --good: #4caf50;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  --radius: 10px;
  --radius-sm: 6px;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-display: 'Rajdhani', 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-2: #ffffff;
  --bg-3: #e5e7eb;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --border: #d1d5db;
  --text: #0f172a;
  --text-dim: #475569;
  --text-muted: #94a3b8;
  --accent: #0ea847;
  --accent-2: #0e7490;
  --warn: #b45309;
  --bad: #b91c1c;
  --good: #047857;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute; left: -9999px;
  background: var(--accent); color: #000; padding: 8px 12px; border-radius: 6px;
  z-index: 1000;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ===== TOP BAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.icon-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--accent); }

.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.brand-logo {
  font-size: 28px;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.5);
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text h1 .accent { color: var(--accent); }
.brand-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
}
.search-wrap input {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  width: 240px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s;
}
.search-wrap input:focus { border-color: var(--accent); }
@media (max-width: 700px) {
  .search-wrap input { width: 140px; }
  .brand-text h1 { font-size: 15px; }
  .brand-sub { display: none; }
}

#navToggle {
  display: none;
}
@media (max-width: 900px) {
  #navToggle { display: inline-flex; }
}

/* ===== LAYOUT ===== */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

/* ===== NAV PANEL ===== */
.nav-panel {
  border-right: 1px solid var(--border);
  background: var(--bg-2);
  padding: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
}

@media (max-width: 900px) {
  .nav-panel {
    position: fixed;
    inset: 60px 0 0 0;
    max-height: calc(100vh - 60px);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 40;
    box-shadow: var(--shadow);
  }
  .nav-panel.open { transform: translateX(0); }
}

.nav-group { margin-bottom: 18px; }
.nav-group h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.nav-link span { font-family: var(--font-mono); opacity: .8; min-width: 18px; }
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link.active {
  background: var(--panel-2);
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

/* ===== MAIN CONTENT ===== */
.content {
  padding: 24px 32px 60px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 700px) {
  .content { padding: 16px 16px 80px; }
}

/* ===== SECTIONS ===== */
.page-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.page-header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.page-header .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  text-transform: uppercase;
}
.tag.coalition-blue { color: #5fb4ff; border-color: #5fb4ff44; background: #5fb4ff10; }
.tag.coalition-red { color: #ff7373; border-color: #ff737344; background: #ff737310; }
.tag.coalition-both { color: var(--warn); border-color: var(--warn); background: #ffb45410; }
.tag.cat-fighter { color: var(--accent); }
.tag.cat-multirole { color: var(--accent-2); }
.tag.cat-attack { color: var(--warn); }
.tag.cat-helicopter { color: #b794f4; }
.tag.cat-wwii { color: #f4a261; }
.tag.cat-coldwar { color: #ef6c57; }
.tag.cat-trainer { color: #94a3b8; }

.lede {
  font-size: 18px;
  color: var(--text-dim);
  margin: 16px 0 0;
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 14px;
}

/* ===== CARDS / TIPS ===== */
.section { margin-bottom: 32px; }
.section h2 {
  margin: 0 0 14px;
  font-size: 22px;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
}

.section h3 {
  margin: 24px 0 10px;
  font-size: 16px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.tip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color .15s, transform .15s;
}
.tip:hover { border-color: var(--accent); }

.tip .icon {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.tip.good .icon { background: #1e4d2c; color: #66ff8a; }
.tip.warn .icon { background: #4d3c1e; color: #ffce5c; }
.tip.bad .icon  { background: #4d1e1e; color: #ff8484; }
.tip.tip .icon  { background: #1e3c4d; color: #66d3ff; }

.tip-content { flex: 1; line-height: 1.55; }

.tip code, .lede code, .page-header code {
  font-family: var(--font-mono);
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
  color: var(--accent);
}

/* ===== WEAPON / REFERENCE LISTS ===== */
.weapon-list, .reference-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.weapon-list li, .reference-list li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
}
.weapon-list li strong, .reference-list li strong {
  color: var(--accent);
  font-family: var(--font-mono);
  margin-right: 6px;
}
.reference-list a {
  color: var(--accent-2);
  text-decoration: none;
  word-break: break-all;
}
.reference-list a:hover { text-decoration: underline; }

/* ===== GLOSSARY ===== */
.glossary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.gloss {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.gloss-term {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.5px;
}
.gloss-def { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* ===== HOME / HERO ===== */
.hero {
  background:
    radial-gradient(ellipse at top, rgba(57, 255, 20, 0.08), transparent 60%),
    linear-gradient(135deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 28px;
}
.hero h1 {
  margin: 0 0 6px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
}
.hero h1 .accent { color: var(--accent); }
.hero p { color: var(--text-dim); font-size: 16px; margin: 0 0 14px; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--accent);
  font-weight: 700;
}
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.aircraft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.aircraft-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}
.aircraft-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.aircraft-card .name {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.aircraft-card .short {
  font-size: 12px;
  color: var(--accent);
  font-family: var(--font-mono);
}
.aircraft-card .tagline {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
.aircraft-card .row { display: flex; gap: 4px; flex-wrap: wrap; }

/* ===== SEARCH HIGHLIGHT ===== */
mark {
  background: var(--accent);
  color: #000;
  padding: 0 2px;
  border-radius: 2px;
}

/* ===== BOTTOM BAR (mobile) ===== */
.bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  z-index: 30;
  padding: 8px 0;
}
.bottom-bar .bottom-link {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: inherit;
  padding: 8px;
  cursor: pointer;
}
.bottom-bar .bottom-link.active { color: var(--accent); }
@media (max-width: 700px) {
  .bottom-bar { display: flex; }
  .footer { padding-bottom: 70px; }
}

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== LOADING ===== */
.loading {
  padding: 60px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ===== ANIMATION ===== */
@keyframes slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.content > * { animation: slide-in .25s ease; }