:root {
  --green: #22c670;
  --green-dark: #087442;
  --green-deep: #064a31;
  --mint: #e4f8ed;
  --mint-strong: #cff1df;
  --paper: #f4fbf7;
  --panel: #ffffff;
  --ink: #082d20;
  --muted: #587167;
  --line: #cfe5d9;
  --stage: #061a1b;
  --stage-deep: #031112;
  --cyan: #5edcec;
  --amber: #f1b84b;
  --violet: #9c83e7;
  --danger: #ef7277;
  --shadow: 0 18px 46px rgba(15, 82, 53, .1);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 2%, rgba(34, 198, 112, .12), transparent 27rem),
    radial-gradient(circle at 92% 18%, rgba(71, 177, 135, .08), transparent 25rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

button, input { font: inherit; }
button { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  left: 12px;
  top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-180%);
}

.skip-link:focus { transform: none; }

.site-header {
  width: min(1500px, calc(100% - 28px));
  margin: 12px auto 0;
  min-height: 64px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(16, 78, 51, .05);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--mint);
}

.brand img { width: 35px; height: 35px; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; line-height: 1; font-weight: 900; }
.brand small { margin-top: 4px; color: var(--muted); font-size: .63rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }

.level-pill {
  padding: 9px 13px;
  border: 1px solid #c3e9d4;
  border-radius: 999px;
  background: var(--mint);
  color: var(--green-dark);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

main {
  width: min(1500px, calc(100% - 28px));
  margin: 24px auto 0;
}

.intro {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, .85fr);
  align-items: end;
  gap: 24px;
}

.eyebrow, .step-label {
  color: var(--green-dark);
  font-size: .71rem;
  font-weight: 950;
  letter-spacing: .105em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 900px;
  margin-bottom: 4px;
  font-size: clamp(2rem, 3vw, 3.15rem);
  line-height: 1.02;
  letter-spacing: -.045em;
}

.intro > div:first-child > p {
  max-width: 880px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(.95rem, 1.25vw, 1.08rem);
  line-height: 1.45;
}

.model-assumption {
  min-height: 84px;
  padding: 15px 17px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid #bee7d1;
  border-radius: 17px;
  background: rgba(228, 248, 237, .83);
}

.model-assumption > span {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  font-style: italic;
}

.model-assumption p { margin: 0; }
.model-assumption small, .model-assumption strong { display: block; }
.model-assumption small { margin-bottom: 4px; color: var(--green-dark); font-size: .64rem; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.model-assumption strong { font-size: .86rem; line-height: 1.35; }

.laboratory-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 355px;
  gap: 16px;
  align-items: start;
}

.stage-panel, .control-panel, .energy-panel, .learning-row, .model-note {
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.stage-panel { min-width: 0; overflow: hidden; }

.stage-toolbar {
  min-height: 77px;
  padding: 14px 15px 14px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
}

.stage-toolbar h2, .energy-panel h2 {
  margin: 4px 0 0;
  font-size: clamp(1.05rem, 1.55vw, 1.35rem);
  line-height: 1.16;
  letter-spacing: -.02em;
}

.transport-controls { display: flex; gap: 8px; flex: 0 0 auto; }

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 850;
}

button:hover { border-color: #8ed4ad; background: var(--mint); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid rgba(34, 198, 112, .32); outline-offset: 2px; }

.primary-button, .quiet-button { padding: 9px 14px; }
.primary-button { border-color: var(--green); background: var(--green); color: #052719; }
.primary-button:hover { border-color: #19a65b; background: #28d77a; }
.quiet-button { background: #fff; }

.apparatus-frame {
  position: relative;
  height: 535px;
  overflow: hidden;
  background: var(--stage);
}

#ramp-canvas { width: 100%; height: 100%; display: block; }

.power-badge, .run-badge {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(94, 220, 236, .28);
  background: rgba(3, 17, 18, .88);
  color: #dffaf0;
  backdrop-filter: blur(8px);
}

.power-badge {
  top: 14px;
  right: 14px;
  min-width: 190px;
  padding: 11px 13px;
  border-radius: 13px;
  text-align: right;
}

.power-badge small, .power-badge strong, .power-badge span, .run-badge small, .run-badge strong { display: block; }
.power-badge small, .run-badge small { color: #86ac9e; font-size: .61rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.power-badge strong { margin: 3px 0 1px; color: var(--green); font-size: 1.45rem; line-height: 1; }
.power-badge span { color: #b8d6c9; font-size: .69rem; }

.run-badge {
  left: 14px;
  top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
}

.run-badge strong { margin-top: 2px; color: var(--cyan); font-size: .85rem; }

.force-key {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  padding: 7px 10px;
  border: 1px solid rgba(116, 167, 149, .22);
  border-radius: 11px;
  background: rgba(3, 17, 18, .78);
  color: #b8d6c9;
  font-size: .67rem;
  font-weight: 750;
}

.force-key span { display: inline-flex; align-items: center; gap: 6px; }
.force-key i { width: 24px; height: 3px; border-radius: 4px; background: var(--green); }
.force-key span:last-child i { background: var(--amber); }

.event-strip {
  min-height: 69px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: minmax(210px, .55fr) minmax(320px, 1fr);
  align-items: center;
  gap: 20px;
  background: var(--green-deep);
  color: #d8f4e6;
}

.event-strip div span, .event-strip div strong { display: block; }
.event-strip div span { color: #7fc2a1; font-size: .62rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.event-strip div strong { margin-top: 3px; font-size: .8rem; }
.event-strip p { margin: 0; color: #b5d7c7; font-size: .75rem; line-height: 1.42; }
.event-strip p strong { color: var(--green); }

.control-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 13px;
}

.control-section { padding: 1px 0 13px; }
.control-section + .control-section { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }

.step-label { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.step-label b { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 8px; background: var(--green); color: var(--ink); font-size: .75rem; }

.range-control { display: block; margin: 0 0 15px; }
.range-control > span { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: .77rem; }
.range-control output { color: var(--green-dark); font-weight: 900; text-align: right; }
.range-control input { width: 100%; margin: 0; accent-color: var(--green); }
.range-control > small { margin-top: 4px; display: flex; justify-content: space-between; color: var(--muted); font-size: .57rem; }
.range-control.compact { margin-bottom: 0; }
.range-control.compact > small { display: block; }
.friction-control { margin-top: 13px; padding-left: 4px; border-left: 3px solid var(--amber); }

.switch-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  cursor: pointer;
  font-size: .78rem;
}

.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control > span {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  border: 1px solid #b7d5c5;
  border-radius: 99px;
  background: #dfeae4;
  transition: .18s ease;
}
.switch-control > span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  transition: .18s ease;
}
.switch-control input:checked + span { border-color: var(--green); background: var(--green); }
.switch-control input:checked + span::after { transform: translateX(16px); }
.switch-control input:focus-visible + span { outline: 3px solid rgba(34, 198, 112, .32); outline-offset: 2px; }

.launch-button {
  width: 100%;
  min-height: 46px;
  margin-top: 13px;
  border-color: var(--green);
  background: var(--green);
  color: #052719;
  font-size: .9rem;
}
.launch-button:hover { border-color: #19a65b; background: #28d77a; }
.control-note { margin: 7px 2px 0; color: var(--muted); font-size: .62rem; line-height: 1.48; }

.active-setup {
  padding: 12px;
  border-left: 3px solid var(--green);
  border-radius: 11px;
  background: var(--mint);
}
.active-setup > span { display: block; margin-bottom: 8px; color: var(--green-dark); font-size: .61rem; font-weight: 950; letter-spacing: .09em; text-transform: uppercase; }
.active-setup div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.active-setup b { padding: 6px 7px; border: 1px solid #c3ead5; border-radius: 8px; background: rgba(255, 255, 255, .72); font-size: .65rem; }

.display-controls { display: grid; gap: 13px; }

.readout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.readout-grid div { padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: #fbfefc; }
.readout-grid span, .readout-grid strong { display: block; }
.readout-grid span { margin-bottom: 3px; color: var(--muted); font-size: .6rem; }
.readout-grid strong { color: var(--green-dark); font-size: .78rem; }

.energy-panel {
  grid-column: 1;
  padding: 16px;
}
.energy-panel > header { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.energy-panel > header p { max-width: 360px; margin: 0; color: var(--muted); font-size: .65rem; line-height: 1.4; text-align: right; }

.energy-equation {
  margin-top: 13px;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 8px;
}
.energy-equation > em { color: var(--violet); font-size: 1.35rem; font-style: normal; font-weight: 950; text-align: center; }
.energy-term { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #fbfefc; }
.energy-term span, .energy-term strong { display: block; }
.energy-term span { color: var(--muted); font-size: .61rem; font-weight: 750; }
.energy-term strong { margin: 3px 0 8px; font-size: 1rem; }
.energy-term i { display: block; height: 8px; overflow: hidden; border-radius: 99px; background: #e5efe9; }
.energy-term i b { display: block; width: 0; height: 100%; border-radius: inherit; transition: width .12s linear; }
.motor-term i b { background: var(--green); }
.gravity-term i b { background: var(--violet); }
.thermal-term i b { background: var(--amber); }
.thermal-term.is-zero { opacity: .58; }

.power-evidence { margin-top: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.power-evidence article { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fbfefc; }
.power-evidence article > span, .power-evidence article > strong { display: block; }
.power-evidence article > span { color: var(--green-dark); font-size: .59rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.power-evidence article > strong { margin: 3px 0; font-size: .78rem; }
.power-evidence p { margin: 0; color: var(--muted); font-size: .66rem; line-height: 1.35; }

.learning-row {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
}
.learning-row article { min-width: 0; padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; }
.learning-row article + article { border-left: 1px solid var(--line); }
.learning-row article > span { flex: 0 0 auto; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: var(--green); font-size: .68rem; font-weight: 950; }
.learning-row strong { display: block; font-size: .77rem; }
.learning-row p { margin: 3px 0 0; color: var(--muted); font-size: .66rem; line-height: 1.35; }

.model-note { margin-top: 11px; padding: 0 15px; box-shadow: none; }
.model-note summary { padding: 12px 0; cursor: pointer; color: var(--green-dark); font-size: .72rem; font-weight: 850; }
.model-note p { margin: -2px 0 14px; color: var(--muted); font-size: .72rem; line-height: 1.5; }

.site-footer {
  width: min(1500px, calc(100% - 28px));
  margin: 22px auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #779487;
  font-size: .62rem;
}
.site-footer img { width: 23px; height: 23px; object-fit: contain; opacity: .72; }
.site-footer i { width: 4px; height: 4px; border-radius: 50%; background: var(--green); }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] { display: none !important; }

@media (max-width: 1120px) {
  .laboratory-grid { grid-template-columns: minmax(0, 1fr) 325px; }
  .apparatus-frame { height: 500px; }
  .power-evidence { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; gap: 12px; }
  .model-assumption { min-height: 0; }
  .laboratory-grid { grid-template-columns: 1fr; }
  .control-panel { grid-column: 1; grid-row: auto; }
  .energy-panel { grid-column: 1; }
  .energy-panel > header { align-items: start; }
  .energy-panel > header p { text-align: left; }
}

@media (max-width: 650px) {
  .site-header, main, .site-footer { width: min(100% - 18px, 1500px); }
  main { margin-top: 17px; }
  .level-pill { display: none; }
  h1 { font-size: 2rem; }
  .stage-toolbar { align-items: flex-start; flex-direction: column; }
  .transport-controls { width: 100%; }
  .transport-controls button { flex: 1; }
  .apparatus-frame { height: 430px; }
  .power-badge { min-width: 158px; }
  .power-badge strong { font-size: 1.2rem; }
  .event-strip { grid-template-columns: 1fr; gap: 6px; }
  .energy-panel > header { flex-direction: column; gap: 6px; }
  .energy-equation { grid-template-columns: 1fr; }
  .energy-equation > em { height: 12px; line-height: 10px; }
  .learning-row { grid-template-columns: 1fr; }
  .learning-row article + article { border-left: 0; border-top: 1px solid var(--line); }
  .site-footer { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
