:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #211c33;
    background: #f4f2fb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 42px 18px;
    background:
        radial-gradient(circle at 9% 5%, #dfd8ff 0, transparent 28rem),
        radial-gradient(circle at 100% 40%, #d9f6ec 0, transparent 32rem),
        #f7f6fb;
}

.card {
    max-width: 780px;
    margin: auto;
    padding: 38px;
    background: #fff;
    border: 1px solid #e9e6f2;
    border-radius: 28px;
    box-shadow: 0 20px 70px #39315b18;
}

.narrow { max-width: 420px; }
.narrow form { margin-top: 24px; }
.narrow label { margin-bottom: 20px; }

.top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.top form { flex: none; }

.eyebrow {
    margin: 0 0 8px;
    color: #7056d8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .13em;
}

.lead {
    margin: 10px 0 0;
    color: #625d72;
    line-height: 1.5;
}

h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -.045em;
}

h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -.025em;
}

h2 em {
    color: #827c90;
    font-size: 13px;
    font-style: normal;
    font-weight: 600;
}

.steps {
    display: flex;
    gap: 12px;
    padding: 20px 0 28px;
    color: #5f5b6c;
    font-size: 13px;
}

.steps span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.steps b,
.section-title > span {
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border-radius: 50%;
    background: #ede9ff;
    color: #644bc7;
    font-size: 12px;
}

.form-section {
    margin: 14px 0;
    padding: 24px;
    border: 1px solid #eceaf2;
    border-radius: 18px;
    background: #fdfdff;
}

.section-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
}

.section-title > span {
    flex: none;
    width: 27px;
    height: 27px;
}

.section-title p {
    margin: 4px 0 0;
    color: #777181;
    font-size: 14px;
}

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

textarea,
input,
select,
button { font: inherit; }

textarea,
input,
select {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 13px 14px;
    border: 1px solid #d9d5e4;
    border-radius: 11px;
    outline: none;
    background: #fff;
    color: #2b253b;
}

textarea:focus,
input:focus,
select:focus {
    border-color: #7357db;
    box-shadow: 0 0 0 3px #e9e4ff;
}

textarea {
    height: 145px;
    resize: vertical;
    line-height: 1.45;
}

.hint,
.price-note {
    margin: 10px 0 0;
    color: #736d7d;
    font-size: 13px;
    line-height: 1.45;
}

.upload {
    display: flex;
    min-height: 66px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 15px;
    border: 1.5px dashed #bfb6db;
    border-radius: 12px;
    background: #faf9ff;
    color: #4f3c9e;
    cursor: pointer;
}

.upload small {
    overflow: hidden;
    color: #777181;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.upload:focus-within { outline: 3px solid #e9e4ff; }

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.primary {
    width: 100%;
    padding: 15px 18px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #6e50da, #4d39b5);
    box-shadow: 0 9px 18px #6246c13b;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.primary span {
    margin-left: 7px;
    font-size: 21px;
    line-height: 0;
}

.secondary {
    padding: 10px 13px;
    border: 1px solid #dcd7e8;
    border-radius: 10px;
    background: #fff;
    color: #514a60;
    font-weight: 700;
    cursor: pointer;
}

.primary:disabled {
    opacity: .65;
    cursor: wait;
}

#message {
    min-height: 24px;
    margin: 18px 3px 0;
    color: #4f4771;
    font-weight: 600;
}

.result {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #eceaf2;
}

.result img {
    display: block;
    max-width: 100%;
    max-height: 720px;
    margin-top: 16px;
    border-radius: 15px;
    box-shadow: 0 10px 30px #29204029;
}

.download {
    display: inline-block;
    margin-top: 5px;
    color: #523abd;
    font-weight: 800;
    text-decoration: none;
}

.error { color: #b42318 !important; }

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #625d72;
    font-weight: 600;
}

.check-row input {
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    accent-color: #644bc7;
}

.history {
    margin-top: 34px;
    padding-top: 28px;
    border-top: 1px solid #eceaf2;
}

.history-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.history-heading > span {
    color: #827c90;
    font-size: 12px;
}

.history-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.history-card {
    overflow: hidden;
    border: 1px solid #eceaf2;
    border-radius: 15px;
    background: #fff;
}

.history-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f4f2fb;
}

.history-card > div { padding: 13px; }
.history-card p {
    display: -webkit-box;
    margin: 0 0 7px;
    overflow: hidden;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.history-card small {
    display: block;
    margin-bottom: 10px;
    color: #827c90;
}

.history-card a {
    color: #523abd;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.history-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 24px;
    border: 1px dashed #d9d5e4;
    border-radius: 14px;
    color: #777181;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 560px) {
    body { padding: 14px; }
    .card {
        padding: 23px 18px;
        border-radius: 20px;
    }
    .top { gap: 12px; }
    .top h1 { font-size: 26px; }
    .steps {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding-bottom: 16px;
    }
    .steps span:last-child { grid-column: 1 / -1; }
    .form-section { padding: 18px; }
    .grid { grid-template-columns: 1fr; }
    .history-grid { grid-template-columns: 1fr; }
    .upload {
        align-items: flex-start;
        flex-direction: column;
    }
    .upload small {
        max-width: 100%;
        white-space: normal;
    }
}
