:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.95);
  --bg-subtle: rgba(255, 255, 255, 0.03);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-secondary: #818cf8;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(56, 189, 248, 0.4);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --code-bg: #050811;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-secondary: #4f46e5;
  --border: #e2e8f0;
  --border-strong: #38bdf8;
  --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
  --code-bg: #0f172a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(129, 140, 248, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.65;
  font-size: 16px;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.nav-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main) !important;
  text-decoration: none !important;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.42rem 0.8rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  background: var(--bg-subtle);
}

.theme-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.container {
  max-width: 1180px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
}

.subnav a {
  padding: 0.4rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.2s;
}

.subnav a:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.subnav a.active {
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent);
  border-color: var(--border-strong);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-card {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(129, 140, 248, 0.08)), var(--bg-card);
  border: 1px solid var(--border-strong);
  padding: 2.25rem;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.15rem;
  margin: 1.25rem 0;
}

.mini-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mini-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

h1, h2, h3, h4 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.3;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.4rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.15rem;
  color: var(--accent);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

ul.tech-tree {
  list-style: none;
  padding-left: 0;
  margin: 0.75rem 0 1.5rem 0;
}

ul.tech-tree li {
  position: relative;
  padding: 0.35rem 0 0.35rem 1.25rem;
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
}

ul.tech-tree li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.95rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

ul.tech-tree li.level-0 {
  border-left: none;
  margin-left: 0;
  padding-left: 0;
  margin-top: 0.85rem;
  font-weight: 600;
}

ul.tech-tree li.level-0::before {
  display: none;
}

ul.tech-tree li.level-1 { margin-left: 0.75rem; }
ul.tech-tree li.level-2 { margin-left: 2.0rem; border-left-color: rgba(129, 140, 248, 0.35); }
ul.tech-tree li.level-2::before { background: var(--accent-secondary); width: 6px; height: 6px; left: -4px; }
ul.tech-tree li.level-3 { margin-left: 3.25rem; font-size: 0.94rem; color: var(--text-muted); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th, td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) {
  background: var(--bg-subtle);
}

tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

th, tr[bgcolor] td:first-child, td.table-header {
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
}

.badge-excellent { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-vgood { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.35); }
.badge-good { background: rgba(129, 140, 248, 0.15); color: #a5b4fc; border: 1px solid rgba(129, 140, 248, 0.35); }
.badge-avg { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-poor { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.35); }

img:not([width="1"]) {
  max-width: 100%;
  height: auto;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: zoom-in;
}

img:not([width="1"]):hover {
  transform: scale(1.01);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

.code-wrapper {
  position: relative;
  margin: 1.25rem 0;
}

pre.code-block {
  background: var(--code-bg);
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-strong);
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.92rem;
  line-height: 1.6;
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 0.45rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn:hover {
  background: #38bdf8;
  color: #0b0f19;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.92);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 1.5rem;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 94vw;
  max-height: 82vh;
  border-radius: 0.5rem;
  border: 1px solid var(--border-strong);
  cursor: default;
}

.lightbox-bar {
  margin-top: 0.85rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  color: #f1f5f9;
  font-size: 0.95rem;
}

.lightbox-close {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.35rem 0.85rem;
  border-radius: 0.45rem;
  cursor: pointer;
  font-weight: 600;
}

.site-footer {
  max-width: 1180px;
  margin: 3rem auto 2rem auto;
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

@media (max-width: 768px) {
  .card { padding: 1.25rem; }
  h1 { font-size: 1.55rem; }
  .nav-container { flex-direction: column; align-items: flex-start; }
}