:root {
  color-scheme: light;
  font-family: Georgia, "Noto Sans", system-ui, serif;
  color: #193e40;
  background: #164e52;
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  min-height: 56px;
  border: 16px solid transparent;
  border-image: url("../ui/secondary-normal.webp") 40 fill / 16px stretch;
  border-radius: 10px;
  padding: 1px 8px;
  color: #193e40;
  background: none;
  box-shadow: none;
  font-weight: 700;
  transition:
    transform 0.12s,
    filter 0.12s;
}
button:hover {
  filter: brightness(1.07);
}
button:active,
button.held {
  border-image-source: url("../ui/secondary-pressed.webp");
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid #fff5d6;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary {
  border-image-source: url("../ui/primary-normal.webp");
  color: #fff4d4;
}
.primary:active {
  border-image-source: url("../ui/primary-pressed.webp");
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.label-art {
  display: block;
  width: 100%;
  height: 30px;
  object-fit: contain;
  pointer-events: none;
}
.title-art {
  display: block;
  width: min(100%, 360px);
  height: 60px;
  object-fit: contain;
  object-position: left center;
}
[dir="rtl"] .title-art {
  object-position: right center;
}
#game {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  outline: none;
  background: #b2d9d1 url("../background.webp") center / cover no-repeat;
}
#game::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 80px #143f4438;
  border: 5px solid #143f4470;
}
.flight-zone {
  position: absolute;
  inset: 76px 0 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: ltr;
}
#valley {
  position: relative;
  flex: none;
  width: min(100%, calc((100dvh - 266px) * 1.666667));
  aspect-ratio: 700 / 420;
  overflow: hidden;
}
canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
#flight-ui {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  inset-inline: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.route-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 47px;
  background: #fff1d3ed;
  padding: 5px 14px;
  border-radius: 5px 18px 8px 15px;
  box-shadow: 0 3px 8px #183e4030;
  border-bottom: 2px solid #caa160;
}
#route {
  font-size: 15px;
}
.parcel-count {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-inline-start: 12px;
  border-inline-start: 1px solid #bca77d;
}
.parcel-count img {
  object-fit: contain;
}
.lift-gauge {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  color: #fff8de;
  background: #144c50e8;
  border: 1px solid #fae6aa99;
  border-radius: 30px;
  font: 13px system-ui;
  box-shadow: 0 3px 8px #183e4030;
}
#energy-number {
  min-width: 24px;
  text-align: end;
}
.meter {
  width: clamp(60px, 12vw, 120px);
  height: 12px;
  background: #082c34;
  border-radius: 9px;
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #83d9c5, #dfefac);
  transform-origin: left;
}
.hud-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.hud-actions button {
  display: grid;
  place-items: center;
  padding: 0;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 50%;
  border-image: none;
  background: url("../ui/round-normal.webp") center / contain no-repeat;
}
.hud-actions button:active,
.menu-close:active {
  background-image: url("../ui/round-pressed.webp");
}
.hud-actions button img,
.menu-close img {
  width: 21px;
  height: 21px;
  object-fit: contain;
  pointer-events: none;
}
.flight-controls {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  inset-inline: 16px;
  text-align: center;
  color: #fff7df;
  text-shadow: 0 1px 3px #123e40;
}
#hint {
  font: 13px/1.5 system-ui;
  max-width: 640px;
  margin: 0 auto 10px;
  background: #123e40b8;
  padding: 5px 14px;
  border-radius: 20px;
  width: fit-content;
}
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
}
.controls button {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 280px;
  max-width: 100%;
  flex: none;
  height: 94px;
  min-height: 0;
  padding: 19px 27px;
  border: 0;
  border-radius: 15px;
  border-image: none;
  background: url("../ui/lift-normal.webp") center / contain no-repeat;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  text-shadow: none;
}
.controls button .lift-symbol {
  width: 32px;
  height: 32px;
  flex: none;
  object-fit: contain;
}
.controls button .label-art {
  min-width: 0;
  height: 37px;
}
.controls button.held {
  background-image: url("../ui/lift-pressed.webp");
}
.controls > span {
  font: 13px/1.5 system-ui;
  max-width: 100%;
}
#live {
  min-height: 17px;
  margin-top: 10px;
  font: 11px/1.5 system-ui;
}
#overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #082f3b9c;
  backdrop-filter: blur(3px);
  overscroll-behavior: contain;
}
#overlay[hidden] {
  display: none;
}
.menu-panel {
  position: relative;
  width: min(100%, 570px);
  max-height: 100%;
  overflow-y: auto;
  padding: 32px;
  border: 5px double #c49d59;
  border-radius: 22px 9px 22px 9px;
  background: repeating-linear-gradient(
      3deg,
      transparent 0 4px,
      #a7803808 5px,
      transparent 6px
    ),
    radial-gradient(ellipse at center, #fff7e2 35%, #efdbab);
  box-shadow:
    0 18px 60px #001d3199,
    inset 0 0 24px #9a672c15;
  scrollbar-width: thin;
  scrollbar-color: #ad7e45 #f6e7c4;
  overscroll-behavior: contain;
}
.menu-panel::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 24px;
  width: 10px;
  height: 20px;
  background: #ac412c;
  pointer-events: none;
}
.menu-close {
  position: absolute;
  top: 9px;
  inset-inline-end: 10px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  border-image: none;
  background: url("../ui/round-normal.webp") center / contain no-repeat;
}
#menu-title {
  font-size: clamp(25px, 4vw, 38px);
  line-height: 1.15;
  margin: 0 34px 18px 0;
}
[dir="rtl"] #menu-title {
  margin: 0 0 18px 34px;
}
#menu-content p {
  font: 14px/1.6 system-ui;
  margin: 12px 0;
}
.menu-eyebrow {
  letter-spacing: 0.14em;
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #69807b;
}
.menu-eyebrow img {
  display: block;
  width: min(100%, 160px);
  height: 24px;
  object-fit: contain;
}
.start {
  display: flex;
  align-items: center;
  gap: 18px;
}
.start > .game-logo {
  width: 120px;
  height: 100px;
  object-fit: contain;
  flex-shrink: 0;
}
.start #menu-title {
  margin: 0;
}
.start > div {
  flex: 1;
  min-width: 0;
}
.start .title-art {
  height: 96px;
}
.start p {
  margin: 6px 0 !important;
}
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.actions .primary {
  flex-grow: 1;
}
.actions button {
  flex: 1 1 190px;
  min-width: 0;
  height: 68px;
}
.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font: 12px/1.5 system-ui;
  padding: 12px 0;
  border-block: 1px solid #bba16c66;
}
.legend img {
  width: 23px;
  height: 23px;
  object-fit: contain;
  vertical-align: middle;
  margin-inline-end: 5px;
}
.routes {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 9px;
  margin: 18px 0;
}
.routes button {
  border: 0;
  border-image: none;
  padding: 6px;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  background: url("../ui/route-normal.webp") center / contain no-repeat;
  font-variant-numeric: tabular-nums;
}
.routes button:active {
  background-image: url("../ui/route-pressed.webp");
}
.routes button[aria-current="step"] {
  color: #fff8de;
  background-image: url("../ui/route-selected.webp");
}
.routes button:disabled {
  opacity: 1;
  color: #244e50;
  background-image: url("../ui/route-locked.webp");
}
.routes small {
  display: block;
  font: 10px system-ui;
  margin-top: 3px;
}
.settings {
  display: grid;
  gap: 20px;
  margin: 24px 0;
}
.settings label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44%;
  align-items: center;
  gap: 16px;
  font: 15px/1.4 system-ui;
}
.settings input[type="range"] {
  width: 100%;
  height: 32px;
  accent-color: #ad432b;
}
.settings input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: #ad432b;
}
.stats {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-block: 1px solid #bba16c66;
}
.stats b {
  display: block;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  color: #a33b25;
}
.stats span {
  font: 12px system-ui;
}
#game:not([data-screen="play"]) #flight-ui {
  opacity: 0.15;
}
#game[data-screen="loading"] #flight-ui,
#game[data-screen="start"] #flight-ui,
#game[data-screen="map"] #flight-ui,
#game[data-screen="settings"] #flight-ui {
  visibility: hidden;
}
#game:fullscreen {
  height: 100dvh;
}
body.reduced * {
  transition: none !important;
}
@media (max-width: 600px) {
  .hud {
    inset-inline: 10px;
    top: max(12px, env(safe-area-inset-top));
    gap: 7px;
    flex-wrap: wrap;
  }
  .route-badge {
    padding: 4px 10px;
    gap: 8px;
    min-height: 44px;
  }
  #route {
    font-size: 12px;
  }
  .parcel-count {
    font-size: 13px;
    padding-inline-start: 8px;
  }
  .lift-gauge {
    position: absolute;
    top: 54px;
    inset-inline-start: 0;
    font-size: 12px;
    padding: 6px 10px;
  }
  .meter {
    width: 86px;
  }
  .flight-zone {
    inset: 102px 0 210px;
  }
  #valley {
    width: min(100%, calc((100dvh - 312px) * 1.666667));
  }
  .flight-controls {
    inset-inline: 14px;
    bottom: max(16px, env(safe-area-inset-bottom));
  }
  .controls {
    flex-direction: column;
    gap: 8px;
  }
  .controls button {
    width: 280px;
  }
  .controls > span {
    max-width: 100%;
    font-size: 12px;
  }
  #hint {
    font-size: 12px;
    margin-bottom: 12px;
  }
  #live {
    font-size: 10px;
  }
  #overlay {
    padding: 16px;
  }
  .menu-panel {
    padding: 24px 20px;
  }
  .start {
    flex-direction: row;
    gap: 10px;
    text-align: start;
  }
  .start > .game-logo {
    width: 64px;
    height: 64px;
  }
  #menu-title {
    font-size: 27px;
  }
  .start #menu-title {
    margin: 0;
  }
  .start .title-art {
    height: 64px;
  }
  .title-art {
    height: 52px;
  }
  #menu-content p {
    font-size: 13px;
  }
  .actions {
    gap: 10px;
    margin-top: 18px;
  }
  .actions button {
    flex-basis: calc(50% - 5px);
  }
  .actions .primary {
    flex-basis: 100%;
  }
  .routes {
    grid-template-columns: repeat(4, 1fr);
  }
  .settings label {
    font-size: 14px;
  }
}
@media (max-width: 360px) {
  .actions button {
    flex-basis: 100%;
  }
}
@media (max-height: 460px) and (min-width: 601px) {
  .hud {
    top: 8px;
  }
  .flight-zone {
    inset: 62px 0 84px;
  }
  #valley {
    width: min(100%, calc((100dvh - 146px) * 1.666667));
  }
  .flight-controls {
    bottom: 8px;
  }
  #hint,
  #live {
    display: none;
  }
  .controls button {
    width: 200px;
    height: 67px;
    padding: 12px 20px;
  }
  .controls > span {
    display: none;
  }
  .controls button .label-art {
    height: 29px;
  }
  .menu-panel {
    padding: 22px;
  }
  .start > .game-logo {
    width: 100px;
    height: 75px;
  }
  .start {
    gap: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
