* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: #1a1b1e; color: #e6e6e6; font-family: -apple-system, Segoe UI, Arial, sans-serif; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

#toolbar {
  display: flex; align-items: center; gap: 6px;
  background: #202225; border-bottom: 1px solid #000; padding: 8px 12px; flex-shrink: 0;
}
#toolbar .brand { font-weight: 700; margin-right: 12px; color: #7cb7ff; }
#toolbar button {
  background: #2f3136; color: #e6e6e6; border: 1px solid #3d3f44; border-radius: 4px;
  padding: 6px 10px; cursor: pointer; font-size: 13px;
}
#toolbar button:hover { background: #3d3f44; }
#toolbar .sep { width: 1px; height: 22px; background: #3d3f44; margin: 0 6px; }

#main { flex: 1; display: flex; overflow: hidden; }

#canvasWrap {
  flex: 1; min-width: 0; min-height: 0; overflow: hidden; display: flex;
  align-items: center; justify-content: center;
  background: #1a1b1e;
  padding: 24px;
  position: relative;
}
#canvasStage {
  border: 1px solid #000;
  box-shadow: 0 0 0 1px #444, 0 8px 30px rgba(0,0,0,.6);
  background: repeating-conic-gradient(#e9e9e9 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
  flex-shrink: 0;
  line-height: 0;
}

#rightPanel { width: clamp(180px, 30vw, 320px); flex-shrink: 0; display: flex; flex-direction: column; background: #202225; border-left: 1px solid #000; overflow: hidden; }
#propsPanel { flex: 0 0 auto; max-height: 50%; overflow-y: auto; padding: 12px; border-bottom: 1px solid #000; }
#layersPanel { flex: 1; overflow-y: auto; padding: 12px; }
h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: #9aa0a6; display: flex; align-items: center; justify-content: space-between; }
.mini { font-size: 11px; padding: 3px 7px; background: #2f3136; border: 1px solid #3d3f44; color: #e6e6e6; border-radius: 3px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.mini.danger:hover { background: #6b2b2b; }
.mini:hover { background: #3d3f44; }

.empty { color: #666; font-size: 13px; }

#layersList { display: flex; flex-direction: column; gap: 4px; }
.layerItem {
  display: flex; align-items: center; gap: 6px; background: #2a2c30; border: 1px solid #3d3f44; border-radius: 4px;
  padding: 6px 8px; cursor: pointer; font-size: 13px;
}
.layerItem.selected { border-color: #7cb7ff; background: #2c3542; }
.layerItem input[type=text] { background: transparent; border: none; color: #e6e6e6; width: 100%; font-size: 13px; }
.layerItem .icon { opacity: .8; width: 16px; text-align: center; }
.layerItem .layerBtns { display: flex; gap: 2px; margin-left: auto; }
.layerItem .layerBtns button { background: transparent; border: none; color: #ccc; cursor: pointer; font-size: 12px; padding: 2px 4px; }
.layerItem .layerBtns button:hover { color: #fff; }
.layerItem.hiddenLayer { opacity: .45; }

.propRow { margin-bottom: 10px; }
.propRow label { display: block; font-size: 11px; color: #9aa0a6; margin-bottom: 3px; }
.propRow input[type=text], .propRow input[type=number], .propRow select, .propRow textarea {
  width: 100%; background: #17181a; border: 1px solid #3d3f44; color: #e6e6e6; border-radius: 4px; padding: 5px 7px; font-size: 13px;
}
.propRow input[type=range] { width: 100%; }
.propRow input[type=color] { width: 100%; height: 30px; border: 1px solid #3d3f44; background: #17181a; padding: 2px; border-radius: 4px; }
.propRow2 { display: flex; gap: 8px; }
.propRow2 > div { flex: 1; }
.rowInline { display: flex; align-items: center; gap: 8px; }
.rowInline label { margin: 0; }
.toggleBtn { background: #2f3136; border: 1px solid #3d3f44; color: #e6e6e6; padding: 5px 9px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.toggleBtn.active { background: #3f6fb0; border-color: #7cb7ff; }

#modalOverlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
#modalOverlay.hidden { display: none; }
#modalBox { background: #202225; border: 1px solid #3d3f44; border-radius: 8px; padding: 18px; width: 320px; }
#modalBox h3 { margin-top: 0; }
.modalActions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modalActions button { background: #2f3136; border: 1px solid #3d3f44; color: #e6e6e6; padding: 6px 14px; border-radius: 4px; cursor: pointer; }
#modalOk { background: #3f6fb0; border-color: #7cb7ff; }
