:root {
  --bg: #0f161d;
  --panel: #121a23;
  --accent: #42d6c7;
  --accent-soft: rgba(66,214,199,0.18);
  --text: #e5f7ff;
  --muted: #94a8bd;
  --danger: #ff8677;
  --radius: 6px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
#topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #0b1015;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.btn {
  background: rgba(66,214,199,0.12);
  border: 1px solid rgba(66,214,199,0.18);
  border-radius: 4px;
  color: var(--text);
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 500;
}
.btn.primary {
  background: var(--accent);
  color: #001b12;
  border-color: rgba(0,0,0,0);
}
#statusBar {
  min-width: 220px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}
#layout {
  display: grid;
  /* nur noch 2 Spalten: links (Tiles) + Mitte (Map) */
  grid-template-columns: 480px 1fr;
  height: calc(100vh - 42px);
}
#left {
  background: var(--panel);
  padding: 10px;
  overflow-y: auto;
}
#main {
  position: relative;
  background: #05090e;
}
#left h2 {
  margin-top: 0;
  font-size: 14px;
}

/* Map-Liste ------------------------------------------------- */
#mapList {
  list-style: none;
  margin: 0 0 12px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
#mapList li {
  background: #0a1017;
  border: 1px solid rgba(255,255,255,0.015);
  border-radius: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  cursor: pointer;
}
#mapList li.active {
  outline: 2px solid var(--accent);
}
#mapList canvas {
  width: 46px;
  height: 46px;
  background: #394451;
  border-radius: 3px;
}

/* Tilepalette ----------------------------------------------- */
#tilePalette {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  max-height: 640px;
  overflow-y: auto;
}
.tile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  margin: 0;
  background: #0c1218;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.02);
  cursor: pointer;
}
.tile-btn img {
  display: block;
  image-rendering: pixelated;
  max-width: 64px;
  max-height: 64px;
}
.tile-btn span {
  display: none;
}
.tile-btn.active {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}
.tile-btn:hover {
  border-color: var(--accent-soft);
}

/* Canvas & Layerbar ---------------------------------------- */
#layerbar {
  background: #0d131a;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  padding: 4px 12px 6px;
  display: flex;
  flex-direction: column;   /* Zeilen untereinander */
  gap: 4px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#canvasWrap {
  position: relative;
  width: 100%;
  height: calc(100% - 36px);
  overflow: auto;
}
#canvasWrap canvas {
  position: absolute;
  top: 0;
  left: 0;
  image-rendering: pixelated;
}

/* Sonstiges ------------------------------------------------ */
.sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.04);
}
#selectedTileBox img {
  width: 64px;
  height: 64px;
  background: #000;
  image-rendering: pixelated;
  margin-bottom: 4px;
}
.debug {
  background: #0a1015;
  border: 1px solid rgba(255,255,255,0.02);
  border-radius: 4px;
  padding: 6px;
  font-size: 11px;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
}
.hint {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
