:root {
    --red: #ed1b2f;
    --red-dark: #cb1023;
    --ink: #17202a;
    --muted: #65707d;
    --line: #dfe3e7;
    --surface: #ffffff;
    --canvas: #f3f1ed;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 92% 4%, rgba(237, 27, 47, 0.1), transparent 28rem),
        linear-gradient(135deg, #faf9f7 0%, var(--canvas) 100%);
    font-family: "DM Sans", Arial, sans-serif;
}

body::before {
    position: fixed;
    inset: 0 auto 0 0;
    width: 7px;
    background: var(--red);
    content: "";
}

.app-shell {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 64px 0 80px;
}

.intro {
    position: relative;
    max-width: 770px;
    padding-left: 96px;
}

.brand {
    position: absolute;
    top: 2px;
    left: 0;
    display: grid;
    width: 66px;
    height: 66px;
    place-items: center;
    color: #fff;
    background: var(--red);
    border-radius: 18px 18px 18px 4px;
    font-family: "Manrope", Arial, sans-serif;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--red-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    font-family: "Manrope", Arial, sans-serif;
    letter-spacing: -0.04em;
}

h1 {
    max-width: 680px;
    font-size: clamp(36px, 5vw, 62px);
    line-height: 1.04;
}

.intro-copy {
    max-width: 650px;
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.65;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(320px, 0.78fr) minmax(440px, 1.22fr);
    gap: 24px;
    align-items: start;
    margin-top: 54px;
}

.generator-card,
.result-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(23, 32, 42, 0.08);
    box-shadow: 0 24px 70px rgba(31, 37, 44, 0.09);
}

.generator-card {
    position: relative;
    padding: 42px;
    border-radius: 4px 28px 28px 28px;
    overflow: hidden;
}

.generator-card::after {
    position: absolute;
    right: -54px;
    bottom: -54px;
    width: 150px;
    height: 150px;
    border: 28px solid rgba(237, 27, 47, 0.06);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.step-marker {
    position: absolute;
    top: 0;
    right: 28px;
    color: rgba(23, 32, 42, 0.09);
    font-family: "Manrope", Arial, sans-serif;
    font-size: 74px;
    font-weight: 800;
    line-height: 1;
}

.form-heading {
    position: relative;
    max-width: 320px;
    margin-bottom: 34px;
}

h2 {
    font-size: 25px;
    line-height: 1.25;
}

label {
    display: block;
    margin-bottom: 9px;
    font-size: 14px;
    font-weight: 700;
}

input[type="text"] {
    display: block;
    width: 100%;
    min-height: 60px;
    padding: 17px 18px;
    color: var(--ink);
    background: #fbfbfa;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    font: 500 17px/1.5 "DM Sans", Arial, sans-serif;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input[type="text"]:focus {
    background: #fff;
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(237, 27, 47, 0.1);
}

input[type="text"]::placeholder {
    color: #9aa1a8;
}

.input-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 9px 2px 26px;
    color: var(--muted);
    font-size: 12px;
}

button,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 22px;
    color: #fff;
    background: var(--red);
    border: 0;
    border-radius: 10px;
    font: 700 15px "DM Sans", Arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

button {
    position: relative;
    z-index: 1;
    width: 100%;
    justify-content: space-between;
}

button:hover,
.download-button:hover {
    background: var(--red-dark);
    box-shadow: 0 10px 24px rgba(203, 16, 35, 0.22);
    transform: translateY(-1px);
}

button:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
}

.button-arrow {
    font-size: 22px;
}

button.loading .button-arrow {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    font-size: 0;
    animation: spin 700ms linear infinite;
}

.status {
    position: relative;
    z-index: 1;
    min-height: 20px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.status:empty {
    margin: 0;
    min-height: 0;
}

.status.success {
    color: #197447;
}

.status.error {
    color: #b01224;
}

.result-card {
    padding: 24px;
    border-radius: 28px 4px 28px 28px;
}

.result-card[hidden] {
    display: none;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 4px 4px 20px;
}

.result-header h2 {
    font-size: 22px;
}

.download-button {
    min-height: 44px;
    padding: 0 18px;
    font-size: 13px;
}

iframe {
    display: block;
    width: 100%;
    height: 540px;
    background: #ecebea;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.error-page {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
    text-align: center;
}

.error-page h1 {
    color: var(--red);
    font-size: clamp(80px, 20vw, 180px);
}

.error-page a {
    color: var(--red-dark);
    font-weight: 700;
}

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

@media (max-width: 880px) {
    .app-shell {
        width: min(100% - 32px, 680px);
        padding-top: 40px;
    }

    .workspace {
        grid-template-columns: 1fr;
        margin-top: 40px;
    }

    iframe {
        height: 460px;
    }
}

@media (max-width: 520px) {
    body::before {
        width: 4px;
    }

    .app-shell {
        width: calc(100% - 24px);
        padding: 28px 0 48px;
    }

    .intro {
        padding: 76px 4px 0;
    }

    .brand {
        left: 4px;
        width: 58px;
        height: 58px;
        border-radius: 15px 15px 15px 4px;
    }

    h1 {
        font-size: 38px;
    }

    .intro-copy {
        font-size: 15px;
    }

    .generator-card,
    .result-card {
        padding: 24px;
        border-radius: 4px 20px 20px 20px;
    }

    .step-marker {
        right: 18px;
        font-size: 60px;
    }

    .result-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .download-button {
        width: 100%;
    }

    iframe {
        height: 360px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
