/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #13131f;
  color: #c0c0dd;
  font-family: monospace;
  font-size: 13px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── App shell ────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
#toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  height: 44px;
  background: #0e0e1a;
  border-bottom: 1px solid #2a2a40;
  flex-shrink: 0;
}

.logo {
  font-weight: bold;
  color: #e8d060;
  font-size: 14px;
  margin-right: 6px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

#toolbar button, #play-link {
  background: #1e1e30;
  border: 1px solid #3a3a58;
  color: #b0b0cc;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

#toolbar button:hover, #play-link:hover {
  background: #2a2a44;
  border-color: #6655aa;
  color: #e0e0ff;
}

#btn-test {
  background: #1a2e1a;
  border-color: #336633;
  color: #66bb66;
}

#btn-test:hover {
  background: #223322;
  border-color: #55aa55;
  color: #88dd88;
}

/* ── Test mode overlay ────────────────────────────────────────────────────── */
#test-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  flex-direction: column;
  background: #0e0e1a;
}

#test-overlay.active {
  display: flex;
}

#test-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  height: 40px;
  background: #0a180a;
  border-bottom: 1px solid #2a4a2a;
  flex-shrink: 0;
}

#test-label {
  color: #66bb66;
  font-weight: bold;
  font-size: 13px;
}

#test-hint {
  color: #446644;
  font-size: 11px;
}

#btn-exit-test {
  margin-left: auto;
  background: #1a2e1a;
  border: 1px solid #336633;
  color: #66bb66;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

#btn-exit-test:hover {
  background: #223322;
  border-color: #55aa55;
  color: #88dd88;
}

#test-frame {
  flex: 1;
  border: none;
  width: 100%;
}

.separator {
  width: 1px;
  height: 24px;
  background: #2a2a40;
  margin: 0 4px;
}

/* ── Main layout ──────────────────────────────────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Palette panel ────────────────────────────────────────────────────────── */
#palette-panel {
  width: 140px;
  flex-shrink: 0;
  background: #0e0e1a;
  border-right: 1px solid #2a2a40;
  overflow-y: auto;
  padding: 10px 0;
}

.palette-group {
  margin-bottom: 10px;
}

.palette-group-label {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555577;
  padding: 0 10px 5px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}

.palette-item:hover {
  background: #1a1a2e;
}

.palette-item.selected {
  background: #1e1e34;
  border-left-color: #7766cc;
}

.palette-item canvas {
  display: block;
  flex-shrink: 0;
  border-radius: 2px;
}

.palette-item span {
  font-size: 12px;
  color: #9090bb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-item.selected span {
  color: #d0d0ff;
}

/* ── Canvas area ──────────────────────────────────────────────────────────── */
#canvas-wrap {
  flex: 1;
  overflow: auto;
  background: #1a1a2e;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 16px;
}

#editorCanvas {
  display: block;
  cursor: crosshair;
  image-rendering: pixelated;
  /* drop shadow to visually separate the canvas from the bg */
  box-shadow: 0 0 0 1px #2a2a44, 0 4px 24px rgba(0,0,0,0.6);
}

/* ── Properties panel ─────────────────────────────────────────────────────── */
#props-panel {
  width: 180px;
  flex-shrink: 0;
  background: #0e0e1a;
  border-left: 1px solid #2a2a40;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#props-panel h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7777aa;
  margin-bottom: 4px;
}

.prop-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prop-row label {
  font-size: 11px;
  color: #777799;
}

.prop-row input {
  background: #1a1a2e;
  border: 1px solid #3a3a58;
  color: #c0c0dd;
  padding: 4px 6px;
  border-radius: 3px;
  font: inherit;
  width: 100%;
}

.prop-row input:focus {
  outline: none;
  border-color: #5555aa;
}

#btn-resize {
  background: #1e1e30;
  border: 1px solid #3a3a58;
  color: #b0b0cc;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  width: 100%;
  transition: background 0.12s;
}

#btn-resize:hover {
  background: #2a2a44;
  border-color: #6655aa;
  color: #e0e0ff;
}

hr {
  border: none;
  border-top: 1px solid #2a2a40;
}

#info-box p {
  font-size: 11px;
  color: #555577;
  line-height: 1.6;
}

#level-stats {
  font-size: 11px;
  color: #555577;
  line-height: 1.8;
}

/* ── Status bar ───────────────────────────────────────────────────────────── */
#statusbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 14px;
  height: 28px;
  background: #0e0e1a;
  border-top: 1px solid #2a2a40;
  flex-shrink: 0;
  font-size: 11px;
  color: #555577;
}

#status-tool   { color: #9090bb; }
#status-coords { color: #666688; }
#status-hint   { margin-left: auto; }

/* ── Exit config entries ──────────────────────────────────────────────────── */
.exits-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #44ccff;
  margin-bottom: 4px;
}

.exits-empty {
  font-size: 11px;
  color: #445566;
  font-style: italic;
}

.exit-entry {
  border: 1px solid #2a3a4a;
  border-left: 3px solid #2288bb;
  border-radius: 3px;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: #0e1a24;
}

.exit-entry.hidden {
  border-color: #2a3040;
  border-left-color: #446688;
  background: #0e1520;
}

.exit-entry-header {
  font-size: 11px;
  color: #44ccff;
  font-weight: bold;
  margin-bottom: 5px;
}

.exit-entry.hidden .exit-entry-header {
  color: #6688aa;
}

.exit-entry .prop-row label {
  color: #446677;
}

/* ── Variant picker popup ─────────────────────────────────────────────────── */
#variant-picker {
  display: none;
  position: fixed;
  z-index: 200;
  background: #0e0e1a;
  border: 1px solid #3a3a58;
  border-radius: 5px;
  padding: 6px;
  gap: 5px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}

.variant-thumb {
  display: block;
  cursor: pointer;
  border-radius: 3px;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color 0.1s;
  image-rendering: pixelated;
}

.variant-thumb:hover    { border-color: #7766cc; }
.variant-thumb.selected { border-color: #e8d060; }

/* ── Scrollbar styling ────────────────────────────────────────────────────── */
::-webkit-scrollbar             { width: 6px; height: 6px; }
::-webkit-scrollbar-track       { background: #0e0e1a; }
::-webkit-scrollbar-thumb       { background: #2a2a44; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a5a; }
