:root {
  --accent: #4cc9f0;
  --bg: #0b0f1a;
  --panel: #131a2a;
  --panel2: #1b2235;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eef7;
  --muted: #8c9ab0;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* Topbar */
#topbar {
  height: 54px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; letter-spacing: 0.5px; }
.brand span { color: var(--accent); font-weight: 600; }
.top-actions { display: flex; gap: 8px; }

/* Buttons */
.btn {
  font: inherit; font-size: 13px; cursor: pointer;
  color: var(--text); background: var(--panel2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; text-decoration: none; display: inline-flex; align-items: center;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: #283150; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #06121f; border-color: transparent; font-weight: 600; }
.btn.accent { background: #b388ff; color: #120a26; border-color: transparent; font-weight: 600; }
.btn.danger { background: #3a1f28; color: #ff9aa6; }
.btn.danger:hover { background: #532a36; }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; justify-content: center; margin-bottom: 8px; }

/* Layout */
#layout { display: grid; grid-template-columns: 260px 1fr 260px; height: calc(100% - 54px); }
aside { background: var(--panel); overflow-y: auto; padding: 16px; }
#maps-panel { border-right: 1px solid var(--border); }
#tools-panel { border-left: 1px solid var(--border); }
aside h2 { font-size: 15px; margin: 0 0 12px; }
aside h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
  margin: 20px 0 8px; }

/* Map-Liste */
#map-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
#map-list li {
  padding: 8px 10px; border-radius: 8px; background: var(--panel2);
  border: 1px solid transparent; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
#map-list li:hover { background: #283150; }
#map-list li.active { border-color: var(--accent); background: #1d2a45; }
#map-list li .meta { color: var(--muted); font-size: 11px; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
label input, label select { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 13px;
  color: var(--text); background: var(--panel2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.map-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* Stage */
#stage { position: relative; overflow: hidden; background:
  repeating-conic-gradient(#0e1320 0% 25%, #0b0f1a 0% 50%) 0 / 32px 32px; }
#grid { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; display: block; }
#status { position: absolute; left: 10px; bottom: 10px; font-size: 12px; color: var(--muted);
  background: rgba(11,15,26,0.6); padding: 4px 8px; border-radius: 6px; pointer-events: none; }

/* Werkzeug-Paletten */
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tool {
  font: inherit; font-size: 12px; text-align: left; cursor: pointer; color: var(--text);
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; display: flex; align-items: center; gap: 6px;
}
.tool:hover { background: #283150; }
.tool.active { border-color: var(--accent); background: #1d2a45; box-shadow: 0 0 0 1px var(--accent) inset; }
.tool .swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.4); flex: none; }

.brush { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.brush input { flex: 1; }

/* Fackel-Ausrichtung (Kompass) */
.dirpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: ". n ." "w . e" ". s .";
  gap: 6px;
  max-width: 150px;
}
.dir-btn {
  font: inherit; font-size: 16px; cursor: pointer; color: var(--text);
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 0;
}
.dir-btn:hover { background: #283150; }
.dir-btn.active { border-color: var(--accent); background: #1d2a45; box-shadow: 0 0 0 1px var(--accent) inset; }
.dir-btn[data-dir="n"] { grid-area: n; }
.dir-btn[data-dir="w"] { grid-area: w; }
.dir-btn[data-dir="e"] { grid-area: e; }
.dir-btn[data-dir="s"] { grid-area: s; }

/* Brücke drehen */
.rotrow { display: flex; gap: 6px; }
.rot-btn {
  flex: 1; font: inherit; font-size: 18px; cursor: pointer; color: var(--text);
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 0;
}
.rot-btn:hover { background: #283150; }
.rot-btn.active { border-color: var(--accent); background: #1d2a45; box-shadow: 0 0 0 1px var(--accent) inset; }

/* Eigenschaften-Panel (schwebend über dem Spielfeld) */
.props-float {
  position: absolute; top: 12px; right: 12px; width: 232px; z-index: 5;
  background: rgba(19, 26, 42, 0.96); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45); backdrop-filter: blur(6px);
  max-height: calc(100% - 24px); overflow-y: auto;
}
.props-float.hidden { display: none; }
.props-float .prop-hint { color: var(--muted); line-height: 1.5; margin: 0; }
.props-float .prop-title { font-weight: 600; color: var(--text); margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.props-float label { margin-bottom: 8px; }
.props-float .prop-checks { margin-bottom: 8px; }
.props-float .prop-checks-label { color: var(--muted); margin-bottom: 4px; }
.props-float .check {
  display: flex; align-items: center; gap: 6px; color: var(--text);
  margin: 0 0 2px; font-size: 13px; cursor: pointer;
}
.props-float .check input { width: auto; margin: 0; }

.legend { margin-top: 20px; font-size: 12px; color: var(--muted); line-height: 1.5;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.legend b { color: var(--text); }
.legend p { margin: 6px 0 0; }
