:root {
  --bg-color: #07090e;
  --surface-color: rgba(18, 24, 38, 0.85);
  --border-glow: rgba(0, 240, 255, 0.25);
  --accent-cyan: #00f0ff;
  --accent-magenta: #ff0077;
  --accent-amber: #ffb700;
  --accent-purple: #9d4edd;
  --text-primary: #f0f4fc;
  --text-secondary: #8e9bb4;
  --grid-line: rgba(255, 255, 255, 0.08);
  --grid-danger: rgba(255, 59, 48, 0.35);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  touch-action: none;
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  position: relative;
  background: radial-gradient(circle at center, #0f1524 0%, #07090e 100%);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

/* Header HUD */
.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(10, 14, 23, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glow);
  z-index: 10;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.hud-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
}

.hud-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.hud-title-wrap {
  text-align: center;
}

.game-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Canvas Wrapper */
.canvas-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Guide Toast */
.guide-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 20, 32, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.4);
  padding: 10px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 240, 255, 0.2);
  pointer-events: none;
  animation: pulseGuide 3s infinite alternate;
  z-index: 5;
  transition: opacity 0.5s ease;
}

.guide-icon {
  font-size: 24px;
}

.guide-text {
  font-size: 11px;
  line-height: 1.45;
  color: #d8e2f3;
}

.guide-text strong {
  color: var(--accent-cyan);
}

.guide-text em {
  color: var(--text-secondary);
  font-size: 10px;
}

@keyframes pulseGuide {
  0% { transform: translateX(-50%) scale(1); }
  100% { transform: translateX(-50%) scale(1.02); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 240, 255, 0.4); }
}

/* Game Over Overlay */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 14, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  transition: opacity 0.3s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  background: var(--surface-color);
  border: 1px solid rgba(255, 0, 119, 0.4);
  padding: 30px 24px;
  border-radius: 20px;
  text-align: center;
  width: 85%;
  max-width: 320px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8), 0 0 30px rgba(255, 0, 119, 0.25);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.overlay-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.final-score-title {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.final-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 42px;
  font-weight: 800;
  color: #fff;
  margin: 8px 0 16px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.game-over-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.neon-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-magenta) 0%, #bd00ff 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(255, 0, 119, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.neon-btn:active {
  transform: scale(0.97);
  filter: brightness(1.2);
}

/* Footer / Action Controls */
.game-footer {
  padding: 12px 18px env(safe-area-inset-bottom, 14px);
  background: rgba(10, 14, 23, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.control-tip {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.action-buttons {
  display: flex;
  gap: 10px;
}

.quick-btn {
  flex: 1;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.98);
}

.quick-btn.drop-btn {
  flex: 1.5;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2) 0%, rgba(0, 240, 255, 0.08) 100%);
  border-color: rgba(0, 240, 255, 0.4);
  color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.quick-btn.drop-btn:active {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.6);
}
