* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background: #2b2b2b;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #e0e0e0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
/* ========== MENU BAR ========== */
.menu-bar {
    display: flex;
    align-items: center;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    padding: 4px 12px;
    gap: 20px;
    flex-wrap: wrap;
}
.logo {
    font-weight: bold;
    font-size: 16px;
    color: #ffaa44;
    letter-spacing: 1px;
}
.menu-items {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.menu-item {
    font-size: 13px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
}
.menu-item:hover {
    background: #4a4a4a;
}
.header {
    display: none;
}
/* ========== DROPDOWN ========== */
.menu-item.dropdown {
    position: relative;
}
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #2d2d2d;
    border: 1px solid #555;
    border-radius: 4px;
    min-width: 100px;
    z-index: 1000;
}
.menu-item.dropdown:hover .dropdown-content {
    display: block;
}
.dropdown-item {
    padding: 6px 12px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 12px;
}
.dropdown-item:hover {
    background: #4a4a4a;
}
/* ========== BUTTONS & CONTROLS ========== */
.small-btn {
    background: #4a4a4a;
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.small-btn:hover {
    background: #666;
}
.small-btn.del {
    background: #8b3c3c;
}
.icon-btn {
    background: #4a4a4a;
    border: 1px solid #555;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    transition: all 0.2s;
}
.icon-btn:hover {
    background: #666;
    border-color: #1e88e5;
}
.icon-btn.active {
    background: #1e88e5;
    border-color: #1e88e5;
}
.icon-btn.del {
    background: #8b3c3c;
}
.icon-btn.del:hover {
    background: #a04040;
}
.fps-control {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    background: #4a4a4a;
    padding: 2px 8px;
    border-radius: 4px;
}
.fps-control input {
    width: 60px;
}
/* ========== LAYOUT SECTIONS ========== */
.middle-section {
    display: flex;
    flex: 1;
    overflow: hidden;
}
/* ========== LEFT TOOLBAR (Adobe Animate style) ========== */
.toolbar-vertical {
    width: 60px;
    background: #2d2d2d;
    padding: 6px 3px;
    border-right: 1px solid #444;
    overflow-y: auto;
}
.tool-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}
.tool-btn {
    width: 36px;
    height: 36px;
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 6px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ddd;
}
.tool-btn.active {
    background: #1e88e5;
    border-color: #fff;
    color: white;
}
.tool-btn:hover {
    background: #555;
}
.color-picker {
    width: 36px;
    height: 36px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #222;
    cursor: pointer;
}
.size-slider {
    width: 36px;
    height: 3px;
    margin: 0 auto;
}
/* ========== CANVAS AREA ========== */
.canvas-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #2c2c2c;
    padding: 16px;
}
#mainCanvas {
    background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    cursor: crosshair;
}
/* ========== RIGHT PANEL (common) ========== */
.models-panel {
    width: 280px;
    background: #3a3a3a;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #555;
    min-width: 150px;
    max-width: 60vw;
}
.models-header {
    padding: 8px 12px;
    background: #2e2e2e;
    border-bottom: 1px solid #555;
    font-weight: bold;
    text-align: center;
}
.models-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    justify-content: center;
    border-bottom: 1px solid #555;
}
.model-btn {
    background: #4a4a4a;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.model-btn:hover {
    background: #666;
}
.three-container {
    flex: 1;
    background: #1e1e1e;
    margin: 8px;
    border-radius: 8px;
    overflow: hidden;
}
.three-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}
.light-controls {
    padding: 10px;
    background: #2e2e2e;
    border-top: 1px solid #555;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
}
.light-controls label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.light-controls input {
    width: 80px;
}
/* ========== DRAWINGS PANEL (shapes) ========== */
.drawing-item {
    background: #4a4a4a;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin: 2px;
}
.drawing-item.active {
    background: #1e88e5;
}
.library-instruction {
    font-size: 11px;
    color: #aaa;
    text-align: center;
    padding: 5px;
}
/* ========== MATERIALS PANEL ========== */
.materials-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid #555;
}
.materials-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #2e2e2e;
    border-bottom: 1px solid #555;
}
.folder-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.breadcrumb {
    font-size: 12px;
    color: #aaa;
}
.materials-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}
.folder-item, .material-item {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    width: 70px;
    height: 70px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-align: center;
    position: relative;
}
.folder-item {
    background: #3a3a4a;
}
.material-item {
    background: white;
    color: black;
}
.material-item span {
    color: black;
}
.material-item img {
    max-width: 50px;
    max-height: 50px;
}
.delete-item-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.folder-item:hover .delete-item-btn,
.material-item:hover .delete-item-btn {
    display: flex;
}
/* ========== TEXT PANEL ========== */
.text-panel {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.text-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.text-row label {
    width: 70px;
    font-size: 12px;
}
.text-row input, .text-row select {
    background: #4a4a4a;
    border: 1px solid #666;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    flex: 1;
}
.text-row input[type="range"] {
    flex: 2;
}
.text-row button {
    background: #1e88e5;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.text-row textarea {
    background: #4a4a4a;
    border: 1px solid #666;
    color: white;
    padding: 4px;
    border-radius: 4px;
    width: 100%;
    height: 60px;
    resize: vertical;
}
/* ========== TIMELINE (with playhead & keyframe) ========== */
.timeline-container {
    background: #2e2e2e;
    border-top: 1px solid #555;
    height: 170px;
    min-height: 80px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: auto;
}
.timeline-header {
    display: flex;
    background: #1a1a1a;
    border-bottom: 1px solid #444;
    padding: 2px 0;
    position: relative;
}
.layer-header-col {
    width: 80px;
    padding: 4px;
    font-size: 12px;
    text-align: center;
}
.frames-header-col {
    flex: 1;
    display: flex;
    position: relative;
}
.frame-h-cell {
    width: 44px;
    text-align: center;
    font-size: 11px;
}
.layers-timeline {
    flex: 1;
    overflow-y: auto;
}
.layer-row {
    display: flex;
    border-bottom: 1px solid #444;
}
.layer-name-col {
    width: 80px;
    padding: 4px;
    background: #2a2a2a;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}
.layer-name-col.active {
    background: #006666;
}
.layer-frames-col {
    flex: 1;
    display: flex;
}
.frame-cell {
    width: 44px;
    height: 44px;
    background: #3a3a3a;
    border-right: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
}
.frame-cell.active {
    background: #004d44;
    border: 2px solid #00ffcc;
}
.frame-cell.plus {
    background: #2a2a2a;
    color: #aaa;
}
.frame-cell.keyframe {
    background: #2a6e3a;
    position: relative;
}
.frame-cell.keyframe::after {
    content: "◆";
    font-size: 8px;
    color: #ffcc00;
    position: absolute;
    bottom: 2px;
    right: 2px;
}
.frame-cell.selected {
    background: #005577;
    border: 2px solid #00ccff;
}
.frame-cell.tweened {
    background: #2a4a2a;
}
.frame-cell.guide {
    background: #4a3a2a;
    opacity: 0.7;
}
.timeline-controls {
    padding: 6px;
    background: #1e1e1e;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff3366;
    left: 0;
    z-index: 20;
    pointer-events: none;
    box-shadow: 0 0 2px #ff3366;
}
/* ========== LAYER VISIBILITY ========== */
.layer-visibility-toggle,
.layer-visibility-toggle-small {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 2px 6px;
    border-radius: 4px;
}
.layer-visibility-toggle:hover,
.layer-visibility-toggle-small:hover {
    background: rgba(255,255,255,0.2);
}
.layer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.layer-item span:first-child {
    flex: 1;
}
/* ========== RESIZERS ========== */
.timeline-resizer {
    height: 5px;
    background: #555;
    cursor: ns-resize;
}
.timeline-resizer:hover {
    background: #1e88e5;
}
.panel-resizer {
    width: 5px;
    background: #555;
    cursor: ew-resize;
}
.panel-resizer:hover {
    background: #1e88e5;
}
.panel-section {
    width: 100%;
}
/* ========== TIMELINE CONTEXT MENU ========== */
.timeline-context-menu {
    background: #2d2d2d;
    border: 1px solid #555;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.context-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    color: #e0e0e0;
    transition: background 0.2s;
}
.context-item:hover {
    background: #3a3a3a;
}
/* ========== TIMELINE ZOOM CONTROLS ========== */
.zoom-controls {
    display: flex;
    gap: 4px;
    align-items: center;
    background: #4a4a4a;
    padding: 4px 8px;
    border-radius: 4px;
}
.zoom-controls button {
    background: transparent;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
}
.zoom-controls button:hover {
    background: #555;
    border-radius: 2px;
}
.zoom-level {
    font-size: 11px;
    color: #aaa;
    min-width: 30px;
    text-align: center;
}
/* ========== ONION SKIN RANGE CONTROL ========== */
.onion-skin-range-container {
    display: grid;
    gap: 8px;
}

.onion-marker {
    transition: all 0.2s;
}

.onion-marker:hover {
    opacity: 0.8;
    box-shadow: 0 0 8px currentColor;
}

.onion-skin-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 12px;
    background: #1a1a1a;
    border-bottom: 1px solid #444;
}

.icon-btn-tiny {
    background: #4a4a4a;
    border: 1px solid #555;
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.icon-btn-tiny:hover {
    background: #666;
    border-color: #1e88e5;
}

.icon-btn-tiny.active {
    background: #1e88e5;
    border-color: #1e88e5;
}
.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid #555;
    transition: all 0.2s;
}
.color-swatch:hover {
    border-color: #1e88e5;
    transform: scale(1.1);
}
.color-label {
    font-size: 10px;
    color: #aaa;
}
.onion-info {
    font-size: 10px;
    color: #888;
    padding: 8px;
    background: #2a2a2a;
    border-radius: 4px;
    margin-top: 4px;
    border-left: 3px solid #1e88e5;
}

/* ========== BRUSH PANEL ========== */
.brush-panel {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow-y: auto;
}

.brush-library-section {
    background: #2a2a2a;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #444;
}

.brush-library-header {
    font-size: 12px;
    font-weight: bold;
    color: #aaa;
    margin-bottom: 8px;
}

.brush-presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.brush-preset-btn {
    background: #4a4a4a;
    border: 2px solid #555;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
    transition: all 0.2s;
}

.brush-preset-btn:hover {
    background: #5a5a5a;
    border-color: #1e88e5;
}

.brush-preset-btn.active {
    background: #1e88e5;
    border-color: #1e88e5;
    color: white;
}

.brush-settings-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.brush-setting-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brush-setting-row label {
    font-size: 11px;
    color: #aaa;
    font-weight: 500;
}

.brush-setting-row input[type="range"],
.brush-setting-row select {
    background: #4a4a4a;
    border: 1px solid #666;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
}

.brush-setting-row select {
    padding: 6px 8px;
    font-size: 11px;
}

.brush-setting-row input[type="range"] {
    height: 6px;
    cursor: pointer;
}

.brush-preview-canvas {
    border: 1px solid #555 !important;
    border-radius: 4px;
    background: #3a3a3a !important;
}

.custom-brushes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-brush-item {
    background: #4a4a4a;
    border: 1px solid #555;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-brush-item:hover {
    background: #5a5a5a;
    border-color: #1e88e5;
}

.custom-brush-item.selected {
    background: #1e88e5;
    border-color: #1e88e5;
}

.custom-brush-item-buttons {
    display: flex;
    gap: 4px;
}

.brush-delete-btn {
    background: #8b3c3c;
    border: none;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
}

.brush-delete-btn:hover {
    background: #a04040;
}