* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  width:100%; height:100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  background: #fdf6ec;
  color: #333;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.container {
  max-width: 420px; height:100dvh;
  margin: 0 auto; padding: 4px 8px 6px;
  display: flex; flex-direction: column;
}

/* Score row */
.score-row {
  display: flex;
  justify-content: space-around;
  background: #fff;
  border-radius: 8px;
  padding: 5px 2px;
  margin-bottom: 4px;
  font-size: 13px; color: #888;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.score-row b { font-weight: normal; }
.score-row em {
  font-style: normal; font-weight: bold;
  font-size: 18px; color: #2c3e50; display: block;
}

/* Game Area — fills available space */
.game-area {
  position: relative;
  flex: 1;
  display: flex; justify-content: center; align-items: center;
  background: #1a1a2e;
  border-radius: 10px;
  margin-bottom: 4px;
  min-height: 0;
  overflow: hidden;
}
#gameCanvas {
  display: block;
  border: 3px solid #444;
  border-radius: 3px;
  background: #0f0f23;
  max-width: 100%;
  max-height: 100%;
}

/* Start button */
.btn-start {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 26px;
  padding: 16px 40px;
  border: none; border-radius: 18px;
  background: #e74c3c; color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(231,76,60,0.5);
  z-index: 10; letter-spacing: 4px;
}
.btn-start:active { background: #c0392b; transform: translate(-50%,-50%) scale(0.96); }

/* Game over overlay */
.game-overlay {
  position: absolute;
  top:0; left:0; right:0; bottom:0;
  background: rgba(0,0,0,0.75);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 10px; z-index: 9;
}
.game-overlay .overlay-text {
  color: #fff; font-size: 24px;
  text-align: center; line-height: 1.6;
  margin-bottom: 12px;
}
.game-overlay .encourage {
  font-size: 18px; color: #f1c40f; display: block; margin-top: 6px;
}
.btn-restart {
  font-size: 24px;
  padding: 14px 44px;
  border: none; border-radius: 50px;
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #fff; font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(243,156,18,0.5);
  letter-spacing: 6px;
  animation: pulse 2s infinite;
}
.btn-restart:active { transform: scale(0.95); }
@keyframes pulse {
  0%,100% { box-shadow: 0 4px 16px rgba(243,156,18,0.5); }
  50% { box-shadow: 0 4px 28px rgba(243,156,18,0.8); }
}
.hidden { display:none !important; }

/* Feedback overlay */
.feedback-overlay {
  position: absolute;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  color: #f1c40f; font-size: 18px; font-weight: bold;
  text-align: center;
  background: rgba(0,0,0,0.6);
  padding: 6px 16px; border-radius: 10px;
  pointer-events: none; opacity: 0;
  transition: opacity 0.3s; z-index: 8;
}

/* Controls — fixed at bottom */
.controls { flex-shrink: 0; }
.control-row {
  display: flex;
  justify-content: center; gap: 6px;
  margin-bottom: 4px;
}
.ctrl-btn {
  flex: 1; min-height: 52px;
  font-size: 19px; border: none; border-radius: 12px;
  background: #fff; color: #2c3e50;
  cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  padding: 10px 4px; font-weight: bold; letter-spacing: 1px;
}
.ctrl-btn:active { background: #e8e8e8; transform: scale(0.96); }
.ctrl-blue { background:#3498db; color:#fff; }
.ctrl-blue:active { background:#2980b9; }
.ctrl-green { background:#27ae60; color:#fff; }
.ctrl-green:active { background:#1e8449; }
.ctrl-orange { background:#e67e22; color:#fff; }
.ctrl-orange:active { background:#d35400; }
