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

:root {
  --color-primary: #3498db;
  --color-success: #27ae60;
  --color-danger: #e74c3c;
  --color-warning: #f39c12;
  --color-surface: #2c2c2c;
  --color-background: #1a1a1a;
  --color-border: #444;
  --color-text: #eee;
  --color-text-secondary: #aaa;
  --color-text-muted: #888;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.app-container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: #2c3e50;
  color: white;
  display: flex;
  flex-direction: column;
}

.logo {
  padding: 24px 20px;
  font-size: 20px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: #34495e;
}

.nav-menu {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
}

.nav-item.active {
  background: rgba(52, 152, 219, 0.15);
  border-left-color: #3498db;
  font-weight: 500;
}

.nav-icon {
  width: 20px;
  text-align: center;
}

.nav-category {
  padding: 16px 20px 8px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-category:first-child {
  padding-top: 8px;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  background: white;
  padding: 16px 24px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button.btn-primary {
  background: #3498db;
  color: white;
}

button.btn-primary:hover {
  background: #2980b9;
}

button.btn-success {
  background: #27ae60;
  color: white;
}

button.btn-success:hover {
  background: #229954;
}

button.btn-secondary {
  background: #95a5a6;
  color: white;
}

button.btn-secondary:hover {
  background: #7f8c8d;
}

button.btn-danger {
  background: #e74c3c;
  color: white;
}

button.btn-danger:hover {
  background: #c0392b;
}

button.btn-ghost {
  background: transparent;
  border: 1px solid #bdc3c7;
  color: #7f8c8d;
}

button.btn-ghost:hover {
  background: #ecf0f1;
}

button.btn-ghost.active {
  background: #8b5cf6;
  color: white;
  border-color: #8b5cf6;
}

button.btn-ghost.active:hover {
  background: #7c3aed;
  border-color: #7c3aed;
}

button.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.section-content {
  display: none;
  width: 100%;
}

.section-content.active {
  display: flex;
}

.list-panel {
  width: 320px;
  background: white;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}

.list-header {
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
}

.search-box {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.list-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Allow popups to overflow in map editor tools */
#maps-tools {
  overflow: visible !important;
}

#maps-tools .tool-section {
  overflow: visible;
}

.list-item {
  padding: 12px;
  margin-bottom: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-item:hover {
  background: #f8f9fa;
  border-color: #e0e0e0;
}

.list-item.selected {
  background: #e3f2fd;
  border-color: #3498db;
}

.item-icon {
  width: 40px;
  height: 40px;
  background: #ecf0f1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  image-rendering: pixelated;
}

.item-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 500;
  font-size: 14px;
  color: #2c3e50;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  font-size: 12px;
  color: #95a5a6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-actions {
  opacity: 0;
  transition: opacity 0.2s;
}

.list-item:hover .item-actions {
  opacity: 1;
}

/* Editor Panel */
.editor-panel {
  flex: 1;
  overflow-y: auto;
  background: #fafafa;
}

.editor-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.editor-section {
  background: white;
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid #e0e0e0;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #ecf0f1;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row.single {
  grid-template-columns: 1fr;
}

.form-row.triple {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-row.quad {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.checkbox-label span {
  user-select: none;
}

.array-editor {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 12px;
}

.array-item {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 8px;
}

.array-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #95a5a6;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-info {
  background: #e3f2fd;
  color: #1976d2;
}

.badge-success {
  background: #e8f5e9;
  color: #388e3c;
}

.badge-warning {
  background: #fff3e0;
  color: #f57c00;
}

.info-box {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 13px;
  color: #1565c0;
  margin-top: 12px;
}

.json-editor {
  min-height: 300px;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  padding: 16px 20px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10000;
  animation: slideIn 0.3s;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  max-height: 80px;
}

.toast.success { border-left: 4px solid #27ae60; }
.toast.error { border-left: 4px solid #e74c3c; }

@keyframes slideIn {
  from { transform: translateX(400px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #bdc3c7;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #95a5a6;
}

.icon-preview {
  width: 60px;
  height: 60px;
  background: #ecf0f1;
  border: 2px solid #ddd;
  border-radius: 4px;
  display: inline-block;
  position: relative;
  overflow: hidden;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.icon-preview canvas {
  width: 100%;
  height: 100%;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  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: 10000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

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

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: #2c3e50;
  font-size: 20px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8f9fa;
}

.info-box {
  padding: 12px 16px;
  border-left: 4px solid #3498db;
  background: #e3f2fd;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.6;
}

/* Map Editor Specific Styles */
#map-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: crosshair;
}

.tool-section {
  padding: 12px;
}

.tool-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button.active {
  background: #3498db !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.tool-section .form-group {
  margin-bottom: 0;
}

.tool-section .form-group label {
  font-size: 12px;
  font-weight: 500;
  color: #555;
  margin-bottom: 4px;
  display: block;
}

.tool-section input[type="number"] {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

/* ===== PARTICLE & PROPS EDITOR STYLES ===== */

/* Layout for particle/props editors */
.particle-editor-layout,
.props-editor-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  height: 100%;
  max-height: calc(100vh - 60px);
  gap: 0;
  background: #1a1a2e;
  overflow: hidden;
}

/* Preview Panel */
.particle-preview-panel,
.prop-preview-panel {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-right: 1px solid #2a2a4a;
  position: relative;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid #2a2a4a;
}

.preview-header span {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.preview-controls {
  display: flex;
  gap: 8px;
}

.preview-controls button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
}

.preview-controls button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.preview-canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.preview-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.preview-stats {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.4);
  color: #7fdbff;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  border-top: 1px solid #2a2a4a;
}

/* Properties Panel */
.particle-properties-panel,
.prop-properties-panel {
  background: #f8f9fa;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  max-height: 100vh;
}

/* Editor Sections in Particle/Props Editors */
.particle-properties-panel .editor-section,
.prop-properties-panel .editor-section {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  margin: 0;
  padding: 16px;
}

.particle-properties-panel .section-title,
.prop-properties-panel .section-title {
  font-size: 13px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.section-title .collapse-icon {
  font-size: 10px;
  transition: transform 0.2s;
  color: #666;
}

/* Section content visible by default - use !important to override .section-content rule */
.editor-section.collapsible .section-content {
  display: block !important;
  padding-top: 8px;
}

/* Prevent scroll jump on clicks */
.particle-properties-panel,
.prop-properties-panel {
  scroll-behavior: smooth;
}

.particle-properties-panel *,
.prop-properties-panel * {
  scroll-margin-top: 0;
}

.editor-section.collapsible.collapsed .section-content {
  display: none !important;
}

.editor-section.collapsible.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

/* Layer List */
.layer-list {
  background: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

.layer-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid #e0e0e0;
}

.layer-item:last-child {
  border-bottom: none;
}

.layer-item:hover {
  background: #e8f4fc;
}

.layer-item.active {
  background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
  color: #fff;
}

.layer-item.active .layer-actions button {
  color: rgba(255, 255, 255, 0.8);
}

.layer-name {
  flex: 1;
  font-weight: 500;
  font-size: 13px;
}

.layer-actions {
  display: flex;
  gap: 4px;
}

.layer-actions button {
  padding: 2px 6px;
  font-size: 12px;
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
}

.layer-actions button:hover {
  background: rgba(0, 0, 0, 0.1);
}

.layer-actions button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Particle List in Props Editor */
.particle-list {
  background: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  min-height: 60px;
}

.particle-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid #e0e0e0;
}

.particle-item:last-child {
  border-bottom: none;
}

.particle-item:hover {
  background: #e8f4fc;
}

.particle-item.active {
  background: linear-gradient(90deg, #9b59b6 0%, #8e44ad 100%);
  color: #fff;
}

.particle-name {
  flex: 1;
  font-weight: 500;
  font-size: 13px;
}

.empty-state {
  padding: 20px;
  text-align: center;
  color: #999;
  font-size: 13px;
  font-style: italic;
}

/* Visual Range Sliders */
.visual-slider {
  position: relative;
  height: 8px;
  background: linear-gradient(90deg, #e0e0e0 0%, #3498db 100%);
  border-radius: 4px;
  cursor: pointer;
}

.visual-slider-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 2px solid #3498db;
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Color Picker Enhancement */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 8px;
}

.color-picker-row input[type="color"] {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-picker-row input[type="color"]::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}

.color-picker-label {
  flex: 1;
  font-weight: 500;
  font-size: 13px;
}

.color-picker-alpha {
  width: 60px;
  text-align: right;
}

/* Gradient Editor */
.gradient-editor {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
}

.gradient-bar {
  height: 24px;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  border: 1px solid #333;
  margin-bottom: 8px;
}

.gradient-stop {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  top: 100%;
  transform: translate(-50%, 4px);
  cursor: grab;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Preset Buttons */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #3498db;
}

.preset-btn .preset-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.preset-btn .preset-name {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
}

/* Emitter Shape Visualizer */
.shape-preview {
  width: 100%;
  height: 80px;
  background: #1a1a2e;
  border-radius: 8px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.shape-preview::before {
  content: '';
  position: absolute;
  background: radial-gradient(circle, rgba(52, 152, 219, 0.3) 0%, transparent 70%);
  border: 2px dashed rgba(52, 152, 219, 0.5);
}

.shape-preview.point::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.shape-preview.sphere::before {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.shape-preview.box::before {
  width: 80px;
  height: 50px;
  border-radius: 4px;
}

.shape-preview.cone::before {
  width: 0;
  height: 0;
  border: none;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 60px solid rgba(52, 152, 219, 0.3);
  background: none;
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  border-top: 1px solid #444;
}

.action-bar button {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-bar .btn-save {
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  color: #fff;
}

.action-bar .btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.action-bar .btn-export {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: #fff;
}

.action-bar .btn-import {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Read-only inputs */
.readonly-input {
  background: #f0f0f0 !important;
  color: #666 !important;
  cursor: not-allowed;
}

/* Quick value buttons */
.quick-values {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.quick-value-btn {
  padding: 2px 8px;
  background: #e9ecef;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-value-btn:hover {
  background: #3498db;
  color: #fff;
  border-color: #3498db;
}

/* Tooltip */
.tooltip-trigger {
  position: relative;
  cursor: help;
}

.tooltip-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  z-index: 100;
}

.tooltip-trigger:hover::after {
  opacity: 1;
  visibility: visible;
  bottom: calc(100% + 8px);
}

/* Tabs for Editor Sections */
.editor-tabs {
  display: flex;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.editor-tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.editor-tab:hover {
  color: #3498db;
  background: #fff;
}

.editor-tab.active {
  color: #3498db;
  border-bottom-color: #3498db;
  background: #fff;
}

/* Responsive Grid for Form Fields */
.field-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.field-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Mini inline labels */
.mini-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* Checkbox styling for particle/props */
.particle-properties-panel .checkbox-label,
.prop-properties-panel .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
}

.particle-properties-panel .checkbox-label input,
.prop-properties-panel .checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: #3498db;
}

/* Animation for preview loading */
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.loading-preview {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 24px;
  border-radius: 8px;
  color: #fff;
  font-weight: 500;
  z-index: 10000;
  animation: slideInUp 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.toast-success { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.toast-error { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.toast-info { background: linear-gradient(135deg, #3498db, #2980b9); }

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

/* ===== NEW INTUITIVE PARTICLE EDITOR UI ===== */

/* Start Section with Presets */
.start-section {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid #2a2a4a;
}

.start-section h3 {
  color: #fff;
  font-size: 16px;
  margin-bottom: 8px;
}

.start-section .help-text {
  color: #8892b0;
  font-size: 13px;
  margin-bottom: 16px;
}

.preset-grid-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.preset-btn-lg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn-lg span {
  font-size: 24px;
  margin-bottom: 4px;
}

.preset-btn-lg:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: #8b5cf6;
  transform: translateY(-2px);
}

.btn-link {
  background: none;
  border: none;
  color: #8b5cf6;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 0;
  width: 100%;
  text-align: center;
}

.btn-link:hover {
  color: #a78bfa;
  text-decoration: underline;
}

/* Effect Header */
.effect-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border-bottom: 2px solid #8b5cf6;
}

.effect-name-input {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #2c3e50;
  padding: 8px 0;
}

.effect-name-input:focus {
  outline: none;
  border-bottom: 2px solid #8b5cf6;
}

.effect-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: #f0f0f0;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #8b5cf6;
  transform: scale(1.1);
}

/* Control Groups */
.control-group {
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #fff;
}

.control-group h3 {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 12px;
}

.control-group h4 {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
}

/* Slider Rows */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.slider-row label {
  width: 80px;
  font-size: 13px;
  color: #666;
  flex-shrink: 0;
}

.slider-row input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  background: linear-gradient(90deg, #e0e0e0, #8b5cf6);
  border-radius: 3px;
  cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 2px solid #8b5cf6;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.slider-value {
  width: 50px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #8b5cf6;
}

/* Color Row */
.color-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.color-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.color-pick label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
}

.color-pick input[type="color"] {
  width: 50px;
  height: 50px;
  padding: 0;
  border: 3px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.color-pick input[type="color"]:hover {
  border-color: #8b5cf6;
  transform: scale(1.05);
}

.color-pick input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-pick input[type="color"]::-webkit-color-swatch {
  border-radius: 8px;
  border: none;
}

.color-arrow {
  font-size: 24px;
  color: #ccc;
}

/* Direction Picker */
.direction-picker {
  margin-bottom: 12px;
}

.direction-picker label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

.direction-btns {
  display: flex;
  gap: 8px;
}

.direction-btns button {
  flex: 1;
  padding: 10px;
  border: 2px solid #e0e0e0;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.direction-btns button:hover {
  border-color: #8b5cf6;
  background: #f8f5ff;
}

.direction-btns button.active {
  border-color: #8b5cf6;
  background: #8b5cf6;
  color: #fff;
}

/* Texture Row */
.texture-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.current-texture {
  width: 64px;
  height: 64px;
  background: #1a1a2e;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e0e0e0;
}

.current-texture img {
  max-width: 56px;
  max-height: 56px;
  image-rendering: pixelated;
}

.texture-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.texture-quick-picks img {
  width: 36px;
  height: 36px;
  background: #f0f0f0;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s;
  image-rendering: pixelated;
}

.texture-quick-picks img:hover {
  background: #8b5cf6;
  transform: scale(1.1);
}

/* Blend Buttons */
.blend-btns {
  display: flex;
  gap: 8px;
}

.blend-btns button {
  flex: 1;
  padding: 12px;
  border: 2px solid #e0e0e0;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.blend-btns button:hover {
  border-color: #8b5cf6;
}

.blend-btns button.active {
  border-color: #8b5cf6;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
}

/* Advanced Section */
.advanced-section {
  border-bottom: 1px solid #e0e0e0;
}

.advanced-section summary {
  padding: 16px;
  background: #f8f9fa;
  cursor: pointer;
  font-weight: 600;
  color: #666;
  list-style: none;
}

.advanced-section summary::-webkit-details-marker {
  display: none;
}

.advanced-section summary:hover {
  background: #f0f0f0;
}

.advanced-content {
  padding: 0;
}

/* Layer Chips */
.layer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.layer-chip {
  padding: 8px 12px;
  background: #f0f0f0;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.layer-chip:hover {
  background: #e0e0e0;
}

.layer-chip.active {
  background: #8b5cf6;
  color: #fff;
  border-color: #8b5cf6;
}

.layer-chip.add {
  background: transparent;
  border-style: dashed;
  color: #8b5cf6;
}

.layer-chip.add:hover {
  background: #f8f5ff;
}

/* Checkbox Row */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 13px;
  color: #666;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #8b5cf6;
}

/* Modal Overlays */
#preset-modal-overlay,
#texture-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.preset-modal,
.texture-modal {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preset-modal-content,
.texture-modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  width: 90%;
}

.preset-modal-content h2,
.texture-modal-content h2 {
  font-size: 24px;
  margin-bottom: 20px;
  color: #2c3e50;
}

.preset-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.preset-category h3 {
  font-size: 14px;
  color: #8b5cf6;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preset-list button {
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: #f0f0f0;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-list button:hover {
  background: #8b5cf6;
  color: #fff;
}

.texture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
}

.texture-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  background: #f0f0f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.texture-item:hover {
  background: #8b5cf6;
  color: #fff;
  transform: scale(1.05);
}

.texture-item img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.texture-item span {
  font-size: 10px;
  text-align: center;
}

.btn-close {
  display: block;
  margin: 20px auto 0;
  padding: 12px 32px;
  background: #e0e0e0;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close:hover {
  background: #ccc;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
  background: #f0f0f0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
}

.btn-sm:hover {
  background: #e0e0e0;
}

/* ===== FULLSCREEN PARTICLE EDITOR LAYOUT ===== */

.particle-editor-fullscreen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0a0a1a;
  overflow: hidden;
}

.particle-editor-fullscreen .preview-canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.particle-editor-fullscreen #particle-preview-canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Floating Toolbar */
.particle-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  z-index: 100;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-left .effect-name-input {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  width: 150px;
}

.toolbar-left .effect-name-input:focus {
  outline: none;
  border-color: #8b5cf6;
}

.toolbar-btn {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.toolbar-btn:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.5);
}

.toolbar-btn.active {
  background: rgba(139, 92, 246, 0.4);
  border-color: #8b5cf6;
}

.toolbar-btn.wizard-btn {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border-color: #8b5cf6;
  font-weight: 500;
}

.toolbar-btn.wizard-btn:hover {
  background: linear-gradient(135deg, #9b6cf6, #7376f1);
  transform: translateY(-1px);
}

.system-selector {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
  min-width: 120px;
  cursor: pointer;
}

.system-selector:hover {
  border-color: rgba(139, 92, 246, 0.5);
}

.system-selector:focus {
  outline: none;
  border-color: #8b5cf6;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 4px;
}

/* Stats Overlay */
.preview-stats-overlay {
  position: absolute;
  top: 70px;
  left: 12px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  color: #8892b0;
  font-size: 12px;
  font-family: monospace;
  z-index: 100;
}

/* Right Controls Panel */
.particle-controls-panel {
  position: absolute;
  top: 70px;
  right: 0;
  bottom: 12px;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: transparent;
  border: none;
  overflow-y: scroll;
  overflow-x: hidden;
  z-index: 100;
  padding: 8px 20px 8px 8px;
}

/* Custom scrollbar for particle controls - thin and overlay style */
.particle-controls-panel::-webkit-scrollbar {
  width: 8px;
}
.particle-controls-panel::-webkit-scrollbar-track {
  background: transparent;
}
.particle-controls-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}
.particle-controls-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.particle-controls-panel .control-group {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 6px;
}

.particle-controls-panel .control-group h3 {
  color: #fff;
  font-size: 13px;
  margin-bottom: 10px;
}

.particle-controls-panel .slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.particle-controls-panel .slider-row label {
  color: #8892b0;
  font-size: 12px;
  min-width: 60px;
}

.particle-controls-panel .slider-row input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.particle-controls-panel .slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #8b5cf6;
  border-radius: 50%;
  cursor: pointer;
}

.particle-controls-panel .slider-value {
  color: #fff;
  font-size: 11px;
  min-width: 50px;
  text-align: right;
  flex-shrink: 0;
}

.particle-controls-panel .color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.particle-controls-panel .color-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.particle-controls-panel .color-pick label {
  color: #8892b0;
  font-size: 10px;
}

.particle-controls-panel .color-pick input[type="color"] {
  width: 40px;
  height: 30px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.particle-controls-panel .color-arrow {
  color: #8892b0;
}

.particle-controls-panel .direction-picker {
  margin-bottom: 8px;
}

.particle-controls-panel .direction-picker label {
  display: block;
  color: #8892b0;
  font-size: 12px;
  margin-bottom: 6px;
}

.particle-controls-panel .direction-btns {
  display: flex;
  gap: 4px;
}

.particle-controls-panel .direction-btns button {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
}

.particle-controls-panel .direction-btns button:hover {
  background: rgba(139, 92, 246, 0.3);
}

.particle-controls-panel .direction-btns button.active {
  background: rgba(139, 92, 246, 0.4);
  border-color: #8b5cf6;
}

.particle-controls-panel .texture-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.particle-controls-panel .current-texture {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  overflow: hidden;
}

.particle-controls-panel .current-texture img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.particle-controls-panel .texture-quick-picks {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.particle-controls-panel .texture-quick-picks img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s;
}

.particle-controls-panel .texture-quick-picks img:hover {
  opacity: 1;
  transform: scale(1.1);
}

.particle-controls-panel .blend-btns {
  display: flex;
  gap: 4px;
}

.particle-controls-panel .blend-btns button {
  flex: 1;
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.particle-controls-panel .blend-btns button:hover {
  background: rgba(139, 92, 246, 0.3);
}

.particle-controls-panel .blend-btns button.active {
  background: rgba(139, 92, 246, 0.4);
  border-color: #8b5cf6;
}

.particle-controls-panel .advanced-section {
  margin-top: 8px;
}

.particle-controls-panel .advanced-section summary {
  color: #8892b0;
  font-size: 12px;
  cursor: pointer;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.particle-controls-panel .empty-state {
  color: #8892b0;
  text-align: center;
  padding: 40px 20px;
}

/* Bottom Layer Bar - Compact Vertical List */
.particle-layer-bar {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: transparent;
  border: none;
  z-index: 100;
  padding: 0;
  min-width: 120px;
}

.layer-list-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.layer-row:hover {
  background: rgba(255, 255, 255, 0.1);
}

.layer-row.active {
  background: rgba(139, 92, 246, 0.3);
  border-left: 2px solid #8b5cf6;
}

.layer-visibility {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #8b5cf6;
}

.layer-color-box {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.layer-row-name {
  color: #ccc;
  font-size: 11px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-row.active .layer-row-name {
  color: #fff;
}

.layer-row-delete {
  color: #666;
  font-size: 12px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.layer-row:hover .layer-row-delete {
  opacity: 1;
}

.layer-row-delete:hover {
  color: #f87171;
}

.layer-add-btn {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: #666;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 2px;
}

.layer-add-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: #8b5cf6;
  color: #fff;
}

/* Wizard Modal */
#wizard-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.wizard-modal {
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  padding: 32px;
  max-width: 900px;
  max-height: 80vh;
  overflow-y: auto;
  width: 100%;
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.wizard-header {
  text-align: center;
  margin-bottom: 24px;
}

.wizard-header h2 {
  font-size: 28px;
  color: #fff;
  margin-bottom: 8px;
}

.wizard-header p {
  color: #8892b0;
  font-size: 14px;
}

.wizard-categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.wizard-category {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
}

.wizard-category h3 {
  color: #fff;
  font-size: 14px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wizard-presets {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wizard-preset-btn {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.wizard-preset-btn:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: #8b5cf6;
  color: #fff;
  transform: translateX(4px);
}

.wizard-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.wizard-footer button {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* ============ LIGHT CONTROLS ============ */
.light-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  max-height: 150px;
  overflow-y: auto;
}

.light-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.light-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.light-item.selected {
  background: rgba(139, 92, 246, 0.2);
  border-color: #8b5cf6;
}

.light-icon {
  font-size: 14px;
}

.light-name {
  flex: 1;
  font-size: 12px;
  color: #ccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.light-toggle {
  display: flex;
  align-items: center;
}

.light-toggle input {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.light-delete {
  background: none;
  border: none;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.light-delete:hover {
  color: #e74c3c;
}

.empty-lights {
  color: #666;
  font-size: 11px;
  font-style: italic;
  padding: 8px;
  text-align: center;
}

.light-properties {
  animation: fadeIn 0.15s ease;
}

.light-properties .form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.light-properties .form-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.light-properties .form-group label {
  font-size: 10px;
  color: #888;
}

.light-properties .form-group input,
.light-properties .form-group select {
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #444;
  border-radius: 3px;
  color: #eee;
  font-size: 11px;
}

.light-properties .form-group input:focus,
.light-properties .form-group select:focus {
  border-color: #8b5cf6;
  outline: none;
}

.light-properties .checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ccc;
}

.light-properties .checkbox-row input {
  width: 14px;
  height: 14px;
}

/* ========================================
   Paperdoll Pixel Editor
   ======================================== */

.paperdoll-editor-layout {
  display: flex;
  height: calc(100% - 120px);
  gap: 16px;
  padding: 16px;
}

.paperdoll-preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.paperdoll-preview-panel .preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--color-border);
  font-weight: 500;
  font-size: 13px;
}

.paperdoll-preview-panel .preview-controls {
  display: flex;
  gap: 4px;
}

.paperdoll-preview-panel .preview-controls button {
  padding: 4px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 12px;
}

.paperdoll-preview-panel .preview-controls button:hover {
  background: var(--color-border);
}

.paperdoll-preview-panel .preview-canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0f16;
  overflow: hidden;
}

.paperdoll-preview-panel #paperdoll-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

.paperdoll-preview-panel .preview-stats {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-text-secondary);
  font-family: 'VCR OSD Mono', monospace;
}

.paperdoll-properties-panel {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 8px;
}

.paperdoll-properties-panel .editor-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
}

.paperdoll-properties-panel .section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tools */
.paperdoll-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.paperdoll-tool {
  padding: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}

.paperdoll-tool:hover {
  background: var(--color-border);
}

.paperdoll-tool.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary);
}

/* Palette */
.paperdoll-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.palette-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s;
}

.palette-btn:hover {
  transform: scale(1.1);
}

.palette-btn.selected {
  outline: 2px solid #ff4d4d;
  outline-offset: 1px;
}

/* Layers */
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.layer-row:hover {
  background: rgba(0, 0, 0, 0.3);
}

.layer-row.active {
  background: rgba(var(--color-primary-rgb), 0.15);
  border-color: var(--color-primary);
}

.layer-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.layer-btn.toggled {
  background: rgba(var(--color-primary-rgb), 0.2);
}

.layer-name {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  font-size: 11px;
}

/* Thumbnails */
.paperdoll-thumbstrip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
}

.paperdoll-thumb {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0a0f16;
  border: 2px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 0.15s;
}

.paperdoll-thumb:hover {
  border-color: var(--color-text-secondary);
}

.paperdoll-thumb.active {
  border-color: var(--color-primary);
}

/* Button variants for paperdoll */
.paperdoll-properties-panel .btn-primary {
  padding: 8px 12px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: opacity 0.15s;
}

.paperdoll-properties-panel .btn-primary:hover {
  opacity: 0.9;
}

.paperdoll-properties-panel .btn-secondary {
  padding: 8px 12px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.paperdoll-properties-panel .btn-secondary:hover {
  background: var(--color-border);
}

.paperdoll-properties-panel .btn-success {
  padding: 8px 12px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.paperdoll-properties-panel .btn-success:hover {
  background: #059669;
}

.paperdoll-properties-panel .btn-sm {
  padding: 4px 8px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}

.paperdoll-properties-panel .btn-sm:hover {
  background: var(--color-border);
}

.paperdoll-properties-panel .btn-secondary.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Segment list */
.segment-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.segment-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
}

.segment-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.segment-row.active {
  background: rgba(100, 108, 255, 0.2);
}

/* Flagged frames list */
.flagged-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Jutsu Scaling / Curve Editor ───────────────────────────── */
.scaling-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin-bottom: 20px;
}

.scaling-grid .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scaling-grid label {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-hint {
  font-size: 11px;
  color: #6366f1;
  font-weight: 600;
  background: rgba(99,102,241,0.12);
  padding: 1px 5px;
  border-radius: 3px;
}

.scaling-grid input[type="range"] {
  width: 100%;
  accent-color: #7c3aed;
  cursor: pointer;
  height: 4px;
}

.range-endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #4b5563;
  margin-top: -2px;
}

.curve-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.curve-block {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 10px 12px 8px;
}

.curve-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.curve-sublabel {
  font-weight: 400;
  color: #6b7280;
  text-transform: none;
  font-size: 10px;
}

.curve-block canvas {
  display: block;
  width: 100%;
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WORLD VIEW — Map section revamp
   ═══════════════════════════════════════════════════════════════════════════ */

/* Section must flex column so tab bar + panes stack */
#section-maps {
  flex-direction: column !important;
  background: #1a1d23;
}

/* ── Tab bar ── */
.wv-tabbar {
  display: flex;
  align-items: center;
  background: #12151a;
  border-bottom: 1px solid #2a2d35;
  padding: 0 16px;
  gap: 0;
  flex-shrink: 0;
  height: 42px;
}

.wv-tabs {
  display: flex;
  gap: 2px;
}

.wv-tab {
  padding: 0 20px;
  height: 42px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #7a8394;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  border-radius: 0;
  letter-spacing: 0.01em;
}

.wv-tab:hover {
  color: #c8d0de;
  background: rgba(255,255,255,0.03);
}

.wv-tab.active {
  color: #74b9ff;
  border-bottom-color: #3498db;
  background: rgba(52,152,219,0.06);
}

.wv-breadcrumb {
  margin-left: auto;
  font-size: 11px;
  color: #4a5568;
  font-family: monospace;
  letter-spacing: 0.03em;
}

/* ── World View sidebar ── */
.wv-sidebar {
  width: 220px;
  background: #12151a;
  border-right: 1px solid #22262f;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.wv-panel {
  border-bottom: 1px solid #22262f;
}

.wv-panel-header {
  padding: 10px 14px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wv-icon-btn {
  background: transparent;
  border: none;
  color: #4a5568;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.wv-icon-btn:hover {
  color: #74b9ff;
  background: rgba(52,152,219,0.1);
}

/* Tile list */
.wv-tile-list {
  overflow-y: auto;
  max-height: 200px;
}

.wv-tile-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 12px;
  color: #8892a4;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.wv-tile-item:hover {
  background: rgba(52,152,219,0.08);
  color: #c8d0de;
}

.wv-tile-item.active {
  background: rgba(52,152,219,0.12);
  border-left-color: #3498db;
  color: #74b9ff;
}

.wv-tile-coord {
  font-family: monospace;
  font-size: 10px;
  color: #4a5568;
  margin-left: auto;
}

/* Layers */
.wv-layers {
  padding: 6px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wv-layer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #6b7a8f;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  opacity: 0.5;
}

.wv-layer-btn.active {
  opacity: 1;
  color: #c8d0de;
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.07);
}

.wv-layer-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.06);
}

.wv-layer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.wv-layer-count {
  margin-left: auto;
  font-size: 10px;
  font-family: monospace;
  color: #4a5568;
  background: rgba(255,255,255,0.05);
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* Controls hint */
.wv-hint {
  margin-top: auto;
  padding: 10px 14px 14px;
  font-size: 10px;
  color: #3a4252;
  line-height: 1.8;
}

.wv-hint kbd {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 9px;
  font-family: monospace;
  color: #5a6578;
}

/* Canvas toolbar */
.wv-canvas-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
}

.wv-tb-btn {
  background: rgba(18,21,26,0.85);
  border: 1px solid rgba(255,255,255,0.12);
  color: #8892a4;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.15s;
}

.wv-tb-btn:hover {
  background: rgba(52,152,219,0.15);
  border-color: rgba(52,152,219,0.4);
  color: #74b9ff;
}

/* ── Editor layers inside tile editor sidebar ── */
.wv-editor-layers {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
}

.wv-editor-layer {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  padding: 3px 0;
}

.wv-editor-layer input[type=checkbox] {
  accent-color: #3498db;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* ── Create Tile Dialog ── */
.wv-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9990;
  backdrop-filter: blur(2px);
}

.wv-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9991;
  background: #1e2330;
  border: 1px solid #3a4252;
  border-radius: 12px;
  width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  overflow: hidden;
}

.wv-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #12151a;
  border-bottom: 1px solid #2a2d35;
  font-size: 14px;
  font-weight: 600;
  color: #c8d0de;
}

.wv-dialog-close {
  background: transparent;
  border: none;
  color: #4a5568;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.wv-dialog-close:hover { color: #e74c3c; background: rgba(231,76,60,0.1); }

.wv-dialog-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wv-form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wv-form-row label {
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wv-input {
  background: #12151a;
  border: 1px solid #2a2d35;
  border-radius: 6px;
  color: #c8d0de;
  padding: 7px 10px;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.wv-input:focus { border-color: #3498db; }
.wv-input[readonly] { color: #5a6578; }

.wv-info-box {
  background: rgba(52,152,219,0.07);
  border: 1px solid rgba(52,152,219,0.2);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  color: #5a7a9a;
  line-height: 1.5;
}

.wv-info-box code {
  font-family: monospace;
  color: #74b9ff;
  font-size: 11px;
}

.wv-dialog-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  background: #12151a;
  border-top: 1px solid #2a2d35;
}

.wv-btn {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.wv-btn-primary { background: #3498db; color: white; border-color: #3498db; }
.wv-btn-primary:hover { background: #2980b9; }

.wv-btn-ghost { background: transparent; border-color: #2a2d35; color: #6b7a8f; }
.wv-btn-ghost:hover { background: rgba(255,255,255,0.05); color: #c8d0de; }

/* ── Mode toggle (3D / 2D) ── */
.wv-mode-panel {
  padding: 10px 10px 12px;
}

.wv-mode-btns {
  display: flex;
  gap: 4px;
  background: #0c0f14;
  border-radius: 8px;
  padding: 3px;
  border: 1px solid #1e2330;
}

.wv-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: 1px solid transparent;
  color: #4a5568;
  background: transparent;
  transition: all 0.18s;
}

.wv-mode-btn svg { opacity: 0.5; transition: opacity 0.18s; }

.wv-mode-btn.active {
  background: linear-gradient(135deg, #1e3a5f, #1a2c4a);
  color: #74b9ff;
  border-color: rgba(52,152,219,0.35);
  box-shadow: 0 2px 8px rgba(52,152,219,0.15);
}

.wv-mode-btn.active svg { opacity: 1; }

.wv-mode-btn:hover:not(.active) {
  background: rgba(255,255,255,0.04);
  color: #8892a4;
}

/* ── Tile info panel ── */
.wv-tile-info-panel {
  border-bottom: 1px solid #22262f;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(52,152,219,0.05), transparent);
}

.wv-info-title {
  font-size: 13px;
  font-weight: 700;
  color: #74b9ff;
  margin-bottom: 3px;
}

.wv-info-sub {
  font-size: 10px;
  color: #3a4a5e;
  font-family: monospace;
  margin-bottom: 8px;
}

.wv-info-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.wv-stat {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--c, #8892a4);
}

.wv-info-btn {
  width: 100%;
  padding: 7px;
  background: linear-gradient(135deg, #1a4a7a, #1e3a5f);
  border: 1px solid rgba(52,152,219,0.3);
  border-radius: 6px;
  color: #74b9ff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.wv-info-btn:hover {
  background: linear-gradient(135deg, #1e5a90, #234870);
  border-color: rgba(52,152,219,0.6);
  box-shadow: 0 2px 12px rgba(52,152,219,0.2);
}

/* ── Loading spinner ── */
.wv-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(52,152,219,0.2);
  border-top-color: #3498db;
  border-radius: 50%;
  animation: wvSpin 0.8s linear infinite;
}

@keyframes wvSpin {
  to { transform: rotate(360deg); }
}

/* ── Canvas toolbar improvements ── */
.wv-tb-group {
  display: flex;
  gap: 4px;
}

/* ── Toast notifications ── */
.wv-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: white;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.wv-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.wv-toast-success { background: #27ae60; box-shadow: 0 4px 16px rgba(39,174,96,0.4); }
.wv-toast-error   { background: #e74c3c; box-shadow: 0 4px 16px rgba(231,76,60,0.4); }
.wv-toast-info    { background: #3498db; box-shadow: 0 4px 16px rgba(52,152,219,0.4); }

/* ═══════════════════════════════════════════════════════════════════════════
   TILE EDITOR OVERLAY — AAA-grade floating UI panels
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Top Bar ── */
.ed-topbar {
  position: absolute;
  pointer-events: auto;
  top: 0; left: 0; right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(8,12,20,0.92) 0%, rgba(8,12,20,0.75) 100%);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 24px rgba(0,0,0,0.5);
  z-index: 20;
  user-select: none;
}

.ed-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.ed-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
}

/* ── Map Select ── */
.ed-map-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ed-select-icon {
  position: absolute;
  left: 9px;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

.ed-map-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 28px 6px 28px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-width: 160px;
  outline: none;
}

.ed-map-select:hover {
  border-color: rgba(52,152,219,0.4);
  background: rgba(255,255,255,0.08);
}

.ed-map-select:focus {
  border-color: rgba(52,152,219,0.7);
  box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}

.ed-map-select option {
  background: #1a2230;
  color: rgba(255,255,255,0.85);
}

/* ── Status Pill ── */
.ed-status-pill {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(52,152,219,0.12);
  border: 1px solid rgba(52,152,219,0.25);
  color: rgba(52,152,219,0.9);
  letter-spacing: 0.03em;
  white-space: nowrap;
  font-weight: 500;
}

/* ── Tool Palette ── */
.ed-tools {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 10px;
  padding: 5px;
  flex: 0 0 auto;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.ed-tool-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.82);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.ed-tool-btn {
  font-size: 16px;
  line-height: 1;
}

.ed-tool-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  pointer-events: none;
}

.ed-tool-btn:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
}

.ed-tool-btn.active {
  color: #3498db;
  background: rgba(52,152,219,0.15);
  border-color: rgba(52,152,219,0.4);
  box-shadow: 0 0 10px rgba(52,152,219,0.2);
}

.ed-tool-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.1);
  margin: 0 3px;
}

/* ── Header Buttons (Settings / Save) ── */
.ed-hdr-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.ed-hdr-btn:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.95);
  border-color: rgba(255,255,255,0.2);
}

.ed-hdr-save {
  background: rgba(39,174,96,0.15);
  border-color: rgba(39,174,96,0.35);
  color: rgba(39,174,96,0.9);
  font-weight: 600;
}

.ed-hdr-save:hover {
  background: rgba(39,174,96,0.25);
  border-color: rgba(39,174,96,0.6);
  color: #2ecc71;
  box-shadow: 0 0 12px rgba(39,174,96,0.25);
}

/* ── Floating Glass Panel ── */
.ed-float-panel {
  position: absolute;
  pointer-events: auto;
  min-width: 220px;
  max-width: 640px; /* grows to fit multi-column layer lists */
  background: rgba(10,15,26,0.82);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.6),
    0 1px 0 rgba(255,255,255,0.04) inset;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
}

.ed-float-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 9px 14px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
}

.ed-float-header:active { cursor: grabbing; }

.ed-float-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}

.ed-float-title svg { opacity: 0.5; }

.ed-float-collapse {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.ed-float-collapse:hover {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.08);
}

.ed-float-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.ed-float-body::-webkit-scrollbar { width: 4px; }
.ed-float-body::-webkit-scrollbar-track { background: transparent; }
.ed-float-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* ── Layer Category ── */
.ed-layer-cat {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ed-layer-cat:last-child { border-bottom: none; }

.ed-layer-cat-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.ed-layer-cat-header:hover {
  background: rgba(255,255,255,0.04);
}

.ed-layer-eye {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.2);
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
  padding: 2px;
}

.ed-layer-eye:hover { color: rgba(255,255,255,0.6); }

.ed-layer-eye.active {
  color: rgba(255,255,255,0.7);
}

.ed-layer-eye.hidden-layer {
  color: rgba(255,255,255,0.15);
  opacity: 0.5;
}

.ed-layer-dot-sm {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.85;
}

.ed-layer-cat-name {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ed-layer-badge {
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ed-layer-badge.has-items {
  background: rgba(52,152,219,0.2);
  color: rgba(52,152,219,0.9);
}

.ed-layer-chevron {
  font-size: 14px;
  color: rgba(255,255,255,0.3);
  transition: transform 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.ed-layer-cat.open .ed-layer-chevron {
  transform: rotate(90deg);
}

.ed-layer-items {
  display: none;
  padding: 0 0 4px 0;
  background: rgba(0,0,0,0.2);
  overflow-x: auto;
}

.ed-layer-cat.open .ed-layer-items {
  display: block;
}

/* Multi-column layout — new column every 10 items */
.ed-layer-cols {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.ed-layer-col {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  border-right: 1px solid rgba(255,255,255,0.05);
  min-width: 140px;
}

.ed-layer-col:last-child { border-right: none; }

.ed-layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-radius: 0;
}

.ed-layer-item:hover {
  background: rgba(52,152,219,0.1);
  color: rgba(255,255,255,0.9);
}

.ed-layer-item .ed-layer-item-icon {
  font-size: 10px;
  opacity: 0.6;
  flex-shrink: 0;
}

.ed-layer-item .ed-layer-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-layer-item .ed-layer-item-del {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: rgba(231,76,60,0.4);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.ed-layer-item:hover .ed-layer-item-del {
  opacity: 1;
}

.ed-layer-item .ed-layer-item-del:hover {
  color: #e74c3c;
  background: rgba(231,76,60,0.12);
}

/* ── Form Fields inside panels ── */
.ed-float-body .ed-field {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ed-float-body .ed-field:last-child { border-bottom: none; }

.ed-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.ed-label-row {
  display: flex;
  align-items: center;
  gap: 7px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
}

.ed-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
}

.ed-select:focus { border-color: rgba(52,152,219,0.6); }

.ed-select option { background: #1a2230; }

.ed-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.ed-input:focus { border-color: rgba(52,152,219,0.6); }

.ed-btn-ghost {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.ed-btn-ghost:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.2);
}

.ed-checkbox {
  accent-color: #3498db;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ── Context Panel grid for tool settings ── */
.ed-ctx-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px;
}

.ed-ctx-grid .full-col { grid-column: 1 / -1; }

.ed-ctx-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-bottom: 3px;
}

.ed-ctx-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ── Coordinate Readout ── */
.ed-coord-readout {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 5px 11px;
  border-radius: 7px;
  background: rgba(8,12,20,0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 11px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.ed-coord-readout span { color: rgba(52,152,219,0.8); }

/* Collapsed panel body */
.ed-float-body.collapsed { display: none; }

/* ── Selection Inspector (Blender-style, top-left) ── */
.ed-inspector {
  position: absolute;
  top: 64px;
  left: 12px;
  min-width: 200px;
  max-width: 260px;
  background: rgba(8,12,20,0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 13px 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  font-size: 11px;
  line-height: 1.5;
  animation: edInspectorIn 0.15s ease;
}

@keyframes edInspectorIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ed-insp-name {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ed-insp-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.ed-insp-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin: 7px 0;
}

.ed-insp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 1px 0;
}

.ed-insp-key {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.ed-insp-val {
  color: rgba(255,255,255,0.78);
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.ed-insp-val.highlight { color: #3498db; }

/* Type badge colours */
.ed-insp-badge-spawn     { background: rgba(46,204,113,0.18);  color: #2ecc71; border: 1px solid rgba(46,204,113,0.3); }
.ed-insp-badge-npc       { background: rgba(231,76,60,0.18);   color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.ed-insp-badge-portal    { background: rgba(155,89,182,0.18);  color: #9b59b6; border: 1px solid rgba(155,89,182,0.3); }
.ed-insp-badge-death     { background: rgba(230,126,34,0.18);  color: #e67e22; border: 1px solid rgba(230,126,34,0.3); }
.ed-insp-badge-prop      { background: rgba(39,174,96,0.18);   color: #27ae60; border: 1px solid rgba(39,174,96,0.3); }
.ed-insp-badge-fish      { background: rgba(52,152,219,0.18);  color: #3498db; border: 1px solid rgba(52,152,219,0.3); }
.ed-insp-badge-mesh      { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,0.12); }

/* ── Game Settings section ── */
#section-game-settings select.ed-input,
#section-game-settings textarea.ed-input,
#section-game-settings input.ed-input {
  background: #2a2a2a;
  color: #ddd;
  border-color: #555;
}
#section-game-settings select.ed-input option {
  background: #2a2a2a;
  color: #ddd;
}
