:root {
  font-family:
    "Avenir Next", "Nunito", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #253b32;
  background: #eaf1e8;
  font-synthesis: none;
  --green: #2d664a;
  --muted: #849085;
  --orange: #ec9b43;
  --paper: #fffefa;
  --line: #e5e9df;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
button,
a,
input {
  font: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #dd992f;
  outline-offset: 5px;
}
button {
  border: 0;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button,
a {
  touch-action: manipulation;
}
button svg {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button:hover {
  filter: brightness(0.97);
}
button:active {
  transform: translateY(1px);
}
[hidden] {
  display: none !important;
}
#world {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
#world canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.world-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(239, 243, 233, 0.88) 0,
      rgba(239, 243, 233, 0.35) 23%,
      transparent 45%
    ),
    linear-gradient(0deg, rgba(235, 241, 231, 0.8), transparent 22%);
}
.topbar {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: linear-gradient(#eef3ebee, #eef3eb00);
}
.brand {
  text-decoration: none;
  color: #253b32;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: -1.3px;
  line-height: 1.08;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: #2d664a;
  width: 44px;
  height: 48px;
  border-radius: 15px 15px 18px 15px;
  color: #f8d981;
  font-size: 38px;
  transform: rotate(-6deg);
  box-shadow: inset 0 -4px #20533b;
}
.brand-rc {
  color: #4e8863;
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: #859081;
  margin-top: 6px;
  font-weight: 500;
}
.island-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #6f7e72;
  margin-left: 60px;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5e9c6e;
  box-shadow: 0 0 0 4px #dce8d9;
}
.divider {
  color: #bac3b5;
  margin: 0 5px;
}
.sun-icon {
  font-size: 24px;
  color: #cbac65;
  margin-left: 10px;
}
.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.stars-pill {
  border: 1px solid #f0e5c9;
  border-radius: 25px;
  background: #fff9e9;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 17px;
  font-size: 14px;
}
.stars-pill > span:first-child {
  color: #d4a344;
  font-size: 23px;
  line-height: 1;
}
.stars-max {
  font-size: 11px;
  color: #b2a37c;
}
.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff85;
  border: 1px solid #dce3d655;
  font-size: 20px;
}
.icon-button[aria-pressed="false"] {
  color: #98a292;
}
.rail {
  position: fixed;
  z-index: 10;
  left: 23px;
  top: 142px;
  bottom: 37px;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 18px;
  width: 64px;
}
.nav-button {
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 62px;
  background: none;
  padding: 14px 5px;
  border-radius: 18px;
  font-size: 11px;
  color: #8b9586;
  letter-spacing: 1px;
}
.nav-button.active {
  background: #fffef9;
  color: #315a43;
  box-shadow: 0 8px 20px #345b3410;
}
.nav-button svg {
  width: 24px;
  height: 24px;
}
.nav-button i {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #df9c48;
  border-radius: 50%;
  top: 12px;
  right: 12px;
}
.rail-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  white-space: nowrap;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7d9bd;
  color: #816b47;
  font-weight: 800;
  font-size: 15px;
  border: 3px solid #fafbf2;
}
.rail-bottom small {
  font-size: 9px;
  letter-spacing: 1px;
  color: #98a18f;
}
#camp {
  position: absolute;
  top: 130px;
  left: 133px;
  width: 294px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 700;
  color: #77917a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.eyebrow > span {
  width: 16px;
  height: 2px;
  background: #73926d;
}
.welcome h1 {
  font-size: 42px;
  line-height: 1.4;
  letter-spacing: 2px;
  margin: 18px 0 8px;
  font-weight: 850;
}
.welcome h1 > span {
  color: #dba954;
}
.welcome > p {
  font-size: 13px;
  color: #879482;
  letter-spacing: 1px;
  margin: 0 0 30px;
}
.mission-card {
  border: 1px solid #fff;
  border-radius: 22px;
  background: #fffefaec;
  box-shadow: 0 15px 45px #395c3110;
  padding: 22px 23px 14px;
  backdrop-filter: blur(12px);
}
.card-overline {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 1px;
  color: #97a08e;
}
.tiny-flag {
  font-size: 17px;
  color: #b19f64;
  vertical-align: middle;
  margin-right: 4px;
}
.mission-card h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 16px 0 10px;
  letter-spacing: 1px;
}
.mission-card > p {
  font-size: 12px;
  line-height: 1.9;
  color: #8a9383;
  margin: 0;
  min-height: 45px;
}
.mission-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #8b9687;
  margin: 18px 0;
}
.mission-meta > span:first-child {
  padding: 5px 9px;
  background: #eef3e8;
  color: #678460;
  border-radius: 6px;
}
.mission-reward {
  border-top: 1px dashed #dfe5d7;
  padding: 14px 0 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #9ca38f;
  font-size: 10px;
}
.mission-reward b {
  display: block;
  color: #6c795f;
  font-size: 11px;
  margin-top: 4px;
  font-weight: 500;
}
.mission-reward > span:last-child {
  color: #d7b26d;
  font-size: 20px;
  letter-spacing: 2px;
}
.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  border-radius: 12px;
  background: #2e664b;
  color: #fffcef;
  padding: 16px 19px;
  font-size: 14px;
  font-weight: 650;
  box-shadow: 0 5px 0 #23513b;
  letter-spacing: 1px;
  transition: background 0.2s;
}
.primary-button:hover {
  background: #3b7959;
}
.primary-button span {
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}
.text-button {
  display: flex;
  justify-content: center;
  gap: 14px;
  align-items: center;
  padding: 16px 0 6px;
  font-size: 11px;
  background: none;
  color: #8d9684;
  width: 100%;
}
.guide-note {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin: 22px 8px;
}
.guide-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 12px;
  background: #f4cb7b;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 30px;
  color: #73552a;
  box-shadow: inset 0 -3px #ddb060;
}
.guide-note p {
  margin: 0;
  font-size: 10px;
  line-height: 1.9;
  color: #99a08f;
}
.guide-note b {
  display: block;
  font-size: 11px;
  color: #7d896f;
  font-weight: 650;
}
.map-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.map-label {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -100%);
  padding: 0;
  background: none;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 4px;
  white-space: nowrap;
  transition: opacity 0.25s;
}
.map-label > span {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fffef8ed;
  border: 1px solid #fff;
  box-shadow: 0 5px 12px #47614a19;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 650;
  color: #587051;
  backdrop-filter: blur(6px);
}
.map-label b {
  font-size: 10px;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  background: #e8eddd;
  display: grid;
  place-items: center;
  color: #849675;
}
.map-label i {
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  background: #629060;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #ffffff38;
}
.map-label.selected > span {
  background: #2e6449;
  color: #fff;
  border-color: #598769;
}
.map-label.selected b {
  background: #ffffff25;
  color: #fce2a8;
}
.map-label.selected i {
  background: #ffd07b;
}
.map-label.complete b {
  background: #dbe8c6;
  color: #49734b;
}
.island-caption {
  position: fixed;
  bottom: 154px;
  left: 58%;
  display: flex;
  align-items: center;
  gap: 13px;
  pointer-events: none;
  color: #769172;
  transform: translateX(-50%);
  opacity: 0.85;
}
.location-pin {
  font-size: 29px;
}
.island-caption div {
  font-size: 14px;
  letter-spacing: 3px;
  font-weight: 650;
  white-space: nowrap;
}
.island-caption small {
  display: block;
  font-size: 6px;
  letter-spacing: 2px;
  margin-top: 7px;
  font-weight: 500;
}
.caption-line {
  width: 70px;
  height: 1px;
  background: #a9ba9a;
  margin-left: 8px;
}
.island-chapter {
  font-size: 30px;
  color: #a5b39c;
  font-weight: 300;
}
.map-tools {
  position: fixed;
  right: 38px;
  bottom: 155px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.camp-footer {
  position: fixed;
  left: 133px;
  right: 38px;
  bottom: 28px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.car-companion {
  display: flex;
  align-items: center;
  gap: 13px;
  background: #fffefacc;
  border: 1px solid #fff;
  border-radius: 17px;
  padding: 9px 17px 9px 7px;
  min-width: 284px;
  text-align: left;
  box-shadow: 0 7px 25px #46663b0a;
}
.car-companion > div {
  width: 85px;
  height: 52px;
  background: #eeeedd;
  border-radius: 11px;
}
.car-companion svg {
  width: 88px;
  height: 52px;
  stroke-width: initial;
  stroke: initial;
}
.car-companion small {
  font-size: 9px;
  color: #99a18d;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 7px;
}
.car-companion b {
  font-size: 12px;
  font-weight: 650;
}
.companion-arrow {
  color: #86917b;
  font-size: 22px;
  margin-left: 18px;
}
.camp-footer-hint {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 10px;
  color: #97a08c;
}
.camp-footer-hint > span:last-child {
  margin-left: 9px;
}
.keycap {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 21px;
  height: 23px;
  padding: 0 5px;
  border: 1px solid #cdd6c4;
  background: #ffffff6b;
  border-bottom-width: 3px;
  border-radius: 5px;
  font-size: 9px;
  line-height: 1;
  color: #77866b;
}
.free-button {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  background: #ffffff70;
  border: 1px solid #cfdac8;
  border-radius: 13px;
  padding: 16px 20px;
  color: #58744c;
  white-space: nowrap;
}
.free-button svg {
  width: 20px;
  height: 20px;
}
.free-button > span:last-child {
  margin-left: 15px;
}
.driving .camp-ui,
.driving .rail,
.driving .island-status,
.driving #map-labels {
  display: none;
}
.driving .world-vignette {
  background: linear-gradient(0deg, #eef3e966, transparent 26%);
}
.driving .topbar {
  height: 80px;
}
.driving .brand small {
  display: none;
}
.driving .brand {
  font-size: 24px;
}
.driving .brand-mark {
  width: 34px;
  height: 38px;
  font-size: 28px;
}
.drive-top {
  position: fixed;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 12;
}
.round-button {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: grid;
  place-items: center;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #fffefbea;
  box-shadow: 0 3px 15px #2147220e;
  font-size: 20px;
}
.drive-objective {
  background: #fffef8e8;
  border: 1px solid #fff;
  backdrop-filter: blur(8px);
  border-radius: 14px;
  width: 260px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 9px;
}
.drive-objective > b {
  font-size: 11px;
  color: #7e956e;
  font-weight: 500;
}
.progress-track {
  width: 100%;
  height: 4px;
  border-radius: 10px;
  background: #e4e9d9;
  overflow: hidden;
}
.progress-track span {
  display: block;
  height: 100%;
  background: #83a465;
  width: 0;
  transition: width 0.4s;
}
.drive-coach {
  position: fixed;
  top: 114px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffef3eb;
  border: 1px solid #fff;
  border-radius: 15px;
  padding: 10px 17px 10px 10px;
  font-size: 12px;
  line-height: 1.6;
  max-width: 90vw;
  box-shadow: 0 4px 24px #30523110;
  white-space: nowrap;
  pointer-events: none;
}
.drive-coach .guide-avatar {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  font-size: 24px;
  border-radius: 9px;
}
.drive-instruments {
  position: fixed;
  right: 36px;
  bottom: 110px;
  background: #fffef8e8;
  backdrop-filter: blur(8px);
  border: 1px solid white;
  border-radius: 21px;
  display: grid;
  grid-template-columns: 72px 150px;
  gap: 12px;
  padding: 19px;
}
.speed {
  text-align: center;
  border-right: 1px solid #dce4d2;
}
.speed b {
  display: block;
  font-size: 35px;
  font-weight: 550;
  line-height: 1;
}
.speed > span {
  display: block;
  font-size: 8px;
  margin-top: 9px;
  letter-spacing: 1px;
  color: #94a087;
}
.terrain-readout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  font-size: 12px;
}
.terrain-readout small {
  font-size: 9px;
  color: #8b977f;
}
.assist-button {
  grid-column: 1/-1;
  background: #e8f0df;
  color: #617c50;
  border-radius: 7px;
  font-size: 10px;
  padding: 8px;
}
.assist-button[aria-pressed="false"] {
  background: #f3e5cd;
  color: #997342;
}
.drive-bottom {
  position: fixed;
  bottom: 27px;
  left: 36px;
  right: 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #738b65;
}
.keyboard-help {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drive-utility {
  display: flex;
  gap: 10px;
}
.drive-utility button {
  border: 1px solid #d0ddc7;
  background: #fffdf5b3;
  border-radius: 9px;
  padding: 11px;
  font-size: 11px;
}
.drive-utility kbd {
  margin-left: 8px;
  opacity: 0.45;
  font-size: 9px;
}
.free-return {
  position: fixed;
  top: 176px;
  left: 50%;
  transform: translateX(-50%);
  background: #2d664a;
  color: white;
  border-radius: 20px;
  padding: 11px 18px;
  font-size: 11px;
}
#drive-pop {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 9px #427242;
  pointer-events: none;
  transition: opacity 0.4s;
}
dialog {
  color: #2e4236;
  background: #fcfcf4;
  border: 1px solid #fff;
  border-radius: 26px;
  box-shadow: 0 30px 100px #25473240;
  padding: 30px;
  max-height: 86dvh;
  width: 720px;
  max-width: calc(100vw - 36px);
  overflow: auto;
}
dialog::backdrop {
  background: #24442e47;
  backdrop-filter: blur(7px);
}
.panel-heading {
  position: sticky;
  top: -30px;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  margin-top: -12px;
  margin-bottom: 23px;
  background: #fcfcf4;
}
.panel-heading > div:first-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.panel-heading h2 {
  margin: 9px 0 0;
  font-size: 27px;
  letter-spacing: 1px;
}
.close-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eaf0e1;
  color: #859579;
  font-size: 25px;
}
.panel-intro {
  font-size: 12px;
  line-height: 1.9;
  color: #849079;
  margin: -4px 0 20px;
}
.mission-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.mission-item {
  text-align: left;
  background: white;
  border: 1px solid #e3e8dc;
  border-radius: 15px;
  padding: 17px;
  display: grid;
  grid-template-columns: 36px 1fr;
  column-gap: 12px;
  row-gap: 7px;
  position: relative;
}
.mission-item .mission-icon {
  grid-row: 1/4;
  background: #edf2e3;
  border-radius: 11px;
  width: 36px;
  height: 39px;
  display: grid;
  place-items: center;
  font-size: 19px;
}
.mission-item b {
  font-size: 14px;
}
.mission-item small {
  font-size: 10px;
  color: #8d9784;
}
.mission-item .star-row {
  font-size: 15px;
  color: #d1ae60;
  letter-spacing: 2px;
}
.mission-item .mission-tag {
  position: absolute;
  right: 12px;
  bottom: 14px;
  font-size: 8px;
  color: #8ba175;
}
.mission-item.current {
  border-color: #91ae75;
  box-shadow: inset 0 0 0 1px #91ae75;
}
.vehicle-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.vehicle-option {
  background: #eef1e2;
  border: 2px solid transparent;
  border-radius: 15px;
  padding: 12px 8px;
  text-align: left;
}
.vehicle-option.selected {
  border-color: #629060;
  background: #edf5e6;
}
.vehicle-option svg {
  width: 100%;
  height: 87px;
  stroke: initial;
}
.vehicle-option b {
  display: block;
  font-size: 12px;
  margin: 8px 0 5px;
  text-align: center;
}
.vehicle-option small {
  display: block;
  font-size: 9px;
  color: #849175;
  text-align: center;
}
.setup-title {
  font-size: 13px;
  margin: 24px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.setup-title small {
  font-size: 10px;
  font-weight: 400;
  color: #96a188;
}
.choice-row {
  display: flex;
  gap: 9px;
}
.choice {
  flex: 1;
  border: 1px solid #e0e6d8;
  background: white;
  border-radius: 11px;
  padding: 12px 6px;
  font-size: 12px;
}
.choice.active {
  border-color: #74a064;
  background: #ecf3e3;
  color: #4e7540;
  box-shadow: inset 0 0 0 1px #74a064;
}
.choice small {
  display: block;
  font-size: 9px;
  color: #98a38c;
  margin-top: 5px;
}
.setup-explanation {
  background: #edf1e4;
  border-radius: 10px;
  padding: 12px;
  font-size: 11px;
  line-height: 1.8;
  color: #79896d;
  margin-top: 13px;
}
.paint-row {
  display: flex;
  gap: 12px;
}
.paint {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 1px #dbe3d1;
  position: relative;
}
.paint.active {
  box-shadow: 0 0 0 2px #688256;
}
.paint:disabled::after {
  content: "·";
  color: white;
  font-size: 25px;
  position: absolute;
  inset: 0;
}
.paint:disabled {
  opacity: 0.35;
}
.test-strip {
  margin-top: 22px;
  border: 1px dashed #d6ddca;
  border-radius: 13px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  font-size: 11px;
  color: #8a977e;
}
.small-button {
  background: #e5eedb;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 11px;
  color: #58714b;
  white-space: nowrap;
}
.knowledge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.knowledge-card {
  background: white;
  border: 1px solid #e4e9dd;
  border-radius: 14px;
  padding: 17px;
}
.knowledge-card .card-emoji {
  font-size: 22px;
}
.knowledge-card h3 {
  font-size: 18px;
  margin: 9px 0;
}
.knowledge-card p {
  font-size: 16px;
  line-height: 1.6;
  color: #52664a;
  margin: 0;
}
.knowledge-card > p + p {
  margin-top: 12px;
}
.knowledge-card > p > strong {
  display: block;
  padding: 10px;
  border-radius: 8px;
  background: #fff5df;
  color: #6a542d;
  font-size: 15px;
}
.knowledge-card details p {
  font-size: 15px;
  line-height: 1.7;
}
.knowledge-card .workshop-more summary {
  font-size: 14px;
}
.knowledge-card small {
  display: block;
  font-size: 12px;
  line-height: 1.6;
  color: #657852;
  margin-top: 12px;
}
.passport-hero {
  background: #edf2e1;
  border-radius: 17px;
  text-align: center;
  padding: 26px;
}
.passport-hero > span {
  font-size: 38px;
}
.passport-hero h3 {
  font-size: 20px;
  margin: 12px 0 7px;
}
.passport-hero p {
  font-size: 11px;
  color: #8b9879;
}
.passport-stats {
  display: flex;
  justify-content: center;
  gap: 45px;
  margin-top: 23px;
}
.passport-stats b {
  display: block;
  font-size: 24px;
  color: #627f50;
}
.passport-stats small {
  font-size: 10px;
  color: #8b9b7b;
}
.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}
.badge {
  padding: 17px 8px;
  text-align: center;
  background: #fff;
  border: 1px solid #e6eadf;
  border-radius: 13px;
}
.badge > span {
  font-size: 25px;
  filter: grayscale(1);
  opacity: 0.28;
}
.badge.earned > span {
  filter: none;
  opacity: 1;
}
.badge b {
  display: block;
  font-size: 11px;
  margin-top: 10px;
  color: #8b967f;
}
.badge small {
  font-size: 9px;
  color: #a4ac97;
  display: block;
  margin-top: 6px;
}
.legacy-note {
  font-size: 10px;
  color: #8b947f;
  text-align: center;
  margin-top: 20px;
}
.prepare-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #eef2e4;
  border-radius: 17px;
  padding: 20px;
  margin-bottom: 20px;
}
.prepare-hero > span {
  font-size: 42px;
}
.prepare-hero p {
  font-size: 12px;
  line-height: 1.9;
  color: #7c8d6c;
  margin: 0;
}
.prepare-hero b {
  display: block;
  font-size: 15px;
  color: #4f6e43;
  margin-bottom: 5px;
}
.prepare-feedback {
  font-size: 11px;
  line-height: 1.9;
  padding: 13px;
  background: #fff7e8;
  color: #ac8b54;
  border-radius: 10px;
  min-height: 63px;
  margin: 16px 0 23px;
}
.result {
  text-align: center;
}
.result-stars {
  font-size: 53px;
  color: #d3aa51;
  letter-spacing: 10px;
  margin: 4px 0 18px;
  text-shadow: 0 4px #f1e7c8;
}
.result h3 {
  font-size: 26px;
  margin: 0 0 10px;
}
.result > p {
  font-size: 12px;
  color: #8b967e;
  line-height: 1.8;
}
.result-find {
  background: #edf3e3;
  border-radius: 15px;
  text-align: left;
  padding: 19px;
  margin: 23px 0;
}
.result-find small {
  color: #7d9564;
  font-size: 10px;
}
.result-find b {
  display: block;
  font-size: 16px;
  margin: 8px 0;
}
.result-find p {
  margin: 0;
  font-size: 12px;
  line-height: 1.9;
  color: #7e8b6e;
}
.result-stats {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin: 20px 0;
  color: #859275;
  font-size: 11px;
}
.reward-chip {
  display: inline-block;
  padding: 6px 11px;
  background: #faf0d5;
  color: #b29853;
  border-radius: 20px;
  font-size: 10px;
  margin-bottom: 14px;
}
.help-list {
  display: grid;
  gap: 13px;
}
.help-item {
  background: white;
  border-radius: 12px;
  padding: 17px;
  font-size: 12px;
  line-height: 1.8;
}
.help-item b {
  color: #51763f;
}
.help-item span {
  display: block;
  color: #8d987f;
  font-size: 11px;
  margin-top: 4px;
}
.circuit-board {
  background: #e8efdf;
  background-image: radial-gradient(#cbd6bf 1px, transparent 1px);
  background-size: 16px 16px;
  border-radius: 17px;
  padding: 25px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px 14px;
  position: relative;
}
.part {
  position: relative;
  z-index: 1;
  padding: 15px 6px;
  background: #fffef7;
  border: 2px solid #dae3cd;
  border-radius: 13px;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 5px #b8c8aa38;
}
.part span {
  display: block;
  font-size: 25px;
  margin-bottom: 8px;
}
.part small {
  display: block;
  margin-top: 6px;
  font-size: 9px;
  color: #8fa07d;
}
.part.picked {
  border-color: #d4a74d;
  background: #fff5d7;
}
.part.connected {
  border-color: #82aa6c;
}
.part.connected:after {
  content: "✓";
  position: absolute;
  right: 8px;
  top: 4px;
  color: #70a05a;
  font-size: 11px;
}
.circuit-progress {
  display: flex;
  gap: 8px;
  margin: 17px 0;
}
.circuit-progress > span {
  flex: 1;
  height: 5px;
  border-radius: 5px;
  background: #e2e9d7;
}
.circuit-progress > span.done {
  background: #88ac6d;
}
.circuit-note {
  font-size: 12px;
  line-height: 1.9;
  color: #7f916f;
  min-height: 49px;
  margin: 16px 0;
}
.circuit-wires {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}
.circuit-wires span {
  padding: 6px 9px;
  background: #eff4e6;
  color: #7c9369;
  border-radius: 6px;
  font-size: 9px;
}
.experiment-controls {
  display: grid;
  gap: 13px;
  background: #eef3e5;
  border-radius: 13px;
  padding: 18px;
  margin-bottom: 20px;
}
.experiment-controls label {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.experiment-controls input {
  flex: 1;
  accent-color: #678e51;
  min-width: 50px;
}
.experiment-preview {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
}
.motor-wheel {
  width: 48px;
  height: 48px;
  border: 7px solid #3b4634;
  border-radius: 50%;
  background: conic-gradient(
    #b6c6a5 0deg 40deg,
    #7c9070 40deg 90deg,
    #b6c6a5 90deg 130deg,
    #7c9070 130deg 180deg,
    #b6c6a5 180deg 220deg,
    #7c9070 220deg 270deg,
    #b6c6a5 270deg 310deg,
    #7c9070 310deg
  );
  animation: spin 2s linear infinite;
  animation-play-state: paused;
}
.servo-wheel {
  width: 19px;
  height: 43px;
  background: #3b4634;
  border-radius: 6px;
  position: relative;
}
.servo-wheel:after {
  content: "";
  position: absolute;
  height: 5px;
  width: 42px;
  background: #7c8d6d;
  top: 19px;
  left: -12px;
}
.experiment-readout {
  font-size: 10px;
  color: #738d5d;
  text-align: center;
}
.wire-tutorial {
  font-size: 10px;
  color: #a1aa91;
  text-align: center;
  margin: 10px 0;
}
#pause-dialog {
  text-align: center;
  max-width: 360px;
  padding: 30px;
}
.pause-symbol {
  color: #a4b98e;
  font-size: 45px;
}
#pause-dialog h2 {
  font-size: 23px;
}
#pause-dialog p {
  font-size: 12px;
  color: #94a083;
  margin-bottom: 28px;
}
#toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 125px;
  transform: translateX(-50%);
  background: #2c513eea;
  color: #fffde9;
  box-shadow: 0 5px 20px #30492822;
  border-radius: 12px;
  padding: 14px 20px;
  max-width: 90vw;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
#loading,
#load-error {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #eef3e9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#loading .brand-mark {
  width: 66px;
  height: 73px;
  font-size: 60px;
}
#loading h2,
#load-error h2 {
  font-size: 22px;
  margin-top: 28px;
}
#loading p,
#load-error p {
  font-size: 12px;
  color: #8b987e;
  max-width: 80vw;
  text-align: center;
  line-height: 1.9;
}
#load-error button {
  padding: 15px 25px;
  background: #366b4c;
  border-radius: 12px;
  color: white;
}
.confetti-piece {
  position: fixed;
  width: 9px;
  height: 15px;
  z-index: 100;
  pointer-events: none;
  animation: confetti 2.3s ease-out forwards;
}
@keyframes confetti {
  0% {
    transform: translateY(-30px) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(750deg);
    opacity: 0;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (min-width: 1500px) {
  #camp {
    left: 160px;
    top: 155px;
    width: 316px;
  }
  .welcome h1 {
    font-size: 48px;
  }
  .mission-card {
    padding: 25px;
  }
  .camp-footer {
    left: 160px;
  }
  .guide-note {
    margin-top: 28px;
  }
}
@media (max-height: 850px) and (min-width: 850px) {
  #camp {
    top: 111px;
    width: 270px;
  }
  .welcome h1 {
    font-size: 34px;
    line-height: 1.25;
    margin-top: 14px;
  }
  .welcome > p {
    margin-bottom: 18px;
  }
  .mission-card {
    padding: 17px 20px 10px;
  }
  .mission-card h2 {
    font-size: 21px;
    margin: 10px 0;
  }
  .mission-meta {
    margin: 12px 0;
  }
  .mission-reward {
    padding: 11px 0;
  }
  .guide-note {
    margin-top: 14px;
  }
  .camp-footer {
    height: 65px;
    bottom: 18px;
  }
  .island-caption {
    bottom: 128px;
  }
  .rail {
    top: 124px;
  }
  .primary-button {
    padding: 13px 17px;
  }
}
@media (max-width: 1100px) {
  .island-status {
    display: none;
  }
  #camp {
    left: 108px;
    width: 263px;
  }
  .camp-footer {
    left: 108px;
    right: 24px;
  }
  .camp-footer-hint {
    display: none;
  }
  .topbar {
    padding: 0 25px;
  }
  .rail {
    left: 18px;
  }
  .map-tools {
    right: 24px;
  }
  .island-caption {
    left: 68%;
  }
  .welcome h1 {
    font-size: 36px;
  }
  .drive-top {
    top: 88px;
  }
  .drive-coach {
    top: 182px;
  }
  .free-return {
    top: 237px;
  }
}
@media (max-width: 760px) {
  .topbar {
    height: 78px;
    padding: 0 20px;
  }
  .brand {
    font-size: 23px;
    gap: 9px;
  }
  .brand-mark {
    width: 35px;
    height: 39px;
    font-size: 30px;
    border-radius: 12px;
  }
  .brand small {
    font-size: 7px;
    letter-spacing: 1.5px;
    margin-top: 5px;
  }
  .top-actions {
    gap: 7px;
  }
  .stars-pill {
    padding: 8px 11px;
    gap: 6px;
  }
  .stars-pill > span:first-child {
    font-size: 18px;
  }
  .icon-button {
    height: 33px;
    width: 33px;
    font-size: 17px;
  }
  .top-actions #help-button {
    display: none;
  }
  .rail {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    height: 73px;
    flex-direction: row;
    justify-content: space-around;
    gap: 0;
    background: #fffef5f2;
    border-top: 1px solid #e0e6d6;
    backdrop-filter: blur(12px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .rail-bottom {
    display: none;
  }
  .nav-button {
    width: 65px;
    padding: 8px 3px;
    border-radius: 13px;
    gap: 4px;
    font-size: 10px;
  }
  .nav-button.active {
    box-shadow: none;
    background: #edf2e3;
  }
  .nav-button svg {
    width: 22px;
    height: 22px;
  }
  #camp {
    top: 91px;
    left: 22px;
    right: 22px;
    width: auto;
    pointer-events: none;
  }
  .welcome .eyebrow {
    font-size: 7px;
    letter-spacing: 1.5px;
  }
  .welcome h1 {
    font-size: 29px;
    line-height: 1.28;
    letter-spacing: 1px;
    margin: 13px 0 8px;
  }
  .welcome h1 br {
    display: none;
  }
  .welcome > p {
    font-size: 10px;
    margin: 0;
    letter-spacing: 1px;
  }
  .mission-card {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: 150px;
    padding: 15px 18px 14px;
    border-radius: 19px;
    pointer-events: auto;
    display: grid;
    grid-template-columns: 1fr 130px;
    column-gap: 13px;
  }
  .card-overline {
    grid-column: 1/-1;
    font-size: 8px;
    margin-bottom: 4px;
  }
  .mission-card h2 {
    font-size: 19px;
    margin: 7px 0;
  }
  .mission-card > p {
    font-size: 10px;
    line-height: 1.6;
    min-height: 0;
    grid-column: 1;
    grid-row: 3;
  }
  .mission-meta {
    margin: 9px 0 0;
    font-size: 8px;
    grid-column: 1;
  }
  .mission-reward {
    grid-column: 2;
    grid-row: 2/4;
    border: 0;
    flex-direction: column;
    align-items: flex-start;
    padding: 7px 0;
    gap: 4px;
  }
  .mission-reward > span:first-child {
    display: none;
  }
  .mission-reward > span:last-child {
    font-size: 19px;
  }
  .mission-card .primary-button {
    grid-column: 2;
    grid-row: 3/5;
    align-self: end;
    font-size: 12px;
    padding: 13px 12px;
    gap: 5px;
  }
  .mission-card .text-button {
    grid-column: 2;
    grid-row: 2;
    font-size: 9px;
    padding: 5px 0;
    gap: 6px;
    justify-content: flex-start;
    align-self: start;
  }
  .mission-reward {
    display: none;
  }
  .guide-note {
    display: none;
  }
  .camp-footer {
    height: 48px;
    left: 20px;
    right: 20px;
    bottom: 87px;
    gap: 8px;
  }
  .car-companion {
    min-width: 0;
    flex: 1;
    border-radius: 12px;
    padding: 4px 7px;
    gap: 7px;
    height: 48px;
  }
  .car-companion > div {
    width: 57px;
    height: 38px;
  }
  .car-companion svg {
    width: 60px;
    height: 37px;
  }
  .car-companion small {
    font-size: 7px;
    margin-bottom: 4px;
    letter-spacing: 0;
  }
  .car-companion b {
    font-size: 10px;
    white-space: nowrap;
  }
  .companion-arrow {
    font-size: 16px;
    margin: 0 5px 0 auto;
  }
  .free-button {
    padding: 13px 12px;
    font-size: 10px;
    gap: 6px;
    border-radius: 12px;
    height: 46px;
  }
  .free-button > span:last-child {
    margin-left: 0;
  }
  .free-button svg {
    width: 16px;
  }
  .island-caption {
    display: none;
  }
  .map-tools {
    bottom: 330px;
    right: 18px;
    gap: 8px;
  }
  .map-tools .icon-button {
    width: 29px;
    height: 29px;
  }
  .map-tools svg {
    width: 17px;
  }
  .map-label > span {
    padding: 6px 8px;
    font-size: 9px;
    gap: 5px;
    border-radius: 8px;
  }
  .map-label b {
    width: 16px;
    height: 16px;
    font-size: 8px;
  }
  .map-label i {
    width: 5px;
    height: 5px;
    border-width: 1px;
  }
  .world-vignette {
    background: linear-gradient(
      #eef3e966,
      transparent 30%,
      transparent 50%,
      #edf2e644
    );
  }
  dialog {
    padding: 23px 20px;
    border-radius: 22px;
    max-height: 87dvh;
  }
  .panel-heading h2 {
    font-size: 23px;
  }
  .panel-heading {
    margin-bottom: 18px;
  }
  .mission-list {
    grid-template-columns: 1fr;
  }
  .mission-item {
    padding: 12px;
  }
  .mission-item b {
    font-size: 13px;
  }
  .mission-item .star-row {
    font-size: 13px;
  }
  .vehicle-options {
    gap: 7px;
  }
  .vehicle-option {
    padding: 10px 3px;
  }
  .vehicle-option svg {
    height: 61px;
  }
  .vehicle-option small {
    font-size: 8px;
  }
  .vehicle-option b {
    font-size: 10px;
  }
  .choice {
    font-size: 11px;
    padding: 11px 4px;
  }
  .choice small {
    font-size: 8px;
  }
  .knowledge-grid {
    grid-template-columns: 1fr;
  }
  .badge-grid {
    gap: 7px;
  }
  .badge {
    padding: 14px 4px;
  }
  .badge b {
    font-size: 9px;
  }
  .badge small {
    font-size: 8px;
  }
  .circuit-board {
    padding: 18px 10px;
    gap: 15px 9px;
  }
  .part {
    font-size: 11px;
    padding: 12px 4px;
  }
  .part span {
    font-size: 22px;
  }
  .part small {
    font-size: 8px;
  }
  .result-stars {
    font-size: 44px;
  }
  .result h3 {
    font-size: 22px;
  }
  .result-stats {
    font-size: 10px;
    gap: 16px;
  }
}
@media (max-height: 660px) and (max-width: 760px) {
  .welcome h1 {
    font-size: 24px;
  }
  .welcome > p {
    display: none;
  }
  .mission-card {
    bottom: 142px;
    padding: 11px 14px;
  }
  .mission-card > p {
    display: none;
  }
  .mission-card .primary-button {
    grid-row: 2/5;
  }
  .mission-card .text-button {
    display: none;
  }
  .mission-meta {
    grid-row: 3;
    margin-top: 3px;
  }
  .map-tools {
    bottom: 275px;
  }
  .camp-footer {
    bottom: 83px;
  }
}
#next-waypoint {
  position: fixed;
  transform: translate(-50%, -50%);
  z-index: 13;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 20px;
  background: #fff7d8ee;
  color: #685325;
  border: 1px solid #ddba6e;
  box-shadow: 0 3px 14px #4e4f2315;
  pointer-events: none;
  font-size: 12px;
}
#next-waypoint span {
  display: block;
  font-size: 22px;
}
#next-waypoint b {
  font-weight: 550;
  white-space: nowrap;
}
/* Touch driving: a quiet road view and controls in the thumb zone. */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.touch-controls,
.control-settings,
.touch-settings {
  display: none;
}
.close-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
.round-button {
  min-width: 48px;
  min-height: 48px;
}
.assist-button {
  min-height: 44px;
  font-size: 12px;
}
#pause-dialog {
  max-width: min(420px, calc(100vw - 24px));
  padding: 24px;
}
#pause-dialog h2 {
  margin: 4px 0 0;
}
#pause-dialog .pause-symbol {
  font-size: 30px;
}
#pause-dialog p {
  font-size: 14px;
  color: #647358;
  line-height: 1.6;
  margin: 8px 0 18px;
}
#pause-dialog .text-button {
  min-height: 48px;
}
#pause-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: auto;
  max-height: calc(100dvh - 28px - var(--safe-top) - var(--safe-bottom));
}
.pause-heading,
.pause-actions {
  flex-shrink: 0;
}
#pause-title:focus {
  outline: none;
}
.pause-actions {
  padding-top: 10px;
  background: #fcfcf4;
}
.touch-settings {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 2px;
}
.touch-layout .touch-settings {
  display: block;
  text-align: left;
}
.touch-settings fieldset {
  padding: 0;
  margin: 16px 0;
  border: 0;
}
.touch-settings legend {
  font-weight: 650;
  font-size: 14px;
  margin-bottom: 10px;
}
.control-options {
  display: flex;
  gap: 10px;
}
.control-options button {
  flex: 1;
  min-height: 48px;
  background: #eef1e6;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 10px 8px;
  font-size: 14px;
}
.control-options button[aria-pressed="true"] {
  border-color: #39734e;
  background: #e3ecd9;
}
.control-options small,
.setting-check small {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
  color: #647358;
}
.setting-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 12px;
  font-size: 14px;
}
.setting-check input {
  width: 28px;
  height: 28px;
  accent-color: #39734e;
  flex-shrink: 0;
  margin: 8px;
}
#pause-dialog #control-explanation {
  font-size: 12px;
  background: #f0f2e7;
  border-radius: 10px;
  padding: 12px;
}
.touch-layout.driving .topbar {
  display: none;
}
.touch-layout .drive-top {
  top: calc(12px + var(--safe-top));
  left: calc(14px + var(--safe-left));
  right: calc(14px + var(--safe-right));
  width: auto;
  transform: none;
  gap: 10px;
  justify-content: center;
}
.touch-layout .drive-objective {
  flex: 1;
  max-width: 360px;
  min-width: 0;
  font-size: 14px;
  padding: 11px 12px;
  gap: 8px;
}
.touch-layout .drive-objective > b {
  font-size: 12px;
  color: #566d4b;
}
.touch-layout .round-button {
  flex: 0 0 48px;
  height: 48px;
}
.touch-layout .drive-coach {
  top: calc(88px + var(--safe-top));
  white-space: normal;
  font-size: 13px;
  max-width: calc(100vw - 36px);
  width: max-content;
  padding: 9px 12px;
  line-height: 1.5;
}
.touch-layout .drive-coach .guide-avatar {
  display: none;
}
.touch-layout .keyboard-help,
.touch-layout .drive-utility kbd,
.touch-layout .free-return {
  display: none;
}
.touch-layout .touch-controls {
  display: block;
  position: fixed;
  bottom: calc(22px + var(--safe-bottom));
  left: calc(20px + var(--safe-left));
  right: calc(20px + var(--safe-right));
  pointer-events: none;
  z-index: 15;
}
.stick-control {
  width: 156px;
  text-align: center;
}
.stick-caption {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #34553b;
  text-shadow: 0 1px 4px #fff;
}
.stick-caption span {
  display: block;
  font-size: 12px;
}
#drive-stick {
  --stick-x: 0px;
  --stick-y: 0px;
  display: block;
  width: 156px;
  height: 156px;
  position: relative;
  padding: 0;
  border: 2px solid #fffef6;
  border-radius: 50%;
  background: radial-gradient(circle, #d4dec8aa 0 45%, #fffdf0c9 46%);
  box-shadow:
    0 5px 24px #27472b20,
    inset 0 0 0 8px #fffefa50;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#drive-stick:active {
  transform: none;
}
.stick-knob {
  position: absolute;
  left: calc(50% - 30px);
  top: calc(50% - 30px);
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  color: #ffefd0;
  font-size: 30px;
  background: #39724e;
  border: 3px solid #609067;
  border-radius: 50%;
  box-shadow:
    0 5px 0 #29543a,
    0 9px 16px #27472b30;
  transform: translate(var(--stick-x), var(--stick-y));
  pointer-events: none;
}
#drive-stick:not(.held) .stick-knob {
  transition: transform 0.15s ease-out;
}
#drive-stick.held {
  border-color: #e4b85b;
}
.stick-arrow {
  position: absolute;
  color: #789064;
  font-size: 19px;
  line-height: 20px;
  pointer-events: none;
}
.stick-arrow.up {
  top: 7px;
  left: calc(50% - 8px);
}
.stick-arrow.down {
  bottom: 6px;
  left: calc(50% - 8px);
}
.stick-arrow.left {
  left: 7px;
  top: calc(50% - 10px);
}
.stick-arrow.right {
  right: 7px;
  top: calc(50% - 10px);
}
.button-controls {
  display: none;
  justify-content: space-between;
  align-items: end;
}
.touch-steering,
.touch-pedals {
  display: grid;
  grid-template-columns: repeat(2, 62px);
  gap: 10px;
}
.button-controls button {
  width: 62px;
  min-height: 58px;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  border: 2px solid #fff;
  background: #fffbedeb;
  box-shadow: 0 4px 0 #788d6659;
  border-radius: 16px;
  font-size: 15px;
}
.touch-steering button {
  height: 76px;
  font-size: 22px;
}
.touch-pedals .touch-throttle {
  grid-column: 1 / -1;
  width: 100%;
  height: 66px;
  background: #39724e;
  color: #fff;
}
.button-controls button.held {
  background: #c3d9ad;
  color: #27462e;
  transform: translateY(3px);
  box-shadow: none;
}
[data-touch-mode="buttons"] .stick-control {
  display: none;
}
[data-touch-mode="buttons"] .button-controls {
  display: flex;
}
[data-stick-hand="right"] .stick-control {
  margin-left: auto;
}
.touch-layout .drive-bottom {
  left: auto;
  right: calc(20px + var(--safe-right));
  bottom: calc(22px + var(--safe-bottom));
  z-index: 16;
}
.touch-layout .drive-utility {
  flex-direction: column;
  gap: 10px;
}
.touch-layout .drive-utility button {
  font-size: 13px;
  min-height: 48px;
  min-width: 116px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fffdf2e8;
}
.touch-layout .control-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: fixed;
  bottom: calc(145px + var(--safe-bottom));
  right: calc(20px + var(--safe-right));
  min-height: 44px;
  padding: 10px 12px;
  font-size: 12px;
  background: #fffbedeb;
  border-radius: 12px;
  border: 1px solid #fff;
  z-index: 16;
}
.touch-layout[data-stick-hand="right"][data-touch-mode="stick"] .drive-bottom,
.touch-layout[data-stick-hand="right"][data-touch-mode="stick"]
  .control-settings {
  right: auto;
  left: calc(20px + var(--safe-left));
}
.touch-layout .drive-instruments {
  bottom: calc(247px + var(--safe-bottom));
  right: calc(20px + var(--safe-right));
  left: calc(20px + var(--safe-left));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 14px;
  width: max-content;
  max-width: calc(100% - 40px);
  margin: auto;
  pointer-events: none;
}
.touch-layout .speed {
  display: flex;
  align-items: baseline;
  gap: 5px;
  border: 0;
  padding: 0;
}
.touch-layout .speed b {
  font-size: 22px;
}
.touch-layout .speed > span {
  font-size: 11px;
  margin: 0;
  letter-spacing: 0;
  color: #617257;
}
.touch-layout .terrain-readout {
  font-size: 12px;
}
.touch-layout .terrain-readout small {
  display: none;
}
.touch-layout .assist-button {
  min-height: 44px;
  font-size: 12px;
  pointer-events: auto;
  padding: 8px;
}
.touch-layout[data-touch-mode="buttons"] .drive-bottom {
  bottom: calc(175px + var(--safe-bottom));
  left: calc(20px + var(--safe-left));
}
.touch-layout[data-touch-mode="buttons"] .drive-utility {
  flex-direction: row;
  justify-content: center;
}
.touch-layout[data-touch-mode="buttons"] .control-settings {
  display: none;
}
.touch-layout #drive-pop {
  top: 28%;
  width: max-content;
  max-width: 90vw;
  font-size: 22px;
}
@media (max-width: 760px) {
  .topbar {
    padding-left: max(16px, var(--safe-left));
    padding-right: max(16px, var(--safe-right));
    top: var(--safe-top);
  }
  .top-actions .icon-button,
  .map-tools .icon-button {
    width: 44px;
    height: 44px;
  }
  .stars-pill {
    min-height: 44px;
  }
  .rail {
    height: calc(73px + var(--safe-bottom));
  }
  .camp-footer {
    bottom: calc(86px + var(--safe-bottom));
  }
  .mission-card {
    bottom: calc(161px + var(--safe-bottom));
  }
  .panel-heading {
    position: sticky;
    top: -23px;
    padding: 12px 0;
    margin-top: -12px;
    z-index: 3;
    background: #fcfcf4;
  }
  .panel-intro,
  .help-item span,
  .prepare-hero p,
  .garage-explanation,
  .circuit-note {
    font-size: 14px;
    line-height: 1.7;
  }
  .choice,
  .vehicle-option b,
  .mission-item b,
  .part {
    font-size: 14px;
  }
  .choice small,
  .vehicle-option small,
  .part small,
  .experiment-readout,
  .wire-tutorial {
    font-size: 12px;
  }
  .choice,
  .paint-option,
  .text-button {
    min-height: 44px;
  }
  .vehicle-option {
    padding: 12px 5px;
  }
  .vehicle-options {
    gap: 5px;
  }
  .vehicle-option small {
    line-height: 1.5;
  }
  .choice-row {
    gap: 6px;
  }
  .choice {
    padding: 10px 5px;
  }
  input[type="range"] {
    min-height: 44px;
    touch-action: pan-y;
  }
  .map-label {
    min-height: 44px;
    min-width: 44px;
  }
}
@media (max-width: 760px) and (min-height: 501px) {
  .mission-card {
    grid-template-columns: 1fr 122px;
    padding: 14px 16px;
    column-gap: 10px;
  }
  .card-overline {
    font-size: 11px;
  }
  .mission-card h2 {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 7px 0 4px;
    font-size: 21px;
  }
  .mission-card > p {
    grid-column: 1 / -1;
    grid-row: 3;
    font-size: 13px;
    line-height: 1.6;
    margin: 6px 0;
  }
  .mission-meta {
    grid-column: 1 / -1;
    grid-row: 4;
    font-size: 11px;
    margin: 6px 0 10px;
  }
  .mission-card .primary-button {
    grid-column: 1;
    grid-row: 5;
    min-height: 52px;
    font-size: 14px;
    padding: 12px;
  }
  .mission-card .text-button {
    display: flex;
    grid-column: 2;
    grid-row: 5;
    min-height: 52px;
    font-size: 12px;
    justify-content: center;
    align-self: center;
  }
  .camp-footer .car-companion b,
  .camp-footer .free-button {
    font-size: 12px;
  }
  .camp-footer .car-companion small {
    font-size: 10px;
  }
  .camp-footer .car-companion > div {
    width: 42px;
  }
  .camp-footer .car-companion svg {
    width: 44px;
  }
  .companion-arrow {
    display: none;
  }
  .nav-button {
    font-size: 12px;
  }
}
@media (max-height: 660px) and (max-width: 760px) {
  .welcome {
    display: none;
  }
}
@media (max-width: 359px) {
  .touch-layout .touch-controls {
    left: 12px;
    right: 12px;
  }
  .stick-control,
  #drive-stick {
    width: 140px;
  }
  #drive-stick {
    height: 140px;
  }
  .touch-layout .drive-bottom,
  .touch-layout .control-settings {
    right: 12px;
  }
  .touch-layout .drive-objective {
    font-size: 12px;
  }
  .touch-layout .drive-top {
    gap: 6px;
    left: 10px;
    right: 10px;
  }
  .touch-layout .drive-objective > b {
    font-size: 11px;
  }
  .touch-layout .drive-instruments {
    gap: 8px;
    padding: 6px 8px;
  }
  .touch-layout .terrain-readout {
    font-size: 11px;
  }
  .touch-layout .speed > span {
    display: none;
  }
}
@media (max-height: 500px) and (min-width: 600px) {
  .touch-layout .drive-top {
    top: calc(8px + var(--safe-top));
    left: 26%;
    right: 26%;
  }
  .touch-layout .drive-objective {
    padding: 8px 10px;
  }
  .touch-layout .drive-coach {
    top: calc(82px + var(--safe-top));
    max-width: 46%;
    font-size: 12px;
    padding: 7px 10px;
  }
  .touch-layout .touch-controls {
    bottom: calc(14px + var(--safe-bottom));
  }
  .stick-control,
  #drive-stick {
    width: 136px;
  }
  #drive-stick {
    height: 136px;
  }
  .stick-caption {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .stick-caption span {
    font-size: 11px;
  }
  .touch-layout .drive-bottom {
    bottom: calc(14px + var(--safe-bottom));
  }
  .touch-layout .control-settings {
    bottom: calc(136px + var(--safe-bottom));
  }
  .touch-layout .drive-instruments {
    top: calc(12px + var(--safe-top));
    bottom: auto;
    left: calc(20px + var(--safe-left));
    right: auto;
    max-width: 23%;
    flex-wrap: wrap;
    gap: 6px;
    padding: 7px;
  }
  .touch-layout .drive-instruments .speed > span {
    display: none;
  }
  .touch-layout[data-touch-mode="buttons"] .drive-bottom {
    left: auto;
    bottom: calc(166px + var(--safe-bottom));
  }
  .touch-layout[data-touch-mode="buttons"] .drive-utility {
    flex-direction: column;
    gap: 6px;
  }
  .touch-layout[data-touch-mode="buttons"] .drive-utility button {
    min-height: 44px;
  }
  .touch-layout #drive-pop {
    top: 39%;
    font-size: 19px;
  }
  #pause-dialog {
    max-height: calc(100dvh - 16px);
  }
  /* Keep the home task reachable when a phone is already held sideways. */
  body:not(.driving) .welcome,
  body:not(.driving) .guide-note,
  body:not(.driving) .island-caption,
  body:not(.driving) .camp-footer-hint,
  body:not(.driving) .island-status {
    display: none;
  }
  body:not(.driving) .topbar {
    height: 64px;
  }
  body:not(.driving) .rail {
    top: 74px;
    bottom: 12px;
    left: 12px;
    width: 62px;
    height: auto;
    right: auto;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0;
    border-radius: 20px;
  }
  body:not(.driving) .rail-bottom {
    display: none;
  }
  body:not(.driving) .nav-button {
    width: 56px;
    padding: 8px 0;
    font-size: 10px;
  }
  body:not(.driving) #camp {
    top: 78px;
    left: 86px;
    bottom: 14px;
    width: 280px;
  }
  body:not(.driving) .mission-card {
    position: static;
    display: block;
    width: 280px;
    padding: 16px;
    margin: 0;
  }
  body:not(.driving) .mission-card > p {
    display: none;
  }
  body:not(.driving) .mission-card h2 {
    font-size: 22px;
    margin: 10px 0;
  }
  body:not(.driving) .mission-meta {
    margin: 8px 0;
  }
  body:not(.driving) .mission-reward {
    display: none;
  }
  body:not(.driving) .mission-card .primary-button {
    min-height: 48px;
    margin-top: 10px;
  }
  body:not(.driving) .mission-card .text-button {
    display: block;
    min-height: 40px;
    margin: 0;
  }
  body:not(.driving) .camp-footer {
    left: auto;
    right: 18px;
    bottom: 14px;
    gap: 12px;
  }
  body:not(.driving) .car-companion {
    display: none;
  }
  body:not(.driving) .map-tools {
    right: 18px;
    bottom: 90px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Keep every action reachable between phone and desktop sizes. */
.mission-card,
.drive-objective,
.panel-heading > div,
.car-companion > span {
  min-width: 0;
}
.nav-button,
.icon-button,
.close-button {
  flex-shrink: 0;
}
.car-companion > span:not(.companion-arrow) {
  overflow: hidden;
}
.car-companion b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drive-coach {
  white-space: normal;
}
dialog {
  overscroll-behavior: contain;
  scroll-padding-block: 72px 20px;
}

/* A foldable in landscape has room for a side panel, but not a tall desktop
   welcome stack. The card scrolls independently above the bottom actions. */
@media (min-width: 600px) and (max-width: 1100px) and (orientation: landscape) {
  body:not(.driving) .topbar {
    top: var(--safe-top);
    height: 76px;
    padding-inline: max(18px, var(--safe-left)) max(18px, var(--safe-right));
  }
  body:not(.driving) .brand {
    font-size: 24px;
  }
  body:not(.driving) .brand-mark {
    width: 36px;
    height: 40px;
    font-size: 30px;
  }
  body:not(.driving) .rail {
    top: calc(88px + var(--safe-top));
    bottom: calc(16px + var(--safe-bottom));
    left: calc(14px + var(--safe-left));
    right: auto;
    width: 64px;
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    padding: 0 3px;
    border: 0;
    border-radius: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  body:not(.driving) .nav-button {
    min-height: 56px;
    width: 58px;
    padding: 9px 3px;
    gap: 4px;
    font-size: 11px;
    letter-spacing: 0;
  }
  body:not(.driving) .rail-bottom,
  body:not(.driving) .guide-note,
  body:not(.driving) .island-caption,
  body:not(.driving) .camp-footer-hint {
    display: none;
  }
  body:not(.driving) #camp {
    position: fixed;
    z-index: 2;
    top: calc(88px + var(--safe-top));
    bottom: calc(90px + var(--safe-bottom));
    left: calc(94px + var(--safe-left));
    right: auto;
    width: clamp(232px, 30vw, 300px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 0 5px 8px 0;
    pointer-events: auto;
  }
  body:not(.driving) .welcome {
    display: block;
  }
  body:not(.driving) .welcome h1 {
    font-size: 27px;
    line-height: 1.2;
    margin: 9px 0 18px;
    letter-spacing: 0;
  }
  body:not(.driving) .welcome h1 br,
  body:not(.driving) .welcome > p,
  body:not(.driving) .welcome .eyebrow {
    display: none;
  }
  body:not(.driving) .mission-card {
    position: static;
    display: block;
    width: auto;
    margin: 0;
    padding: 16px;
  }
  body:not(.driving) .card-overline {
    font-size: 11px;
    letter-spacing: 0;
  }
  body:not(.driving) .mission-card h2 {
    font-size: 23px;
    margin: 12px 0;
  }
  body:not(.driving) .mission-card > p {
    display: none;
  }
  body:not(.driving) .mission-meta {
    font-size: 12px;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 14px;
  }
  body:not(.driving) .mission-reward {
    display: none;
  }
  body:not(.driving) .mission-card .primary-button {
    min-height: 48px;
    font-size: 15px;
    padding: 12px;
    margin: 0 0 5px;
  }
  body:not(.driving) .mission-card .text-button {
    display: flex;
    min-height: 44px;
    font-size: 13px;
    padding: 10px 0 4px;
    margin: 0;
    justify-content: center;
  }
  body:not(.driving) .camp-footer {
    left: calc(94px + var(--safe-left));
    right: calc(18px + var(--safe-right));
    bottom: calc(16px + var(--safe-bottom));
    height: 56px;
    gap: 12px;
  }
  body:not(.driving) .car-companion {
    display: flex;
    min-width: 0;
    max-width: 280px;
    flex: 1;
    height: 56px;
    padding: 6px 10px;
    gap: 8px;
  }
  body:not(.driving) .car-companion > div {
    width: 54px;
    height: 40px;
    flex-shrink: 0;
  }
  body:not(.driving) .car-companion svg {
    width: 54px;
    height: 40px;
  }
  body:not(.driving) .companion-arrow {
    display: none;
  }
  body:not(.driving) .free-button {
    min-height: 48px;
    height: auto;
    padding: 12px;
    font-size: 13px;
    gap: 7px;
  }
  body:not(.driving) .free-button > span:last-child {
    margin-left: 0;
  }
  body:not(.driving) .map-tools {
    right: calc(18px + var(--safe-right));
    bottom: calc(90px + var(--safe-bottom));
  }
  body:not(.driving) .map-tools .icon-button {
    width: 44px;
    height: 44px;
  }
}
@media (min-width: 600px) and (max-width: 1100px) and (max-height: 500px) {
  body:not(.driving) .topbar {
    height: 60px;
  }
  body:not(.driving) #camp,
  body:not(.driving) .rail {
    top: calc(70px + var(--safe-top));
  }
  body:not(.driving) .welcome {
    display: none;
  }
}
@media (max-width: 599px) {
  .mission-card {
    max-height: calc(100dvh - 255px - var(--safe-top) - var(--safe-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-block: 12px;
  }
  .camp-footer .car-companion > div {
    flex-shrink: 0;
  }
  .camp-footer .free-button {
    flex-shrink: 0;
    gap: 5px;
  }
  .test-strip {
    flex-wrap: wrap;
  }
  .test-strip button {
    flex: 1;
    min-height: 44px;
    white-space: normal;
  }
}

/* A consistent exit and a small destination picker stay visible in every mode. */
#leave-drive,
.quick-nav-button {
  width: auto;
  min-width: 76px;
  flex-basis: auto;
  padding: 8px 12px;
  border-radius: 13px;
  font-size: 14px;
  white-space: nowrap;
}
.touch-layout #leave-drive,
.touch-layout .quick-nav-button {
  flex-basis: auto;
}
.dialog-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dialog-header .small-button,
#pause-dialog [data-open-navigation] {
  min-height: 44px;
  font-size: 13px;
}
#navigation-dialog {
  width: 520px;
  max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom));
  padding: 24px;
}
#navigation-dialog h2 {
  margin: 0;
  font-size: 24px;
}
#navigation-dialog p {
  margin: 10px 0 18px;
  color: #647358;
  font-size: 14px;
  line-height: 1.5;
}
.navigation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.navigation-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 80px;
  padding: 12px 6px;
  background: #edf2e4;
  border: 1px solid #cbd9be;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.4;
}
.navigation-grid button[aria-current] {
  background: #dce9cf;
  border-color: #789b65;
}
#navigation-resume {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  border-radius: 12px;
  background: #2e664b;
  color: #fffcef;
  font-size: 15px;
}
@media (max-width: 599px) {
  .touch-layout .drive-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
  }
  .touch-layout #leave-drive {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }
  .touch-layout .quick-nav-button {
    grid-column: 2;
    grid-row: 1;
  }
  .touch-layout #pause-drive {
    grid-column: 3;
    grid-row: 1;
  }
  .touch-layout .drive-objective {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: none;
    width: 100%;
    padding: 9px 12px;
    gap: 6px;
  }
  .touch-layout .drive-coach {
    top: calc(140px + var(--safe-top));
    max-width: calc(100vw - 28px);
    font-size: 12px;
    padding: 7px 10px;
  }
  .panel-heading {
    gap: 10px;
  }
  .dialog-header {
    gap: 5px;
  }
  .dialog-header .small-button {
    padding: 8px;
    font-size: 12px;
  }
  #navigation-dialog {
    padding: 20px;
  }
  .navigation-grid {
    gap: 8px;
  }
  .navigation-grid button {
    min-height: 70px;
    font-size: 14px;
    gap: 6px;
    padding: 10px 5px;
  }
}
@media (min-width: 600px) and (max-height: 500px) {
  .touch-layout .drive-top {
    left: calc(20px + var(--safe-left));
    right: calc(20px + var(--safe-right));
    gap: 8px;
  }
  .touch-layout .drive-objective {
    max-width: 440px;
  }
  .touch-layout .drive-instruments {
    top: calc(86px + var(--safe-top));
  }
}
@media (max-height: 500px) {
  #navigation-dialog {
    padding: 18px 20px;
  }
  #navigation-dialog h2 {
    font-size: 21px;
    margin-bottom: 12px;
  }
  #navigation-dialog p {
    display: none;
  }
  .navigation-grid button {
    min-height: 58px;
    padding: 8px;
    gap: 4px;
    flex-direction: row;
  }
  #navigation-resume {
    margin-top: 12px;
  }
}

/* Short landscape windows need one toolbar row, regardless of phone width. */
@media (max-height: 500px) and (orientation: landscape) {
  .touch-layout .drive-top {
    display: flex;
    top: calc(8px + var(--safe-top));
    left: calc(16px + var(--safe-left));
    right: calc(16px + var(--safe-right));
    gap: 8px;
  }
  .touch-layout .drive-objective {
    flex: 1;
    min-width: 0;
    max-width: 440px;
    padding: 8px 10px;
    gap: 6px;
    font-size: 12px;
  }
  .touch-layout .drive-objective > b {
    font-size: 11px;
  }
  .touch-layout .drive-coach,
  .touch-layout .stick-caption span,
  .touch-layout .drive-instruments .speed,
  .touch-layout .drive-instruments .terrain-readout {
    display: none;
  }
  .touch-layout .touch-controls {
    left: calc(16px + var(--safe-left));
    right: calc(16px + var(--safe-right));
    bottom: calc(14px + var(--safe-bottom));
  }
  .touch-layout .stick-control,
  .touch-layout #drive-stick {
    width: 136px;
  }
  .touch-layout #drive-stick {
    height: 136px;
  }
  .touch-layout .stick-caption {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .touch-layout .drive-instruments {
    top: calc(74px + var(--safe-top));
    bottom: auto;
    left: calc(16px + var(--safe-left));
    right: auto;
    margin: 0;
    padding: 0;
    border: 0;
    max-width: none;
    background: transparent;
    backdrop-filter: none;
  }
  .touch-layout .drive-instruments .assist-button {
    padding: 8px 12px;
    border: 1px solid #fff;
    border-radius: 12px;
    background: #e8f0dfed;
  }
  .touch-layout .drive-bottom {
    left: auto;
    right: calc(16px + var(--safe-right));
    bottom: calc(14px + var(--safe-bottom));
  }
  .touch-layout .drive-utility {
    gap: 6px;
  }
  .touch-layout .drive-utility button {
    min-height: 44px;
    padding: 8px 10px;
  }
  .touch-layout .control-settings {
    right: calc(16px + var(--safe-right));
    bottom: calc(118px + var(--safe-bottom));
  }
  .touch-layout[data-stick-hand="right"][data-touch-mode="stick"] .drive-bottom,
  .touch-layout[data-stick-hand="right"][data-touch-mode="stick"] .control-settings {
    left: calc(16px + var(--safe-left));
    right: auto;
  }
  .touch-layout .button-controls button {
    min-height: 44px;
  }
  .touch-layout .touch-steering button {
    height: 64px;
  }
  .touch-layout .touch-throttle {
    height: 56px;
  }
  .touch-layout[data-touch-mode="buttons"] .drive-bottom {
    top: calc(74px + var(--safe-top));
    bottom: auto;
    left: auto;
    right: calc(16px + var(--safe-right));
  }
  .touch-layout[data-touch-mode="buttons"] .drive-utility {
    flex-direction: row;
  }
  #pause-dialog[open] {
    max-width: min(620px, calc(100vw - 24px));
    max-height: calc(100dvh - 16px - var(--safe-top) - var(--safe-bottom));
    padding: 16px;
    gap: 8px;
  }
  #pause-dialog .pause-symbol,
  #pause-dialog #pause-message {
    display: none;
  }
  #pause-dialog h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
  }
  #pause-dialog .touch-settings {
    min-height: 80px;
  }
  #pause-dialog .touch-settings fieldset {
    margin: 8px 0 14px;
  }
  #pause-dialog .pause-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding-top: 6px;
  }
  #pause-dialog .pause-actions button {
    min-width: 0;
    min-height: 46px;
    padding: 8px;
    margin: 0;
    font-size: 13px;
    justify-content: center;
    white-space: normal;
  }
}

/* Hands-on learning shares the always-visible navigation and grows on wide screens. */
#panel-dialog.learning-dialog {
  width: min(1080px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
}
.learning-intro { margin: 0 0 22px; font-size: 19px; line-height: 1.6; }
.learning-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.learning-card { padding: 18px; min-width: 0; border: 1px solid #dce5d6; border-radius: 22px; background: #fffef8; text-align: left; color: #2e4236; cursor: pointer; }
.learning-card:hover { background: #f0f5e9; border-color: #91ab80; }
.learning-card:focus-visible { outline: 3px solid #56825f; outline-offset: 3px; }
.learning-art { display: flex; align-items: center; justify-content: center; height: 120px; margin-bottom: 18px; border-radius: 16px; font-size: 48px; background: #e9efe0; color: #406d52; }
.learning-art i { margin: 0 12px; font-size: 28px; font-style: normal; color: #9a7a37; }
.direction-art { background: #e7eef1; color: #557c91; }
.circuit-art { background: #f5ebd1; color: #a27b31; }
.learning-card small { font-size: 13px; color: #73816b; }
.learning-card h3 { font-size: 22px; margin: 12px 0 8px; }
.learning-card p { min-height: 48px; font-size: 16px; line-height: 1.6; margin: 0 0 18px; }
.learning-card b { display: block; font-size: 15px; color: #326648; }
.learning-save-note { font-size: 14px; color: #687b60; margin: 22px 0 0; }
.learning-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.learning-toolbar .small-button { min-height: 44px; }
.learning-toolbar span { font-size: 13px; color: #497152; text-align: right; }
.learning-speech-status:empty { display: none; }
.learning-speech-status { color: #716637; font-size: 14px; }
.learning-stamps { margin-top: 26px; padding-top: 20px; border-top: 1px solid #dde5d6; }
.learning-stamps h3 { margin: 0; font-size: 19px; }
.learning-stamps p { font-size: 14px; color: #718267; }
.learning-stamps > div { display: flex; gap: 12px; flex-wrap: wrap; }
.learning-stamp { flex: 1; min-width: 190px; padding: 18px; border-radius: 16px; background: #f0f2e9; font-weight: 700; color: #78866e; }
.learning-stamp.earned { color: #38674e; background: #e6efdc; }
.learning-stamp small { display: block; margin-top: 10px; font-size: 13px; font-weight: 400; }
@media (max-width: 600px) and (orientation: portrait) {
  body:not(.driving) .rail { overflow-x: auto; }
  body:not(.driving) .nav-button { width: calc((100vw - 12px) / 6); min-width: 44px; }
}
@media (max-width: 600px) {
  #panel-dialog.learning-dialog { padding: 16px; max-width: calc(100vw - 16px); width: calc(100vw - 16px); }
  .learning-dialog .panel-heading { top: -16px; gap: 8px; }
  .learning-dialog .panel-heading h2 { font-size: 21px; letter-spacing: 0; }
  .learning-cards { grid-template-columns: 1fr; gap: 12px; }
  .learning-card { padding: 16px; position: relative; padding-left: 104px; min-height: 138px; }
  .learning-art { position: absolute; left: 12px; top: 16px; width: 78px; height: 100px; font-size: 28px; }
  .learning-art i { margin: 0 4px; font-size: 17px; }
  .learning-card h3 { font-size: 20px; margin: 6px 0; }
  .learning-card p { min-height: 0; font-size: 15px; margin-bottom: 8px; }
}
@media (max-height: 500px) {
  #panel-dialog.learning-dialog { max-height: calc(100dvh - 16px); }
  .learning-dialog .panel-heading { margin-bottom: 8px; }
  .learning-art { height: 66px; margin-bottom: 10px; font-size: 36px; }
  .learning-intro { font-size: 16px; margin-bottom: 12px; }
  body:not(.driving) .rail { justify-content: flex-start; overflow-y: auto; }
}
/* Keep the experiment controls and drawing together in landscape viewports. */
@media (min-width: 720px) {
  #panel-dialog.learning-dialog { padding: 20px 24px; max-height: calc(100dvh - 24px); }
  .learning-dialog .panel-heading { top: -20px; margin-bottom: 8px; padding: 8px 0; align-items: center; }
  .learning-dialog .panel-heading h2 { margin-top: 3px; font-size: 23px; }
  .learning-dialog .learning-toolbar { margin-bottom: 8px; }
}
