:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #161718;
  color: #f5f1e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(43, 74, 67, 0.92), rgba(31, 32, 36, 0.96)),
    #161718;
}

button {
  border: 0;
  border-radius: 8px;
  background: #f0c553;
  color: #181711;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
  box-shadow: 0 3px 0 #8a6720;
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #8a6720;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.game-panel {
  position: relative;
  display: grid;
  min-height: calc(100vh - 36px);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #26292a;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  image-rendering: auto;
}

.hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr)) auto;
  gap: 8px;
  pointer-events: none;
}

.hud > div,
.hud button {
  pointer-events: auto;
}

.hud > div {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(12, 13, 14, 0.68);
  padding: 8px 10px;
  backdrop-filter: blur(8px);
}

.label {
  display: block;
  color: #aeb8ac;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  background: rgba(12, 13, 14, 0.68);
  text-align: center;
}

.banner.hidden {
  display: none;
}

.banner h1 {
  margin: 0;
  color: #f0c553;
  font-size: clamp(42px, 8vw, 94px);
  line-height: 0.95;
}

.banner p {
  max-width: 560px;
  margin: 0;
  color: #f5f1e8;
  font-size: 18px;
}

.touch-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: none;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(2, 54px);
  gap: 8px;
}

.touch-controls button {
  min-height: 54px;
  padding: 0;
  border-radius: 8px;
  background: rgba(240, 197, 83, 0.9);
  font-size: 20px;
}

#push {
  grid-column: 2;
  grid-row: 1;
}

#left,
#brake,
#right {
  grid-row: 2;
}

.side-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(20, 21, 22, 0.68);
}

.side-panel h2 {
  margin: 0;
  color: #f0c553;
  font-size: 28px;
}

.side-panel p {
  margin: 0;
  color: #d7d8cf;
  line-height: 1.5;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dl div {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 12px;
}

dt {
  color: #86d0b4;
  font-weight: 900;
}

dd {
  margin: 4px 0 0;
  color: #f5f1e8;
}

.series {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.series span {
  color: #aeb8ac;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.series b {
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .game-panel {
    align-self: start;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 960 / 600;
  }

  canvas {
    height: auto;
    min-height: 0;
    aspect-ratio: 960 / 600;
  }

  .side-panel {
    min-height: auto;
  }

  .touch-controls {
    display: grid;
  }
}

@media (max-width: 620px) {
  .hud {
    top: 5px;
    left: 5px;
    right: 5px;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 34px;
    gap: 4px;
  }

  .hud > div {
    padding: 3px 5px;
  }

  .label {
    font-size: 7px;
  }

  .hud button {
    min-height: 34px;
    padding: 0;
  }

  .hud strong {
    font-size: 11px;
  }

  .banner {
    gap: 6px;
    padding: 10px;
  }

  .banner h1 {
    font-size: 30px;
  }

  .banner p {
    max-width: 280px;
    font-size: 11px;
    line-height: 1.25;
  }

  .banner button {
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }

  .touch-controls {
    right: 5px;
    bottom: 5px;
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(2, 36px);
    gap: 4px;
  }

  .touch-controls button {
    min-height: 36px;
    font-size: 14px;
  }
}
