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

body {
  background: #000;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  touch-action: none;
  user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}

#score-display {
  font-size: 28px;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

#score {
  color: #ffcc00;
}

#combo-display {
  position: absolute;
  top: 50px;
  left: 20px;
  font-size: 22px;
  font-weight: bold;
  color: #ff6600;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  transition: opacity 0.3s;
}

#speed-display {
  font-size: 20px;
  color: #aaa;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.hidden {
  display: none !important;
}

#menu-screen, #game-over-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 20;
  color: #fff;
}

#menu-screen h1 {
  font-size: 72px;
  letter-spacing: 12px;
  color: #ffcc00;
  text-shadow: 0 0 30px rgba(255, 204, 0, 0.5);
  margin-bottom: 5px;
}

.subtitle {
  font-size: 18px;
  color: #888;
  margin-bottom: 30px;
}

.menu-controls {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 15px 25px;
  margin-bottom: 30px;
  text-align: left;
}

.menu-controls p {
  font-size: 15px;
  color: #bbb;
  margin: 6px 0;
}

#game-over-screen h2 {
  font-size: 56px;
  color: #ff4444;
  margin-bottom: 15px;
}

#game-over-screen p {
  font-size: 22px;
  margin: 5px 0;
  color: #ccc;
}

button {
  padding: 14px 48px;
  font-size: 22px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #ffcc00;
  color: #000;
  margin-top: 20px;
  transition: transform 0.15s, background 0.15s;
}

button:hover {
  background: #ffdd44;
  transform: scale(1.05);
}

button:active {
  transform: scale(0.97);
}

#touch-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px 10px 20px;
  z-index: 15;
  pointer-events: none;
}

.touch-btn {
  pointer-events: auto;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  padding: 0;
  margin: 0 8px;
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.touch-btn:active {
  opacity: 0.85;
  background: rgba(255, 204, 0, 0.3);
}

.left-btn { float: left; }
.right-btn { float: right; }

.flip-text {
  position: absolute;
  font-size: 36px;
  font-weight: bold;
  color: #ffcc00;
  text-shadow: 0 0 15px rgba(255, 204, 0, 0.7);
  pointer-events: none;
  z-index: 12;
  animation: flipPop 1s ease-out forwards;
}

@keyframes flipPop {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(1.5); }
}

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

@media (pointer: fine) {
  .touch-hint { display: none; }
}
