* {
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100vh;
    padding: 24px 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at top, #fff, transparent 40%),
        linear-gradient(180deg, #fee 0%, #eee 100%);
    color: #321;
}

main {
    position: relative;
    width: min(412px, calc(100vw - 24px));
    height: min(915px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid #dca;
    border-radius: 28px;
    background: #ffe;
    box-shadow: 0 18px 40px #432;
}

.screen-content {
    height: 100%;
    overflow-y: auto;
    padding: 24px 16px 40px;
    scrollbar-gutter: stable;
}

h1 {
    margin: 0 0 8px;
    font-size: clamp(1.6rem, 2vw, 2.2rem);
}

.intro {
    margin: 0 0 24px;
    color: #765;
    line-height: 1.6;
}

.controls {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid #dca;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 18px #432;
}

.controls label {
    display: block;
    margin: 0 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #765;
}

.controls select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ba8;
    border-radius: 12px;
    font: inherit;
    color: #321;
    background: #ffe;
}

.device-meta {
    margin: 10px 0 0;
    color: #765;
    font-size: 0.9rem;
    line-height: 1.5;
}

.upload-panel {
    margin: 0 0 18px;
}

.upload-dropzone {
    display: block;
    padding: 16px 14px;
    border: 1px dashed #ba8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 18px #432;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background 160ms ease,
        transform 160ms ease;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover {
    border-color: #765;
    background: #ffe;
    transform: translateY(-1px);
}

.upload-title,
.upload-copy {
    display: block;
}

.upload-title {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
}

.upload-copy {
    color: #765;
    font-size: 0.9rem;
    line-height: 1.5;
}

#upload-input {
    display: none;
}

.grid {
    display: grid;
    gap: 18px;
}

.version-footer {
    margin-top: 20px;
    color: #765;
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: center;
}

.card {
    padding: 18px;
    border: 1px solid #dca;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 24px #432;
}

.card h2 {
    margin: 0 0 6px;
    font-size: 1.15rem;
}

.meta {
    margin: 0 0 16px;
    color: #765;
    font-size: 0.95rem;
}

.preview-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    align-items: start;
}

figure {
    margin: 0;
    padding: 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #dca;
    display: grid;
    grid-template-columns: fit-content(120px) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

figcaption {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
}

.label {
    font-size: clamp(1rem, 2.8vw, 1.15rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.hint {
    display: block;
    color: #765;
    font-size: clamp(0.7rem, 2.1vw, 0.85rem);
    line-height: 1.3;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.info {
    min-width: 0;
}

.frame {
    justify-self: start;
    overflow: auto;
    padding: 8px;
    border-radius: 12px;
    background:
        linear-gradient(45deg, #edc 25%, transparent 25%, transparent 75%, #edc 75%),
        linear-gradient(45deg, #edc 25%, transparent 25%, transparent 75%, #edc 75%);
    background-position: 0 0, 8px 8px;
    background-size: 16px 16px;
    border: 1px solid #ba8;
}

.frame.plain-bg {
    background: #fff;
}

.frame img {
    margin: 0 auto;
}

img {
    display: block;
    max-width: none;
    height: auto;
    border-radius: 10px;
}

@media (min-width: 721px) {
    body {
        padding: 36px 0;
    }

    main {
        height: min(915px, calc(100vh - 72px));
        border: 10px solid #321;
        border-radius: 38px;
        box-shadow:
            0 28px 50px #432,
            0 0 0 2px #765,
            inset 0 0 0 1px #ba8;
    }

    .screen-content {
        padding-top: 64px;
    }

    main::before {
        content: "";
        position: absolute;
        top: 0;
        left: 50%;
        width: 124px;
        height: 26px;
        transform: translateX(-50%);
        border-radius: 0 0 16px 16px;
        background: #321;
        box-shadow: 0 1px 0 #765;
    }

    main::after {
        content: "";
        position: absolute;
        top: 10px;
        left: 50%;
        width: 44px;
        height: 6px;
        transform: translateX(-50%);
        border-radius: 999px;
        background: #765;
    }
}

@media (max-width: 560px) {
    body {
        padding: 0;
    }

    main {
        width: 100%;
        height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .screen-content {
        padding: 20px 12px 32px;
    }

    .preview-row {
        grid-template-columns: 1fr;
    }

    figure {
        grid-template-columns: fit-content(104px) minmax(0, 1fr);
        gap: 8px;
        align-items: center;
    }

    figure {
        padding: 12px;
    }

    .label {
        font-size: 0.95rem;
    }

    .upload-dropzone {
        padding: 14px 12px;
    }

    .hint,
    .meta {
        font-size: 0.85rem;
    }
}
