: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.editor-standalone-page,
html.editor-standalone-page body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.editor-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Layout */
.editor-shell #layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  flex: 1;
  min-height: 0;
}
/* Topbar */
.editor-shell #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 – siehe .editor-shell #layout oben */
.editor-shell aside { background: var(--panel); overflow-y: auto; padding: 16px; }
.editor-shell #maps-panel { border-right: 1px solid var(--border); }
.editor-shell #tools-panel { border-left: 1px solid var(--border); }
.editor-shell aside h2 { font-size: 15px; margin: 0 0 12px; }
.editor-shell 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; }
.map-actions-save {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.map-stats {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.map-stats-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0 0 10px; }
.map-stats-dl dt { color: #9fb0c7; }
.map-stats-dl dd { color: var(--text); margin: 0; }
.map-stats-src { color: var(--muted); font-size: 11px; }
.map-stats-label { font-weight: 600; color: #cdd8e8; margin: 0 0 6px; font-size: 12px; }
.map-stats-players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.map-stats-players li { padding: 4px 6px; background: rgba(255,255,255,0.04); border-radius: 6px; }
.map-stats-players b { color: var(--accent); }
.map-stats-empty { margin: 0; font-size: 11px; color: var(--muted); }

/* Stage */
.editor-shell #stage {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  background:
  repeating-conic-gradient(#0e1320 0% 25%, #0b0f1a 0% 50%) 0 / 32px 32px; }
.editor-shell #grid { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; display: block; }
.editor-map-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(11, 15, 26, 0.72);
  backdrop-filter: blur(4px);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
.editor-map-loading.hidden { display: none; }
.editor-map-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent, #5b9cff);
  border-radius: 50%;
  animation: editor-map-spin 0.75s linear infinite;
}
@keyframes editor-map-spin {
  to { transform: rotate(360deg); }
}
.editor-shell #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; }

/* Cloud-Dialog */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(6, 9, 17, 0.7); backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-box {
  width: 420px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); padding: 18px 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head span { font-weight: 700; font-size: 16px; }
.cloud-user { color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.cloud-user b { color: var(--accent); }
.cloud-hint { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
.cloud-form { display: flex; flex-direction: column; gap: 10px; }
.cloud-form input {
  width: 100%; padding: 9px 11px; border-radius: 8px; font: inherit; font-size: 13px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
}
.cloud-form input:focus { outline: none; border-color: var(--accent); }
.cloud-form .row { display: flex; gap: 8px; }
.cloud-form .row .btn { flex: 1; justify-content: center; }
.cloud-msg { color: #ff8a8a; font-size: 12px; min-height: 14px; }
.cloud-list { display: flex; flex-direction: column; gap: 8px; }
.cloud-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px;
}
.cloud-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-item-name i { color: var(--muted); font-style: normal; font-size: 11px; }
.cloud-empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.cloud-sec { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 14px 0 8px; }
.cloud-sec:first-child { margin-top: 0; }
.cloud-badge { font-size: 11px; color: var(--muted); margin-left: 6px; }
.cloud-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

.share-box { max-width: 420px; }
.share-map-name { font-weight: 600; margin-bottom: 14px; color: var(--accent); }
.share-section-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin: 12px 0 8px; }
.share-section-label:first-of-type { margin-top: 0; }
.share-modes { border: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; padding: 0; }
.share-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.share-opt input { width: auto; flex: 0; }
.share-users-wrap { margin-bottom: 12px; }
.share-users-label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.share-users-label textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(8,12,22,0.6);
  color: var(--text); font-size: 13px; resize: vertical; font-family: inherit;
}
.share-users-label textarea:focus { outline: none; border-color: var(--accent); }
.full { width: 100%; justify-content: center; }

.modal-actions { margin-top: 12px; display: flex; justify-content: flex-end; gap: 8px; }
.cell-wall { margin: 10px 0; padding: 8px; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; }
.cell-wall label { display: block; margin: 6px 0; }
.cell-objs { font-size: 13px; opacity: 0.85; margin-bottom: 10px; }
