/* =========================================
   RESET
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


:root {

    --primary: #f4511e;
    --primary-dark: #d84315;

    --background: #f5f7fa;

    --white: #ffffff;

    --text: #172033;

    --muted: #6b7280;

    --border: #e5e7eb;

    --shadow:
        0 10px 30px rgba(0, 0, 0, 0.07);

    --radius: 18px;
}


body {

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--background);

    color: var(--text);

    min-height: 100vh;
}


.container {

    width: min(1100px, 92%);

    margin: auto;
}


/* =========================================
   HEADER
========================================= */

.header {

    background: var(--white);

    border-bottom:
        1px solid var(--border);

    position: sticky;

    top: 0;

    z-index: 100;
}


.header-inner {

    height: 72px;

    display: flex;

    align-items: center;

    justify-content: space-between;
}


.brand {

    display: flex;

    align-items: center;

    gap: 12px;
}


.brand-logo {

    width: 42px;
    height: 42px;

    display: grid;

    place-items: center;

    border-radius: 12px;

    background: var(--primary);

    color: white;

    font-weight: 800;

    font-size: 15px;
}


.brand h1 {

    font-size: 18px;

    line-height: 1.1;
}


.brand p {

    font-size: 12px;

    color: var(--muted);

    margin-top: 3px;
}


/* =========================================
   MAIN
========================================= */

.main {

    padding:
        40px 0 60px;
}


.hero {

    text-align: center;

    margin-bottom: 30px;
}


.hero h2 {

    font-size:
        clamp(28px, 5vw, 44px);

    line-height: 1.1;

    margin-bottom: 10px;
}


.hero p {

    color: var(--muted);

    font-size: 16px;
}


/* =========================================
   CARD
========================================= */

.card {

    background: var(--white);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    padding: 24px;

    box-shadow: var(--shadow);
}


.section-title {

    display: flex;

    align-items: center;

    gap: 12px;

    margin-bottom: 22px;
}


.step {

    width: 36px;
    height: 36px;

    flex-shrink: 0;

    display: grid;

    place-items: center;

    border-radius: 50%;

    background: #fff1eb;

    color: var(--primary);

    font-weight: 800;
}


.section-title h3 {

    font-size: 18px;

    margin-bottom: 3px;
}


.section-title p {

    color: var(--muted);

    font-size: 13px;
}


/* =========================================
   UPLOAD
========================================= */

.upload-card {

    max-width: 650px;

    margin: auto;
}


.upload-box {

    min-height: 210px;

    border:
        2px dashed #d5d9df;

    border-radius: 16px;

    display: flex;

    flex-direction: column;

    justify-content: center;

    align-items: center;

    text-align: center;

    cursor: pointer;

    transition: 0.2s ease;
}


.upload-box:hover {

    border-color: var(--primary);

    background: #fffaf8;
}


.upload-icon {

    width: 64px;
    height: 64px;

    display: grid;

    place-items: center;

    border-radius: 50%;

    background: #fff1eb;

    font-size: 28px;

    margin-bottom: 14px;
}


.upload-box strong {

    font-size: 17px;

    margin-bottom: 5px;
}


.upload-box span {

    color: var(--muted);

    font-size: 13px;
}


/* =========================================
   EDITOR
========================================= */

.editor-section {

    margin-top: 30px;
}


.editor-grid {

    display: grid;

    grid-template-columns:
        minmax(0, 1.1fr)
        minmax(300px, 0.9fr);

    gap: 24px;

    align-items: start;
}


/* =========================================
   CANVAS
========================================= */

.canvas-wrapper {

    width: min(100%, 520px);

    margin: auto;

    border-radius: 16px;

    overflow: hidden;

    background: #eee;

    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}


#previewCanvas {

    display: block;

    width: 100%;

    height: auto;

    aspect-ratio: 1 / 1;

    touch-action: none;

    cursor: grab;
}


#previewCanvas:active {

    cursor: grabbing;
}


/* =========================================
   CONTROLS
========================================= */

.controls {

    margin-top: 22px;
}


.control-group {

    margin-bottom: 18px;
}


.control-group label {

    display: block;

    font-size: 13px;

    font-weight: 700;

    margin-bottom: 8px;
}


#zoom {

    width: 100%;

    accent-color: var(--primary);
}


.control-row {

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 8px;
}


.control-btn {

    border: 1px solid var(--border);

    background: white;

    border-radius: 10px;

    height: 42px;

    font-size: 18px;

    cursor: pointer;

    transition: 0.15s ease;
}


.control-btn:hover {

    background: #f8f8f8;

    border-color: #cdd1d7;
}


/* =========================================
   FRAMES
========================================= */

.frames-grid {

    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 12px;

    max-height: 580px;

    overflow-y: auto;

    padding-right: 4px;
}


.frame-option {

    border:
        2px solid transparent;

    border-radius: 14px;

    overflow: hidden;

    cursor: pointer;

    background: #f5f5f5;

    position: relative;

    transition: 0.2s ease;
}


.frame-option:hover {

    transform: translateY(-2px);
}


.frame-option.selected {

    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(244, 81, 30, 0.12);
}


.frame-option img {

    width: 100%;

    display: block;

    aspect-ratio: 1 / 1;

    object-fit: cover;
}


.frame-number {

    position: absolute;

    left: 8px;

    bottom: 8px;

    background: rgba(0, 0, 0, 0.7);

    color: white;

    font-size: 11px;

    padding: 4px 7px;

    border-radius: 6px;
}


/* =========================================
   DOWNLOAD
========================================= */

.download-btn {

    width: 100%;

    border: none;

    background: var(--primary);

    color: white;

    font-size: 16px;

    font-weight: 800;

    padding: 15px;

    border-radius: 12px;

    margin-top: 20px;

    cursor: pointer;

    transition: 0.2s ease;
}


.download-btn:hover {

    background: var(--primary-dark);

    transform: translateY(-1px);
}


.download-btn:active {

    transform: translateY(0);
}


/* =========================================
   INFO
========================================= */

.info {

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 15px;

    margin-top: 30px;
}


.info-item {

    background: white;

    border: 1px solid var(--border);

    border-radius: 14px;

    padding: 20px;

    text-align: center;
}


.info-item strong {

    display: block;

    color: var(--primary);

    font-size: 22px;

    margin-bottom: 5px;
}


.info-item span {

    color: var(--muted);

    font-size: 13px;
}


/* =========================================
   FOOTER
========================================= */

.footer {

    background: white;

    border-top:
        1px solid var(--border);

    text-align: center;

    padding: 25px 0;

    color: var(--muted);

    font-size: 13px;
}


.footer .small {

    margin-top: 5px;

    font-size: 11px;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 800px) {

    .main {

        padding-top: 25px;
    }


    .editor-grid {

        grid-template-columns: 1fr;
    }


    .frames-grid {

        grid-template-columns:
            repeat(3, 1fr);

        max-height: none;
    }

}


@media (max-width: 500px) {

    .container {

        width: 94%;
    }


    .card {

        padding: 16px;
    }


    .hero h2 {

        font-size: 28px;
    }


    .info {

        grid-template-columns: 1fr;
    }


    .frames-grid {

        grid-template-columns:
            repeat(3, 1fr);

        gap: 8px;
    }


    .frame-number {

        font-size: 9px;

        padding: 3px 5px;
    }

}