#main { padding-top: clamp(22px, 4.2vw, 50px); }
.screen-heading { margin-bottom: 22px; }
.screen-heading h1 { font-size: clamp(33px, 5.1vw, 60px); }
.screen-heading.compact { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.surface { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 0 #e8e3d5; }
.settings, .results-card { padding: clamp(20px, 3.1vw, 38px); }
fieldset { padding: 0; border: 0; margin: 0 0 24px; min-width: 0; }
legend { margin-bottom: 9px; padding: 0; font-weight: 800; font-size: 18px; }
.choices { display: grid; gap: 9px; }
.levels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.operations { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rounds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices label { position: relative; display: grid; }
.choices input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choices span {
  display: grid; align-content: center; gap: 4px; min-height: 50px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: 13px; cursor: pointer;
  font-weight: 750; background: #fbfaf6;
}
.choices input:checked + span { background: var(--mint); border-color: var(--green); color: #134936; }
.choices input:focus-visible + span { outline: 3px solid #2068b2; outline-offset: 2px; }
.choices b { font-size: 19px; }
.choices small { font-size: 13px; color: var(--muted); font-weight: 600; }
.choices input:disabled + span { cursor: default; opacity: .7; }
.primary, .secondary, .mission-nav button, .text-button {
  min-height: 48px; border-radius: 13px; padding: 9px 16px; font-weight: 800; line-height: 1.15;
}
.primary { background: var(--green); color: white; border: 2px solid var(--green); min-height: 53px; }
.primary:not(:disabled):hover { background: #104431; }
.primary:disabled { opacity: .65; }
.secondary, .mission-nav button, .text-button { background: #fffefa; border: 1px solid #cbd4c7; color: #204b3c; }
.secondary:hover, .mission-nav button:hover, .text-button:not(:disabled):hover { background: #edf3e9; }
.settings-footer, .action-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
#best-preview { color: var(--muted); font-size: 15px; font-weight: 700; }
.sprint-grid { display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr); align-items: start; gap: 20px; }
.question-board { padding: clamp(16px, 2.4vw, 30px); text-align: center; }
.score-strip { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.score-strip span { display: flex; align-items: center; gap: 6px; font-size: clamp(12px, 1.6vw, 16px); font-weight: 700; color: var(--muted); }
.score-strip b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 1.2em; }
#timer-track { height: 7px; overflow: hidden; border-radius: 10px; background: #e7eddf; margin-top: 13px; }
#timer-fill { background: #3a8c58; height: 100%; border-radius: inherit; }
.ending #timer-fill { background: #b24e2c; }
.equation { font-weight: 850; font-size: clamp(33px, 6vw, 85px); line-height: 1.1; margin: clamp(14px, 3vw, 36px) 0 12px; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.answer {
  display: inline-grid; place-items: center; min-width: clamp(75px, 12vw, 146px); min-height: clamp(49px, 7vw, 84px);
  padding: 2px 14px; border: 2px solid #9fbdab; border-radius: 15px; background: #edf7eb;
  color: #174e3a; font-size: clamp(30px, 5.8vw, 61px); font-variant-numeric: tabular-nums; font-weight: 850; line-height: 1;
}
.feedback { min-height: 2.6em; display: grid; place-items: center; margin: 10px 0 3px; font-weight: 800; }
[data-status="yes"] { color: #14603f; }
[data-status="review"] { color: #8a3d22; }
.helper-controls { display: flex; justify-content: center; gap: 9px; }
.hint { margin-top: 14px; padding: 12px; border-radius: 11px; background: #f4eedb; line-height: 1.35; text-align: left; }
.dot-model { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.dot-group { display: flex; flex-wrap: wrap; gap: 3px; border: 1px solid #8e9e87; border-radius: 6px; padding: 5px; }
.dot-group i { display: block; width: 7px; height: 7px; background: var(--green); border-radius: 50%; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: clamp(12px, 2.2vw, 23px); gap: 9px; }
.keypad button {
  min-height: clamp(52px, 8.4vh, 92px); padding: 6px 2px; border: 1px solid #bed1c1;
  border-radius: 15px; background: #edf5ea; box-shadow: 0 3px 0 #cfdecf;
  font-size: clamp(22px, 4.3vw, 53px); font-weight: 850; color: #204b3c;
}
.keypad button:hover { background: #dcefd9; }
.keypad button:active { transform: translateY(2px); box-shadow: 0 1px 0 #cfdecf; }
.keypad .key-check { background: var(--green); color: white; border-color: var(--green); font-size: clamp(14px, 2.2vw, 24px); }
.keypad .key-check:hover { background: #104431; }
.result-lead { font-weight: 850; font-size: clamp(25px, 5vw, 46px); }
.result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0 24px; }
.result-stats div { display: grid; gap: 3px; align-content: start; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #f4f7ee; }
.result-stats strong { font-size: clamp(22px, 4vw, 35px); }
.result-stats span { font-size: 14px; color: var(--muted); font-weight: 700; }
#review { margin-bottom: 22px; }
#review h2 { font-size: 20px; }
#review-list { display: flex; flex-wrap: wrap; column-gap: 32px; row-gap: 6px; padding-left: 20px; }
.mission-nav { display: flex; gap: 7px; }
.mission-nav button[aria-pressed="true"] { color: var(--green); background: var(--mint); border-color: var(--green); }
.rally-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(295px, 1fr); gap: 20px; align-items: start; }
.track-panel { background: #e9f2fe; overflow: hidden; }
#track { display: block; width: 100%; aspect-ratio: 720/350; }
.distance-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 14px; }
.distance-row span { background: #fff; border: 1px solid #c5d6e9; border-radius: 9px; padding: 6px 9px; font-size: 15px; font-weight: 800; }
#distance-a { color: #9b3521; }
#distance-b { color: #225daf; }
.experiment-panel { padding: clamp(16px, 2.2vw, 23px); }
.experiment-panel h2 { font-family: Rockwell, Georgia, serif; font-size: clamp(21px, 2.5vw, 29px); letter-spacing: -.02em; }
#experiment-prompt { margin: 7px 0 14px; color: var(--muted); line-height: 1.4; }
#experiment-controls { display: grid; gap: 7px; margin-bottom: 14px; }
.cart-options { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: space-between; align-items: center; background: #f3f6f5; border-radius: 11px; padding: 6px 10px; }
.cart-options label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 700; }
.cart-options select { min-height: 42px; padding: 4px; border: 1px solid #c5d4ca; background: var(--white); border-radius: 7px; color: var(--ink); }
#predictions { margin-bottom: 12px; }
#predictions legend { font-size: 15px; margin-bottom: 5px; }
.predictions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.predictions span { font-size: 13px; text-align: center; min-height: 44px; padding: 4px 3px; }
.launch { width: 100%; }
.ramp-feedback { font-weight: 750; line-height: 1.4; }
.ramp-feedback:not(:empty) { margin: 11px 0 0; }
#next-experiment { margin-top: 10px; }
@media (max-width: 790px) {
  .rally-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .rally-grid .experiment-panel { max-width: 100%; }
}
@media (max-width: 630px) {
  #main { padding-bottom: 24px; }
  .screen-heading { margin-bottom: 13px; }
  .screen-heading.compact { gap: 8px; }
  .sprint-grid { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .question-board { padding: 12px; }
  .equation { margin: 12px 0 7px; }
  .feedback { margin-top: 3px; min-height: 28px; font-size: 14px; }
  .helper-controls button { min-height: 44px; }
  .keypad { padding: 10px; gap: 7px; }
  .keypad button { min-height: 46px; border-radius: 9px; }
  .levels { grid-template-columns: 1fr; }
  .levels span { display: flex; align-items: center; gap: 8px; }
  .operations { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choices span { padding-inline: 8px; }
  .mission-nav button { min-height: 44px; padding-inline: 12px; }
}
