/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: #0b0f14;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: #2dd4bf; text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  color: #2dd4bf;
  background: rgba(45,212,191,0.08);
  padding: 1px 6px;
  border-radius: 3px;
}
strong { font-weight: 500; color: #f1f5f9; }

/* ===== NAV ===== */
#nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,15,20,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(45,212,191,0.1);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 2rem;
}
.nav-logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem; font-weight: 600; color: #2dd4bf;
}
.nav-logo span { color: #475569; }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { color: #64748b; font-size: 0.875rem; transition: color 0.2s; }
.nav-links a:hover { color: #e2e8f0; text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; color: #94a3b8; font-size: 1.3rem; cursor: pointer; }

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  position: relative; padding: 6rem 2rem 4rem;
  overflow: hidden;
}
.hero-canvas { position: absolute; inset: 0; opacity: 0.3; pointer-events: none; }
.hero-content { position: relative; z-index: 1; text-align: center; max-width: 700px; }
.badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace; font-size: 0.7rem;
  color: #2dd4bf; background: rgba(45,212,191,0.07);
  border: 1px solid rgba(45,212,191,0.2);
  padding: 5px 14px; border-radius: 4px;
  margin-bottom: 1.5rem; letter-spacing: 0.08em;
}
h1 {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 600; line-height: 1.12;
  color: #f1f5f9; margin-bottom: 1.25rem;
  letter-spacing: -0.03em;
}
h1 em { font-style: normal; color: #2dd4bf; }
.hero-sub { font-size: 1.05rem; color: #94a3b8; max-width: 520px; margin: 0 auto 2.5rem; }
.btn-group { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn-primary {
  background: #2dd4bf; color: #0b0f14;
  padding: 0.7rem 1.8rem; border-radius: 6px;
  font-weight: 500; font-size: 0.95rem;
  transition: opacity 0.2s; border: none; cursor: pointer;
}
.btn-primary:hover { opacity: 0.82; text-decoration: none; color: #0b0f14; }
.btn-outline {
  background: transparent; color: #2dd4bf;
  padding: 0.7rem 1.8rem; border-radius: 6px;
  font-weight: 500; font-size: 0.95rem;
  border: 1px solid rgba(45,212,191,0.35);
  transition: background 0.2s; cursor: pointer;
}
.btn-outline:hover { background: rgba(45,212,191,0.07); text-decoration: none; color: #2dd4bf; }
.hero-stats {
  display: flex; gap: 3rem; justify-content: center;
  margin-top: 4rem; padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.stat { text-align: center; }
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem; font-weight: 600; color: #f1f5f9;
  display: block;
}
.stat-num .unit { font-size: 0.85rem; color: #fbbf24; }
.stat-label { font-size: 0.72rem; color: #475569; letter-spacing: 0.08em; text-transform: uppercase; font-family: 'JetBrains Mono', monospace; }

/* ===== SECTIONS ===== */
section { padding: 5rem 2rem; }
section:nth-child(even) { background: rgba(255,255,255,0.015); }
.container { max-width: 1100px; margin: 0 auto; }
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; color: #2dd4bf;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 0.6rem;
}
h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600; color: #f1f5f9;
  margin-bottom: 0.9rem; letter-spacing: -0.02em;
}
.section-intro { color: #94a3b8; max-width: 620px; margin-bottom: 2.5rem; }

/* ===== CARDS ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px; padding: 1.5rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: rgba(45,212,191,0.2); }
.card-icon { font-size: 1.4rem; color: #2dd4bf; margin-bottom: 0.9rem; }
.card h3 { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: 600; color: #f1f5f9; margin-bottom: 0.4rem; }
.card p { font-size: 0.875rem; color: #94a3b8; line-height: 1.65; }
.tag {
  display: inline-block; margin-top: 0.9rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.68rem;
  color: #fbbf24; background: rgba(251,191,36,0.07);
  border: 1px solid rgba(251,191,36,0.18);
  padding: 2px 8px; border-radius: 3px;
}
.info-box {
  margin-top: 2rem;
  background: rgba(45,212,191,0.04);
  border: 1px solid rgba(45,212,191,0.12);
  border-left: 3px solid #2dd4bf;
  border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.5rem;
}
.info-box-label { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: #2dd4bf; letter-spacing: 0.08em; margin-bottom: 0.5rem; text-transform: uppercase; }
.info-box p { font-size: 0.9rem; color: #94a3b8; }

/* ===== MAP ===== */
.map-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; align-items: start; }
#map { height: 500px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.07); overflow: hidden; }
.map-sidebar {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px; overflow: hidden;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-title { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: #64748b; letter-spacing: 0.06em; text-transform: uppercase; }
.sidebar-count { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: #2dd4bf; }
.node-list { max-height: 380px; overflow-y: auto; }
.node-item {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: background 0.15s;
}
.node-item:hover { background: rgba(255,255,255,0.03); }
.node-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.node-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.node-dot.online { background: #2dd4bf; box-shadow: 0 0 5px #2dd4bf; animation: pulse-dot 2.5s infinite; }
.node-dot.offline { background: #fbbf24; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.35} }
.node-id { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; font-weight: 600; color: #f1f5f9; }
.node-meta { font-size: 0.75rem; color: #475569; padding-left: 15px; }
.node-meta span { color: #64748b; }
.loading-indicator { padding: 2rem; text-align: center; color: #475569; font-size: 0.85rem; font-family: 'JetBrains Mono', monospace; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-footer p { font-size: 0.78rem; color: #475569; }
.sidebar-footer a { color: #2dd4bf; }

/* ===== NAMING ===== */
.naming-schema {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px; padding: 2rem; margin-bottom: 2rem;
}
.schema-display { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-bottom: 1.75rem; font-family: 'JetBrains Mono', monospace; font-size: clamp(0.85rem, 2.5vw, 1.15rem); }
.seg { padding: 6px 12px; border-radius: 5px; font-weight: 600; }
.seg-sep { color: #334155; font-size: 1.2em; }
.seg-de  { background: rgba(88,101,242,0.15); color: #818cf8; }
.seg-nw  { background: rgba(45,212,191,0.12); color: #2dd4bf; }
.seg-kr  { background: rgba(251,191,36,0.12); color: #fbbf24; }
.seg-st  { background: rgba(249,115,22,0.12); color: #fb923c; }
.seg-ot  { background: rgba(167,139,250,0.12); color: #a78bfa; }
.seg-rp  { background: rgba(34,197,94,0.12); color: #4ade80; }
.schema-legend { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #94a3b8; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dot.seg-de  { background: rgba(88,101,242,0.4); }
.dot.seg-nw  { background: rgba(45,212,191,0.4); }
.dot.seg-kr  { background: rgba(251,191,36,0.4); }
.dot.seg-st  { background: rgba(249,115,22,0.4); }
.dot.seg-ot  { background: rgba(167,139,250,0.4); }
.dot.seg-rp  { background: rgba(34,197,94,0.4); }
.naming-rules { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.75rem; }
.rule { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 1rem 1.25rem; display: flex; gap: 1.5rem; align-items: baseline; }
.rule-label { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: #2dd4bf; text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; min-width: 110px; }
.rule p { font-size: 0.875rem; color: #94a3b8; }
.naming-examples { border: 1px solid rgba(255,255,255,0.07); border-radius: 8px; overflow: hidden; }
.example-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 0.75rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.82rem; }
.example-row.header { color: #475569; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-family: 'JetBrains Mono', monospace; }
.example-row:last-child { border-bottom: none; }
.char-count { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; text-align: center; white-space: nowrap; }
.char-count.ok { color: #4ade80; }
.char-count.warn { color: #f87171; }
.example-row span:last-child { color: #64748b; }

/* ===== STEPS ===== */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 2.5rem; }
.step { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 10px; padding: 1.5rem; }
.step-num { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: rgba(45,212,191,0.45); display: block; margin-bottom: 0.75rem; letter-spacing: 0.05em; }
.step h3 { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: 600; color: #f1f5f9; margin-bottom: 0.5rem; }
.step p { font-size: 0.875rem; color: #94a3b8; line-height: 1.65; margin-bottom: 0.75rem; }
.step a { font-size: 0.82rem; color: #2dd4bf; }
.hardware-hint { background: rgba(251,191,36,0.04); border: 1px solid rgba(251,191,36,0.1); border-radius: 10px; padding: 1.5rem; }
.hw-title { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: #fbbf24; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 1rem; }
.hw-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.hw-item { display: flex; gap: 1rem; align-items: baseline; }
.hw-name { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; color: #f1f5f9; flex-shrink: 0; }
.hw-note { font-size: 0.82rem; color: #64748b; }

/* ===== COMMUNITY ===== */
.comm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.comm-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px; padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: border-color 0.2s; color: inherit;
}
.comm-card:hover { border-color: rgba(45,212,191,0.25); text-decoration: none; }
.comm-icon { width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.comm-card h4 { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 600; color: #f1f5f9; margin-bottom: 2px; }
.comm-card p { font-size: 0.78rem; color: #64748b; }
.comm-arrow { margin-left: auto; color: #334155; font-size: 1rem; transition: color 0.2s; }
.comm-card:hover .comm-arrow { color: #2dd4bf; }

/* ===== FOOTER ===== */
footer { padding: 2.5rem 2rem; border-top: 1px solid rgba(255,255,255,0.06); }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1.5rem; }
.footer-logo { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; color: #2dd4bf; margin-bottom: 0.35rem; }
.footer-left p { font-size: 0.78rem; color: #334155; }
.footer-right { display: flex; gap: 1.5rem; }
.footer-right a { font-size: 0.8rem; color: #334155; transition: color 0.2s; }
.footer-right a:hover { color: #94a3b8; text-decoration: none; }

/* ===== LEAFLET OVERRIDES ===== */
.leaflet-popup-content-wrapper { background: #141920; color: #e2e8f0; border: 1px solid rgba(45,212,191,0.2); border-radius: 8px; box-shadow: none; }
.leaflet-popup-tip { background: #141920; }
.leaflet-popup-content { margin: 12px 16px; }
.leaflet-container a.leaflet-popup-close-button { color: #64748b; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; flex-direction: column; gap: 0; position: absolute; top: 56px; left: 0; right: 0; background: #0d1219; border-bottom: 1px solid rgba(45,212,191,0.1); padding: 0.5rem 0; z-index: 99; }
  .nav-links.open { display: flex; }
  .nav-links li { border-bottom: 1px solid rgba(255,255,255,0.04); }
  .nav-links a { display: block; padding: 0.75rem 2rem; }
  .map-layout { grid-template-columns: 1fr; }
  #map { height: 360px; }
  .node-list { max-height: 220px; }
  .hero-stats { gap: 1.5rem; }
  .rule { flex-direction: column; gap: 0.35rem; }
  .rule-label { min-width: unset; }
  .example-row { grid-template-columns: 1fr auto; }
  .example-row span:last-child { display: none; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .node-dot.online { animation: none; }
  .hero-canvas { display: none; }
}
