:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101217;
  color: #f6f1e8;
  --bg: #101217;
  --surface: #181d24;
  --surface-strong: #202630;
  --ink: #f6f1e8;
  --muted: #b9c1cc;
  --line: #343c48;
  --brand: #72f0c4;
  --brand-strong: #2ac799;
  --amber: #ffbd73;
  --blue: #94bfff;
  --rose: #ff8f88;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 189, 115, 0.08), transparent 24rem),
    linear-gradient(135deg, #101217 0%, #141923 48%, #17130f 100%);
  color: var(--ink);
}

body,
button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem max(1rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 18, 23, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(114, 240, 196, 0.55);
  border-radius: 8px;
  background: rgba(114, 240, 196, 0.1);
  color: var(--brand);
  font-weight: 800;
}

.brand strong,
.brand span span {
  display: block;
}

.brand strong {
  font-size: 0.98rem;
}

.brand span span {
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.4rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.nav-link.active {
  border-color: rgba(114, 240, 196, 0.45);
  color: var(--brand);
  background: rgba(114, 240, 196, 0.08);
}

.nav-link.disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.nav-link small {
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 800;
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 2.25rem 1rem 4rem;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 410px);
  gap: 1.25rem;
  align-items: end;
  padding: 2.25rem 0 1.5rem;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 1rem;
  font-size: 4.2rem;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.65rem;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.lead {
  max-width: 45rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.65;
}

.hero-card,
.info-card,
.simulation-panel,
.controls-panel,
.concept-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(24, 29, 36, 0.92);
  box-shadow: 0 22px 70px var(--shadow);
}

.hero-card {
  padding: 1.25rem;
}

.hero-card h2 {
  margin-bottom: 0.65rem;
}

.hero-card p:not(.panel-label) {
  margin-bottom: 1.1rem;
  color: var(--muted);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.panel-label {
  margin-bottom: 0.65rem;
  color: var(--amber);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.5rem;
  min-height: 2.75rem;
  padding: 0 0.95rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(148, 191, 255, 0.65);
  outline-offset: 3px;
}

.primary {
  background: var(--brand);
  color: #082018;
}

.secondary,
.speed-button {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.speed-button {
  min-width: 5.2rem;
  text-transform: capitalize;
}

.speed-button.active {
  border-color: rgba(255, 189, 115, 0.55);
  background: rgba(255, 189, 115, 0.15);
  color: var(--amber);
}

.lab-section {
  padding-top: 1.5rem;
}

.lab-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.action-row:empty {
  display: none;
}

.speed-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lab-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 450px);
  gap: 1rem;
  margin-bottom: 1rem;
}

.info-card {
  padding: 1rem;
}

.question-text {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.55;
}

.equation {
  margin: 0;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.28rem;
  line-height: 1.5;
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1rem;
  align-items: start;
}

.simulation-panel,
.controls-panel {
  padding: 1rem;
}

canvas {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0e13;
}

.motion-canvas {
  height: 290px;
}

.graph-canvas {
  height: 220px;
}

.readout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  margin: 1rem 0;
}

.readout {
  min-width: 0;
  padding: 0.9rem 0.8rem;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.readout:first-child {
  border-left: 0;
}

.readout span,
.readout strong {
  display: block;
}

.readout span {
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.readout strong {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.05rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.graph-block {
  margin-top: 0.25rem;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.panel-title-row h3 {
  margin-bottom: 0;
}

.panel-title-row span {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
}

.controls-panel h3 {
  margin-bottom: 1.1rem;
}

.control {
  display: block;
  padding: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.control:first-child {
  border-top: 0;
  padding-top: 0;
}

.control-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.control strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.control em {
  color: var(--amber);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  font-style: normal;
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
  cursor: pointer;
}

input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--brand);
}

.checkbox-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.checkbox-control span {
  margin: 0;
}

.vector-canvas {
  height: 420px;
}

.forces-canvas {
  height: 360px;
}

.projectiles-canvas {
  height: 360px;
}

.energy-canvas {
  height: 360px;
}

.springs-canvas {
  height: 340px;
}

.energy-bars {
  display: grid;
  gap: 0.85rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.energy-bar-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.energy-bar-header strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.energy-bar-header span {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
}

.energy-bar-track {
  height: 0.8rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.energy-bar-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 120ms linear;
}

.energy-bar-ke .energy-bar-track span {
  background: var(--amber);
}

.energy-bar-pe .energy-bar-track span {
  background: var(--blue);
}

.energy-bar-total .energy-bar-track span {
  background: var(--brand);
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.concept-card {
  padding: 1rem;
}

.concept-card h3 {
  color: var(--blue);
}

.concept-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 1040px) {
  .concept-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .hero-section,
  .lab-summary-grid,
  .lab-layout {
    grid-template-columns: 1fr;
  }

  .lab-heading {
    align-items: start;
    flex-direction: column;
  }

  .action-row {
    width: 100%;
    justify-content: stretch;
  }

  .action-row > .button,
  .speed-group {
    flex: 1 1 100%;
  }

  .speed-button {
    flex: 1;
  }
}

@media (max-width: 700px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    width: 100%;
    justify-content: stretch;
  }

  .nav-link {
    flex: 1 1 calc(50% - 0.5rem);
  }

  main {
    padding-top: 1rem;
  }

  h1 {
    font-size: 3rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .lead {
    font-size: 1rem;
  }

  .motion-canvas {
    height: 230px;
  }

  .vector-canvas {
    height: 300px;
  }

  .forces-canvas {
    height: 280px;
  }

  .projectiles-canvas {
    height: 280px;
  }

  .energy-canvas {
    height: 280px;
  }

  .springs-canvas {
    height: 280px;
  }

  .graph-canvas {
    height: 200px;
  }

  .readout-grid,
  .concept-grid {
    grid-template-columns: 1fr;
  }

  .readout,
  .readout:first-child {
    border-left: 0;
  }

  .readout + .readout {
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }
}

@media (max-width: 430px) {
  .nav-link {
    flex-basis: 100%;
  }

  .button,
  .speed-button {
    width: 100%;
  }

  .equation {
    font-size: 1rem;
  }
}
