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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 13px;
    line-height: 1.4;
}

.app-layout {
    display: grid;
    grid-template-columns: var(--panel-left-width) 1fr var(--panel-right-width);
    grid-template-rows: var(--toolbar-height) 1fr var(--timeline-height);
    grid-template-areas:
        "toolbar toolbar toolbar"
        "left canvas right"
        "timeline timeline timeline";
    height: 100vh;
    height: 100dvh;
}

.app-layout.timeline-collapsed {
    grid-template-rows: var(--toolbar-height) 1fr var(--timeline-collapsed);
}

.app-layout.fullscreen {
    grid-template-columns: 0 1fr 0;
    grid-template-rows: 0 1fr 0;
}

.app-layout.fullscreen .toolbar,
.app-layout.fullscreen .panel-left,
.app-layout.fullscreen .panel-right,
.app-layout.fullscreen .timeline-panel {
    display: none;
}

/* Canvas area */
.canvas-area {
    grid-area: canvas;
    position: relative;
    background: #000;
    overflow: hidden;
}

#glcanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.canvas-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    z-index: 5;
    opacity: 0;
    transition: opacity var(--dur-normal);
}

.canvas-area:hover .canvas-overlay {
    opacity: 1;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

/* Selection */
::selection { background: var(--accent-dim); color: var(--text-primary); }

/* Focus */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Utility */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
