:root {
    --av-ink: #090a12;
    --av-ink-2: #11131f;
    --av-panel: rgba(15, 17, 29, 0.94);
    --av-panel-2: rgba(22, 25, 40, 0.94);
    --av-text: #fff8fb;
    --av-muted: rgba(255, 248, 251, 0.68);
    --av-faint: rgba(255, 248, 251, 0.46);
    --av-line: rgba(255, 255, 255, 0.12);
    --av-pink: #ff4f9a;
    --av-cyan: #28d8ff;
    --av-yellow: #ffd34f;
    --av-lime: #43f29b;
}

html,
body.av-page {
    min-height: 100%;
    background:
        linear-gradient(115deg, rgba(255, 79, 154, 0.14) 0 1px, transparent 1px 88px),
        linear-gradient(65deg, rgba(40, 216, 255, 0.12) 0 1px, transparent 1px 74px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 6px),
        linear-gradient(180deg, #141623 0%, #090a12 44%, #0d0f18 100%);
}

.av-shell {
    max-width: 1240px;
}

.av-main {
    padding-top: 16px;
    padding-bottom: 18px;
}

.av-studio {
    max-width: 1080px;
    margin: 0 auto;
}

.av-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 18px;
    overflow: hidden;
    min-height: 190px;
    padding: 16px;
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 79, 154, 0.2), transparent 34%),
        linear-gradient(315deg, rgba(40, 216, 255, 0.16), transparent 36%),
        var(--av-panel);
    color: var(--av-text);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

.av-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(112deg, transparent 0 16px, rgba(255, 255, 255, 0.045) 16px 17px),
        repeating-linear-gradient(90deg, transparent 0 44px, rgba(255, 211, 79, 0.09) 44px 46px);
    opacity: 0.65;
    pointer-events: none;
}

.av-hero::after {
    content: "01";
    position: absolute;
    right: 18px;
    bottom: 14px;
    color: rgba(255, 255, 255, 0.08);
    font-family: var(--font-family-display);
    font-size: 92px;
    font-weight: 900;
    line-height: 0.8;
    pointer-events: none;
}

.av-hero-copy {
    position: relative;
    z-index: 1;
    max-width: 780px;
    align-self: center;
}

.av-quick-cards {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 10px;
    align-self: center;
}

.av-quick-card {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    min-height: 96px;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(255, 79, 154, 0.42);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 79, 154, 0.2), rgba(40, 216, 255, 0.1)),
        rgba(255, 255, 255, 0.075);
    color: var(--av-text);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.av-tool-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    min-height: 86px;
    align-items: center;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(40, 216, 255, 0.42);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(40, 216, 255, 0.18), rgba(255, 211, 79, 0.1)),
        rgba(255, 255, 255, 0.075);
    color: var(--av-text);
    text-decoration: none;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.av-quick-card:hover,
.av-collection-card.has-items {
    border-color: var(--av-pink);
    background:
        linear-gradient(135deg, rgba(255, 79, 154, 0.28), rgba(40, 216, 255, 0.14)),
        rgba(255, 255, 255, 0.1);
    color: var(--av-text);
    text-decoration: none;
    transform: translateY(-1px);
}

.av-upscale-card {
    border-color: rgba(40, 216, 255, 0.42);
    background:
        linear-gradient(135deg, rgba(40, 216, 255, 0.18), rgba(255, 211, 79, 0.1)),
        rgba(255, 255, 255, 0.075);
}

.av-upscale-card:hover {
    border-color: var(--av-cyan);
    background:
        linear-gradient(135deg, rgba(40, 216, 255, 0.26), rgba(255, 211, 79, 0.14)),
        rgba(255, 255, 255, 0.1);
    color: var(--av-text);
    text-decoration: none;
    transform: translateY(-1px);
}

.av-quick-icon {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(8, 9, 18, 0.52);
    color: #ff92bf;
    font-size: 18px;
}

.av-upscale-card .av-quick-icon {
    color: var(--av-cyan);
}

.av-quick-copy strong,
.av-quick-copy small {
    display: block;
}

.av-quick-copy strong {
    color: var(--av-text);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
}

.av-quick-copy small {
    margin-top: 5px;
    color: var(--av-muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
}

.av-kicker,
.av-panel-kicker,
.av-result-kicker,
.av-modal-kicker {
    margin: 0 0 10px;
    color: var(--av-cyan);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.av-title {
    max-width: 760px;
    margin: 0;
    color: var(--av-text);
    font-family: var(--font-family-display);
    font-size: clamp(42px, 6.8vw, 86px);
    font-weight: 900;
    line-height: 0.84;
    letter-spacing: 0;
    text-shadow: 4px 4px 0 rgba(255, 79, 154, 0.24), -3px -3px 0 rgba(40, 216, 255, 0.16);
}

.av-subtitle {
    max-width: 540px;
    margin: 12px 0 0;
    color: var(--av-muted);
    font-size: 14px;
    line-height: 1.55;
}

.av-hero-tags {
    position: relative;
    z-index: 1;
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-self: end;
}

.av-hero-tags span {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--av-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--av-text);
    font-size: 11px;
    font-weight: 900;
}

.av-workspace {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 14px;
    margin-top: 14px;
    align-items: start;
}

.av-category-panel,
.av-result-section {
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background: var(--av-panel);
    color: var(--av-text);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

.av-category-panel {
    position: sticky;
    top: 88px;
    overflow: hidden;
    padding: 12px;
}

.av-category-panel::before,
.av-result-section::before {
    content: "";
    display: block;
    height: 4px;
    margin: -12px -12px 12px;
    background: linear-gradient(90deg, var(--av-pink), var(--av-yellow), var(--av-cyan), var(--av-lime));
}

.av-result-section::before {
    margin: 0;
}

.av-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.av-panel-head h2,
.av-result-label,
.av-result-empty h2,
.av-modal-header h2 {
    margin: 0;
    color: var(--av-text);
    font-family: var(--font-family-display);
    font-weight: 900;
    letter-spacing: 0;
}

.av-panel-head h2 {
    font-size: 24px;
    line-height: 1.05;
}

.av-panel-count {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--av-line);
    border-radius: 999px;
    color: var(--av-muted);
    font-size: 11px;
    font-weight: 900;
}

.av-cat-grid {
    display: grid;
    gap: 8px;
}

.cat-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 60px;
    padding: 9px;
    border: 1px solid var(--av-line);
    border-left: 4px solid var(--color, var(--av-pink));
    border-radius: 8px;
    background:
        linear-gradient(90deg, var(--colorSoft, rgba(255, 79, 154, 0.16)), transparent 74%),
        rgba(255, 255, 255, 0.045);
    color: var(--av-text);
    cursor: pointer;
    text-align: left;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.cat-card:hover,
.cat-card.active {
    border-color: var(--color, var(--av-pink));
    background:
        linear-gradient(90deg, var(--colorSoft, rgba(255, 79, 154, 0.2)), rgba(255, 255, 255, 0.04)),
        rgba(255, 255, 255, 0.08);
    transform: translateX(3px);
}

.cat-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background: rgba(9, 10, 18, 0.66);
    color: var(--color, var(--av-pink));
    font-size: 15px;
}

.cat-title {
    display: block;
    margin: 0;
    color: var(--av-text);
    font-size: 13px;
    font-weight: 900;
    line-height: 1.15;
}

.cat-desc {
    display: block;
    margin: 3px 0 0;
    color: var(--av-muted);
    font-size: 11px;
    line-height: 1.3;
}

.av-result-section {
    min-height: 0;
    overflow: hidden;
}

.av-result-empty {
    display: flex;
    min-height: 406px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 34px 24px;
    text-align: center;
}

.av-result-empty[hidden],
.av-result-live[hidden] {
    display: none !important;
}

.av-result-empty i {
    display: inline-flex;
    width: 54px;
    height: 54px;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255, 79, 154, 0.2), rgba(40, 216, 255, 0.16));
    color: #ffffff;
    font-size: 21px;
}

.av-result-empty h2 {
    max-width: 360px;
    font-size: 24px;
    line-height: 1.08;
}

.av-result-empty p {
    max-width: 370px;
    margin: 10px auto 0;
    color: var(--av-muted);
    font-size: 13px;
    line-height: 1.5;
}

.av-result-live {
    padding: 12px;
}

.av-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 0 10px;
}

.av-result-label {
    font-size: 22px;
    line-height: 1.05;
}

.av-btn-regen {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--av-text);
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.av-btn-regen:hover:not(:disabled) {
    border-color: var(--accent, var(--av-pink));
    background: rgba(255, 255, 255, 0.13);
}

.av-btn-regen:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.av-btn-regen.loading .btn-icon {
    animation: spin 0.8s linear infinite;
}

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

.av-result-card {
    position: relative;
    display: flex;
    height: clamp(330px, 54vh, 500px);
    min-height: 0;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background:
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 12px),
        #080912;
}

.av-result-card::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    pointer-events: none;
}

.skeleton {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.1) 48%, transparent 66%),
        linear-gradient(135deg, rgba(255, 79, 154, 0.18), rgba(40, 216, 255, 0.14)),
        #11131f;
    background-size: 200% 100%, auto, auto;
    animation: shimmer 1.35s infinite;
}

@keyframes shimmer {
    from {
        background-position: 200% 0, 0 0, 0 0;
    }
    to {
        background-position: -200% 0, 0 0, 0 0;
    }
}

.result-img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.result-img.loaded {
    opacity: 1;
}

.av-error {
    position: relative;
    z-index: 1;
    padding: 28px;
    color: var(--av-muted);
    text-align: center;
}

.av-error i {
    margin-bottom: 12px;
    color: #ff92bf;
    font-size: 28px;
}

.av-error p {
    margin: 0 0 14px;
}

.av-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.av-actions .btn,
.av-error .btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    font-weight: 900;
}

.btn--primary {
    border: 0;
    background: linear-gradient(90deg, var(--accent, var(--av-pink)), var(--av-cyan));
    color: #080912;
}

.btn--primary:hover {
    filter: brightness(1.06);
}

.btn--outline {
    border: 1px solid var(--av-line);
    background: rgba(255, 255, 255, 0.07);
    color: var(--av-text);
}

.av-btn-fav.active {
    border-color: rgba(255, 79, 154, 0.72);
    background: rgba(255, 79, 154, 0.18);
    color: #ff92bf;
}

.av-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.66);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.av-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.av-modal-content {
    display: flex;
    width: min(820px, 100%);
    max-height: 86vh;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 9px),
        #11131f;
    color: var(--av-text);
    transform: translateY(14px);
    transition: transform 220ms ease;
}

.av-modal.show .av-modal-content {
    transform: translateY(0);
}

.av-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--av-line);
}

.av-modal-header h2 {
    font-size: 24px;
}

.av-btn-close {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--av-text);
}

.av-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.av-fav-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.av-fav-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background: #080912;
}

.av-fav-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.av-fav-download,
.av-fav-delete {
    position: absolute;
    top: 8px;
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(8, 9, 18, 0.72);
    color: #ffffff;
    backdrop-filter: blur(10px);
}

.av-fav-download {
    left: 8px;
}

.av-fav-delete {
    right: 8px;
    color: #ff92bf;
}

.av-fav-download:hover,
.av-fav-delete:hover {
    background: rgba(255, 255, 255, 0.15);
}

.av-fav-label {
    position: absolute;
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(8, 9, 18, 0.76);
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    backdrop-filter: blur(10px);
}

.av-empty-state {
    padding: 48px 18px;
    color: var(--av-muted);
    text-align: center;
}

.av-empty-state i {
    margin-bottom: 14px;
    color: var(--av-cyan);
    font-size: 34px;
}

.av-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 2000;
    min-width: 220px;
    max-width: calc(100vw - 32px);
    padding: 12px 16px;
    border: 1px solid var(--av-line);
    border-radius: 999px;
    background: #11131f;
    color: var(--av-text);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    opacity: 0;
    transform: translateX(-50%) translateY(24px);
    transition: opacity 220ms ease, transform 220ms ease;
}

.av-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.av-footer {
    max-width: 1080px;
    margin: 14px auto 20px;
}

.av-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--av-line);
    border-radius: 8px;
    background: var(--av-panel);
    color: var(--av-text);
}

.av-footer strong,
.av-footer span {
    display: block;
}

.av-footer strong {
    font-size: 14px;
    font-weight: 900;
}

.av-footer span {
    margin-top: 4px;
    color: var(--av-muted);
    font-size: 12px;
}

.av-footer nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.av-footer a {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--av-line);
    border-radius: 999px;
    color: var(--av-muted);
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.av-footer a:hover {
    border-color: var(--av-pink);
    color: var(--av-text);
    text-decoration: none;
}

@media (max-width: 980px) {
    .av-hero {
        grid-template-columns: 1fr;
    }

    .av-workspace {
        grid-template-columns: 1fr;
    }

    .av-category-panel {
        position: static;
    }

    .av-cat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .av-fav-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .av-main {
        padding-top: 12px;
    }

    .av-hero {
        min-height: 0;
        padding: 14px;
    }

    .av-title {
        font-size: 42px;
    }

    .av-subtitle {
        font-size: 14px;
    }

    .av-hero-tags {
        margin-top: 18px;
    }

    .av-quick-cards {
        margin-top: 18px;
    }

    .av-cat-grid {
        grid-template-columns: 1fr;
    }

    .av-result-empty {
        min-height: 320px;
    }

    .av-result-card {
        height: 310px;
    }

    .av-actions {
        grid-template-columns: 1fr;
    }

    .av-fav-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .av-footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .av-footer nav {
        justify-content: flex-start;
    }
}
