*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    color: #ffffff;
    background-color: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("src/bkg.jpg") center / cover no-repeat;
    filter: blur(12px);
    transform: scale(1.08);
    z-index: -3;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(163, 76, 255, 0.28), transparent 55%),
        radial-gradient(circle at 78% 22%, rgba(63, 147, 255, 0.22), transparent 58%),
        rgba(8, 8, 16, 0.78);
    z-index: -1;
}

#particleCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.85;
}

.app-shell {
    width: min(920px, 96vw);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6vh 0;
    transition: filter 0.7s ease;
}

.app-shell.blurred {
    filter: blur(18px);
    pointer-events: none;
}

.hero {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    align-items: center;
}

.brand-title {
    font-family: "Audiowide", serif;
    font-weight: 400;
    font-size: clamp(3rem, 10vw, 8rem);
    margin: 0;
    color: #e2e2e2;
    text-shadow:
        0 0 5px rgba(255, 255, 255, 0.6),
        0 0 10px rgba(255, 255, 255, 0.4),
        0 0 15px rgba(255, 255, 255, 0.2),
        0 0 20px rgba(255, 255, 255, 0.12);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.35s ease-out, transform 1.35s ease-out;
}

.brand-title.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.brand-title.is-glow {
    animation: titleGlow 7.2s ease-in-out infinite alternate;
}

.edition-tag {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.edition-tag.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.cta-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.95rem 1.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
    background: linear-gradient(135deg, #ffffff, #dfe7ff);
    color: #0d0f1a;
    box-shadow:
        0 8px 30px rgba(255, 255, 255, 0.18),
        0 2px 10px rgba(0, 0, 0, 0.28);
}

.action-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow:
        0 10px 40px rgba(255, 255, 255, 0.22),
        0 4px 18px rgba(0, 0, 0, 0.32);
    border-color: rgba(255, 255, 255, 0.3);
}

.action-btn:active {
    transform: translateY(0);
}

.upload-btn {
    color: #0d0f1a;
}

.download-btn {
    margin-top: 1.1rem;
    background: linear-gradient(135deg, #0f172a, #1f2b4a);
    color: #e9eeff;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 30px rgba(27, 42, 82, 0.6),
        0 2px 12px rgba(0, 0, 0, 0.4);
}

.download-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 1.2rem;
    height: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.error-message {
    min-height: 1.2em;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #ff7b7b;
    text-shadow: 0 0 20px rgba(255, 88, 88, 0.4);
}

.processing {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.3rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 10px 34px rgba(0, 0, 0, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.processing-ring {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    animation: spin 1s linear infinite;
}

.processing-text {
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
}

.result-panel {
    width: min(520px, 86vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.result-panel.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.result-frame {
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 26px;
    padding: 1rem;
    box-shadow:
        0 14px 44px rgba(0, 0, 0, 0.42),
        0 0 18px rgba(255, 255, 255, 0.16);
}

.result-frame img {
    display: block;
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
    background: #0b0b0f;
}

.is-hidden {
    display: none !important;
}

.preloader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 6, 12, 0.78);
    backdrop-filter: blur(18px);
    z-index: 12;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
}

.preloader-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.16);
    border-top-color: #ffffff;
    animation: spin 1s linear infinite;
}

.preloader-percent {
    font-size: 1.2rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

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

@keyframes titleGlow {
    0% {
        text-shadow:
            0 0 5px rgba(255, 255, 255, 0.6),
            0 0 10px rgba(255, 255, 255, 0.4),
            0 0 15px rgba(255, 255, 255, 0.2),
            0 0 20px rgba(255, 255, 255, 0.12);
    }
    100% {
        text-shadow:
            0 0 12px rgba(255, 255, 255, 0.8),
            0 0 22px rgba(163, 76, 255, 0.6),
            0 0 36px rgba(163, 76, 255, 0.32),
            0 0 42px rgba(163, 76, 255, 0.25);
    }
}

@media (max-width: 720px) {
    .hero {
        gap: 1.6rem;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .result-panel {
        width: 100%;
    }
}
