:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e2ec;
  --primary: #0f6bff;
  --primary-dark: #0847b8;
  --accent: #00a6a6;
  --warning: #f59e0b;
  --shadow: 0 18px 45px rgba(18, 38, 63, 0.12);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Fira Code", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 107, 255, 0.08), transparent 420px),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.6;
}

img,
canvas {
  max-width: 100%;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.topbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.topbar-nav a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.topbar-nav a:hover,
.topbar-nav a.active {
  color: var(--primary-dark);
  background: #eaf2ff;
}

.burger-menu {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.btn-github,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.btn-github {
  background: var(--ink);
  color: #fff;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.hero {
  padding: clamp(46px, 7vw, 92px) clamp(18px, 5vw, 56px) 34px;
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 520px);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
}

.hero-copy h1 {
  margin: 12px 0;
  color: #101828;
  font-size: clamp(2.5rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-motto {
  max-width: 650px;
  margin: 0 0 12px;
  color: var(--primary-dark);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 800;
}

.hero-intro {
  max-width: 660px;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-media {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(circle at 35% 20%, #d8f6ff, #ffffff 46%, #eaf2ff);
  box-shadow: var(--shadow);
}

.hero-media img,
.robot-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats-ribbon {
  padding: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
}

.stat-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  box-shadow: 0 10px 28px rgba(18, 38, 63, 0.07);
}

.stat-card strong {
  display: block;
  color: var(--primary-dark);
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(58px, 8vw, 96px) 20px;
}

.section-head {
  max-width: 720px;
  margin-bottom: 32px;
}

.section-head h2,
.section-copy h2,
.contact-layout h2 {
  margin: 8px 0 10px;
  color: #101828;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.section-head p,
.section-copy p,
.contact-layout p {
  margin: 0;
  color: var(--muted);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.team-card,
.panel,
.mini-card,
.chart-wrapper,
.code-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(18, 38, 63, 0.07);
}

.team-card {
  min-height: 245px;
  padding: 22px;
}

.team-card.featured {
  grid-column: span 2;
  background: linear-gradient(135deg, #ffffff, #eef6ff);
}

.avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #eaf2ff;
  color: var(--primary-dark);
  font-weight: 900;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-card h3,
.mini-card h3,
.panel h3,
.chart-wrapper h3 {
  margin: 0 0 6px;
  color: #101828;
  font-size: 1.05rem;
}

.team-card .role {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.team-card p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1fr);
  gap: 34px;
  align-items: center;
}

.feature-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.feature-list span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.feature-list i {
  color: var(--accent);
}

.panel {
  padding: 22px;
}

.spec-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.spec-table th,
.spec-table td {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.spec-table th {
  color: var(--muted);
  width: 42%;
}

.electronics-layout,
.results-layout,
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.schematic-viewer {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: zoom-in;
  box-shadow: var(--shadow);
}

.schematic-viewer img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.schematic-viewer span {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(16, 24, 40, 0.82);
  color: #fff;
  font-weight: 800;
}

.cards-column {
  display: grid;
  gap: 14px;
}

.mini-card {
  display: flex;
  gap: 16px;
  padding: 18px;
}

.mini-card i {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #eaf2ff;
  color: var(--primary-dark);
  flex: 0 0 auto;
}

.mini-card p {
  margin: 0;
  color: var(--muted);
}

.code-section-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
}

.code-tabs {
  display: grid;
  gap: 10px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.tab-btn:hover,
.tab-btn.active {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #eaf2ff;
}

.code-panel {
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--primary-dark);
  font-weight: 900;
}

.code-panel pre {
  min-height: 280px;
  max-height: 430px;
  margin: 0;
  padding: 20px;
  overflow: auto;
  background: #101828;
  color: #ecf3ff;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.code-explanation {
  margin: 0;
  padding: 16px 18px;
  color: var(--muted);
}

.code-comment { color: #98a2b3; }
.code-keyword { color: #7dd3fc; }
.code-type { color: #a7f3d0; }
.code-func { color: #fcd34d; }

.simulator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: stretch;
}

.sim-canvas-wrapper {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101828;
  box-shadow: var(--shadow);
}

.sim-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sim-telemetry {
  position: absolute;
  top: 14px;
  left: 14px;
  width: min(270px, calc(100% - 28px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(16, 24, 40, 0.82);
  color: #fff;
}

.telemetry-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 0.82rem;
}

.telemetry-row span {
  color: #cbd5e1;
}

.telemetry-row strong {
  color: #7dd3fc;
}

.sim-controls-panel {
  display: grid;
  gap: 16px;
}

.slider-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  color: var(--muted);
  font-weight: 900;
}

.slider-group input {
  grid-column: 1 / -1;
  width: 100%;
}

.sim-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sim-actions .btn:last-child {
  grid-column: 1 / -1;
}

.charts-panel {
  display: grid;
  gap: 18px;
}

.chart-wrapper {
  padding: 18px;
}

.chart-canvas-container {
  height: 250px;
}

.stats-summary-panel {
  display: grid;
  gap: 18px;
}

.perf-metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.perf-metric span {
  color: var(--muted);
  font-weight: 800;
}

.perf-metric div {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.perf-metric i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 900ms ease;
}

.contact-form {
  display: grid;
  gap: 12px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
}

.contact-form textarea {
  min-height: 130px;
  resize: vertical;
}

.form-status {
  display: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 800;
}

.form-status.success {
  display: block;
  background: #ecfdf3;
  color: #027a48;
}

.form-status.error {
  display: block;
  background: #fff1f3;
  color: #c01048;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.86);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-height: 86vh;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.page-footer {
  padding: 32px 20px;
  border-top: 1px solid var(--line);
  background: #101828;
  color: #cbd5e1;
  text-align: center;
  font-size: 0.9rem;
}

.page-footer p {
  margin: 4px 0;
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
  }

  .burger-menu {
    display: inline-grid;
    place-items: center;
    margin-left: auto;
  }

  .btn-github {
    display: none;
  }

  .topbar-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
  }

  .topbar-nav.open {
    display: flex;
  }

  .hero-content,
  .split,
  .electronics-layout,
  .results-layout,
  .contact-layout,
  .simulator-layout {
    grid-template-columns: 1fr;
  }

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

  .sim-canvas-wrapper {
    min-height: 430px;
  }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 34px;
  }

  .stats-grid,
  .team-grid,
  .code-section-layout {
    grid-template-columns: 1fr;
  }

  .team-card.featured {
    grid-column: auto;
  }

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

  .tab-btn {
    justify-content: center;
  }

  .sim-telemetry {
    position: static;
    width: 100%;
    border-radius: 0;
  }
}
