:root {
    --ink: #292440;
    --muted: #5e5573;
    --accent: #6547ad;
    --surface: #fff8fe;
    --lavender: #ebdfff;
    --pink: #f8dce9;
    --mint: #d5f2eb;
    --motion: 300ms cubic-bezier(0.2, 0.85, 0.3, 1.25);
    --field-border: 1px solid rgb(97 73 146 / 23%);
    --shadow: 0 12px 36px rgb(73 49 125 / 12%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background:
        radial-gradient(ellipse at 9% 14%, #f9cde5, transparent 47%),
        radial-gradient(ellipse at 88% 25%, #d6c7fc, transparent 49%),
        radial-gradient(ellipse at 85% 83%, #bcf1e7, transparent 48%),
        #eef0fe;
    background-attachment: fixed;
    color: var(--ink);
    font-family: 'Outfit', 'Malgun Gothic', sans-serif;
    min-height: 100vh;
    padding: clamp(2rem, 5vw, 4rem) 1rem;
}

.container {
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem;
    padding: clamp(1.5rem, 5vw, 3.25rem);
    background: var(--lavender);
    border-radius: 2rem 2rem 5rem 2rem;
}

header h1 {
    font-size: clamp(2.15rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.06em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

header h1 span {
    color: var(--accent);
}

header p {
    color: var(--muted);
    font-size: clamp(0.95rem, 2vw, 1.15rem);
}

.creator-badge,
.preview-badge {
    display: inline-block;
    background: var(--surface);
    border-radius: 100px;
    color: var(--accent);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.creator-badge {
    margin-bottom: 1rem;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1.5rem;
    padding: 0.85rem 1.15rem;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    transition: border-radius var(--motion), background-color 180ms ease;
    font-weight: 700;
    text-decoration: none;
}

.hero-cta:hover {
    background: #51338e;
    border-radius: 1rem;
}

.hero-art {
    position: relative;
    display: grid;
    place-items: center;
    isolation: isolate;
    width: clamp(9rem, 26vw, 17rem);
}

.hero-art::before {
    content: "";
    position: absolute;
    inset: 5%;
    z-index: -1;
    background: var(--pink);
    border-radius: 42% 58% 57% 43% / 48% 45% 55% 52%;
    transform: rotate(-14deg);
}

.hero-sticker {
    position: absolute;
    right: 0;
    bottom: 10%;
    padding: 0.4rem 0.85rem;
    background: var(--mint);
    border-radius: 46% 54% 39% 61%;
    color: #215e52;
    font-weight: 800;
    transform: rotate(10deg);
}

.hero-art img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 17rem;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.guide-step,
.generator-card,
.slide-card,
footer {
    background: var(--surface);
}

.visual-guide {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 0.85rem;
}

.guide-step {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-radius: 1.25rem;
    padding: 0.95rem;
}

.step-icon {
    display: grid;
    place-items: center;
    flex: 0 0 2.65rem;
    height: 2.65rem;
    border-radius: 0.8rem;
    background: #ebdfff;
    color: var(--accent);
    font-size: 1.1rem;
}

.guide-step:nth-child(3) .step-icon {
    background: #f8dce9;
    color: #8c4165;
}

.guide-step:nth-child(5) .step-icon {
    background: #d5f2eb;
    color: #27695d;
}

.step-text h3 {
    font-size: 1rem;
}

.step-text p {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.guide-arrow {
    color: var(--accent);
    font-size: 0.75rem;
}

.generator-card {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    border-radius: 1.75rem;
    overflow: hidden;
}

.config-panel,
.preview-panel {
    padding: clamp(1.25rem, 4vw, 2.5rem);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.preview-panel {
    background: var(--mint);
    justify-content: center;
    align-items: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label,
.short-url-box label {
    font-size: 0.9rem;
    font-weight: 700;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.input-wrapper i {
    position: absolute;
    left: 0.9rem;
    color: var(--accent);
    pointer-events: none;
}

.input-wrapper-row {
    display: flex;
    gap: 0.65rem;
    align-items: stretch;
}

input,
select,
button {
    color: inherit;
    font: inherit;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
.hero-cta:focus-visible,
.home-cta:focus-visible,
.slide-presets input:focus-visible + label,
#qr-text:target {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input[type="text"],
input[type="color"],
select,
.file-input {
    width: 100%;
    min-width: 0;
    padding: 0.8rem;
    background: rgb(255 255 255 / 75%);
    border: var(--field-border);
    border-radius: 0.8rem;
}

input.input-large {
    padding-left: 2.5rem;
    scroll-margin-top: 2rem;
}

.file-input,
.short-url-input {
    flex: 1;
}

.file-input {
    font-size: 0.85rem;
}

.file-input::file-selector-button {
    background: #eee5fc;
    border: 0;
    border-radius: 0.5rem;
    color: var(--accent);
    font: inherit;
    font-weight: 700;
    margin-right: 0.55rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
}

select,
input[type="color"] {
    cursor: pointer;
}

input[type="color"] {
    height: 2.9rem;
    padding: 0.35rem;
}

.secondary-btn,
.primary-btn {
    border: 0;
    border-radius: 1.5rem;
    cursor: pointer;
    font-weight: 700;
    transition: border-radius var(--motion), transform var(--motion);
}

.primary-btn:disabled {
    cursor: default;
    opacity: 0.65;
    transform: none;
    box-shadow: none;
}

.scan-check {
    width: min(100%, 24rem);
    display: grid;
    gap: 0.7rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 1.75rem 1.75rem 1.75rem 0.85rem;
}

.scan-heading {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.scan-heading img {
    object-fit: cover;
    object-position: center 12%;
    border-radius: 50%;
    background: #f3eaff;
}

.scan-heading h2 {
    font-size: 1rem;
    margin-top: 0.35rem;
}

.paper-sticker {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 0.4rem;
    background: #ffe7a5;
    color: #654318;
    box-shadow: 0 2px 0 #e9c87a;
    font-size: 0.78rem;
    font-weight: 800;
    transform: rotate(-3deg);
}

.scan-check p,
.slide-controls p {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.scan-check p[data-result="pass"] {
    background: var(--mint);
    color: #215e52;
    padding: 0.6rem 0.8rem;
    border-radius: 1rem;
    animation: scan-pop var(--motion);
}

@keyframes scan-pop {
    from { transform: scale(0.94); }
    to { transform: scale(1); }
}

.scan-check p[data-result="fail"],
#slide-status {
    color: #843b5b;
}

.slide-card {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    align-items: center;
    gap: 1.5rem;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    border-radius: 1.75rem;
}

.slide-controls {
    display: grid;
    gap: 0.75rem;
    justify-items: start;
}

.slide-presets {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
    border: 0;
}

.slide-presets legend {
    margin-bottom: 0.45rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.slide-presets input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.slide-presets label {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.5rem 0.7rem;
    background: var(--lavender);
    border-radius: 0.65rem;
    color: #50338a;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-radius var(--motion), background-color 180ms ease;
}

.slide-presets input:checked + label {
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
}

.home-cta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    background: var(--pink);
    color: #682b51;
    border-radius: 1.25rem 1.25rem 2.25rem 1.25rem;
    text-decoration: none;
}

.home-cta small,
.home-cta strong {
    display: block;
}

.home-cta:hover strong {
    text-decoration: underline;
}

#slide-status:empty {
    display: none;
}

#slide-preview {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 1.5rem;
    background: #eee5fc;
    box-shadow: var(--shadow);
}

.secondary-btn {
    padding: 0.65rem 0.85rem;
    background: #e9dfff;
    color: #50338a;
    font-size: 0.85rem;
    white-space: nowrap;
}

.secondary-btn.danger {
    background: #f9e0ea;
    color: #843b5b;
}

.copy-btn {
    background: #d6f2e9;
    color: #215e52;
}

.copy-btn.copied {
    background: #bde9db;
}

.secondary-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.secondary-btn:hover:not(:disabled),
.primary-btn:hover {
    border-radius: 1rem;
}

.secondary-btn:active:not(:disabled),
.primary-btn:active {
    transform: scale(0.98);
}

.short-url-box {
    background: #def8f1;
    border-radius: 1rem;
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
}

.short-url-box:not([hidden]) {
    display: flex;
}

#shorten-status {
    color: #843b5b;
    font-size: 0.9rem;
}

#shorten-status:empty {
    display: none;
}

.short-url-input {
    color: var(--accent);
}

.customization-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.download-config {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: var(--field-border);
}

.primary-btn {
    width: 100%;
    padding: 1rem;
    background: var(--accent);
    color: #fff;
    font-size: 1.05rem;
}

#canvas-container {
    max-width: 100%;
    background: #fff;
    padding: 1rem;
    border-radius: 1.25rem;
    box-shadow: var(--shadow);
}

#canvas-container svg {
    display: block;
    max-width: 100%;
    height: auto;
}

footer {
    border-radius: 1.25rem;
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.6;
}

footer p:first-child {
    color: var(--ink);
    font-weight: 700;
}

@media (max-width: 760px) {
    .generator-card,
    .slide-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    header {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .hero-art {
        width: 10rem;
    }

    .visual-guide {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .guide-arrow {
        display: none;
    }

    .guide-step {
        padding: 0.65rem 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-cta,
    .secondary-btn,
    .primary-btn,
    .slide-presets label,
    .scan-check p[data-result="pass"] {
        animation: none;
        transition: none;
    }
}
