:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #9fd8ff;
  color: #18222b;
}

* {
  box-sizing: border-box;
}

html,
body,
#game-shell {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

#game-shell {
  position: relative;
  background: linear-gradient(#9fd8ff 0%, #cfefff 58%, #98d36f 58%, #5fac4e 100%);
}

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

.hud {
  position: fixed;
  top: 18px;
  left: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 3;
}

.hud > div {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid rgb(255 255 255 / 0.56);
  border-radius: 8px;
  background: rgb(255 255 255 / 0.78);
  box-shadow: 0 10px 28px rgb(62 83 44 / 0.18);
  backdrop-filter: blur(14px);
}

.label {
  display: block;
  margin-bottom: 2px;
  color: #52606a;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.prompt {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 4;
  width: min(330px, calc(100vw - 36px));
  padding: 16px;
  border: 1px solid rgb(255 255 255 / 0.62);
  border-radius: 8px;
  background: rgb(255 255 255 / 0.83);
  box-shadow: 0 14px 34px rgb(37 55 24 / 0.22);
  backdrop-filter: blur(18px);
}

.prompt strong,
.prompt span {
  display: block;
}

.prompt strong {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.prompt span {
  margin-bottom: 12px;
  color: #44515b;
  line-height: 1.35;
}

button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  background: #273f23;
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #38572f;
}

.prompt.is-hidden {
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 12px;
  height: 12px;
  border: 2px solid rgb(255 255 255 / 0.82);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.22);
  transform: translate(-50%, -50%);
}

.interaction-hint {
  position: fixed;
  left: 50%;
  bottom: 132px;
  z-index: 3;
  max-width: min(360px, calc(100vw - 36px));
  padding: 10px 14px;
  border: 1px solid rgb(255 255 255 / 0.62);
  border-radius: 8px;
  background: rgb(24 34 43 / 0.74);
  box-shadow: 0 10px 28px rgb(37 55 24 / 0.22);
  color: white;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateX(-50%) translateY(8px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.interaction-hint.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.touch-controls {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 3;
  display: none;
  grid-template:
    ". up ." 54px
    "left down right" 54px / 54px 54px 54px;
  gap: 8px;
  touch-action: none;
}

.touch-button {
  min-width: 54px;
  min-height: 54px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.6);
  border-radius: 8px;
  background: rgb(39 63 35 / 0.74);
  box-shadow: 0 10px 24px rgb(37 55 24 / 0.2);
  color: white;
  font-size: 1.05rem;
  line-height: 1;
  backdrop-filter: blur(14px);
  user-select: none;
  -webkit-user-select: none;
}

.touch-button:active {
  background: rgb(56 87 47 / 0.88);
}

.touch-button.up {
  grid-area: up;
}

.touch-button.left {
  grid-area: left;
}

.touch-button.right {
  grid-area: right;
}

.touch-button.down {
  grid-area: down;
}

.action-button {
  position: fixed;
  right: 22px;
  bottom: 58px;
  z-index: 3;
  display: none;
  width: 62px;
  height: 62px;
  min-height: 62px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.62);
  border-radius: 50%;
  background: rgb(39 63 35 / 0.78);
  box-shadow: 0 10px 24px rgb(37 55 24 / 0.24);
  color: white;
  font-size: 1.15rem;
  backdrop-filter: blur(14px);
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 640px) {
  .hud {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .hud > div {
    min-width: 68px;
    padding: 8px 10px;
  }

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

  .prompt {
    right: 10px;
    bottom: 10px;
    width: min(310px, calc(100vw - 20px));
  }
}

@media (pointer: coarse) {
  .touch-controls {
    display: grid;
  }

  .action-button {
    display: block;
  }
}
