* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: #1c1c1c;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, sans-serif;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 12px;
}

#canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 960px;
}

#game-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 540;
  background: #7ec850;
  border: 2px solid #333;
  border-radius: 4px;
  touch-action: none;
  display: block;
}

#interact-prompt {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  max-width: 90%;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

#interact-prompt.visible {
  opacity: 1;
}

#touch-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  user-select: none;
}

#touch-row {
  display: flex;
  gap: 8px;
}

.touch-btn {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #222;
  font-size: 22px;
  touch-action: none;
}

.touch-btn:active {
  background: rgba(255, 255, 255, 1);
}

#btn-interact {
  display: none;
  background: rgba(70, 180, 110, 0.92);
  color: #fff;
  font-weight: bold;
}

#btn-interact.visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
}

#interaction-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
}

#interaction-panel.visible {
  display: flex;
}

#panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

#panel-box {
  position: relative;
  background: #fff;
  color: #222;
  border-radius: 8px;
  padding: 20px 24px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#panel-box h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

#panel-box p {
  margin: 0 0 16px;
  line-height: 1.4;
}

#panel-close {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #2255cc;
  color: #fff;
  font-size: 14px;
}
