:root {
  --bg-1: #ffe9b6;
  --bg-2: #ffd3a5;
  --panel: rgba(255, 255, 255, 0.88);
  --text: #2d2a26;
  --accent: #ff7f50;
  --accent-2: #ff9f68;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Nunito", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--text);
}

body {
  background: radial-gradient(circle at top, var(--bg-1), var(--bg-2));
  display: grid;
  place-items: center;
  overflow: auto;
}

.app {
  width: min(100vw, 560px);
  height: 100dvh;
  max-height: 900px;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 12px 12px calc(84px + env(safe-area-inset-bottom));
  margin: 0;
}

@supports (height: 100svh) {
  .app {
    height: 100svh;
  }
}

.hud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.panel {
  background: var(--panel);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.value {
  margin: 4px 0 0;
  font-size: 28px;
  font-weight: 800;
}

.stage-wrap {
  position: relative;
  min-height: 0;
  display: grid;
}

#board {
  width: 100%;
  height: 100%;
  min-height: 180px;
  background: rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5), 0 8px 24px rgba(0, 0, 0, 0.11);
  touch-action: none;
}

.controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(536px, calc(100vw - 24px));
  display: grid;
  z-index: 20;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 18px rgba(255, 127, 80, 0.35);
}

.btn:active {
  transform: translateY(1px);
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 24, 20, 0.56);
  border-radius: 18px;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.hidden {
  display: none;
}

.message {
  margin: 0;
  color: #fff;
  font-size: clamp(20px, 5vw, 34px);
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

@media (max-height: 740px) {
  .app {
    gap: 8px;
    padding-top: 8px;
  }

  .value {
    font-size: 24px;
  }

  .btn {
    padding: 10px 16px;
  }
}
