:root {
  --cream: #fff7e2;
  --mint: #bef8ad;
  --dark: #12262a;
  --muted: #a9c1ba;
  --yellow: #ffd568;
  --coral: #ff8a70;
}

body {
  background: #101c21;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 5px;
}
button:disabled {
  cursor: wait;
  opacity: 0.5;
}
.topbar a {
  color: var(--cream);
  text-decoration: none;
}
.cursor {
  opacity: 0.6;
}
.topbar button,
.bottom-bar button {
  background: transparent;
  border: 1px solid #67817465;
  letter-spacing: 1px;
}

.topbar button:hover,
.bottom-bar button:hover {
  background: #ffffff15;
}
#game-shell {
  height: min(830px, calc(100svh - 105px - var(--safe-top) - var(--safe-bottom)));
  margin: 0 auto;
  border: 1px solid #9ab5a536;
  background: #739a88;
}

#viewport,
#viewport canvas,
.vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.vignette {
  pointer-events: none;
  background: linear-gradient(#071f2b30, transparent 24%, transparent 75%, #071f2b35);
  z-index: 1;
}
.hud {
  top: 28px;
}

.eyebrow {
  font: 10px monospace;
  font-weight: 600;
  letter-spacing: 2.3px;
}
.game-brand {
  text-shadow: 0 2px 16px #10292799;
}
.game-brand .eyebrow {
  color: #ecffed;
}
h1 {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -1.3px;
  margin: 5px 0;
}
h1 span {
  font-size: 24px;
  color: var(--yellow);
  margin-left: 9px;
}
.stats {
  background: #14292eeb;
  box-shadow: 0 10px 25px #15332f12;
  border: 1px solid #d6e8c730;
  padding: 14px 8px;
  gap: 0;
  align-self: start;
}

.stats > div {
  min-width: 95px;
  padding: 0 16px;
}

.stats strong {
  font-size: 25px;
  line-height: 1.4;
  font-weight: 600;
}

.stats strong.urgent {
  color: var(--coral);
}
.dispatch {
  position: absolute;
  z-index: 2;
  top: 138px;
  left: 30px;
  width: 265px;
  background: #13292eec;
  border: 1px solid #fff2;
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 19px;
}
.radio-label {
  font: 10px monospace;
  letter-spacing: 1px;
  color: var(--mint);
  display: flex;
  align-items: center;
  gap: 7px;
}
.radio-label i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
}
#streak {
  margin-left: auto;
  color: var(--yellow);
  letter-spacing: 0;
}
.dispatch h2 {
  font-size: 22px;
  margin: 13px 0 5px;
  letter-spacing: -0.5px;
}
.dispatch p {
  font-size: 12px;
  color: #c0d0c6;
  line-height: 1.65;
  margin: 0 0 17px;
}
.meter-label {
  display: flex;
  justify-content: space-between;
  font: 10px monospace;
  letter-spacing: 0.6px;
  color: #c3d7ce;
}
.meter {
  height: 4px;
  background: #ffffff16;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 13px;
}
.meter > div {
  height: 100%;
  background: var(--yellow);
  width: 100%;
  transition: width 0.15s;
}
.boarding {
  font-size: 10px;
  color: #ecf7d7;
  min-height: 24px;
  line-height: 1.5;
}
.map-panel {
  position: absolute;
  z-index: 2;
  bottom: 66px;
  right: 26px;
  width: 185px;
  background: #10282dda;
  border: 1px solid #ebf4d733;
  border-radius: 11px;
  padding: 12px;
  backdrop-filter: blur(8px);
}
.map-title {
  display: flex;
  justify-content: space-between;
  font: 10px monospace;
  letter-spacing: 0.6px;
  color: #d8eacb;
}
.map-panel canvas {
  width: 100%;
  height: auto;
  display: block;
  margin: 7px 0;
}
.map-legend {
  display: flex;
  justify-content: space-between;
  font: 10px monospace;
  letter-spacing: 0.5px;
  color: #d8eacb;
}
.map-legend i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 3px;
}
.yellow {
  background: var(--yellow);
}
.coral {
  background: var(--coral);
}
.speedometer {
  position: absolute;
  z-index: 2;
  left: 32px;
  bottom: 76px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  text-shadow: 0 2px 9px #002c2a88;
}
.speedometer strong {
  font-size: 48px;
  line-height: 1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.speedometer span {
  font: 10px monospace;
}
.speedometer small {
  position: absolute;
  top: 53px;
  left: 0;
  font: 10px monospace;
  letter-spacing: 2px;
  white-space: nowrap;
}
.bottom-bar {
  bottom: 14px;
  gap: 12px;
}

.keyboard-help {
  color: #e6f3db;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 5px #193d27;
}

.keyboard-help b {
  padding: 0 6px;
}
kbd {
  border-bottom: 1px solid #fff5;
}

.bottom-bar > div {
  display: flex;
  gap: 8px;
}
.bottom-bar button {
  background: #10262dbe;
  border-color: #cadbb746;
}

.target {
  position: absolute;
  z-index: 2;
  bottom: 65px;
  left: 50%;
  transform: translateX(-50%);
  background: #10272dde;
  border: 1px solid #fff3;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 23px 11px 18px;
}
.target > span {
  font-size: 28px;
  color: var(--yellow);
  display: block;
}
.target small {
  display: block;
  font: 10px monospace;
  letter-spacing: 1.3px;
  color: #c5d4c4;
}
.target strong {
  font-size: 18px;
  font-weight: 500;
}
#toast {
  top: 116px;
  max-width: 430px;
  color: var(--dark);
  border-radius: 8px;
  padding: 13px 22px;
  font-size: 13px;
  box-shadow: 0 6px 28px #0c322522;
}

.overlay {
  padding: 32px 6%;
  background: linear-gradient(90deg, #10282d96, transparent 65%);
}

.menu-card {
  width: 360px;
  max-height: 100%;
  overflow-y: auto;
  background: #12292ef2;
  border: 1px solid #d1e4cc44;
  padding: 30px;
  box-shadow: 0 15px 60px #122b342a;
}

.menu-card > .eyebrow {
  font-size: 10px;
  letter-spacing: 1.7px;
}

.menu-card h2 {
  font-size: 49px;
  letter-spacing: -2px;
  line-height: 1.06;
}

.menu-card > p {
  color: #bbd0c6;
}

.intro-details {
  margin: 24px 0;
}

.intro-details span {
  font: 10px monospace;
  color: var(--mint);
  border: 1px solid #c3eab24d;
  border-radius: 50%;
  padding: 5px;
  margin-top: 1px;
}
.intro-details p {
  color: #abc3b9;
}

.primary {
  color: #123c2b;
}

.primary span {
  float: right;
  font-size: 17px;
  line-height: 14px;
}
.primary:hover {
  background: #d0ffbe;
}
.menu-card .menu-note {
  color: #a1b9b0;
}

.secondary {
  border: 1px solid #ffffff30;
  color: #e9efdc;
}

.results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 22px 0;
}
.results div {
  border-top: 1px solid #ffffff2b;
}

.results span {
  display: block;
  font: 10px monospace;
  color: #b0cabe;
  letter-spacing: 1px;
}
.results strong {
  font-size: 27px;
  font-weight: 500;
}
.load-state {
  background: #142c31;
}

footer {
  color: #809b94;
}

footer a {
  color: #b0c7b9;
  text-decoration: none;
}
.touch-controls button {
  background: #153137d9;
  border: 1px solid #dae8c747;
  border-radius: 10px;
}

.touch-controls button.pressed {
  background: #fff1a9;
  color: #163936;
}
.no-script {
  padding: 30px;
  color: var(--yellow);
}
@media (min-width: 1550px) {
  #game-shell {
    margin: 0 30px;
    max-width: none;
  }
}
@media (max-width: 1050px) {
  .terminal {
    display: none;
  }
  .hud {
    left: 22px;
    right: 22px;
  }
  .game-brand h1 {
    font-size: 22px;
  }
  .stats > div {
    min-width: 74px;
    padding: 0 12px;
  }
  .dispatch {
    width: 224px;
    left: 22px;
    padding: 15px;
  }
  .map-panel {
    width: 152px;
    right: 22px;
  }
  .menu-card {
    width: 330px;
    padding: 26px;
  }
  .menu-card h2 {
    font-size: 43px;
  }
  .keyboard-help {
    font-size: 10px;
  }
}
@media (pointer: coarse) {
  .keyboard-help {
    display: none;
  }
  .speedometer {
    bottom: 136px;
  }
  .target {
    bottom: 136px;
  }
  .map-panel {
    bottom: 135px;
  }
  .touch-controls.hidden {
    display: none !important;
  }
  .bottom-bar {
    justify-content: flex-end;
  }
}
@media (max-width: 650px) {
  .topbar {
    height: 46px;
    padding: 0 15px;
    font-size: 10px;
  }
  .topbar button {
    font-size: 10px;
    padding: 7px 9px;
  }
  #game-shell {
    height: calc(100svh - 76px - var(--safe-top) - var(--safe-bottom));
    min-height: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .hud {
    top: 18px;
    left: 16px;
    right: 16px;
    gap: 5px;
  }
  .game-brand h1 {
    font-size: 19px;
    letter-spacing: -0.8px;
  }
  .game-brand h1 span {
    font-size: 18px;
    margin-left: 4px;
  }
  .game-brand .eyebrow {
    font-size: 10px;
    letter-spacing: 1px;
  }
  .stats {
    padding: 9px 0;
  }
  .stats > div {
    min-width: 52px;
    padding: 0 8px;
  }
  .stats span {
    font-size: 10px;
    letter-spacing: 0.3px;
  }
  .stats strong {
    font-size: 18px;
  }
  .dispatch {
    top: 92px;
    left: 16px;
    width: 192px;
    padding: 13px;
  }
  .dispatch h2 {
    font-size: 18px;
    margin-top: 9px;
  }
  .dispatch p {
    font-size: 10px;
    line-height: 1.4;
    margin-bottom: 12px;
  }
  .radio-label {
    font-size: 10px;
  }
  .boarding {
    font-size: 10px;
    min-height: 13px;
  }
  .meter-label {
    font-size: 10px;
  }
  .map-panel {
    width: 119px;
    right: 16px;
    padding: 9px;
    bottom: 131px;
  }
  .map-title {
    font-size: 10px;
  }
  .map-legend {
    font-size: 10px;
    letter-spacing: 0;
  }
  .speedometer {
    left: 20px;
    bottom: 141px;
  }
  .speedometer strong {
    font-size: 36px;
  }
  .speedometer small {
    top: 41px;
    font-size: 10px;
  }
  .target {
    bottom: 286px;
    padding: 9px 14px;
    left: auto;
    right: 16px;
    transform: none;
    gap: 8px;
  }
  .target > span {
    font-size: 22px;
  }
  .target small {
    font-size: 10px;
  }
  .target strong {
    font-size: 14px;
  }
  .overlay {
    padding: 85px 16px 70px;
    align-items: center;
    justify-content: center;
    background: #10282d44;
  }
  .menu-card {
    width: min(340px, 100%);
    padding: 24px;
  }
  .menu-card h2 {
    font-size: 37px;
    margin: 12px 0;
  }
  .menu-card > p {
    font-size: 12px;
  }
  .intro-details {
    gap: 10px;
    margin: 17px 0;
  }
  .intro-details p {
    font-size: 10px;
  }
  .intro-details strong {
    font-size: 11px;
  }
  .menu-card .menu-note {
    font-size: 10px;
  }
  .map-panel.menu-map {
    opacity: 0;
  }
  .bottom-bar {
    left: 16px;
    right: 16px;
    bottom: 12px;
  }
  .keyboard-help {
    display: none;
  }
  #toast {
    top: 82px;
    width: calc(100% - 40px);
    font-size: 11px;
    max-width: 340px;
  }
  footer {
    height: 30px;
    font-size: 10px;
    padding: 0 15px;
  }
  footer > span {
    display: none;
  }
}
@media (max-height: 620px) and (min-width: 651px) {
  .menu-card {
    padding: 20px;
    width: 320px;
  }
  .menu-card h2 {
    font-size: 34px;
    margin: 10px 0;
  }
  .intro-details {
    gap: 7px;
    margin: 12px 0;
  }
  .menu-card > p {
    font-size: 11px;
  }
  .menu-note {
    display: none;
  }
  .hud {
    top: 15px;
  }
  .overlay {
    padding-top: 83px;
    padding-bottom: 16px;
  }
  .dispatch {
    top: 105px;
  }
  .map-panel {
    width: 135px;
  }
  .target {
    bottom: 45px;
  }
  .speedometer {
    bottom: 108px;
  }
  .map-panel {
    bottom: 110px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
/* Keep the desktop minimap compact on short touch-capable viewports. */
@media (min-width: 651px) and (min-height: 521px) and (max-height: 700px) {
  .driving-game:where(:has(.driving-controls:not(.hidden))) .map-panel {
    width: 100px;
    padding: 8px;
  }
  .driving-game:where(:has(.driving-controls:not(.hidden))) .map-title,
  .driving-game:where(:has(.driving-controls:not(.hidden))) .map-legend {
    display: none;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .topbar {
    height: 36px;
    padding: 0 15px;
    font-size: 10px;
  }
  .topbar button {
    padding: 5px 9px;
    font-size: 10px;
  }
  #game-shell {
    height: calc(100svh - 36px - var(--safe-top) - var(--safe-bottom));
    min-height: 0;
    border-radius: 0;
  }
  footer {
    display: none;
  }
  .hud {
    top: 12px;
    left: 14px;
    right: 14px;
  }
  .game-brand h1 {
    font-size: 18px;
  }
  .game-brand .eyebrow {
    font-size: 10px;
  }
  .stats {
    padding: 6px 0;
  }
  .stats > div {
    min-width: 54px;
    padding: 0 9px;
  }
  .stats span {
    font-size: 10px;
  }
  .stats strong {
    font-size: 18px;
  }
  .overlay {
    padding: 60px 16px 12px;
    align-items: center;
    justify-content: flex-start;
  }
  .menu-card {
    width: 330px;
    padding: 17px;
  }
  .menu-card h2 {
    font-size: 27px;
    margin: 7px 0;
  }
  .menu-card > p {
    font-size: 10px;
    margin: 8px 0;
  }
  .intro-details {
    display: none;
  }
  .menu-card .menu-note {
    display: block;
    font-size: 10px;
    margin-top: 8px;
  }
  .primary {
    padding: 12px;
    font-size: 10px;
  }
  .results {
    margin: 9px 0;
    gap: 7px;
  }
  .results div {
    padding-top: 5px;
  }
  .results strong {
    font-size: 18px;
  }
  .results span {
    font-size: 10px;
  }
  .secondary {
    padding: 8px;
    margin-top: 6px;
  }
  .dispatch {
    top: 77px;
    left: 14px;
    width: 180px;
    padding: 12px;
  }
  .dispatch h2 {
    font-size: 16px;
    margin: 7px 0;
  }
  .dispatch p {
    display: none;
  }
  .radio-label {
    font-size: 10px;
  }
  .meter-label {
    font-size: 10px;
  }
  .meter {
    margin: 6px 0 8px;
  }
  .boarding {
    font-size: 10px;
    min-height: 12px;
  }
  .map-panel {
    width: 105px;
    padding: 8px;
    bottom: 77px;
    right: 14px;
  }
  .map-title {
    font-size: 10px;
  }
  .map-legend {
    font-size: 10px;
  }
  .target {
    left: auto;
    right: 133px;
    bottom: 82px;
    transform: none;
    padding: 7px 13px;
    gap: 8px;
  }
  .target strong {
    font-size: 13px;
  }
  .target small {
    font-size: 10px;
  }
  .target > span {
    font-size: 23px;
  }
  .speedometer {
    display: none;
  }
  .keyboard-help {
    display: none;
  }
  .bottom-bar {
    top: 12px;
    bottom: auto;
    left: auto;
    right: 232px;
  }
  .bottom-bar button {
    font-size: 10px;
    padding: 7px 9px;
  }
  #toast {
    top: 72px;
    font-size: 10px;
    max-width: 290px;
    padding: 9px 14px;
  }
}
.coconut-hud {
  position: absolute;
  z-index: 2;
  right: 30px;
  top: 112px;
  display: flex;
  align-items: center;
  gap: 21px;
  padding: 12px 16px;
  background: #14292eed;
  border: 1px solid #fff2;
  border-radius: 10px;
  pointer-events: none;
}
.coconut-hud > div > span:not([aria-hidden]) {
  display: block;
  font: 10px monospace;
  letter-spacing: 1.3px;
  color: var(--muted);
}
.coconut-hud strong {
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--yellow);
}
.coconut-total {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 6px;
  align-items: center;
}
.coconut-total > span {
  font-size: 21px;
}
.coconut-total strong {
  color: var(--cream);
}
.coconut-total small {
  grid-column: 1/-1;
  font: 10px monospace;
  letter-spacing: 0.7px;
  color: #bacfc0;
  text-align: center;
}
.coconut-dot {
  background: #fff1cb;
  border: 1px solid #795034;
}
.coconut-pop {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 43%;
  transform: translate(-50%, 12px);
  opacity: 0;
  background: #fff3d4;
  color: #50391e;
  padding: 9px 14px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: bold;
  pointer-events: none;
  transition:
    opacity 0.18s,
    transform 0.25s;
  box-shadow: 0 3px 18px #344b3c30;
}
.coconut-pop.show {
  opacity: 1;
  transform: translate(-50%, -10px);
}
.results {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 9px;
}
.results span {
  font-size: 10px;
  letter-spacing: 0.5px;
}
.results strong {
  font-size: 24px;
}
.results small {
  display: block;
  font: 10px monospace;
  color: var(--yellow);
  margin-top: 3px;
}
@media (max-width: 1050px) {
  .coconut-hud {
    right: 22px;
    top: 112px;
    gap: 16px;
  }
}
@media (max-width: 650px) {
  .coconut-hud {
    right: 16px;
    top: 92px;
    width: 151px;
    padding: 11px;
    gap: 12px;
    justify-content: space-between;
  }
  .coconut-hud strong {
    font-size: 16px;
  }
  .coconut-hud > div > span:not([aria-hidden]) {
    font-size: 10px;
  }
  .coconut-total > span {
    font-size: 18px;
  }
  .coconut-total small {
    font-size: 10px;
  }
  .coconut-pop {
    font-size: 12px;
    padding: 8px 12px;
  }
  .results strong {
    font-size: 21px;
  }
  .results span {
    font-size: 10px;
  }
  .results small {
    font-size: 10px;
  }
}
@media (max-width: 380px) {
  .game-brand h1 span {
    display: none;
  }
  .dispatch {
    width: 165px;
    left: 12px;
  }
  .coconut-hud {
    right: 12px;
    width: 120px;
    gap: 7px;
    padding: 10px 8px;
  }
  .coconut-hud strong {
    font-size: 14px;
  }
  .coconut-total small {
    font-size: 10px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .coconut-hud {
    right: 14px;
    top: 64px;
    width: 189px;
    padding: 6px 10px;
    gap: 14px;
  }
  .coconut-hud > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 7px;
  }
  .coconut-hud strong {
    font-size: 16px;
  }
  .coconut-total {
    display: flex;
    gap: 5px;
  }
  .coconut-total > span {
    font-size: 17px;
  }
  .coconut-total small {
    display: none;
  }
  .results {
    gap: 5px 9px;
    margin: 8px 0;
  }
  .results strong {
    font-size: 16px;
  }
  .results span {
    font-size: 10px;
  }
  .results small {
    font-size: 10px;
  }
  .coconut-pop {
    font-size: 11px;
    padding: 7px 10px;
  }
}
@media (max-width: 650px) and (min-height: 521px) {
  #toast {
    top: 252px;
  }
}
@media (max-width: 650px) and (max-height: 650px) and (orientation: portrait) {
  .target {
    bottom: 278px;
  }
  .overlay {
    padding: 70px 16px 12px;
  }
  .intro-details {
    display: none;
  }
  .menu-card {
    padding: 20px;
  }
  .menu-card h2 {
    font-size: 32px;
  }
  .dispatch {
    padding: 10px;
  }
  .dispatch h2 {
    font-size: 16px;
    margin: 7px 0 4px;
  }
  .dispatch p {
    font-size: 10px;
    margin-bottom: 8px;
  }
  .boarding {
    font-size: 10px;
  }
  #toast {
    top: 73px;
    width: calc(100% - 24px);
    padding: 3px 8px;
    font-size: 10px;
  }
}
@media (max-height: 380px) and (orientation: landscape) {
  .overlay {
    padding: 8px 16px;
  }
  .menu-card {
    width: 350px;
    padding: 12px 16px;
  }
  .menu-card h2 {
    font-size: 23px;
    margin: 5px 0;
  }
  .menu-card > p {
    line-height: 1.5;
    margin: 6px 0;
  }
  .menu-card .menu-note {
    display: none;
  }
  .map-panel {
    width: 84px;
    padding: 6px;
    bottom: 68px;
  }
}
