* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a1a; font-family: 'Chakra Petch', sans-serif; }
canvas { display: block; width: 100%; height: 100%; }
#ui-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 10;
}
#ui-overlay > * { pointer-events: auto; }
#ui-overlay .menu-container {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.menu-panel {
  background: rgba(10, 10, 30, 0.92); border: 2px solid rgba(100, 200, 255, 0.3);
  border-radius: 12px; padding: 30px 40px; min-width: 360px; max-width: 90vw;
  backdrop-filter: blur(10px); box-shadow: 0 0 40px rgba(50, 100, 200, 0.15);
}
.menu-title {
  font-family: 'Press Start 2P', cursive; font-size: 28px; text-align: center;
  margin-bottom: 30px; letter-spacing: 4px;
  background: linear-gradient(135deg, #00e5ff, #aa66ff, #ff6ec7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none; animation: titlePulse 3s ease-in-out infinite;
}
@keyframes titlePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}
.menu-btn {
  display: block; width: 100%; padding: 14px 20px; margin: 8px 0;
  background: linear-gradient(135deg, rgba(30, 40, 80, 0.8), rgba(20, 30, 60, 0.9));
  border: 1px solid rgba(100, 180, 255, 0.25); border-radius: 8px;
  color: #c0d8ff; font-family: 'Chakra Petch', sans-serif; font-size: 16px;
  font-weight: 600; cursor: pointer; transition: all 0.2s ease;
  text-align: left; letter-spacing: 1px;
}
.menu-btn:hover {
  background: linear-gradient(135deg, rgba(50, 70, 140, 0.9), rgba(30, 50, 100, 0.95));
  border-color: rgba(100, 200, 255, 0.6); color: #fff;
  transform: translateX(4px); box-shadow: 0 0 20px rgba(50, 150, 255, 0.2);
}
.menu-btn.primary {
  background: linear-gradient(135deg, rgba(0, 150, 255, 0.3), rgba(100, 50, 200, 0.3));
  border-color: rgba(100, 200, 255, 0.5); font-size: 18px; padding: 16px 20px;
}
.menu-btn.primary:hover {
  background: linear-gradient(135deg, rgba(0, 150, 255, 0.5), rgba(100, 50, 200, 0.5));
  box-shadow: 0 0 30px rgba(50, 150, 255, 0.3);
}
.menu-btn.danger { border-color: rgba(255, 80, 80, 0.4); color: #ff9090; }
.menu-btn.danger:hover { border-color: rgba(255, 80, 80, 0.7); background: rgba(255, 50, 50, 0.2); }
.back-btn {
  position: absolute; top: 20px; left: 20px; padding: 8px 16px;
  background: rgba(20, 20, 40, 0.8); border: 1px solid rgba(100, 180, 255, 0.3);
  border-radius: 6px; color: #8ab4f8; font-family: 'Chakra Petch', sans-serif;
  font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.back-btn:hover { border-color: rgba(100, 200, 255, 0.6); color: #fff; }
.world-cards { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin: 20px 0; }
.world-card {
  width: 220px; padding: 20px; border-radius: 12px; cursor: pointer;
  transition: all 0.3s ease; border: 2px solid transparent;
}
.world-card:hover { transform: translateY(-5px); }
.world-card.crystal { background: linear-gradient(135deg, #1a0a3e, #0d2d4a); border-color: rgba(0, 229, 255, 0.4); }
.world-card.ice { background: linear-gradient(135deg, #0a1a3e, #1a3050); border-color: rgba(150, 220, 255, 0.4); }
.world-card.lava { background: linear-gradient(135deg, #3e0a0a, #4a2d0d); border-color: rgba(255, 100, 50, 0.4); }
.world-card h3 { font-family: 'Press Start 2P', cursive; font-size: 11px; margin-bottom: 10px; }
.world-card.crystal h3 { color: #00e5ff; }
.world-card.ice h3 { color: #96dcff; }
.world-card.lava h3 { color: #ff6432; }
.world-card p { color: #8899bb; font-size: 13px; }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 20px 0; }
.level-btn {
  width: 56px; height: 56px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Press Start 2P', cursive; font-size: 14px;
  transition: all 0.2s; border: 2px solid rgba(100, 180, 255, 0.2);
  background: rgba(20, 30, 60, 0.8); color: #8ab4f8;
}
.level-btn:hover { transform: scale(1.1); border-color: rgba(100, 200, 255, 0.6); }
.level-btn.completed { border-color: rgba(100, 255, 100, 0.5); color: #80ff80; }
.level-btn.completed::after { content: '⭐'; position: absolute; top: -4px; right: -4px; font-size: 10px; }
.hud { position: absolute; top: 0; left: 0; width: 100%; padding: 10px 16px; display: flex; justify-content: space-between; pointer-events: none; }
.hud-item { font-family: 'Press Start 2P', cursive; font-size: 10px; color: rgba(200, 220, 255, 0.8); text-shadow: 0 0 8px rgba(0, 100, 200, 0.5); }
.char-indicators {
  position: absolute; bottom: 16px; left: 16px; display: flex; gap: 8px;
}
.char-ind {
  width: 36px; height: 36px; border-radius: 6px; border: 2px solid rgba(100, 180, 255, 0.3);
  display: flex; align-items: center; justify-content: center; font-size: 10px;
  font-family: 'Press Start 2P', cursive; transition: all 0.2s;
}
.char-ind.active { border-color: #fff; transform: scale(1.2); box-shadow: 0 0 12px rgba(100, 200, 255, 0.5); }
.char-ind.locked { opacity: 0.3; }
.pause-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(5, 5, 20, 0.85); display: flex; align-items: center; justify-content: center;
}
.footer-link {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  font-size: 11px; opacity: 0.4;
}
.footer-link a { color: #8ab4f8; text-decoration: none; }
.footer-link a:hover { opacity: 1; }
.editor-toolbar {
  position: absolute; top: 0; left: 0; width: 100%; padding: 8px 12px;
  background: rgba(10, 10, 30, 0.95); border-bottom: 1px solid rgba(100, 180, 255, 0.2);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.editor-toolbar input {
  background: rgba(20, 30, 60, 0.8); border: 1px solid rgba(100, 180, 255, 0.3);
  border-radius: 4px; padding: 4px 8px; color: #c0d8ff; font-family: 'Chakra Petch', sans-serif;
  font-size: 13px;
}
.editor-toolbar button, .tool-btn {
  padding: 4px 10px; background: rgba(30, 40, 80, 0.8);
  border: 1px solid rgba(100, 180, 255, 0.25); border-radius: 4px;
  color: #8ab4f8; font-size: 12px; cursor: pointer; font-family: 'Chakra Petch', sans-serif;
  transition: all 0.15s;
}
.editor-toolbar button:hover, .tool-btn:hover { border-color: rgba(100, 200, 255, 0.6); color: #fff; }
.tool-btn.active { background: rgba(0, 150, 255, 0.3); border-color: #00e5ff; color: #fff; }
.editor-sidebar {
  position: absolute; top: 44px; left: 0; width: 180px; bottom: 30px;
  background: rgba(10, 10, 30, 0.95); border-right: 1px solid rgba(100, 180, 255, 0.2);
  overflow-y: auto; padding: 8px;
}
.editor-sidebar h4 {
  font-size: 10px; color: #6688aa; margin: 8px 0 4px; font-family: 'Press Start 2P', cursive;
  letter-spacing: 1px;
}
.tile-option {
  display: inline-flex; width: 32px; height: 32px; margin: 2px; border-radius: 4px;
  border: 1px solid rgba(100, 180, 255, 0.15); cursor: pointer; align-items: center;
  justify-content: center; font-size: 16px; transition: all 0.15s;
  background: rgba(20, 30, 50, 0.6);
}
.tile-option:hover { border-color: rgba(100, 200, 255, 0.5); }
.tile-option.selected { border-color: #00e5ff; background: rgba(0, 150, 255, 0.2); box-shadow: 0 0 8px rgba(0, 200, 255, 0.3); }
.editor-bottom {
  position: absolute; bottom: 0; left: 0; width: 100%; padding: 4px 12px;
  background: rgba(10, 10, 30, 0.95); border-top: 1px solid rgba(100, 180, 255, 0.2);
  font-size: 11px; color: #6688aa; display: flex; justify-content: space-between;
}
.toast {
  position: fixed; top: 20px; right: 20px; padding: 12px 20px;
  background: rgba(10, 30, 60, 0.95); border: 1px solid rgba(100, 255, 100, 0.5);
  border-radius: 8px; color: #80ff80; font-family: 'Chakra Petch', sans-serif;
  font-size: 14px; z-index: 100; animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
  pointer-events: none;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-20px); } }
.settings-panel { max-height: 60vh; overflow-y: auto; }
.settings-section { margin: 16px 0; }
.settings-section h4 { color: #8ab4f8; font-size: 13px; margin-bottom: 8px; border-bottom: 1px solid rgba(100, 180, 255, 0.15); padding-bottom: 4px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; color: #a0b8d8; font-size: 13px; }
.toggle {
  width: 40px; height: 22px; border-radius: 11px; background: rgba(40, 50, 80, 0.8);
  border: 1px solid rgba(100, 180, 255, 0.3); cursor: pointer; position: relative; transition: all 0.2s;
}
.toggle.on { background: rgba(0, 150, 255, 0.4); border-color: #00e5ff; }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #8ab4f8; transition: all 0.2s;
}
.toggle.on::after { left: 20px; background: #00e5ff; }
.tutorial-content { max-height: 50vh; overflow-y: auto; color: #a0b8d8; font-size: 14px; line-height: 1.7; }
.tutorial-content h3 { color: #00e5ff; font-family: 'Press Start 2P', cursive; font-size: 11px; margin: 16px 0 8px; }
.tutorial-content kbd {
  background: rgba(30, 50, 80, 0.8); border: 1px solid rgba(100, 180, 255, 0.3);
  border-radius: 4px; padding: 2px 6px; font-family: 'Press Start 2P', cursive; font-size: 9px; color: #c0d8ff;
}
.confirm-dialog {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.confirm-box {
  background: rgba(15, 15, 35, 0.98); border: 2px solid rgba(255, 100, 100, 0.4);
  border-radius: 10px; padding: 24px 32px; text-align: center; color: #c0d8ff;
}
.confirm-box p { margin-bottom: 16px; font-size: 14px; }
.confirm-box .btn-row { display: flex; gap: 12px; justify-content: center; }
.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 50vh; overflow-y: auto; padding: 4px; }
.achievement-card {
  background: rgba(20, 30, 50, 0.6); border: 1px solid rgba(100, 180, 255, 0.15);
  border-radius: 8px; padding: 10px; text-align: center; transition: all 0.2s;
}
.achievement-card.unlocked { border-color: rgba(255, 215, 0, 0.5); }
.achievement-card .icon { font-size: 24px; margin-bottom: 4px; }
.achievement-card.locked .icon { filter: grayscale(1) brightness(0.4); }
.achievement-card .title { font-size: 10px; font-family: 'Press Start 2P', cursive; color: #8ab4f8; margin-bottom: 4px; }
.achievement-card .desc { font-size: 11px; color: #6688aa; }
.my-levels-list { max-height: 50vh; overflow-y: auto; }
.my-level-card {
  background: rgba(20, 30, 50, 0.6); border: 1px solid rgba(100, 180, 255, 0.15);
  border-radius: 8px; padding: 12px; margin: 8px 0; display: flex; justify-content: space-between; align-items: center;
}
.my-level-card .info { flex: 1; }
.my-level-card .name { color: #c0d8ff; font-weight: 600; }
.my-level-card .meta { color: #6688aa; font-size: 11px; }
.my-level-card .actions { display: flex; gap: 6px; }
.my-level-card .actions button {
  padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(100, 180, 255, 0.25);
  background: rgba(30, 40, 80, 0.6); color: #8ab4f8; font-size: 11px; cursor: pointer;
  font-family: 'Chakra Petch', sans-serif;
}
.my-level-card .actions button:hover { border-color: rgba(100, 200, 255, 0.6); color: #fff; }
.cutscene-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(5, 5, 15, 0.95); display: flex; align-items: center; justify-content: center;
  flex-direction: column; color: #c0d8ff; text-align: center; padding: 40px;
}
.cutscene-overlay h2 { font-family: 'Press Start 2P', cursive; font-size: 16px; margin-bottom: 20px; color: #00e5ff; }
.cutscene-overlay p { font-size: 15px; line-height: 1.8; max-width: 500px; margin-bottom: 20px; }