/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif; font-weight: 400; line-height: 1.6; color: #f5f5dc; background-color: #0a192f; min-height: 100vh; overflow-x: hidden; }
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }
input { font: inherit; color: inherit; border: none; background: none; outline: none; }
:focus-visible { outline: 2px solid #39ff14; outline-offset: 2px; }
::selection { background: #39ff14; color: #0a192f; }

/* ===== CSS Variables ===== */
:root {
  --color-bg: #0a192f;
  --color-bg-secondary: #2a2a2e;
  --color-accent: #39ff14;
  --color-gold: #ffd700;
  --color-helper: #4a7c59;
  --color-warning: #d97a5c;
  --color-text: #f5f5dc;
  --color-text-white: #ffffff;
  --color-border: rgba(57, 255, 20, 0.15);
  --color-border-light: rgba(245, 245, 220, 0.1);
  --nav-width: 240px;
  --nav-collapsed: 64px;
  --header-z: 1000;
  --transition-speed: 0.3s;
  --font-mono: 'Roboto Condensed', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --font-heading: 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --shadow-card: 0 2px 12px rgba(0,0,0,0.4);
  --radius-sm: 2px;
  --radius-md: 4px;
}

/* ===== Skip Link ===== */
.skip-link {
  position: fixed;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 8px 16px;
  background: #39ff14;
  color: #0a192f;
  font-weight: 700;
  font-size: 14px;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ===== Progress Bar ===== */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #39ff14, #ffd700);
  z-index: 9998;
  transition: width 0.1s linear;
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar { display: none; }
}

/* ===== Site Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-width);
  height: 100vh;
  background: #0a192f;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: var(--header-z);
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.header-brand {
  padding: 28px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-bottom: 1px solid var(--color-border);
}
.brand-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #39ff14;
  text-transform: uppercase;
  line-height: 1.2;
  transition: opacity 0.2s;
}
.brand-text:hover { opacity: 0.85; }
.brand-slash {
  display: block;
  width: 40px;
  height: 2px;
  background: #39ff14;
  margin-top: 10px;
  transform: skewX(-20deg);
  opacity: 0.6;
}

/* ===== Nav Toggle (Mobile) ===== */
.nav-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: calc(var(--header-z) + 2);
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: rgba(10, 25, 47, 0.9);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.nav-toggle-line {
  display: block;
  width: 24px;
  height: 2px;
  background: #39ff14;
  transition: transform var(--transition-speed), opacity var(--transition-speed);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Main Nav ===== */
.main-nav { flex: 1; padding: 16px 0; }
.nav-list { display: flex; flex-direction: column; gap: 0; }
.nav-item { border-bottom: 1px solid var(--color-border-light); }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  color: #f5f5dc;
  letter-spacing: 0.02em;
  transition: background 0.2s, color 0.2s;
  position: relative;
}
.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: transparent;
  transition: background 0.2s;
}
.nav-link:hover { background: rgba(57, 255, 20, 0.06); color: #39ff14; }
.nav-link:hover::before { background: #39ff14; }
.nav-link[aria-current="page"] {
  background: rgba(57, 255, 20, 0.08);
  color: #ffffff;
  font-weight: 600;
}
.nav-link[aria-current="page"]::before { background: #39ff14; }
.nav-link[aria-current="page"] .nav-index { color: #ffd700; }
.nav-index {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: #ffd700;
  min-width: 28px;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

/* ===== Header Search ===== */
.header-search {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--color-border);
  position: relative;
}
.search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(57, 255, 20, 0.2);
  border-radius: var(--radius-sm);
  color: #f5f5dc;
  font-size: 13px;
  font-family: var(--font-mono);
  transition: border-color 0.2s, background 0.2s;
}
.search-input::placeholder { color: rgba(245, 245, 220, 0.35); font-family: var(--font-mono); }
.search-input:focus { border-color: #39ff14; background: rgba(57, 255, 20, 0.04); }
.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(57, 255, 20, 0.4);
  border-radius: 50%;
  pointer-events: none;
}
.search-icon::after {
  content: '';
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 6px;
  height: 2px;
  background: rgba(57, 255, 20, 0.4);
  transform: rotate(45deg);
}

/* ===== Main Content Area ===== */
#main-content {
  margin-left: var(--nav-width);
  min-height: 100vh;
  position: relative;
  padding: 0;
}
@media (prefers-reduced-motion: reduce) {
  #main-content { scroll-behavior: auto; }
}

/* ===== Site Footer ===== */
.site-footer {
  margin-left: var(--nav-width);
  background: #2a2a2e;
  border-top: 1px solid rgba(57, 255, 20, 0.08);
  padding: 0;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.footer-primary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}
.footer-brand { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.footer-brand .brand-text { font-size: 18px; }
.trust-statement {
  font-size: 13px;
  color: rgba(245, 245, 220, 0.6);
  line-height: 1.6;
  max-width: 360px;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer-link {
  font-size: 13px;
  color: #f5f5dc;
  padding: 4px 8px;
  transition: color 0.2s;
  letter-spacing: 0.02em;
}
.footer-link:hover { color: #39ff14; }
.footer-link-sep { color: rgba(57, 255, 20, 0.25); font-size: 12px; }
.footer-secondary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid rgba(245, 245, 220, 0.06);
}
.footer-contact {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.contact-item {
  font-size: 12px;
  color: rgba(245, 245, 220, 0.5);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.footer-icp .icp-text {
  font-size: 12px;
  color: rgba(245, 245, 220, 0.4);
  font-family: var(--font-mono);
}
.footer-note {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid rgba(245, 245, 220, 0.04);
}
.note-text {
  font-size: 11px;
  color: rgba(245, 245, 220, 0.3);
  line-height: 1.5;
}
.copyright {
  font-size: 11px;
  color: rgba(245, 245, 220, 0.3);
  font-family: var(--font-mono);
}

/* ===== Scroll Top Button ===== */
.scroll-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  background: rgba(10, 25, 47, 0.9);
  border: 1px solid rgba(57, 255, 20, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #39ff14;
  font-size: 18px;
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-speed), visibility var(--transition-speed), background 0.2s;
  cursor: pointer;
}
.scroll-top[data-visible] { opacity: 1; visibility: visible; }
.scroll-top:hover { background: rgba(57, 255, 20, 0.12); }
.scroll-top::before {
  content: '↑';
  font-weight: 700;
  font-family: var(--font-mono);
}
@media (prefers-reduced-motion: reduce) {
  .scroll-top { display: none; }
}

/* ===== Generic Utilities ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.section { padding: 48px 0; }
.card {
  background: rgba(42, 42, 46, 0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: rgba(57, 255, 20, 0.25); box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: pointer;
  text-transform: uppercase;
}
.btn-primary { background: #39ff14; color: #0a192f; border: 1px solid #39ff14; }
.btn-primary:hover { background: #2cdb0e; border-color: #2cdb0e; }
.btn-outline { background: transparent; color: #39ff14; border: 1px solid rgba(57, 255, 20, 0.3); }
.btn-outline:hover { background: rgba(57, 255, 20, 0.08); border-color: #39ff14; }
.mono { font-family: var(--font-mono); }
.text-accent { color: #39ff14; }
.text-gold { color: #ffd700; }
.text-helper { color: #4a7c59; }
.text-warning { color: #d97a5c; }
.border-accent { border-color: rgba(57, 255, 20, 0.2); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  :root { --nav-width: 220px; }
  .header-brand { padding: 20px 16px 12px; }
  .nav-link { padding: 12px 16px; font-size: 13px; }
  .nav-index { min-width: 24px; font-size: 11px; }
  .header-search { padding: 12px 16px 20px; }
  .search-input { padding: 8px 12px 8px 32px; font-size: 12px; }
  .search-icon { left: 24px; width: 14px; height: 14px; }
  .footer-inner { padding: 32px 24px 24px; }
}

@media (max-width: 768px) {
  :root { --nav-width: 0px; }
  .site-header {
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--transition-speed);
    border-right: 1px solid var(--color-border);
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }
  .site-header[data-open] { transform: translateX(0); }
  .nav-toggle { display: flex; }
  .header-brand { padding: 24px 20px 16px; }
  .nav-link { padding: 14px 20px; font-size: 14px; }
  .nav-index { min-width: 28px; font-size: 12px; }
  .header-search { padding: 16px 20px 24px; }
  .search-input { padding: 10px 14px 10px 36px; font-size: 13px; }
  .search-icon { left: 28px; width: 16px; height: 16px; }
  #main-content, .site-footer { margin-left: 0; }
  #main-content { padding-top: 0; }
  .footer-inner { padding: 28px 20px 24px; gap: 24px; }
  .footer-primary { flex-direction: column; gap: 20px; }
  .footer-secondary { flex-direction: column; align-items: flex-start; gap: 16px; }
  .footer-contact { flex-direction: column; gap: 8px; }
  .footer-note { flex-direction: column; align-items: flex-start; gap: 8px; }
  .scroll-top { bottom: 20px; right: 20px; width: 40px; height: 40px; font-size: 16px; }
  .container { padding: 0 20px; }
  .section { padding: 32px 0; }
}

@media (max-width: 480px) {
  .site-header { width: 100%; }
  .header-brand { padding: 20px 16px 12px; }
  .nav-link { padding: 12px 16px; }
  .footer-inner { padding: 24px 16px 20px; }
  .footer-links { gap: 4px; }
  .footer-link { font-size: 12px; padding: 4px 6px; }
}

/* ===== Overlay for Mobile Nav ===== */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: calc(var(--header-z) - 1);
}
@media (max-width: 768px) {
  .nav-overlay[data-open] { display: block; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .site-header { transition: none; }
  .scroll-top { transition: none; }
}
