/* Split workspace: controls scroll on the left, the device stays on the right. */

html,
body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
}

.container {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.header {
    flex: none;
    padding: 14px 28px 12px;
}

.header h1 {
    font-size: 1.7rem;
    margin-bottom: 2px;
}

.header p {
    font-size: 0.95rem;
}

.header-tools {
    margin-top: 8px;
}

.main-content {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.upload-section,
.preview-section {
    min-height: 0;
    border-radius: 0;
    border: 0;
}

.upload-section {
    overflow: auto;
}

.upload-section {
    border-right: 1px solid rgba(0, 0, 0, 0.25);
    padding: 22px 22px 32px;
}

.upload-section h2,
.preview-section h2 {
    font-size: 1.15rem;
    margin-bottom: 12px;
}

.upload-section .form-group {
    margin-bottom: 14px;
}

.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 28px 12px;
    overflow: hidden;
}

.preview-stage {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

.preview-scroll {
    flex: 0 1 auto;
    min-height: 0;
    width: 100%;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 0 8px;
}

.preview-dock {
    flex: none;
    width: min(440px, 100%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-dock.is-idle {
    display: none;
}

.preview-dock .process-actions,
.preview-dock .progress-bar,
.preview-dock .status-message,
.preview-dock .download-section {
    width: 100%;
    margin: 0;
}

.preview-section .knomi-preview {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    overflow: hidden;
    container-type: size;
}

.preview-section .device-frame {
    width: fit-content;
    max-width: 100%;
    height: auto;
    line-height: 0;
}

.preview-section .knomi-device {
    display: block;
    width: auto;
    height: auto;
    max-width: min(360px, 100cqw);
    max-height: min(420px, 100cqh);
    filter: drop-shadow(0 28px 36px rgba(0, 0, 0, 0.5));
}

.requirements summary {
    cursor: pointer;
    font-weight: 700;
    color: inherit;
}

.requirements summary:focus {
    outline: 2px solid #27ae60;
    outline-offset: 3px;
}

.requirements ul {
    margin-top: 10px;
}

.site-footer {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    padding: 14px 16px !important;
    text-align: center;
    background: #1a252f;
    border-top: 1px solid #5d6d7e !important;
}

.site-footer p {
    margin: 0 !important;
}

@media (max-width: 900px) {
    body {
        height: auto;
        overflow: auto;
    }

    .container {
        height: auto;
        overflow: visible;
    }

    .main-content {
        display: flex;
        flex-direction: column;
        overflow: visible;
    }

    .header {
        padding: 10px 16px 8px;
    }

    .header h1 {
        font-size: 1.35rem;
    }

    .preview-section {
        order: -1;
        position: static;
        max-height: none;
        overflow: visible;
        border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    }

    .preview-scroll {
        overflow: visible;
        min-height: 0;
    }

    .preview-dock {
        width: min(440px, 100%);
    }

    .preview-section .knomi-device {
        max-width: min(230px, 70vw);
        max-height: 250px;
    }

    .upload-section {
        overflow: visible;
        border-right: 0;
    }

}
