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

body {
  background: #0a0a1a;
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

#game-container {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 20px;
  background: linear-gradient(145deg, #111128, #0d0d1f);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* Board */
#board-container canvas {
  display: block;
  border-radius: 8px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5),
              0 0 30px rgba(100,100,255,0.08);
}

/* Side panels */
#left-panel, #right-panel {
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#left-panel > div, #right-panel > div {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #8888cc;
  margin-bottom: 8px;
  font-weight: 600;
}

#score, #level, #lines {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

#next-canvas {
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

/* Controls */
#controls {
  text-align: left !important;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: #b0b0d0;
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #ccc;
  flex-shrink: 0;
}

#start-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #4444ff, #6666ff);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}

#start-btn:hover {
  background: linear-gradient(135deg, #5555ff, #7777ff);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(68,68,255,0.3);
}

#start-btn:active {
  transform: translateY(0);
}

/* Overlay (game over / pause) */
#overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#overlay.hidden {
  display: none;
}

#overlay-content {
  background: #161630;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 40px 50px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

#overlay-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #8888ff, #aaaaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#overlay-text {
  font-size: 18px;
  color: #b0b0d0;
  margin-bottom: 24px;
}

#overlay-btn {
  padding: 14px 40px;
  background: linear-gradient(135deg, #4444ff, #6666ff);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}

#overlay-btn:hover {
  background: linear-gradient(135deg, #5555ff, #7777ff);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(68,68,255,0.3);
}

/* Mobile touch controls */
#mobile-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(15,15,35,0.9);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  z-index: 50;
}

#mobile-controls.hidden {
  display: none;
}

.mbtn {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #ccc;
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.1s;
}

.mbtn:active {
  background: rgba(100,100,255,0.2);
  transform: scale(0.92);
}

.mbtn.drop-btn {
  width: 80px;
  background: rgba(68,68,255,0.15);
  border-color: rgba(68,68,255,0.3);
  color: #8888ff;
  font-weight: 600;
  font-size: 13px;
}

@media (max-width: 700px) {
  #right-panel {
    display: none;
  }
  #left-panel {
    width: 100px;
  }
  #left-panel h3 {
    font-size: 10px;
  }
  #score, #level, #lines {
    font-size: 22px;
  }
  #game-container {
    gap: 12px;
    padding: 12px;
  }
  #board-container canvas {
    width: 240px;
    height: 480px;
  }
  #next-canvas {
    width: 96px;
    height: 96px;
  }
}
