:root {
  --bg-0: #0b0e14;
  --bg-1: #121722;
  --bg-2: #1a2130;
  --bg-3: #242e42;
  --border: #2a3449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #f59e0b;
  --cyan: #38bdf8;
  --danger: #f04438;
  --font-ui: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; overflow: hidden; background: var(--bg-0); color: var(--text);
  font-family: var(--font-ui); font-size: 13px;
}
body { display: flex; flex-direction: column; height: 100vh; width: 100vw; }
.editor-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; height: 100%; }

/* HOME VIEW (FIRST PAGE: SAVED PROJECTS / FILES HUB) */
.home-view {
  flex: 1; overflow-y: auto; padding: 28px 24px 48px;
  background: radial-gradient(circle at 18% 12%, rgba(245, 158, 11, 0.1), transparent 42%),
              radial-gradient(circle at 82% 88%, rgba(56, 189, 248, 0.08), transparent 45%),
              var(--bg-0);
}
.home-inner { max-width: 1180px; margin: 0 auto; }
.home-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
.home-brand { display: flex; align-items: center; gap: 14px; }
.brand-badge-lg { width: 46px; height: 46px; font-size: 20px; border-radius: 10px; }
.home-brand h1 { font-size: 22px; font-weight: 900; letter-spacing: -0.02em; }
.home-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.home-actions-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 18px;
}
.home-create-group { display: flex; flex-wrap: wrap; gap: 8px; }
.home-search { max-width: 260px; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}
.project-card {
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 11px;
  padding: 15px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.14s, transform 0.14s, box-shadow 0.14s;
  cursor: pointer;
}
.project-card:hover {
  border-color: var(--accent); transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
}
.project-card-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 8px; }
.project-card-title { font-size: 15px; font-weight: 800; color: var(--text); line-height: 1.25; min-width: 0; }
.project-card-file {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--cyan);
  background: rgba(56, 189, 248, 0.12); padding: 2px 7px; border-radius: 4px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-card-sub { font-size: 12px; color: var(--muted); line-height: 1.35; min-height: 32px; }
.project-card-stats {
  display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--muted);
}
.project-card-stats span {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px;
}
.project-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding-top: 8px; border-top: 1px solid rgba(42, 52, 73, 0.65);
}
.project-card-actions { display: flex; gap: 5px; }

.active-file-badge {
  cursor: pointer; padding: 2px 6px; border-radius: 6px; border: 1px solid transparent;
}
.active-file-badge:hover { background: var(--bg-2); border-color: var(--border); }

/* CONTEXT MENU (RIGHT CLICK) */
.ctx-menu {
  position: fixed; z-index: 300; min-width: 215px;
  background: #141a27; border: 1px solid #3c4b68; border-radius: 8px;
  padding: 5px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  display: flex; flex-direction: column; gap: 2px;
}
.ctx-header {
  font-family: var(--font-mono); font-size: 10px; font-weight: 800; color: var(--accent);
  padding: 4px 8px 5px; border-bottom: 1px solid var(--border); margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px;
}
.ctx-item {
  background: transparent; color: var(--text); border: none; border-radius: 5px;
  padding: 6px 9px; text-align: left; font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.ctx-item:hover { background: var(--bg-3); color: #fff; }
.ctx-item.danger { color: #fca5a5; }
.ctx-item.danger:hover { background: rgba(240, 68, 56, 0.2); color: #fff; }
.ctx-sep { height: 1px; background: var(--border); margin: 3px 4px; }

/* ADAPTIVE 2-ROW TOP BAR */
.topbar {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.topbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  gap: 6px 10px;
}
.topbar-row-main { border-bottom: 1px solid rgba(42, 52, 73, 0.7); }
.topbar-row-tools { background: #0e131d; padding: 4px 10px; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand-badge {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a; font-family: var(--font-mono); font-weight: 900; font-size: 13px;
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-title { font-weight: 800; font-size: 13px; letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { font-size: 10.5px; color: var(--muted); }

.room-switcher { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.room-switcher select {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 7px; font-size: 12px; font-weight: 600; max-width: 210px;
}

.toolbar-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 3px;
  background: var(--bg-0); padding: 2px; border-radius: 7px; border: 1px solid var(--border);
}
.tool-btn {
  background: transparent; color: var(--muted); border: none; border-radius: 5px;
  padding: 3px 7px; cursor: pointer; display: flex; align-items: center; gap: 4px;
  font-family: var(--font-ui); font-size: 11px; font-weight: 600; transition: 0.12s;
}
.tool-btn:hover { background: var(--bg-2); color: var(--text); }
.tool-btn.active { background: var(--accent); color: #0f172a; }
.tool-btn span { font-size: 13px; line-height: 1; }

.toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.zoom-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted); min-width: 36px; text-align: center; }
.sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }

/* BUTTONS */
.btn {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: 0.12s; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.btn:hover { background: var(--bg-3); border-color: #425270; }
.btn-sm { padding: 4px 8px; font-size: 11.5px; }
.btn-icon { width: 28px; height: 28px; padding: 0; font-size: 14px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--accent); color: #0f172a; border-color: #fbbf24; font-weight: 800; }
.btn-primary:hover { background: #fbbf24; }
.btn-accent-outline { border-color: rgba(56, 189, 248, 0.5); color: var(--cyan); }
.btn-danger-outline { border-color: rgba(240, 68, 56, 0.45); color: #fca5a5; }
.btn-danger-outline:hover { background: rgba(240, 68, 56, 0.18); }
.btn-save { background: #14532d; color: #bbf7d0; border-color: #22c55e; font-weight: 700; padding: 5px 9px; font-size: 11.5px; }
.btn-save:hover { background: #166534; }
.save-pill {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; padding: 3px 8px;
  border-radius: 99px; border: 1px solid var(--border); white-space: nowrap;
}
.save-pill.saved { background: rgba(34, 197, 94, 0.14); color: #86efac; border-color: rgba(34, 197, 94, 0.4); }
.save-pill.dirty { background: rgba(245, 158, 11, 0.18); color: #fde047; border-color: rgba(245, 158, 11, 0.5); }
.file-label { cursor: pointer; }

/* ADAPTIVE MAIN LAYOUT */
.studio-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(215px, 18vw, 268px) minmax(0, 1fr) clamp(215px, 18vw, 268px);
}
.studio-body.hide-left { grid-template-columns: 0px minmax(0, 1fr) clamp(215px, 18vw, 268px); }
.studio-body.hide-right { grid-template-columns: clamp(215px, 18vw, 268px) minmax(0, 1fr) 0px; }
.studio-body.hide-left.hide-right { grid-template-columns: 0px minmax(0, 1fr) 0px; }
.studio-body.hide-left .sidebar-left,
.studio-body.hide-right .sidebar-right { overflow: hidden; border: none; padding: 0; }

.export-toggle-box {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; margin: 6px 0 8px; border-radius: 6px;
  background: var(--bg-0); border: 1px solid var(--border); font-size: 11.5px; font-weight: 700;
}
.export-toggle-box.excluded { border-color: rgba(245, 158, 11, 0.55); color: #fde68a; }
.export-toggle-box.included { border-color: rgba(34, 197, 94, 0.45); color: #bbf7d0; }

@media (max-width: 1200px) {
  .brand-sub { display: none; }
  .canvas-topbar { height: auto; flex-wrap: wrap; padding: 4px 8px; }
  .live-footer { height: 128px; }
}

/* LEFT SIDEBAR */
.sidebar-left, .sidebar-right {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-right { border-right: none; border-left: 1px solid var(--border); overflow-y: auto; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--border); background: var(--bg-0); }
.tab {
  background: transparent; color: var(--muted); border: none; border-bottom: 2px solid transparent;
  padding: 9px 4px; cursor: pointer; font-weight: 700; font-size: 12px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--bg-1); }

.tab-panel { display: none; padding: 10px; overflow-y: auto; flex: 1; }
.tab-panel.active { display: block; }

.section-label {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between;
}
.hint-pill {
  font-size: 9.5px; padding: 1px 6px; border-radius: 99px;
  background: rgba(56, 189, 248, 0.16); color: var(--cyan); text-transform: none; letter-spacing: 0;
}

/* SEMANTIC COLORS */
.semantic-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.sem-chip {
  display: flex; align-items: center; gap: 6px; padding: 5px 7px; border-radius: 6px;
  background: var(--bg-2); border: 1px solid var(--border); cursor: pointer; font-size: 11.5px; font-weight: 600;
  color: var(--text); text-align: left; transition: 0.1s;
}
.sem-chip:hover { border-color: #546585; }
.sem-chip.active { border-color: #ffffff; box-shadow: 0 0 0 1px var(--accent); background: var(--bg-3); }
.sem-dot { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; border: 2px solid; }

.custom-color-box {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 7px; padding: 8px;
  display: flex; flex-direction: column; gap: 7px;
}
.swatch-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.free-swatch {
  height: 20px; border-radius: 4px; border: 2px solid; cursor: pointer; transition: transform 0.1s;
}
.free-swatch:hover { transform: scale(1.08); }
.color-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 11px; color: var(--muted); }
.color-inputs label { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.color-inputs input[type="color"] { width: 32px; height: 22px; border: none; background: transparent; cursor: pointer; }

/* DRAGGABLE GODOT STAMPS */
.stamp-group-title {
  font-size: 10px; font-weight: 800; color: var(--cyan); text-transform: uppercase;
  letter-spacing: 0.05em; margin: 9px 0 4px; grid-column: 1 / -1;
}
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 5px; }
.stamp-card {
  position: relative;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 4px; cursor: grab; display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: 0.12s; user-select: none;
}
.stamp-tut-badge {
  position: absolute; top: 2px; right: 2px; font-family: var(--font-mono);
  font-size: 7.5px; font-weight: 800; padding: 1px 3px; border-radius: 3px;
  background: rgba(245, 158, 11, 0.22); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.45);
}
.stamp-card:hover { border-color: var(--cyan); background: var(--bg-3); transform: translateY(-1px); }
.stamp-card:active { cursor: grabbing; }
.stamp-preview {
  width: 54px; height: 34px; display: flex; align-items: center; justify-content: center;
}
.stamp-canvas { width: 54px; height: 34px; display: block; }
.stamp-name { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.15; }

/* ENEMY PILLS PALETTE */
.pill-palette { display: flex; flex-direction: column; gap: 5px; }
.enemy-card {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 7px;
  cursor: grab; user-select: none; transition: 0.1s;
}
.enemy-card:hover { border-color: var(--accent); background: var(--bg-3); }
.enemy-pill-badge {
  padding: 2px 8px; border-radius: 99px; font-family: var(--font-mono); font-weight: 800; font-size: 11px;
  border: 1.8px solid; color: #fff; flex-shrink: 0; min-width: 40px; text-align: center;
}
.enemy-card-info { overflow: hidden; }
.enemy-card-name { font-weight: 700; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enemy-card-tier { font-size: 10px; color: var(--muted); }

.marker-palette { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.marker-card {
  display: flex; align-items: center; gap: 6px; padding: 5px 7px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
  cursor: grab; font-size: 11px; font-weight: 600; user-select: none;
}
.marker-card:hover { border-color: var(--cyan); background: var(--bg-3); }
.marker-dot {
  width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 9px; font-weight: 800; border: 1.5px solid; flex-shrink: 0;
}

/* ROOM LIST */
.room-list { display: flex; flex-direction: column; gap: 4px; }
.room-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 8px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--border);
  cursor: pointer; text-align: left; color: var(--text);
}
.room-item:hover { border-color: #4f6387; }
.room-item.active { border-color: var(--accent); background: rgba(245, 158, 11, 0.14); }
.room-item-id { font-family: var(--font-mono); font-weight: 800; color: var(--accent); font-size: 11.5px; min-width: 30px; }
.room-item-name { flex: 1; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-item-count { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

/* WORKSPACE */
.workspace { display: flex; flex-direction: column; overflow: hidden; background: var(--bg-0); min-width: 0; }
.canvas-topbar {
  min-height: 36px; flex-shrink: 0; background: var(--bg-1); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 5px 10px; gap: 5px 10px; position: relative; z-index: 2;
}
.room-meta-strip { display: flex; align-items: center; gap: 8px; overflow: hidden; min-width: 0; }
.room-id-chip {
  background: var(--accent); color: #0f172a; font-family: var(--font-mono); font-weight: 900;
  font-size: 11.5px; padding: 2px 7px; border-radius: 4px; flex-shrink: 0;
}
.mono-muted { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.canvas-toggles { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px; }
.chk-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.coords-chip {
  font-family: var(--font-mono); font-size: 11px; color: var(--cyan);
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 4px; padding: 2px 7px; min-width: 74px; text-align: center;
}

.canvas-host { flex: 1; position: relative; overflow: hidden; background: #0f1219; }
#blueprintCanvas { width: 100%; height: 100%; display: block; }
.drop-overlay {
  position: absolute; inset: 10px; border: 2px dashed var(--cyan); border-radius: 10px;
  background: rgba(56, 189, 248, 0.08); color: var(--cyan); font-weight: 800; font-size: 14px;
  display: grid; place-items: center; pointer-events: none;
}

/* LIVE FOOTER */
.live-footer {
  height: 152px;
  background: var(--bg-1);
  border-top: 2px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 12px;
  padding: 8px 12px;
  overflow: hidden;
}
.footer-col { display: flex; flex-direction: column; gap: 5px; overflow: hidden; }
.footer-heading {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 800; color: var(--accent);
}
#txtFooterPurpose {
  flex: 1; resize: none; background: var(--bg-0); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
  font-family: var(--font-ui); font-size: 12px; line-height: 1.35;
}
.live-enemy-legend {
  flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px; align-content: start;
}
.legend-entry {
  display: flex; align-items: flex-start; gap: 6px; padding: 4px 6px;
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 6px;
}
.legend-text { overflow: hidden; }
.legend-title { font-size: 11.5px; font-weight: 700; }
.legend-desc { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* INSPECTOR */
.inspector-header {
  padding: 10px 12px; font-weight: 800; font-size: 12.5px; border-bottom: 1px solid var(--border);
  background: var(--bg-0); letter-spacing: 0.02em;
}
.inspector-body { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.inspector-section { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.empty-hint { color: var(--muted); font-size: 11.5px; line-height: 1.45; }

.field-lbl { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.input-sm {
  width: 100%; background: var(--bg-0); color: var(--text); border: 1px solid var(--border);
  border-radius: 5px; padding: 5px 7px; font-family: var(--font-ui); font-size: 12px;
}
.input-sm:focus, #txtFooterPurpose:focus { outline: none; border-color: var(--cyan); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; padding-right: 6px; }

.shortcut-list { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
kbd {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-family: var(--font-mono); font-size: 10px; color: var(--text);
}

/* MODALS */
.modal {
  position: fixed; inset: 0; background: rgba(5, 8, 14, 0.78);
  display: grid; place-items: center; z-index: 100; backdrop-filter: blur(3px);
}
.modal-card {
  width: 460px; max-width: 94vw; background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,0.6); overflow: hidden;
}
.modal-wide { width: 1060px; }
.modal-map-editor { width: 1320px; max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column; }
.map-editor-body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(270px, 26vw, 340px); min-height: 0; flex: 1; overflow: hidden; }
.map-canvas-pane { display: flex; flex-direction: column; padding: 10px; background: var(--bg-0); min-width: 0; }
.map-hint-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 11px; color: var(--muted); margin-bottom: 6px;
}
#overviewCanvas { width: 100%; height: auto; border-radius: 8px; cursor: grab; display: block; }
#overviewCanvas.dragging { cursor: grabbing; }
.map-side-pane {
  background: var(--bg-1); border-left: 1px solid var(--border);
  overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.map-exit-card {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 7px;
  padding: 8px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 7px;
}
.map-exit-card.locked { border-left: 3px solid #ef4444; }
.map-exit-card.open { border-left: 3px solid #22c55e; }
.map-exit-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.map-exit-badge {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 800; padding: 2px 6px;
  border-radius: 4px; color: #fff;
}
.map-nudge-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 4px; }
.prefab-path {
  font-family: var(--font-mono); font-size: 9.5px; color: #7dd3fc; word-break: break-all;
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; margin-bottom: 7px;
}
.modal-stages { width: 640px; }
.storage-banner {
  padding: 8px 10px; border-radius: 7px; font-size: 12px; font-weight: 600;
  margin-bottom: 10px; border: 1px solid var(--border); background: var(--bg-0);
}
.storage-banner.disk { border-color: rgba(34, 197, 94, 0.45); color: #86efac; background: rgba(20, 83, 45, 0.25); }
.storage-banner.local { border-color: rgba(245, 158, 11, 0.45); color: #fde68a; background: rgba(120, 53, 15, 0.22); }
.disk-file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.stage-create-box {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 8px; padding: 10px;
}
.stage-create-row { display: flex; gap: 8px; }
.stage-create-row .input-sm { flex: 1; }
.stages-list {
  display: flex; flex-direction: column; gap: 7px; max-height: 290px; overflow-y: auto;
}
.stage-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px;
}
.stage-meta { overflow: hidden; }
.stage-title { font-weight: 800; font-size: 12.5px; color: var(--text); }
.stage-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.stage-note { font-size: 11px; color: #cbd5e1; margin-top: 3px; }
.stage-actions { display: flex; gap: 4px; flex-shrink: 0; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-0);
}
.modal-header h3 { font-size: 14px; font-weight: 800; }
.btn-close { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.btn-close:hover { color: #fff; }
.modal-body { padding: 16px; }
.modal-footer {
  padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px;
}

.progress-wrap { margin-top: 14px; }
.progress-bar { width: 100%; height: 10px; background: var(--bg-0); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #f59e0b, #38bdf8); transition: width 0.12s; }

.toast {
  position: fixed; bottom: 18px; right: 20px; z-index: 200;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--accent);
  padding: 9px 14px; border-radius: 8px; font-weight: 700; font-size: 12.5px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
/* PLAYTEST, LAYERS, MODULES, AUDITOR & DEEP-ZOOM MAP */
.btn-play {
  background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.55); font-weight: 800;
}
.btn-play:hover { background: rgba(16, 185, 129, 0.28); color: #ecfdf5; }
.btn-play.active { background: #dc2626; color: #fff; border-color: #ef4444; }

.playtest-hud {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 15;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: rgba(11, 14, 20, 0.92); border: 1.5px solid #38bdf8; border-radius: 8px;
  padding: 6px 12px; font-size: 11.5px; color: var(--text);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55); max-width: 96%;
}

.layers-panel { display: flex; flex-direction: column; gap: 4px; }
.layer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 5px 7px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 600;
}
.layer-row.locked { border-color: rgba(245, 158, 11, 0.45); }
.layer-row.hidden-layer { opacity: 0.5; }
.layer-btns { display: flex; gap: 4px; }
.layer-btn {
  background: var(--bg-0); border: 1px solid var(--border); color: var(--muted);
  border-radius: 4px; width: 24px; height: 22px; cursor: pointer; font-size: 11px;
  display: grid; place-items: center;
}
.layer-btn.on { color: var(--cyan); border-color: var(--cyan); }
.layer-btn.lock-on { color: #fbbf24; border-color: #f59e0b; background: rgba(245, 158, 11, 0.14); }

.modules-list { display: flex; flex-direction: column; gap: 5px; }
.module-card {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 8px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--border);
  cursor: grab; font-size: 11.5px; user-select: none;
}
.module-card:hover { border-color: var(--cyan); background: var(--bg-3); }
.module-meta { overflow: hidden; }
.module-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-sub { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); }

.audit-list { display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow-y: auto; }
.audit-item {
  display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 6px;
  background: var(--bg-0); border: 1px solid var(--border); border-left: 3px solid var(--cyan);
  cursor: pointer; text-align: left; color: var(--text); font-size: 11px;
}
.audit-item.error { border-left-color: #ef4444; }
.audit-item.warn { border-left-color: #f59e0b; }
.audit-item:hover { background: var(--bg-2); }
.audit-title { font-weight: 700; font-size: 11.5px; }
.audit-detail { font-size: 10px; color: var(--muted); line-height: 1.3; }

.map-hint-bar {
  display: flex; flex-direction: column; gap: 5px; padding: 7px 10px;
  background: var(--bg-1); border-bottom: 1px solid var(--border);
}
.map-zoom-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.map-hint-sub { font-size: 11px; color: var(--muted); }
.map-canvas-wrap {
  flex: 1; position: relative; overflow: hidden; min-height: 460px; background: #0f1219;
}
#overviewCanvas { width: 100%; height: 100%; display: block; cursor: grab; }
#overviewCanvas:active { cursor: grabbing; }

.hidden { display: none !important; }
