.editor-shell {
    min-height: calc(100vh - 150px);
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 310px;
    grid-template-rows: minmax(460px, 1fr) 250px;
    gap: 16px;
}

.asset-panel,
.preview-panel,
.properties-panel,
.timeline-panel {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.asset-panel,
.properties-panel {
    padding: 16px;
}

.preview-panel {
    padding: 16px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 14px;
}

.timeline-panel {
    grid-column: 1 / -1;
    padding: 16px;
}

.panel-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 4px;
    border-radius: 16px;
    background: var(--surface-2);
    margin-bottom: 14px;
}

.panel-tabs button {
    min-height: 36px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
}

.panel-tabs button.active {
    color: var(--text);
    background: var(--surface-solid);
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}

.asset-search {
    margin-bottom: 14px;
}

.asset-list {
    display: grid;
    gap: 12px;
}

.asset-card {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-2);
    cursor: grab;
}

.asset-card div {
    height: 88px;
    border-radius: 13px;
    margin-bottom: 12px;
}

.asset-card.video div {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
}

.asset-card.image div {
    background: linear-gradient(135deg, var(--primary-2), #67e8f9);
}

.asset-card.audio div {
    height: 50px;
    background: repeating-linear-gradient(
        90deg,
        rgba(20, 241, 149, 0.9) 0 6px,
        rgba(20, 241, 149, 0.35) 6px 14px
    );
}

.asset-card strong,
.asset-card small {
    display: block;
}

.asset-card small {
    color: var(--muted);
    margin-top: 3px;
}

.preview-window {
    min-height: 360px;
    border-radius: 22px;
    background:
        radial-gradient(circle at 25% 35%, rgba(124, 92, 255, 0.46), transparent 30%),
        radial-gradient(circle at 75% 25%, rgba(0, 212, 255, 0.28), transparent 26%),
        linear-gradient(135deg, #070a12, #192235);
    display: grid;
    place-items: center;
    text-align: center;
    overflow: hidden;
    position: relative;
}

html[data-theme="light"] .preview-window {
    background:
        radial-gradient(circle at 25% 35%, rgba(124, 92, 255, 0.36), transparent 30%),
        radial-gradient(circle at 75% 25%, rgba(0, 212, 255, 0.24), transparent 26%),
        linear-gradient(135deg, #eaf1fb, #ffffff);
}

.preview-overlay {
    max-width: 520px;
    padding: 24px;
}

.preview-badge {
    display: inline-flex;
    margin-bottom: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: var(--primary-2);
    font-size: 12px;
    font-weight: 900;
}

.preview-overlay h2 {
    margin-bottom: 8px;
    font-size: clamp(30px, 4vw, 52px);
    line-height: 0.96;
}

.preview-overlay p {
    color: var(--muted);
    line-height: 1.6;
}

.player-controls {
    display: grid;
    grid-template-columns: auto auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.round-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.round-btn.primary {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.scrubber {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.scrubber span {
    display: block;
    width: 24%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.player-controls small {
    color: var(--muted);
}

.property-stack {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.timeline-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-bottom: 12px;
}

.timeline-head small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.timeline-tracks {
    display: grid;
    gap: 12px;
}

.track {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.track-label {
    color: var(--muted);
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.track-row {
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 78px,
            rgba(255,255,255,0.04) 78px,
            rgba(255,255,255,0.04) 79px
        ),
        var(--surface-2);
    display: flex;
    align-items: center;
    padding: 6px;
    gap: 6px;
    overflow: hidden;
}

html[data-theme="light"] .track-row {
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 78px,
            rgba(15,23,42,0.04) 78px,
            rgba(15,23,42,0.04) 79px
        ),
        var(--surface-2);
}

.timeline-clip {
    height: 34px;
    border-radius: 10px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 900;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-clip.video {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
}

.timeline-clip.image {
    background: linear-gradient(135deg, var(--primary-2), #0891b2);
}

.timeline-clip.audio {
    background: linear-gradient(135deg, #10b981, var(--accent));
    color: #062014;
}

.timeline-clip.text {
    background: linear-gradient(135deg, #f59e0b, var(--warning));
    color: #241601;
}

@media (max-width: 1280px) {
    .editor-shell {
        grid-template-columns: 260px minmax(0, 1fr);
        grid-template-rows: auto auto auto;
    }

    .properties-panel {
        grid-column: 1 / -1;
    }

    .timeline-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .editor-shell {
        grid-template-columns: 1fr;
    }

    .track {
        grid-template-columns: 1fr;
    }
}

/* Milestone 3: dynamic editor states */
.panel-tab-link {
    min-height: 36px;
    border-radius: 12px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    text-decoration: none;
}

.compact-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 14px;
}

.dynamic-list {
    max-height: 520px;
    overflow: auto;
    padding-right: 4px;
}

.skeleton-card {
    min-height: 136px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(90deg, var(--surface-2), rgba(255,255,255,0.08), var(--surface-2));
    background-size: 240% 100%;
    animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
    from { background-position: 0 0; }
    to { background-position: -240% 0; }
}

.dynamic-asset {
    cursor: default;
}

.asset-thumb {
    height: 92px;
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--surface-solid);
    display: grid;
    place-items: center;
}

.asset-thumb img,
.asset-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.asset-preview-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.asset-wave {
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        rgba(20, 241, 149, 0.95) 0 7px,
        rgba(20, 241, 149, 0.25) 7px 16px
    );
}

.dynamic-asset .mini-btn {
    width: 100%;
    margin-top: 10px;
}

.preview-media {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.preview-audio {
    width: min(620px, 86%);
    align-self: center;
    justify-self: center;
}

.properties-actions {
    display: grid;
    gap: 10px;
}

.timeline-clip {
    border: 0;
    cursor: pointer;
    transition: 160ms ease;
    min-width: 90px;
}

.timeline-clip:hover,
.timeline-clip.selected {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(0,0,0,0.28), 0 0 0 2px rgba(255,255,255,0.28) inset;
}

.track-empty {
    color: var(--muted);
    font-size: 12px;
    padding: 0 10px;
}

.timeline-loading {
    grid-column: 1 / -1;
}

.empty-state.compact {
    min-height: 160px;
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    text-align: center;
}

.empty-state.compact span {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--primary-2);
    margin-bottom: 10px;
}

.empty-state.compact h3 {
    margin-bottom: 6px;
}

.empty-state.compact p {
    color: var(--muted);
    line-height: 1.5;
}

.dynamic-asset div,
.dynamic-asset .asset-thumb,
.dynamic-asset .asset-thumb > div {
    margin-bottom: 0;
}

.dynamic-asset .asset-thumb {
    margin-bottom: 10px;
}

.dynamic-asset .asset-preview-fallback,
.dynamic-asset .asset-wave {
    height: 100%;
    border-radius: 0;
}
