:root {
    --primary: #6757f5;
    --ink: #151925;
    --muted: #6f7789;
    --line: #e3e6ee;
    --bg: #f5f7fb
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif
}

a {
    color: inherit;
    text-decoration: none
}

button,
input {
    font: inherit
}

.header {
    height: 66px;
    padding: 0 max(4vw, 18px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: #fffc;
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 5
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 850
}

.logo {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff
}

.header nav,
footer nav {
    display: flex;
    gap: 22px;
    font-size: 14px;
    font-weight: 700;
    color: #596174
}

.hero {
    min-height: calc(100vh - 66px);
    padding: 64px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center
}

.pill {
    padding: 8px 14px;
    border: 1px solid #ddd8ff;
    border-radius: 999px;
    background: #f0eeff;
    color: #5848e5;
    font-size: 14px;
    font-weight: 750
}

.hero h1 {
    font-size: clamp(40px, 6vw, 70px);
    line-height: 1.04;
    letter-spacing: -.055em;
    margin: 22px 0 14px
}

.hero h1 em {
    font-style: normal;
    color: var(--primary)
}

.hero>p {
    color: #667085;
    font-size: 18px
}

.drop-zone {
    width: min(680px, 100%);
    margin-top: 28px;
    padding: 45px 20px;
    border: 2px dashed #cbd0db;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 22px 60px #262e4d14;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 11px;
    cursor: pointer;
    transition: .2s
}

.drop-zone.drag,
.drop-zone:hover {
    border-color: var(--primary);
    background: #f8f7ff
}

.upload-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: #eeecff;
    color: var(--primary);
    font-size: 34px
}

.drop-zone strong {
    font-size: 21px
}

.drop-zone small {
    color: #7b8292
}

.drop-zone b,
.small-upload {
    margin-top: 8px;
    padding: 13px 24px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff
}

.editor {
    max-width: 1480px;
    min-height: calc(100vh - 66px);
    margin: auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 16px
}

.hidden {
    display: none !important
}

.controls,
.workspace {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    overflow: hidden
}

.controls {
    padding: 18px
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.controls h2 {
    margin: 0;
    font-size: 19px
}

.controls h3 {
    font-size: 14px
}

.text-btn {
    border: 0;
    background: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer
}

.mode-grid,
.format {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px
}

.mode,
.format button {
    padding: 11px 8px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    font-weight: 700;
    cursor: pointer
}

.mode.active,
.format .active {
    border-color: var(--primary);
    background: #f0eeff;
    color: #5848e5
}

.panel {
    margin-top: 14px
}

.panel input[type=color] {
    width: 42px;
    height: 42px;
    border: 0;
    background: none
}

.panel span {
    font-size: 14px;
    color: var(--muted)
}

.swatch {
    width: 48%;
    height: 48px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #dbeafe, #ede9fe)
}

.swatch.warm {
    background: linear-gradient(135deg, #fce7f3, #ffedd5)
}

.swatch.mint {
    background: linear-gradient(135deg, #dcfce7, #cffafe)
}

.swatch.dark {
    background: linear-gradient(135deg, #111827, #374151)
}

.small-upload {
    display: block;
    text-align: center;
    cursor: pointer
}

.controls hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 22px 0
}

.controls label {
    display: block;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 650;
    color: #51596a
}

.controls output {
    float: right
}

.controls input[type=range] {
    display: block;
    width: 100%;
    accent-color: var(--primary);
    margin-top: 8px
}

.workspace {
    display: flex;
    flex-direction: column;
    min-height: 650px
}

.workspace-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line)
}

.workspace-head small {
    display: block;
    color: #7c8495;
    margin-top: 3px
}

.workspace-head>button {
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    cursor: pointer
}

.workspace-head>button:disabled {
    opacity: .4
}

.canvas-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background-color: #f6f7fa;
    background-image: linear-gradient(45deg, #e8eaf0 25%, transparent 25%), linear-gradient(-45deg, #e8eaf0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e8eaf0 75%), linear-gradient(-45deg, transparent 75%, #e8eaf0 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0
}

canvas {
    max-width: 100%;
    max-height: 70vh;
    box-shadow: 0 12px 45px #1f264126
}

.loader {
    position: absolute;
    inset: 0;
    background: #f8f9fce8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px
}

.loader span {
    width: 42px;
    height: 42px;
    border: 4px solid #ddd9ff;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite
}

.loader small {
    color: var(--muted)
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.guides {
    max-width: 1050px;
    margin: 20px auto 70px;
    padding: 0 20px
}

.section-label {
    color: var(--primary);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .15em
}

.guides h2 {
    font-size: 34px;
    margin: 8px 0 22px
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px
}

.cards a {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff
}

.cards b {
    font-size: 18px
}

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

footer {
    max-width: 1100px;
    margin: auto;
    padding: 28px 20px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    color: #707889;
    font-size: 14px
}

.content {
    max-width: 780px;
    margin: auto;
    padding: 65px 22px
}

.content h1 {
    font-size: clamp(38px, 6vw, 56px);
    letter-spacing: -.045em
}

.content h2 {
    margin-top: 32px
}

.content p {
    font-size: 17px;
    line-height: 1.85;
    color: #50596b
}

.content .back {
    color: var(--primary);
    font-weight: 800
}

@media(max-width:800px) {
    .header nav a:nth-child(3) {
        display: none
    }

    .editor {
        grid-template-columns: 1fr;
        padding: 12px
    }

    .controls {
        order: 2
    }

    .workspace {
        min-height: 520px
    }

    .cards {
        grid-template-columns: 1fr
    }

    .hero {
        padding-top: 45px
    }

    footer {
        flex-direction: column;
        gap: 18px
    }

    .header nav {
        gap: 12px
    }
}