:root {
  --bg-primary: #0a0b0e;
  --bg-secondary: #12141a;
  --card-bg: rgba(22, 25, 35, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  /* Active Theme Defaults (Electric Gold) */
  --theme-primary: #ffd000;
  --theme-glow: rgba(255, 208, 0, 0.4);
  --theme-ambient: rgba(255, 170, 0, 0.2);
}

[data-theme="cyber"] {
  --theme-primary: #00f0ff;
  --theme-glow: rgba(0, 240, 255, 0.45);
  --theme-ambient: rgba(0, 150, 255, 0.25);
}

[data-theme="emerald"] {
  --theme-primary: #00ff88;
  --theme-glow: rgba(0, 255, 136, 0.45);
  --theme-ambient: rgba(0, 200, 100, 0.25);
}

[data-theme="sunset"] {
  --theme-primary: #ff007f;
  --theme-glow: rgba(255, 0, 127, 0.45);
  --theme-ambient: rgba(255, 80, 0, 0.25);
}

[data-theme="flare"] {
  --theme-primary: #ff5500;
  --theme-glow: rgba(255, 85, 0, 0.45);
  --theme-ambient: rgba(255, 0, 50, 0.25);
}

[data-theme="onyx"] {
  --theme-primary: #e2e8f0;
  --theme-glow: rgba(255, 255, 255, 0.35);
  --theme-ambient: rgba(148, 163, 184, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Background Ambient Glow */
.ambient-glow {
  position: fixed;
  top: -10vw;
  left: 50%;
  transform: translateX(-50%);
  width: 70vw;
  height: 40vw;
  background: radial-gradient(circle, var(--theme-ambient) 0%, rgba(10, 11, 14, 0) 70%);
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
  transition: background 0.6s ease;
}

/* Container */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Navigation */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.logo-img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text-main);
}

.nav-cta {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  color: var(--text-main) !important;
  transition: all 0.2s !important;
}

.nav-cta:hover {
  background: var(--theme-primary);
  color: #000 !important;
  border-color: var(--theme-primary);
  box-shadow: 0 0 15px var(--theme-glow);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.badge-link {
  text-decoration: none;
  display: inline-block;
  margin-bottom: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--theme-primary);
  margin-bottom: 0;
  transition: all 0.25s ease;
}

.badge-link:hover .badge {
  border-color: var(--theme-primary);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 20px var(--theme-glow);
  transform: translateY(-1px);
}

.hero h1 {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
  background: linear-gradient(180deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 36px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--theme-primary);
  color: #050507;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 4px 20px var(--theme-glow);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--theme-glow);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 24px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Interactive App Showcase */
.showcase-container {
  margin: 50px auto 70px;
  max-width: 780px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 28px;
  backdrop-filter: blur(30px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.showcase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.tab-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Visualizer Display Area */
.display-card {
  background: #0d0e12;
  border-radius: 16px;
  padding: 24px;
  min-height: 290px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Gauge Tab */
.gauge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.torus-circle {
  width: 160px;
  height: 160px;
  position: relative;
}

.torus-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.torus-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 14;
}

.torus-fill {
  fill: none;
  stroke: var(--theme-primary);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 440;
  stroke-dashoffset: 66; /* 85% */
  transition: stroke 0.4s ease;
  filter: drop-shadow(0 0 8px var(--theme-glow));
}

.torus-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.torus-pct {
  font-size: 28px;
  font-weight: 800;
}

.torus-eta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--theme-primary);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

/* Energy Flow Canvas Tab */
.flow-wrapper {
  width: 100%;
  position: relative;
  display: none;
}

#flowCanvas {
  width: 100%;
  height: 260px;
  display: block;
}

/* Theme Picker Bar */
.theme-picker-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.theme-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-swatches {
  display: flex;
  gap: 8px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.swatch:hover, .swatch.active {
  transform: scale(1.2);
  border-color: #fff;
}

.swatch.gold { background: #ffd000; }
.swatch.cyber { background: #00f0ff; }
.swatch.emerald { background: #00ff88; }
.swatch.sunset { background: #ff007f; }
.swatch.flare { background: #ff5500; }
.swatch.onyx { background: #e2e8f0; }

/* Features Grid */
.section-title {
  text-align: center;
  margin-bottom: 50px;
}

.section-title h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.section-title p {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 540px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 80px;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 30px;
  backdrop-filter: blur(20px);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 20px;
  color: var(--theme-primary);
}

.feature-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* Integrations Logos */
.inverters-section {
  text-align: center;
  padding: 60px 0;
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 80px;
}

.inverter-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.inverter-pill {
  padding: 10px 20px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Footer */
footer {
  padding: 50px 0 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 13px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--theme-primary);
}

.footer-bottom {
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* Legal Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: #141720;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 36px;
  position: relative;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body h2 {
  font-size: 24px;
  margin-bottom: 16px;
  color: #fff;
}

.modal-body h3 {
  font-size: 16px;
  margin: 20px 0 8px;
  color: var(--theme-primary);
}

.modal-body p, .modal-body li {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 14px;
}

/* Download CTA Section */
.cta-section {
  padding: 60px 0 40px;
  text-align: center;
}

.cta-card {
  background: linear-gradient(180deg, rgba(26, 30, 42, 0.7) 0%, rgba(14, 16, 22, 0.9) 100%);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 56px 32px;
  max-width: 820px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
}

.cta-card::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 250px;
  background: radial-gradient(circle, var(--theme-ambient) 0%, rgba(10, 11, 14, 0) 70%);
  filter: blur(60px);
  pointer-events: none;
}

.cta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--theme-primary);
  margin-bottom: 16px;
}

.cta-card h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cta-card p {
  color: var(--text-muted);
  font-size: clamp(15px, 1.8vw, 17px);
  max-width: 580px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .hero h1 { font-size: 34px; }
  .showcase-container { padding: 18px; }
  .nav-links { display: none; }
  .cta-card { padding: 36px 20px; }
}
