.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    display: grid;
    gap: 16px;
}

.page-header {
    display: grid;
    gap: 6px;
}

.editor {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "uploads"
        "stage"
        "controls";
}

.uploads {
    grid-area: uploads;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stage-wrap {
    grid-area: stage;
    min-width: 0;
}

.controls {
    grid-area: controls;
    display: grid;
    gap: 16px;
    align-content: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

/* Desktop: canvas on the left, one slim control column on the right. */
@media (min-width: 900px) {
    .page {
        padding-top: 24px;
        padding-bottom: 32px;
    }

    .editor {
        grid-template-columns: minmax(0, 1fr) 320px;
        grid-template-areas:
            "uploads uploads"
            "stage controls";
        align-items: start;
    }

    .controls {
        position: sticky;
        top: 16px;
    }
}

/* Mobile: Download sticks to the bottom of the screen. */
@media (max-width: 899.98px) {
    .page {
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }

    .action-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2147483000;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: var(--surface);
        border-top: 1px solid var(--border);
    }
}

/* Keep the canvas near the top of a phone screen. */
@media (max-width: 899.98px) {
    .page {
        gap: 12px;
    }

    .uploads {
        gap: 8px;
    }

    .slot-label {
        min-height: 56px;
        padding: 10px 12px;
    }

    .steps {
        gap: 6px;
        font-size: 0.8125rem;
    }

    .steps li {
        gap: 6px;
        padding: 4px 10px 4px 4px;
    }
}
