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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a1a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

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

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#ui-overlay > * {
  pointer-events: auto;
}

#hud {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  z-index: 10;
}

#hud span {
  background: rgba(0,0,0,0.35);
  padding: 6px 14px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

#score { color: #ffd700; }
#combo { color: #00e5ff; }
#level { color: #76ff03; }

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.screen h1 {
  font-size: clamp(32px, 8vw, 64px);
  color: #fff;
  text-shadow: 0 0 30px rgba(100,100,255,0.5);
  margin-bottom: 24px;
  letter-spacing: 4px;
}

.screen p {
  font-size: clamp(18px, 4vw, 28px);
  color: #ffd700;
  margin-bottom: 24px;
  text-shadow: 0 0 20px rgba(255,215,0,0.3);
}

.screen button {
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 700;
  padding: 14px 48px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 2px;
}

.screen button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(102,126,234,0.5);
}

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

#pause-screen h1 {
  color: #ffd700;
  text-shadow: 0 0 30px rgba(255,215,0,0.5);
}

#pause-screen .btn-secondary {
  margin-top: 8px;
}

#pause-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.15s;
}

#pause-btn:hover {
  background: rgba(0,0,0,0.6);
}

#pause-btn.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

/* --- Editor Toolbar --- */

#editor-toolbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(10,10,26,0.95) 60%, transparent);
  pointer-events: none;
}

#editor-toolbar > * {
  pointer-events: auto;
}

.editor-tools,
.editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.editor-btn {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #ccc;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
}

.editor-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.editor-btn.active {
  border-color: #5ce1e6;
  color: #fff;
  background: rgba(92,225,230,0.15);
  box-shadow: 0 0 12px rgba(92,225,230,0.2);
}

.editor-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: transparent;
  color: #fff;
}

.editor-primary:hover {
  box-shadow: 0 0 16px rgba(102,126,234,0.4);
}

.editor-danger {
  border-color: rgba(255,68,68,0.4);
  color: #ff6666;
}

.editor-danger:hover {
  background: rgba(255,68,68,0.15);
  border-color: #ff4444;
}

.editor-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.icon-box, .icon-circle, .icon-flag {
  display: inline-block;
  width: 14px;
  height: 14px;
}

.icon-box {
  border: 2px solid currentColor;
  border-radius: 2px;
}

.icon-circle {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.icon-flag {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 12px solid currentColor;
}

.btn-secondary {
  font-size: clamp(14px, 2.5vw, 20px);
  font-weight: 700;
  padding: 12px 36px;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 2px;
  margin-top: 8px;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.5);
}

@media (max-width: 480px) {
  #hud { font-size: 14px; padding: 0 10px; }
  #hud span { padding: 4px 10px; }
  .screen button { padding: 12px 32px; }
}
