:root {
  --bg-0: #030712;
  --bg-1: #07111f;
  --bg-2: #0f172a;
  --bg-3: #14091f;
  --panel: rgba(10, 17, 32, 0.66);
  --panel-soft: rgba(255, 255, 255, 0.06);
  --panel-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e6f7ff;
  --muted: #8fa5c2;
  --green: #22c55e;
  --blue: #3b82f6;
  --orange: #f59e0b;
  --red: #ef4444;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow-deep: 0 32px 80px rgba(2, 8, 23, 0.45);
  --shadow-soft: 0 20px 45px rgba(2, 8, 23, 0.22);
  --glow-green: 0 0 0 1px rgba(34, 197, 94, 0.18), 0 0 40px rgba(34, 197, 94, 0.14);
  --glow-blue: 0 0 0 1px rgba(59, 130, 246, 0.16), 0 0 36px rgba(59, 130, 246, 0.12);
}

body.light-mode {
  --bg-0: #f4fbff;
  --bg-1: #e7f2ff;
  --bg-2: #d7e7ff;
  --bg-3: #eef3ff;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-soft: rgba(255, 255, 255, 0.58);
  --panel-strong: rgba(255, 255, 255, 0.82);
  --line: rgba(15, 23, 42, 0.12);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --muted: #475569;
  --shadow-deep: 0 28px 50px rgba(37, 99, 235, 0.12);
  --shadow-soft: 0 18px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(34, 197, 94, 0.12), transparent 26%),
    radial-gradient(circle at 82% 14%, rgba(59, 130, 246, 0.15), transparent 24%),
    radial-gradient(circle at 50% 78%, rgba(168, 85, 247, 0.08), transparent 28%),
    linear-gradient(140deg, var(--bg-0), var(--bg-1) 30%, var(--bg-2) 62%, var(--bg-3));
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.background-grid,
.aurora,
.scan-line {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.background-grid {
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 90%);
}

.aurora {
  filter: blur(110px);
}

.aurora-green {
  top: 5%;
  left: 6%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.2);
  animation: drift 10s ease-in-out infinite alternate;
}

.aurora-blue {
  top: 14%;
  right: 8%;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.2);
  animation: drift 8s ease-in-out infinite alternate-reverse;
}

.scan-line {
  background: linear-gradient(180deg, transparent, rgba(34, 197, 94, 0.08), transparent);
  transform: translateY(-100%);
  animation: scan 8s linear infinite;
}

.glass-panel {
  position: relative;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03)),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.16), transparent 28%, transparent 72%, rgba(59, 130, 246, 0.08));
  pointer-events: none;
}

.glass-panel::after {
  content: "";
  position: absolute;
  inset: auto 18px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  pointer-events: none;
}

.sidebar {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  border-radius: 34px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: space-between;
}

.brand,
.topbar,
.section-header,
.hero-actions,
.hero-proof,
.hero-stats,
.dashboard-actions,
.topbar-actions,
.auth-tabs,
.panel-heading,
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  align-items: flex-start;
}

.brand-mark,
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-family: "Orbitron", sans-serif;
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.28), rgba(59, 130, 246, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--glow-green);
  flex-shrink: 0;
}

.brand-copy,
.nav-link,
.eyebrow,
.hero-tag,
.glass-pill,
.risk-badge {
  font-family: "Orbitron", sans-serif;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-copy span {
  font-size: 1.05rem;
}

.brand-copy small {
  color: var(--muted);
}

.nav-links,
.auth-grid,
.feature-grid,
.checklist-grid,
.dashboard-grid,
.auth-card form,
.choice-group,
.stack-list,
.history-list,
.badge-tray,
.simulation-grid {
  display: grid;
  gap: 18px;
}

.nav-link {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 14px 16px 14px 28px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
}

.nav-link::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%);
  transition: background 0.28s ease, box-shadow 0.28s ease;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.28);
  box-shadow: var(--glow-green);
  transform: translateY(-2px);
}

.nav-link.active::before,
.nav-link:hover::before {
  background: var(--green);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.8);
}

.sidebar-status {
  display: grid;
  gap: 10px;
}

.status-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.09), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-card strong {
  font-size: 0.98rem;
}

.status-card span {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.main-content {
  min-width: 0;
  display: grid;
  gap: 24px;
}

.topbar {
  justify-content: space-between;
  border-radius: 28px;
  padding: 18px 22px;
}

.topbar h1,
.hero h2,
.section-header h2,
.auth-copy h2 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
}

.topbar h1 {
  font-size: clamp(1.6rem, 2vw, 2.2rem);
}

.topbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.search-box {
  min-width: min(100%, 320px);
  flex: 1 1 260px;
}

.search-box input,
.form-row input {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
}

.search-box input:focus,
.form-row input:focus {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--glow-blue);
}

.ghost-button,
.primary-button,
.auth-tab {
  border-radius: 16px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
}

.ghost-button,
.auth-tab {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
}

.ghost-button:hover,
.auth-tab:hover,
.auth-tab.active {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.26);
  box-shadow: var(--glow-blue);
}

.primary-button {
  padding: 14px 18px;
  font-weight: 700;
  color: #04110a;
  background: linear-gradient(135deg, #a4f4bf, var(--green));
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 16px 32px rgba(34, 197, 94, 0.22);
}

.primary-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 42px rgba(34, 197, 94, 0.28);
}

.panel {
  display: none;
  gap: 24px;
}

.panel.active-view {
  display: grid;
}

.hero {
  border-radius: 36px;
  padding: clamp(24px, 3vw, 40px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  overflow: hidden;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.hero-copy h2 {
  font-size: clamp(2.1rem, 5vw, 4.7rem);
  line-height: 1.02;
  max-width: 11ch;
}

.hero-copy p,
.feature-card p,
.auth-copy p,
.question-card p,
#riskExplanation,
.simulation-card p,
.history-item p,
.stack-item,
.hero-stat span {
  color: var(--muted);
  line-height: 1.65;
}

.hero-tag,
.glass-pill,
.badge,
.hero-proof span {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  width: fit-content;
}

.hero-proof,
.hero-stats {
  flex-wrap: wrap;
}

.hero-stats {
  margin-top: 4px;
}

.hero-stat {
  min-width: 160px;
  flex: 1 1 0;
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.hero-stat strong {
  font-family: "Orbitron", sans-serif;
  font-size: 1.15rem;
}

.hero-visual,
.score-panel,
.score-ring,
.score-center {
  display: grid;
  place-items: center;
}

.hero-visual {
  position: relative;
  min-height: 360px;
  isolation: isolate;
}

.hero-orbit {
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-orbit-a {
  inset: 14% 12%;
  animation: spin 24s linear infinite;
}

.hero-orbit-b {
  inset: 4% 2%;
  animation: spin 18s linear infinite reverse;
}

.shield-core {
  position: relative;
  width: clamp(220px, 32vw, 320px);
  aspect-ratio: 1;
  border-radius: 34%;
  background:
    radial-gradient(circle at 28% 25%, rgba(255, 255, 255, 0.28), transparent 22%),
    linear-gradient(145deg, rgba(59, 130, 246, 0.38), rgba(34, 197, 94, 0.28));
  border: 1px solid rgba(255, 255, 255, 0.18);
  transform: rotateX(16deg) rotateY(-14deg);
  box-shadow:
    0 0 80px rgba(34, 197, 94, 0.16),
    0 30px 70px rgba(2, 8, 23, 0.36);
  animation: float 5s ease-in-out infinite;
}

.shield-inner {
  position: absolute;
  inset: 22px;
  border-radius: 28%;
  display: grid;
  place-items: center;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: 0.12em;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.14), transparent 45%),
    rgba(3, 7, 18, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(34, 197, 94, 0.18);
  box-shadow: inset 0 0 24px rgba(34, 197, 94, 0.05);
}

.ring-1 { width: 200px; height: 200px; }
.ring-2 { width: 300px; height: 300px; }
.ring-3 { width: 410px; height: 410px; }

.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.auth-copy,
.auth-card,
.question-card,
.score-panel,
.risk-panel,
.chart-panel,
.insight-panel,
.simulation-panel,
.history-panel {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.feature-card,
.question-card,
.simulation-card,
.stack-item,
.history-item {
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.feature-card:hover,
.question-card:hover,
.simulation-card:hover,
.stack-item:hover,
.history-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
}

.feature-card {
  background:
    linear-gradient(160deg, rgba(59, 130, 246, 0.12), transparent 42%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.feature-card h3,
.question-card h3,
.panel-heading h3,
.simulation-card h4 {
  margin: 0 0 10px;
}

.auth-grid {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
}

.auth-copy,
.auth-card {
  min-height: 100%;
}

.auth-card form {
  gap: 16px;
}

.form-row {
  display: grid;
  gap: 8px;
}

.form-row label {
  font-size: 0.96rem;
  color: var(--muted);
}

.hidden,
#nameRow.hidden {
  display: none;
}

.checklist-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card {
  background:
    linear-gradient(145deg, rgba(34, 197, 94, 0.12), transparent 40%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
}

.choice-group {
  gap: 12px;
}

.choice-group label,
.stack-item,
.history-item,
.simulation-card,
.status-card {
  overflow: hidden;
}

.choice-group label,
.stack-item,
.history-item,
.simulation-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.choice-group label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}

.choice-group label:hover {
  border-color: rgba(34, 197, 94, 0.28);
  transform: translateX(4px);
  box-shadow: var(--glow-green);
}

.choice-group input {
  margin-top: 3px;
  accent-color: var(--green);
}

.section-header {
  justify-content: space-between;
  flex-wrap: wrap;
}

.status-text {
  min-height: 22px;
  color: #bfdcff;
}

.dashboard-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
}

.score-panel {
  grid-column: span 4;
  min-height: 340px;
}

.risk-panel {
  grid-column: span 3;
  min-height: 340px;
}

.chart-panel {
  grid-column: span 5;
}

.insight-panel {
  grid-column: span 4;
}

.simulation-panel {
  grid-column: span 8;
}

.history-panel {
  grid-column: span 4;
}

.score-ring {
  position: relative;
  width: min(100%, 260px);
  aspect-ratio: 1;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.12), transparent 60%);
  z-index: 0;
}

.score-ring svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring circle {
  fill: none;
  stroke-width: 8;
  stroke: rgba(255, 255, 255, 0.1);
}

#scoreStroke {
  stroke-linecap: round;
  stroke-dasharray: 302;
  stroke-dashoffset: 302;
  transition: stroke-dashoffset 1s ease, stroke 0.3s ease;
  filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.8));
}

.score-center {
  position: absolute;
  inset: 36px;
  z-index: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.14), transparent 30%),
    rgba(8, 15, 30, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: center;
}

.score-center strong {
  font-size: clamp(2.3rem, 5vw, 3.3rem);
  font-family: "Orbitron", sans-serif;
}

.risk-panel {
  display: grid;
  align-content: start;
}

.risk-badge {
  display: inline-flex;
  width: fit-content;
  padding: 12px 18px;
  border-radius: 999px;
  margin: 12px 0 4px;
}

.risk-low {
  background: rgba(34, 197, 94, 0.14);
  color: #d1fadf;
}

.risk-medium {
  background: rgba(245, 158, 11, 0.16);
  color: #ffecb1;
}

.risk-high {
  background: rgba(239, 68, 68, 0.16);
  color: #ffd4d4;
}

.badge-tray {
  gap: 10px;
  margin-top: 8px;
}

.badge {
  width: fit-content;
}

.panel-heading {
  justify-content: space-between;
  margin-bottom: 16px;
}

.stack-list,
.history-list,
.simulation-grid {
  gap: 14px;
}

.stack-item {
  position: relative;
  padding-left: 18px;
}

.stack-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--green), var(--blue));
}

.simulation-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.simulation-card {
  min-height: 190px;
  transform-style: preserve-3d;
}

.simulation-card:hover {
  transform: perspective(900px) rotateX(5deg) rotateY(-5deg) translateY(-4px);
}

.severity-danger {
  border-color: rgba(239, 68, 68, 0.34);
}

.severity-warning {
  border-color: rgba(245, 158, 11, 0.32);
}

.severity-safe {
  border-color: rgba(34, 197, 94, 0.32);
}

.history-item {
  justify-content: space-between;
  align-items: center;
}

.history-item strong {
  display: block;
  margin-bottom: 4px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9cc7ff;
}

canvas {
  width: 100% !important;
  height: 280px !important;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

@keyframes drift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(40px, 26px, 0); }
}

@keyframes scan {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    top: 0;
    height: auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 18px;
  }

  .nav-links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-status {
    min-width: 220px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .score-panel,
  .risk-panel,
  .chart-panel,
  .insight-panel,
  .simulation-panel,
  .history-panel {
    grid-column: span 6;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 16px;
    gap: 16px;
  }

  .topbar,
  .feature-card,
  .auth-copy,
  .auth-card,
  .question-card,
  .score-panel,
  .risk-panel,
  .chart-panel,
  .insight-panel,
  .simulation-panel,
  .history-panel,
  .hero,
  .sidebar {
    border-radius: 24px;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .nav-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-status {
    min-width: 0;
  }

  .auth-grid,
  .feature-grid,
  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .search-box {
    flex-basis: 100%;
    min-width: 100%;
  }

  .hero-stat {
    min-width: calc(50% - 8px);
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
  }

  .main-content {
    gap: 16px;
  }

  .sidebar,
  .topbar,
  .hero,
  .feature-card,
  .auth-copy,
  .auth-card,
  .question-card,
  .score-panel,
  .risk-panel,
  .chart-panel,
  .insight-panel,
  .simulation-panel,
  .history-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .nav-links {
    grid-template-columns: 1fr;
  }

  .hero-copy h2 {
    max-width: none;
  }

  .hero-stats {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-stat {
    min-width: 100%;
  }

  .hero-visual {
    min-height: 280px;
  }

  .ring-1 { width: 140px; height: 140px; }
  .ring-2 { width: 210px; height: 210px; }
  .ring-3 { width: 280px; height: 280px; }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .score-panel,
  .risk-panel,
  .chart-panel,
  .insight-panel,
  .simulation-panel,
  .history-panel {
    grid-column: auto;
  }

  .history-item,
  .panel-heading,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .simulation-grid {
    grid-template-columns: 1fr;
  }

  canvas {
    height: 240px !important;
  }
}
