﻿:root {
    --bg: #0B0C10;
    --bg2: #14161C;
    --bg3: #1E2128;
    --fg: #ECF0F3;
    --txt2: #B0B8C5;
    --txt3: #6F7A8C;
    --gold: #F0B429;
    --gold-dim: #DAA520;
    --red: #F87171;
    --green: #6EE7B7;
    --bdr: #2D323C;
    --bdrl: #3A3F4B;
    --accent: #F0B429;
    --accent-dim: #C29217;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    padding: 0 16px 10px;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 7px;
    border-bottom: 1px solid var(--bdr);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.brand {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fg);
}

.bdot {
    width: 14px;
    height: 14px;
    background: var(--gold);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--gold-dim);
}

.topbar-r {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tsel {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    color: var(--fg);
    padding: 6px 8px;
    border-radius: 30px;
    outline: none;
}

    .tsel:focus {
        border-color: var(--gold);
    }

.tpill {
    background: var(--bg3);
    padding: 4px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold);
    border: 1px solid var(--bdrl);
    letter-spacing: 0.3px;
}

/* Key strip */
.kstrip {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    border-radius: 30px;
    padding: 16px 18px;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.kstrip-title {
    font-weight: 700;
    font-size: 0.95rem;
}

    .kstrip-title small {
        display: block;
        font-weight: 400;
        color: var(--txt3);
        font-size: 0.7rem;
    }

.kslots {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex: 2;
    min-width: 280px;
}

.kslot {
    display: flex;
    align-items: center;
    background: var(--bg3);
    border-radius: 40px;
    padding: 4px 8px 4px 4px;
    border: 1px solid var(--bdrl);
    gap: 6px;
}

.sdot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

    .sdot.d-ok {
        background: var(--green);
        box-shadow: 0 0 6px var(--green);
    }

    .sdot.d-active {
        background: var(--gold);
        box-shadow: 0 0 10px var(--gold);
    }

    .sdot.d-exhaust {
        background: var(--red);
    }

.snum {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--txt2);
    min-width: 16px;
    text-align: center;
}

.sinput {
    background: transparent;
    border: none;
    color: var(--fg);
    font-family: monospace;
    font-size: 0.7rem;
    width: 130px;
    outline: none;
    padding: 4px 0;
}

.suses {
    font-size: 0.65rem;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 20px;
    color: var(--txt2);
    white-space: nowrap;
}

.sbadge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    background: var(--bg2);
}

.sb-active {
    color: var(--gold);
}

.sb-ok {
    color: var(--green);
}

.sb-exhaust {
    color: var(--red);
}

.srmv {
    background: transparent;
    border: none;
    color: var(--txt3);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

    .srmv:hover {
        color: var(--red);
    }

.btn-addkey {
    background: var(--bg3);
    border: 1px dashed var(--bdrl);
    color: var(--gold);
    padding: 6px 16px;
    border-radius: 40px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.kstats {
    background: var(--bg);
    border-radius: 40px;
    padding: 8px 18px;
    min-width: 220px;
}

.ksrow {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin: 2px 0;
}

.kslbl {
    color: var(--txt3);
}

.ksval {
    font-weight: 700;
}

.vgold {
    color: var(--gold);
}

.vg {
    color: var(--green);
}

.vr {
    color: var(--red);
}

.pbar {
    height: 4px;
    background: var(--bdr);
    border-radius: 4px;
    margin-top: 6px;
    overflow: hidden;
}

.pfill {
    height: 100%;
    background: var(--gold);
    transition: width 0.2s;
}

.rotbadge {
    font-size: 0.7rem;
    background: var(--bg3);
    padding: 5px 12px;
    border-radius: 30px;
    border: 1px solid var(--bdrl);
    color: var(--txt2);
    white-space: nowrap;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--bdr);
    padding-bottom: 8px;
    flex-shrink: 0;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--txt3);
    font-weight: 700;
    font-size: 0.88rem;
    padding: 4px 14px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.15s;
}

    .tab-btn.active {
        background: var(--bg2);
        color: var(--gold);
        border: 1px solid var(--bdrl);
    }

.tab-content {
    display: none;
}

    .tab-content.active {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

/* Workspace */
.workspace {
    display: flex;
    gap: 24px;
    flex-wrap: nowrap;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.left-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--bg2);
    border-radius: 24px;
    padding: 14px 12px;
    border: 1px solid var(--bdr);
    overflow-y: auto;
    min-height: 0;
}

.right-panel {
    flex: 1;
    min-width: 0;
    background: var(--bg2);
    border-radius: 24px;
    border: 1px solid var(--bdr);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.sec {
    margin-bottom: 14px;
}

.sec-h {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.sn {
    background: var(--bg3);
    color: var(--gold);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    border: 1px solid var(--bdrl);
    flex-shrink: 0;
}

.st {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--txt2);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.sb {
    padding-left: 4px;
}

/* Dropzone */
.dz {
    background: var(--bg3);
    border: 2px dashed var(--bdrl);
    border-radius: 18px;
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    position: relative;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}

    .dz.over {
        border-color: var(--gold);
        background: var(--bg);
    }

.dz-ico {
    font-size: 3rem;
    margin-bottom: 6px;
}

.dz-lbl {
    font-weight: 700;
    font-size: 0.9rem;
}

.dz-hint {
    font-size: 0.7rem;
    color: var(--txt3);
}

.dz.has-img {
    padding: 8px;
}

.dz img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 16px;
}

.dz-rm {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg);
    border: 1px solid var(--red);
    color: var(--red);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form controls */
.fc {
    background: var(--bg3);
    border: 1px solid var(--bdr);
    color: var(--fg);
    padding: 6px 10px;
    border-radius: 30px;
    width: 100%;
    font-size: 0.82rem;
    outline: none;
}

    .fc:focus {
        border-color: var(--gold);
    }

/* Category pills */
.cpills {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.cpill {
    background: var(--bg3);
    border: 1px solid var(--bdr);
    padding: 4px 11px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.1s;
}

    .cpill.active {
        background: var(--gold);
        color: var(--bg);
        border-color: var(--gold);
    }

/* Model grid */
.mgrid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.mcard {
    background: var(--bg3);
    border: 1px solid var(--bdr);
    border-radius: 30px;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.72rem;
    transition: 0.1s;
}

    .mcard.sel {
        border-color: var(--gold);
        background: rgba(240, 180, 41, 0.1);
    }

.mi {
    font-size: 0.9rem;
}

/* Ratio buttons */
.rrow {
    display: flex;
    gap: 5px;
}

.rbtn {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--bdr);
    border-radius: 30px;
    padding: 5px 0;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

    .rbtn small {
        font-size: 0.6rem;
        font-weight: 400;
        color: var(--txt3);
    }

    .rbtn.active {
        border-color: var(--gold);
        color: var(--gold);
    }

/* Generate button */
.btn-gen {
    background: var(--gold);
    color: var(--bg);
    border: none;
    width: 100%;
    padding: 10px 0;
    border-radius: 60px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.15s;
    margin-top: 10px;
    flex-shrink: 0;
}

    .btn-gen:hover {
        background: var(--gold-dim);
    }

/* Right panel states */
.rstate {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    flex: 1;
    min-height: 0;
}

    .rstate.vis {
        display: flex;
    }

.sico {
    font-size: 3.2rem;
    margin-bottom: 10px;
}

.stit {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.ssub {
    color: var(--txt3);
    max-width: 280px;
    margin-bottom: 14px;
    font-size: 0.85rem;
}

.tagwrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 300px;
}

.tag {
    background: var(--bg3);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    color: var(--txt2);
    border: 1px solid var(--bdr);
}

/* Loading */
.ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bdr);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.lsteps {
    margin: 10px 0;
    width: 100%;
    max-width: 280px;
}

.ls {
    padding: 8px 16px;
    border-left: 2px solid var(--bdr);
    font-size: 0.85rem;
    color: var(--txt3);
    position: relative;
}

    .ls.active {
        color: var(--gold);
        border-left-color: var(--gold);
    }

    .ls.done {
        color: var(--green);
        border-left-color: var(--green);
    }

.kswitched {
    background: rgba(240, 180, 41, 0.1);
    border: 1px solid var(--gold);
    border-radius: 30px;
    padding: 8px 16px;
    font-size: 0.75rem;
    display: none;
}

/* Result area */
.result-wrap {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.rbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.rlbl {
    font-weight: 700;
    font-size: 1.1rem;
}

.rkbadge {
    background: var(--bg3);
    padding: 2px 10px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 400;
    margin-left: 10px;
    color: var(--txt2);
}

.rbts {
    display: flex;
    gap: 8px;
}

.rbt {
    background: transparent;
    border: 1px solid var(--bdr);
    color: var(--txt2);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.rbt-s {
    background: var(--gold);
    color: var(--bg);
    border: none;
}

.rbt-vid {
    border-color: var(--gold);
    color: var(--gold);
}

/* FTP upload button */
.rbt-ftp {
    border-color: #2ea44f;
    color: #2ea44f;
    background: transparent;
}
.rbt-ftp:hover:not(:disabled) {
    background: #2ea44f;
    color: #fff;
}
.rbt-ftp:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* FTP status bar (below the result action bar) */
.ftp-status-bar {
    font-size: .72rem;
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--bg3);
    border: 1px solid var(--bdr);
    margin: 0 0 10px;
    color: var(--txt2);
}
.ftp-status-bar.ftp-ok  { border-color: #2ea44f; color: #2ea44f; background: rgba(46,164,79,.08); }
.ftp-status-bar.ftp-err { border-color: #e74c3c; color: #e74c3c; background: rgba(231,76,60,.08); }

.rimg-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg3);
    border-radius: 18px;
    padding: 12px;
    min-height: 0;
    overflow: hidden;
}

.rimg {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    object-fit: contain;
}

/* ── Back-view result panel ─────────────────────────────────────────────── */
.back-result {
    margin-top: 10px;
    border-top: 1px solid var(--bdr);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.back-result-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.back-result-title {
    font-size: .72rem;
    font-weight: 700;
    color: var(--txt2);
    text-transform: uppercase;
    letter-spacing: .07em;
    flex-shrink: 0;
}

.back-result-ring {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid var(--acc);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.back-result-status {
    font-size: .72rem;
    color: var(--txt3);
    flex: 1;
}

.back-rimg-area {
    flex: none;
    min-height: 160px;
    max-height: 380px;
}

/* ── /Back-view result panel ────────────────────────────────────────────── */

.cmpgrid {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: var(--bg3);
    border-radius: 18px;
    padding: 16px;
}

.cgcol {
    display: flex;
    flex-direction: column;
}

.cglbl {
    font-size: 0.75rem;
    color: var(--txt3);
    margin-bottom: 8px;
    text-align: center;
}

.cgcol img {
    width: 100%;
    border-radius: 12px;
}

.pdtl {
    margin-top: 8px;
    flex-shrink: 0;
    color: var(--txt3);
    font-size: 0.72rem;
}

    .pdtl pre {
        background: var(--bg3);
        padding: 12px;
        border-radius: 12px;
        margin-top: 8px;
        font-size: 0.7rem;
        color: var(--txt2);
        white-space: pre-wrap;
    }

/* Video panel */
.vid-panel {
    border-top: 1px solid var(--bdr);
    margin-top: 20px;
    padding-top: 16px;
    display: none;
}

    .vid-panel.open {
        display: block;
    }

.vid-panel-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.vid-panel-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vico {
    font-size: 1.3rem;
}

.vid-title-badge {
    background: var(--bg3);
    padding: 2px 8px;
    border-radius: 30px;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--txt2);
}

.vid-panel-close {
    background: transparent;
    border: 1px solid var(--bdr);
    color: var(--txt3);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
}

.vid-body {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.vid-settings {
    width: 240px;
}

.vg-lbl {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--txt2);
    margin-bottom: 6px;
}

.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.pchip {
    background: var(--bg3);
    border: 1px solid var(--bdr);
    border-radius: 30px;
    padding: 6px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

    .pchip.active {
        border-color: var(--gold);
        color: var(--gold);
    }

.vid-sel {
    background: var(--bg3);
    border: 1px solid var(--bdr);
    color: var(--fg);
    padding: 6px 12px;
    border-radius: 30px;
    width: 100%;
    margin-bottom: 16px;
}

.fx-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.fxtog {
    background: var(--bg3);
    border: 1px solid var(--bdr);
    border-radius: 30px;
    padding: 6px 10px;
    font-size: 0.7rem;
    cursor: pointer;
}

    .fxtog.on {
        background: var(--gold);
        color: var(--bg);
        border-color: var(--gold);
    }

.vid-slider-row {
    margin-bottom: 16px;
}

.slider-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.slider-val {
    font-size: 0.7rem;
    color: var(--gold);
}

.vslider {
    width: 100%;
    background: var(--bg3);
    height: 4px;
    border-radius: 2px;
    -webkit-appearance: none;
}

    .vslider::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 16px;
        height: 16px;
        background: var(--gold);
        border-radius: 50%;
        cursor: pointer;
    }

.btn-create-vid {
    background: var(--gold);
    color: var(--bg);
    border: none;
    padding: 12px 0;
    border-radius: 30px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    margin-top: 8px;
}

.vid-preview {
    flex: 1;
    min-width: 280px;
}

.canvas-wrap {
    background: var(--bg3);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    justify-content: center;
}

#vidCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: #000;
}

.vid-meta {
    text-align: center;
    font-size: 0.7rem;
    color: var(--txt3);
    margin: 8px 0;
}

.vid-status-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vid-prog-wrap {
    height: 4px;
    background: var(--bdr);
    border-radius: 4px;
    display: none;
}

.vid-prog-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 4px;
    width: 0%;
}

.vid-status-txt {
    font-size: 0.8rem;
    color: var(--txt2);
    text-align: center;
}

.btn-dl-vid {
    background: var(--bg3);
    border: 1px solid var(--gold);
    color: var(--gold);
    text-decoration: none;
    padding: 8px 0;
    border-radius: 30px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    display: none;
}

    .btn-dl-vid.ready {
        display: block;
    }

/* Batch */
.mg-dropzone {
    background: var(--bg3);
    border: 2px dashed var(--bdrl);
    border-radius: 24px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
}

.mg-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.mg-thumb {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--bdr);
}

    .mg-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.mg-rm {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.7);
    color: var(--red);
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-add {
    width: 60px;
    height: 60px;
    border: 1px dashed var(--bdr);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--txt3);
    cursor: pointer;
}

.mg-count {
    font-size: 0.8rem;
    margin-top: 8px;
}

.bml {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--bdr);
    border-radius: 16px;
    padding: 8px;
    margin-bottom: 12px;
}

.bmlrow {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
    cursor: pointer;
}

.bquick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bqbtn {
    background: var(--bg3);
    border: 1px solid var(--bdr);
    color: var(--txt2);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    cursor: pointer;
}

.bprog {
    height: 6px;
    background: var(--bdr);
    border-radius: 6px;
    margin: 12px 0 6px;
    display: none;
}

.bprog-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 6px;
    width: 0%;
    transition: width 0.2s;
}

.bprog-txt {
    font-size: 0.7rem;
    color: var(--txt3);
    text-align: center;
    display: none;
}

.batch-result-area {
    display: none;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    padding: 16px 0;
}

.bcard {
    width: 160px;
    background: var(--bg3);
    border: 1px solid var(--bdr);
    border-radius: 20px;
    padding: 12px;
    position: relative;
}

    .bcard img {
        width: 100%;
        border-radius: 12px;
        margin-bottom: 8px;
    }

.bcard-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
}

.bcard-name {
    color: var(--txt2);
}

.bcard-dl {
    background: var(--gold);
    color: var(--bg);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
}

.bcard-vid-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--gold);
    border: none;
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 0.6rem;
    cursor: pointer;
}

.bcard-err {
    width: 160px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid var(--red);
    border-radius: 20px;
    padding: 20px 8px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--red);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg3);
    border: 1px solid var(--gold);
    border-radius: 60px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    opacity: 0;
    transition: 0.3s;
    z-index: 1000;
    min-width: 280px;
}

    .toast.show {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

.toast-ico {
    font-size: 1.4rem;
}

.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
}

.toast-msg {
    font-size: 0.75rem;
    color: var(--txt2);
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--txt3);
    cursor: pointer;
    margin-left: auto;
}

/* Dead overlay */
.dead-ov {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    display: none;
}

    .dead-ov.show {
        display: flex;
    }

.dead-box {
    background: var(--bg2);
    border: 1px solid var(--red);
    border-radius: 40px;
    padding: 40px;
    max-width: 400px;
    text-align: center;
}

.dead-ico {
    font-size: 4rem;
    margin-bottom: 16px;
}

.dead-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--red);
}

.dead-msg {
    color: var(--txt2);
    margin-bottom: 30px;
    line-height: 1.6;
}

.dead-acts {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-dreset, .btn-dclose {
    padding: 10px 24px;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-dreset {
    background: var(--gold);
    color: var(--bg);
}

.btn-dclose {
    background: var(--bg3);
    color: var(--txt2);
    border: 1px solid var(--bdr);
}

/* ── Generate button disabled state ─────────────────────────────── */
.btn-gen:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── App Loading Modal ───────────────────────────────────────────── */
.app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 10, 14, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .4s ease;
}
.app-loading-overlay.app-loading-done {
    opacity: 0;
    pointer-events: none;
}

.app-loading-card {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    border-radius: 28px;
    padding: 48px 52px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: 0 32px 80px rgba(0,0,0,.55);
    min-width: 320px;
    text-align: center;
}

.app-loading-logo {
    font-size: 2.4rem;
    color: var(--gold);
    line-height: 1;
    animation: pulse-logo 1.8s ease-in-out infinite;
}
@keyframes pulse-logo {
    0%,100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .6; transform: scale(.92); }
}

.app-loading-ring {
    width: 44px;
    height: 44px;
    border: 3px solid var(--bdr);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.app-loading-title {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--txt1);
    letter-spacing: .01em;
}

.app-loading-sub {
    font-size: .78rem;
    color: var(--txt3);
    min-height: 1.2em;
    transition: color .3s;
}

.app-loading-dots {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.app-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    opacity: .3;
    animation: dot-pulse 1.2s ease-in-out infinite;
}
.app-loading-dots span:nth-child(2) { animation-delay: .2s; }
.app-loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot-pulse {
    0%,100% { opacity: .3; transform: scale(1); }
    50%      { opacity: 1;  transform: scale(1.3); }
}

/* ── Delete Confirmation Modal ───────────────────────────────────── */
.confirm-ov {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    animation: confirm-fade-in .18s ease;
}
.confirm-ov.show { display: flex; }
@keyframes confirm-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.confirm-box {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    border-radius: 26px;
    padding: 32px 36px 28px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,.55);
    animation: confirm-slide-up .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes confirm-slide-up {
    from { opacity: 0; transform: translateY(18px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-thumb-wrap {
    width: 100px;
    height: 128px;
    margin: 0 auto 18px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--bdr);
    background: var(--bg3);
}
.confirm-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.confirm-ico {
    font-size: 2rem;
    margin-bottom: 8px;
    line-height: 1;
}

.confirm-title {
    font-size: 1.22rem;
    font-weight: 800;
    color: var(--txt1);
    margin-bottom: 10px;
}

.confirm-msg {
    font-size: .78rem;
    color: var(--txt3);
    line-height: 1.6;
    margin-bottom: 24px;
}
.confirm-msg strong { color: #e74c3c; }

.confirm-acts {
    display: flex;
    gap: 10px;
}

.btn-confirm-cancel,
.btn-confirm-delete {
    flex: 1;
    padding: 10px 0;
    border-radius: 40px;
    font-size: .84rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    border: none;
}
.btn-confirm-cancel:hover { opacity: .8; }
.btn-confirm-delete:hover { opacity: .88; }
.btn-confirm-cancel:active,
.btn-confirm-delete:active { transform: scale(.97); }

.btn-confirm-cancel {
    background: var(--bg3);
    color: var(--txt2);
    border: 1px solid var(--bdr);
}

.btn-confirm-delete {
    background: #c0392b;
    color: #fff;
}
.btn-confirm-delete.deleting {
    opacity: .55;
    pointer-events: none;
}

.akind {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg3);
    padding: 5px 10px;
    border-radius: 40px;
    margin-top: 6px;
    flex-shrink: 0;
    font-size: 0.78rem;
}

.akdot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
}

.akkey {
    font-family: monospace;
    color: var(--gold);
}

/* ── Garment front / back views ── */
.garment-views {
    display: flex;
    gap: 10px;
}

.gview-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.gview-lbl {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--txt2);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}

.gview-req { color: var(--red); font-weight: 400; }
.gview-opt { color: var(--txt3); font-weight: 400; }

.gview-col .dz {
    min-height: 110px;
    padding: 12px 8px;
    border-radius: 16px;
    flex: 1;
}

.gview-col .dz .dz-ico { font-size: 1.5rem; margin-bottom: 4px; }
.gview-col .dz .dz-lbl { font-size: 0.72rem; margin-bottom: 2px; }
.gview-col .dz .dz-hint { font-size: 0.63rem; }
.gview-col .dz img { max-height: 88px; }

/* ── Auto-detect row ── */
.detect-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.77rem;
    color: var(--txt2);
    margin-top: 8px;
    padding: 7px 11px;
    background: var(--bg3);
    border-radius: 10px;
    border: 1px solid var(--bdr);
    line-height: 1.3;
}

.detect-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
    animation: detectPulse 1.1s ease-in-out infinite;
}

@keyframes detectPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .35; transform: scale(.65); }
}

.detect-view-tag {
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: auto;
    flex-shrink: 0;
}
.dvt-front { background: rgba(52,211,153,.15); color: var(--green); border: 1px solid rgba(52,211,153,.3); }
.dvt-back  { background: rgba(251,191,36,.15);  color: var(--gold);  border: 1px solid rgba(251,191,36,.3); }

/* ── Zoom lightbox ── */
.zoom-lb {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.zoom-lb.open {
    opacity: 1;
    pointer-events: all;
}

.zoom-lb-bg {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.88);
    cursor: zoom-out;
}

.zoom-lb-cnt {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 92vw;
    max-height: 92vh;
}

.zoom-lb-close {
    position: absolute;
    top: -42px;
    right: 0;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.zoom-lb-close:hover { background: rgba(255,255,255,.24); }

.zoom-lb-img {
    max-width: 88vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 12px;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
    display: block;
    transform-origin: center center;
}

.zoom-lb-img.grabbing { cursor: grabbing; }

.zoom-hint {
    color: rgba(255,255,255,.32);
    font-size: 0.7rem;
    margin-top: 10px;
    pointer-events: none;
}

/* ── Zoom cursor on clickable preview images ── */
#gPreview, #gBackPreview { cursor: zoom-in; }
.rimg-area .rimg         { cursor: zoom-in; }
.cgcol img               { cursor: zoom-in; }

/* ════════════════════════════════════════════
   PRODUCTS TAB
════════════════════════════════════════════ */

/* State divs (same pattern as .rstate but scoped to products) */
.prod-rs {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    min-height: 0;
    padding: 20px;
}
.prod-rs.vis { display: flex; }

/* Search row */
.prod-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.prod-search-row .fc { flex: 1; margin-bottom: 0; width: auto; min-width: 0; }

.btn-prod-search {
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    background: var(--acc);
    color: #000;
    font-weight: 700;
    font-size: .82rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity .15s;
}
.btn-prod-search:hover  { opacity: .85; }
.btn-prod-search:active { opacity: .7;  }

.prod-search-hint {
    font-size: .68rem;
    color: var(--txt3);
    margin-top: 6px;
}

/* Product info sidebar */
.prod-info-name {
    font-size: .88rem;
    font-weight: 700;
    color: var(--txt1);
    margin-bottom: 4px;
}
.prod-info-meta {
    font-size: .75rem;
    color: var(--txt3);
}

/* Results panel */
.prod-results {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.prod-results-hdr {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 0 2px 10px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--bdr);
    margin-bottom: 12px;
}
.prod-results-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--txt1);
}
.prod-results-count {
    font-size: .72rem;
    color: var(--txt3);
    white-space: nowrap;
}

/* Image grid */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-right: 4px;
}

/* Card */
.prod-card {
    background: var(--bg3);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--bdr);
    display: flex;
    flex-direction: column;
    transition: border-color .15s, transform .15s;
}
.prod-card:hover {
    border-color: var(--acc);
    transform: translateY(-2px);
}

.prod-card-img {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg2);
    position: relative;
}
.prod-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .2s;
    cursor: zoom-in;
}
.prod-card:hover .prod-card-img img { transform: scale(1.04); }

.prod-card-foot {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.prod-color-name {
    font-size: .7rem;
    color: var(--txt2);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card footer button layout — row 1: Try On (full width)  row 2: ★ Default + 🗑 Delete */
.btn-tryon {
    display: block;
    width: 100%;
    padding: 6px 0;
    border-radius: 8px;
    border: 1px solid var(--acc);
    background: transparent;
    color: var(--acc);
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, color .15s;
    margin-bottom: 5px;
}
.btn-tryon:hover   { background: var(--acc); color: #000; }
.btn-tryon.loading { opacity: .5; pointer-events: none; }

.prod-btn-row {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-set-default,
.btn-del-img {
    flex: 1;
    padding: 5px 0;
    border-radius: 8px;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, color .15s;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-set-default {
    border: 1px solid #f39c12;
    background: transparent;
    color: #f39c12;
}
.btn-set-default:hover:not(:disabled) { background: #f39c12; color: #fff; }
.btn-set-default:disabled             { opacity: .45; cursor: not-allowed; }
.btn-set-default.is-default           { background: #f39c12; color: #fff; border-color: #f39c12; }

.btn-del-img {
    border: 1px solid #c0392b;
    background: transparent;
    color: #c0392b;
}
.btn-del-img:hover:not(:disabled) { background: #c0392b; color: #fff; }
.btn-del-img:disabled             { opacity: .45; cursor: not-allowed; }

/* ════════════════════════════════════════════
   MOBILE  (≤ 768 px) — panels stack vertically
════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Allow natural page scroll — no viewport lock */
    html {
        height: auto;
        overflow: auto;
    }

    body {
        height: auto;
        overflow: auto;
        padding: 0 10px 24px;
        flex-direction: column;
    }

    /* Topbar: compress model input */
    .topbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 0;
    }

    .topbar-r {
        gap: 8px;
        flex-wrap: wrap;
    }

    #geminiModel {
        width: 100% !important;
        min-width: 0;
    }

    /* Tabs */
    .tabs {
        margin-bottom: 8px;
    }

    /* Tab content — block flow, no flex height lock */
    .tab-content.active {
        display: block;
        flex: none;
        overflow: visible;
        min-height: 0;
    }

    /* Workspace — stack left then right */
    .workspace {
        flex-direction: column;
        flex: none;
        min-height: 0;
        overflow: visible;
        gap: 10px;
    }

    /* Left panel — full width, no scroll lock */
    .left-panel {
        width: 100%;
        overflow-y: visible;
        min-height: 0;
        border-radius: 18px;
    }

    /* Right panel — full width, natural height */
    .right-panel {
        width: 100%;
        overflow-y: visible;
        min-height: 320px;
        border-radius: 18px;
    }

    /* Right-panel states need explicit height on mobile */
    .rstate {
        flex: none;
        min-height: 260px;
    }

    .result-wrap {
        flex: none;
        min-height: 0;
    }

    .rimg-area {
        min-height: 260px;
        border-radius: 14px;
    }

    .rimg {
        max-height: 60vh;
    }

    /* Result action buttons — allow wrapping on narrow screens */
    .rbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .rbts {
        flex-wrap: wrap;
    }

    /* Batch result grid — single column */
    .batch-result-area {
        flex-direction: column;
        align-items: center;
    }

    /* Video panel body — single column */
    .vid-body {
        flex-direction: column;
    }
}
