* { box-sizing: border-box; }
body { margin: 0; padding: 0; display: flex; flex-direction: column; height: 100vh; background-color: #252526; color: #e0e0e0; font-family: 'Segoe UI', monospace; overflow: hidden; user-select: none; }

/* HEADER */
#header {
    height: 36px;
    min-height: 36px;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 100;
}
.header-left, .header-right { display: flex; align-items: center; gap: 10px; }
.header-center { display: flex; align-items: center; flex-shrink: 0; }
.header-center .logo { height: 20px; filter: brightness(0) invert(1); opacity: 0.85; }
.separator { color: #555; }
.zoom-control { display: flex; align-items: center; gap: 6px; font-size: 0.7rem; }
.zoom-control input[type=range] { width: 60px; margin: 0; }
.view-btns button, .res-btns button { padding: 4px 8px; font-size: 0.7rem; }
#header input[type=number] { width: 50px; padding: 2px 4px; font-size: 0.7rem; }
.res-inputs { display: flex; align-items: center; gap: 4px; position: relative; z-index: 10; flex-shrink: 0; }
.res-inputs input { position: relative; z-index: 11; flex-shrink: 0; }

/* MAIN LAYOUT */
#main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* LEFT TOOLBAR */
#toolbar {
    width: 44px;
    min-width: 44px;
    background: #2d2d2d;
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
    padding: 6px 4px;
    gap: 4px;
    overflow-y: auto;
}
.tool-section { display: flex; flex-direction: column; gap: 2px; }
.tool-label { font-size: 0.55rem; color: #888; text-align: center; margin-bottom: 2px; text-transform: uppercase; }
.tool-divider { height: 1px; background: #444; margin: 6px 0; }
.tool-btn {
    width: 36px;
    height: 36px;
    background: #3e3e42;
    border: 1px solid #555;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
}
.tool-btn:hover { background: #4e4e52; border-color: #4ec9b0; }
.tool-btn.active { background: #0e639c; border-color: #0e639c; }
.tool-icon { font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
.tool-icon svg { width: 20px; height: 20px; }

/* RIGHT SIDEBAR */
#sidebar {
    width: 300px;
    min-width: 300px;
    background: #333337;
    border-left: 1px solid #444;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* SCENE SWITCHER */
#scene-switcher {
    background: #2a2a2e;
    border-bottom: 1px solid #444;
    padding: 8px 10px;
}
.scene-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
#scene-select {
    flex: 1;
    background: #1e1e1e;
    border: 1px solid #444;
    color: #4ec9b0;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-family: inherit;
    border-radius: 2px;
    cursor: pointer;
}
#scene-select:hover {
    border-color: #4ec9b0;
}
#scene-select:focus {
    outline: none;
    border-color: #4ec9b0;
}
.scene-row button {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3a3a3e;
    border: 1px solid #555;
    color: #ccc;
    cursor: pointer;
    border-radius: 2px;
}
.scene-row button:hover {
    background: #4a4a4e;
    color: #fff;
}

/* CONTEXT MENU */
.context-menu {
    display: none;
    position: fixed;
    background: #3e3e42;
    border: 1px solid #555;
    border-radius: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 1000;
    min-width: 120px;
}
.menu-item {
    padding: 6px 12px;
    font-size: 0.7rem;
    cursor: pointer;
    color: #ddd;
}
.menu-item:hover {
    background: #4e4e52;
}
.menu-item.danger {
    color: #f66;
}
.menu-item.danger:hover {
    background: #442222;
}
.menu-divider {
    height: 1px;
    background: #555;
    margin: 4px 0;
}

/* PANELS */
.panel { border-bottom: 1px solid #444; }
.panel-header {
    background: #3a3a3e;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #4ec9b0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.panel-header:hover { background: #454548; }
.panel-header .chevron {
    font-size: 0.7rem;
    transition: transform 0.15s;
    width: 12px;
    display: inline-block;
    text-align: center;
    transform-origin: center center;
}
.panel .panel-header .chevron { transform: rotate(90deg); }
.panel.collapsed .panel-header .chevron { transform: rotate(0deg); }
.panel-body { padding: 10px; background: #2e2e32; }
.panel.collapsed .panel-body { display: none; }

/* SUBPANELS */
.subpanel { margin-top: 8px; border-top: 1px solid #444; padding-top: 6px; }
.subpanel-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #888;
    padding: 4px 0;
}
.subpanel-header:hover { color: #aaa; }
.subpanel-header .chevron { font-size: 0.6rem; width: 10px; transition: transform 0.15s; display: inline-block; text-align: center; transform-origin: center center; }
.subpanel-header.collapsed .chevron { transform: rotate(0deg); }
.subpanel-header:not(.collapsed) .chevron { transform: rotate(90deg); }
.subpanel-body { padding-top: 6px; }

/* ROWS & INPUTS */
.row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-size: 0.7rem; color: #ccc; }
.row > span:first-child { min-width: 65px; }
.value { color: #fff; font-weight: bold; }
.group { background: #3e3e42; padding: 8px; border-radius: 2px; border: 1px solid #444; }

input[type=range] { width: 100%; accent-color: #4ec9b0; margin: 3px 0; cursor: pointer; height: 16px; }
input[type=number], input[type=text] { background: #1e1e1e; border: 1px solid #444; color: white; padding: 3px 4px; font-family: inherit; border-radius: 2px; font-size: 0.7rem; }
input[type=number] { width: 55px; color-scheme: dark; }
input[type=number]::-webkit-inner-spin-button { filter: invert(0.7); }
input[type=color] { width: 50px; height: 22px; padding: 0; border: 1px solid #444; cursor: pointer; }

/* CHECKBOX ROWS */
.checkbox-row {
    display: flex;
    gap: 10px;
    margin: 6px 0;
    font-size: 0.65rem;
}
.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    color: #aaa;
}
.checkbox-row input[type=checkbox] { width: 12px; height: 12px; margin: 0; accent-color: #4ec9b0; }

/* LOCK BUTTON */
.lock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    cursor: pointer;
    vertical-align: middle;
}
.lock-btn input[type=checkbox] { display: none; }
.lock-btn .lock-icon {
    width: 12px;
    height: 12px;
    border: 1px solid #555;
    border-radius: 2px;
    background: #333;
    position: relative;
}
.lock-btn .lock-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5px;
    height: 5px;
    border: 1.5px solid #666;
    border-radius: 1px;
}
.lock-btn:hover .lock-icon { border-color: #777; }
.lock-btn:hover .lock-icon::after { border-color: #888; }
.lock-btn input:checked + .lock-icon { background: #4ec9b0; border-color: #4ec9b0; }
.lock-btn input:checked + .lock-icon::after { border-color: #1a1a1a; }

/* BUTTONS */
.btn-group { display: flex; gap: 3px; flex-wrap: wrap; }
button {
    background: #3e3e42;
    color: #fff;
    border: 1px solid #555;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: bold;
    transition: all 0.1s;
    border-radius: 2px;
}
button:hover { background: #4e4e52; border-color: #4ec9b0; }
button.active { background: #0e639c; border-color: #0e639c; }
button.danger { color: #f66; }
button.danger:hover { background: #442222; }
.export-btn { width: 100%; margin-bottom: 5px; padding: 8px; }
.export-btn.primary { background: #0e639c; }

/* OBJECT LIST */
#obj-list { background: #1a1a1a; border: 1px solid #333; overflow-y: auto; }

/* Hide old props panel - inputs kept for event handling */
#props { display: none !important; }
.obj-item { padding: 5px 8px; border-bottom: 1px solid #333; cursor: pointer; font-size: 0.75rem; display: flex; justify-content: space-between; align-items: center; background: #222; color: #ccc; gap: 6px; }
.obj-item:hover { background: #2a2a2a; }
.obj-item.selected { background: #2a2a2a; border-left: 3px solid #4ec9b0; color: #4ec9b0; }
.obj-item.hidden-obj { opacity: 0.5; }
.obj-item.group-header { background: #252530; border-left: 2px solid #9966ff; }
.obj-item.group-header.selected { background: #303040; border-left: 3px solid #9966ff; }
.obj-item.group-child { padding-left: 20px; background: #1e1e22; border-left: 1px solid #9966ff; }
.obj-item.group-child.selected { background: #282830; border-left: 3px solid #4ec9b0; }
.obj-item .eye { cursor: pointer; font-size: 0.85rem; opacity: 0.6; flex-shrink: 0; display: flex; align-items: center; }
.obj-item .eye svg { width: 14px; height: 14px; }
.obj-item .eye:hover { opacity: 1; }
.obj-item .collapse { cursor: pointer; font-size: 0.65rem; opacity: 0.7; margin-right: 3px; color: #9966ff; }
.obj-item .type-icon { font-size: 0.75rem; opacity: 0.5; margin-right: 3px; flex-shrink: 0; display: flex; align-items: center; }
.obj-item .type-icon svg { width: 14px; height: 14px; }
.obj-item .obj-name { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-item .name-edit { flex-grow: 1; background: #111; border: 1px solid #4ec9b0; color: #fff; padding: 2px 4px; font-size: 0.75rem; font-family: inherit; outline: none; }
.obj-item .del { margin-left: auto; flex-shrink: 0; }
.obj-item[draggable] { cursor: grab; }
.obj-item.dragging { opacity: 0.4; }
.obj-item.drag-over { border-top: 2px solid #6495ed; margin-top: -2px; }

/* CANVAS AREA */
#canvas-wrapper { flex-grow: 1; background: #1a1a1a; display: flex; justify-content: center; align-items: center; overflow: auto; position: relative; }
canvas { background: #000; image-rendering: pixelated; box-shadow: 0 0 30px rgba(0,0,0,0.5); display: block; border: 1px solid #333; }
#coords { position: absolute; bottom: 8px; right: 8px; color: #4ec9b0; background: #000; padding: 3px 6px; font-size: 0.65rem; border: 1px solid #333; }

/* ANCHOR GRID */
.anchor-grid {
    display: grid;
    grid-template-columns: repeat(3, 6px);
    grid-template-rows: repeat(3, 6px);
    gap: 2px;
    background: #1a1a1a;
    padding: 2px;
    border: 1px solid #444;
    border-radius: 2px;
    margin-left: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.anchor-cell {
    width: 6px;
    height: 6px;
    min-width: 6px;
    min-height: 6px;
    max-width: 6px;
    max-height: 6px;
    background: #3e3e42;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
    transition: background 0.1s;
    box-sizing: border-box;
}
.anchor-cell:hover { background: #5e5e62; }
.anchor-cell.active { background: #4ec9b0; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1e1e1e; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* INSPECTOR PANEL */
#inspector {
    display: none;
    background: #2d2d2d;
    border-top: 1px solid #4ec9b0;
    padding: 15px 30px;
    gap: 40px;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}
#inspector .inspector-col {
    flex-shrink: 0;
}
#inspector.visible {
    display: flex;
}
.inspector-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 80px;
}
.inspector-label {
    font-size: 0.6rem;
    color: #4ec9b0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.inspector-row {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
}
.inspector-row span {
    min-width: 18px;
    color: #888;
    font-size: 0.65rem;
}
.inspector-row input[type="number"] {
    width: 55px;
    padding: 2px 3px;
    font-size: 0.7rem;
}
.inspector-row input[type="text"] {
    padding: 2px 4px;
    font-size: 0.7rem;
}
.inspector-row input[type="color"] {
    width: 28px;
    height: 20px;
    padding: 0;
    border: 1px solid #555;
}
.inspector-row input[type="range"] {
    height: 14px;
    margin: 0;
}
.inspector-row select {
    padding: 2px;
    font-size: 0.65rem;
    background: #1e1e1e;
    border: 1px solid #444;
    color: #fff;
}
.inspector-row label {
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    gap: 2px;
    color: #aaa;
}
.inspector-row label input[type="checkbox"] {
    width: 11px;
    height: 11px;
    margin: 0;
}
.inspector-row button {
    padding: 2px 6px;
    font-size: 0.65rem;
}
.inspector-type-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inspector-type-icon svg {
    width: 12px;
    height: 12px;
}
.inspector-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.inspector-actions button {
    padding: 4px 10px;
    font-size: 0.65rem;
}
/* Type-specific columns - hidden by default */
.insp-type-col {
    display: none;
}
/* Shadow settings - hidden by default */
#insp-shadow-settings {
    display: none;
}
