* {
      margin: 0;
      padding: 0;
      box-sizing: border-box
    }

    :root {
      --bg: #1a1a2e;
      --surface: #16213e;
      --panel: #0f3460;
      --accent: #e94560;
      --accent2: #533483;
      --text: #eee;
      --text2: #aab;
      --border: #2a2a4a;
      --input-bg: #1a1a3e;
      --hover: #e9456033
    }

    body {
      font-family: 'Segoe UI', system-ui, sans-serif;
      background: var(--bg);
      color: var(--text);
      height: 100vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      user-select: none
    }

    /* Header */
    .header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      flex-wrap: wrap
    }

    .header h1 {
      font-size: 16px;
      font-weight: 700;
      color: var(--accent);
      margin-right: 8px;
      white-space: nowrap
    }

    .header label {
      font-size: 12px;
      color: var(--text2)
    }

    .header select,
    .header input {
      background: var(--input-bg);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 4px 8px;
      font-size: 12px;
      outline: none
    }

    .header select:focus,
    .header input:focus {
      border-color: var(--accent)
    }

    .header input[type=number] {
      width: 80px;
    }

    .separator {
      width: 1px;
      height: 24px;
      background: var(--border);
      flex-shrink: 0
    }

    /* Toolbar */
    .toolbar {
      display: flex;
      gap: 6px;
      padding: 8px 16px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      flex-wrap: wrap;
      align-items: center
    }

    .toolbar span {
      font-size: 11px;
      color: var(--text2);
      margin-right: 4px
    }

    .btn {
      background: var(--panel);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 5px 10px;
      font-size: 11px;
      cursor: pointer;
      transition: all .2s;
      white-space: nowrap
    }

    .btn:hover {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff
    }

    .btn.active {
      background: var(--accent);
      border-color: var(--accent)
    }

    .btn.danger {
      border-color: #c0392b
    }

    .btn.danger:hover {
      background: #c0392b
    }

    .btn.copy {
      background: var(--accent2);
      border-color: var(--accent2)
    }

    .btn.copy:hover {
      background: var(--accent);
      border-color: var(--accent)
    }

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

    /* Canvas area */
    .canvas-wrap {
      flex: 1;
      overflow: hidden;
      position: relative;
      background: #111128;
      cursor: grab
    }

    .canvas-wrap.panning {
      cursor: grabbing
    }

    #canvas {
      display: block;
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%
    }

    /* Element list sidebar */
    .sidebar {
      width: 300px;
      background: var(--surface);
      border-left: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      flex-shrink: 0
    }

    .sidebar h2 {
      font-size: 13px;
      padding: 10px 12px;
      border-bottom: 1px solid var(--border);
      color: var(--accent);
      letter-spacing: .5px
    }

    .element-list {
      flex: 1;
      overflow-y: auto;
      padding: 4px
    }

    .el-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      border-radius: 6px;
      cursor: pointer;
      font-size: 12px;
      transition: background .15s;
      border: 1px solid transparent
    }

    .el-item:hover {
      background: var(--hover)
    }

    .el-item.selected {
      background: var(--accent)22;
      border-color: var(--accent)
    }

    .el-item .el-type {
      color: var(--accent);
      font-weight: 600;
      min-width: 70px
    }

    .el-item .el-label {
      color: var(--text2);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      flex: 1
    }

    .el-item .el-actions {
      display: flex;
      gap: 2px
    }

    .el-item .el-actions button {
      background: none;
      border: none;
      color: var(--text2);
      cursor: pointer;
      font-size: 14px;
      padding: 2px 4px;
      border-radius: 3px
    }

    .el-item .el-actions button:hover {
      color: var(--accent);
      background: var(--hover)
    }

    /* Properties panel */
    .props {
      overflow-y: auto;
      border-top: 1px solid var(--border);
      max-height: 50%
    }

    .props h2 {
      position: sticky;
      top: 0;
      background: var(--surface);
      z-index: 1
    }

    .prop-group {
      padding: 6px 12px
    }

    .prop-row {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 4px
    }

    .prop-row label {
      font-size: 11px;
      color: var(--text2);
      min-width: 80px;
      text-align: right
    }

    .prop-row input,
    .prop-row select {
      flex: 1;
      background: var(--input-bg);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 4px;
      padding: 3px 6px;
      font-size: 11px;
      outline: none
    }

    .prop-row input:focus,
    .prop-row select:focus {
      border-color: var(--accent)
    }

    .prop-row input[type=color] {
      padding: 0;
      width: 30px;
      height: 22px;
      cursor: pointer
    }

    .prop-row .required {
      color: var(--accent);
      font-weight: 700
    }

    /* YAML output — 고정 높이로 처음부터 스크롤 가능, 아이템 추가 시 레이아웃 밀림 방지 */
    .yaml-wrap {
      background: var(--surface);
      border-top: 1px solid var(--border);
      flex-shrink: 0;
      height: 35vh;
      min-height: 180px;
      display: flex;
      flex-direction: column
    }

    .yaml-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 6px 16px;
      border-bottom: 1px solid var(--border)
    }

    .yaml-header h2 {
      font-size: 13px;
      color: var(--accent);
      letter-spacing: .5px
    }

    #yaml-output {
      flex: 1;
      min-height: 0;
      width: 100%;
      border: none;
      outline: none;
      resize: vertical;
      overflow: auto;
      padding: 10px 16px;
      font-family: 'Fira Code', 'Cascadia Code', monospace;
      font-size: 12px;
      line-height: 1.5;
      color: #7fdbca;
      white-space: pre;
      tab-size: 2;
      background: #0a0a1a;
      user-select: text;
      cursor: text
    }

    /* Canvas coordinate tooltip */
    .coord-tooltip {
      position: fixed;
      background: rgba(0, 0, 0, .85);
      color: var(--text);
      font-size: 11px;
      padding: 3px 8px;
      border-radius: 4px;
      pointer-events: none;
      display: none;
      z-index: 100;
      font-family: monospace
    }

    /* Scrollbar */
    ::-webkit-scrollbar {
      width: 6px;
      height: 6px
    }

    ::-webkit-scrollbar-track {
      background: var(--bg)
    }

    ::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 3px
    }

    ::-webkit-scrollbar-thumb:hover {
      background: var(--accent)
    }

    .no-elements {
      padding: 20px;
      text-align: center;
      color: var(--text2);
      font-size: 12px
    }
