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

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas,
img {
  -webkit-user-drag: none;
  user-drag: none;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overscroll-behavior: none;
  background: #111416;
}

button,
a {
  border: 0;
  border-radius: 7px;
  color: inherit;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 14px;
  min-height: 100dvh;
  padding: 14px;
}

.court-shell {
  position: relative;
  align-self: center;
  width: 100%;
  overflow: hidden;
  border: 2px solid #363e42;
  border-radius: 8px;
  aspect-ratio: 16 / 10;
  background: #d4af73;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: 42px 1fr 90px 1fr 42px;
  gap: 7px;
  pointer-events: none;
}

.hud > * {
  min-width: 0;
  min-height: 42px;
  border: 2px solid #182024;
  padding: 5px 8px;
  background: rgba(247, 242, 232, 0.94);
  color: #182024;
  text-align: center;
  pointer-events: auto;
}

.hud a,
.hud button {
  display: grid;
  place-items: center;
  padding: 0;
  color: #e2a91f;
  background: #182024;
}

.hud span {
  display: block;
  overflow: hidden;
  color: #647076;
  font-size: 9px;
  font-weight: 1000;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud strong {
  display: block;
  font-size: 21px;
  line-height: 1;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  padding: 20px;
  background: rgba(14, 18, 20, 0.78);
  text-align: center;
}

.overlay.hidden {
  display: none;
}

.overlay p {
  margin: 0;
  color: #7ce0c9;
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.overlay h1 {
  margin: 0;
  color: #f4c84a;
  font-size: clamp(42px, 8vw, 88px);
  line-height: 0.86;
}

.overlay span {
  font-weight: 800;
}

.overlay button {
  min-height: 46px;
  margin-top: 6px;
  padding: 0 20px;
  background: #ef6559;
  color: #171a1c;
  box-shadow: 0 4px 0 #8a322d;
}

.mobile-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  display: grid;
  grid-template-columns: 134px auto auto 148px;
  gap: 10px;
  align-items: end;
  pointer-events: none;
}

.mobile-controls button {
  min-height: 48px;
  border: 2px solid #182024;
  background: rgba(247, 242, 232, 0.93);
  color: #182024;
  box-shadow: 0 3px 0 rgba(24, 32, 36, 0.65);
  pointer-events: auto;
  touch-action: none;
}

.mobile-controls button.active {
  transform: translateY(2px);
  box-shadow: none;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(2, 42px);
  gap: 4px;
}

.dpad button {
  min-height: 42px;
  padding: 0;
}

#up { grid-column: 2; }
#left { grid-column: 1; grid-row: 2; }
#down { grid-column: 2; grid-row: 2; }
#right { grid-column: 3; grid-row: 2; }

.switch {
  justify-self: center;
  padding: 0 14px;
  font-size: 11px;
}

.jump {
  justify-self: center;
  padding: 0 14px;
  font-size: 11px;
}

.throw {
  position: relative;
  overflow: hidden;
  background: #ef6559 !important;
}

.throw i {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 7px;
  background: #f4c84a;
}

aside {
  align-self: center;
  border-left: 1px solid #343a3d;
  padding: 22px;
}

.eyebrow {
  margin: 0;
  color: #7ce0c9;
  font-size: 10px;
  font-weight: 1000;
  text-transform: uppercase;
}

aside h2 {
  margin: 4px 0 18px;
  color: #f4c84a;
  font-size: 34px;
  line-height: 0.95;
}

.status {
  border: 1px solid #3c4549;
  border-radius: 7px;
  padding: 10px;
  color: #7ce0c9;
  font-weight: 900;
}

dl {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

dl div {
  border-top: 1px solid #303639;
  padding-top: 10px;
}

dt {
  color: #f4c84a;
  font-weight: 900;
}

dd {
  margin: 3px 0 0;
  color: #abb4b0;
  font-size: 13px;
}

@media (max-width: 900px) {
  .app {
    display: grid;
    place-items: center;
    padding: 8px;
  }

  .court-shell {
    width: min(100%, calc((100dvh - 16px) * 16 / 10));
  }

  aside {
    display: none;
  }
}

@media (max-width: 620px) {
  .court-shell {
    aspect-ratio: 4 / 5;
    width: min(100%, calc((100dvh - 16px) * 4 / 5));
  }

  .hud {
    top: 5px;
    left: 5px;
    right: 5px;
    grid-template-columns: 32px 1fr 52px 1fr 32px;
    gap: 3px;
  }

  .hud > * {
    min-height: 34px;
    padding: 3px;
  }

  .hud span {
    font-size: 6px;
  }

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

  .mobile-controls {
    right: 6px;
    bottom: 6px;
    left: 6px;
    grid-template-columns: 110px 42px 42px 90px;
    gap: 5px;
  }

  .dpad {
    grid-template-columns: repeat(3, 34px);
    grid-template-rows: repeat(2, 34px);
  }

  .dpad button {
    min-height: 34px;
    font-size: 11px;
  }

  .mobile-controls .switch,
  .mobile-controls .jump,
  .mobile-controls .throw {
    min-height: 42px;
    padding: 0 6px;
    font-size: 9px;
  }

  .overlay h1 {
    font-size: 42px;
  }

  .overlay span {
    max-width: 260px;
    font-size: 12px;
  }
}
