:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #86cfe6;
  color: #142033;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  background:
    linear-gradient(#77c8e4 0 58%, #67aa65 58% 100%);
}

.home-link {
  position: absolute;
  z-index: 4;
  top: 16px;
  right: 16px;
  padding: 8px 10px;
  border: 2px solid #202b3d;
  border-radius: 8px;
  background: rgba(255, 252, 229, 0.92);
  box-shadow: 0 4px 0 rgba(32, 43, 61, 0.2);
  color: #202b3d;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
}

.home-link:hover,
.home-link:focus {
  background: #ffd86b;
  outline: none;
}

.game-shell {
  position: relative;
  width: min(100vw, 1200px, calc(100vh * 16 / 9));
  height: min(100vh, 720px, calc(100vw * 9 / 16));
  overflow: hidden;
  background: #7dceed;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

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

.hud {
  position: absolute;
  z-index: 2;
  inset: 16px auto auto 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.hud > div {
  min-width: 78px;
  padding: 8px 10px;
  border: 2px solid #202b3d;
  border-radius: 8px;
  background: rgba(255, 252, 229, 0.92);
  box-shadow: 0 4px 0 rgba(32, 43, 61, 0.2);
}

.label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  color: #47606f;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  margin-top: 2px;
  font-size: 1.35rem;
  line-height: 1;
}

.title-card {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: rgba(18, 31, 48, 0.38);
}

.title-card.hidden {
  display: none;
}

.title-card h1,
.title-card p {
  margin: 0;
  color: #fffce5;
  text-shadow: 0 3px 0 #1f2c3f;
}

.title-card h1 {
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.9;
}

.title-card p {
  max-width: 32rem;
  margin-top: 16px;
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 800;
}

.title-card button {
  margin-top: 24px;
  min-width: 132px;
  border: 2px solid #18263a;
  border-radius: 8px;
  padding: 12px 18px;
  background: #ffcf45;
  box-shadow: 0 5px 0 #b65d34;
  color: #18263a;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
}

.title-card button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #b65d34;
}

.gesture-pad {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  height: 28%;
  display: none;
  pointer-events: none;
}

.move-pill {
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: min(52vw, 280px);
  height: 12px;
  border: 2px solid rgba(24, 38, 58, 0.65);
  border-radius: 999px;
  background: rgba(255, 252, 229, 0.42);
  transform: translateX(-50%);
}

.move-pill::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(24, 38, 58, 0.7);
  border-radius: 50%;
  background: rgba(255, 207, 69, 0.78);
  content: "";
  transform: translate(-50%, -50%);
}

.rotate-device {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: none;
  place-items: center;
  gap: 18px;
  background: #142033;
  color: #fffce5;
  text-align: center;
}

.rotate-device strong {
  display: block;
  font-size: clamp(1.25rem, 7vw, 2.2rem);
  line-height: 1;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.32);
}

.phone-icon {
  width: 72px;
  height: 116px;
  border: 5px solid #ffcf45;
  border-radius: 16px;
  box-shadow: 0 0 0 5px rgba(255, 252, 229, 0.12);
  transform: rotate(90deg);
}

.phone-icon::after {
  display: block;
  width: 18px;
  height: 5px;
  margin: 96px auto 0;
  border-radius: 999px;
  background: #ffcf45;
  content: "";
}

@media (hover: none), (pointer: coarse) {
  body {
    background: #142033;
  }

  .game-shell {
    width: min(100vw, calc(100dvh * 16 / 9));
    height: min(100dvh, calc(100vw * 9 / 16));
  }

  .gesture-pad {
    display: block;
  }

  .hud {
    inset: 10px auto auto 10px;
    gap: 6px;
  }

  .hud > div {
    min-width: 62px;
    padding: 7px 8px;
  }

  .hud strong {
    font-size: 1.1rem;
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .rotate-device {
    display: grid;
  }
}
