/* ==================== UPLOAD ZONES ==================== */
.up-zone {
    border: 1.5px dashed var(--border-secondary);
    border-radius: var(--radius-md);
    padding: 10px;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
    background: var(--bg-root)
}

.up-zone:hover {
    border-color: var(--accent);
    background: var(--accent-softer);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm)
}

.up-zone.has {
    border-style: solid;
    border-color: var(--accent-border);
    padding: 4px
}

.up-zone.uploading {
    opacity: .6;
    pointer-events: none
}

.up-zone.uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6
}

.up-prev {
    transition: opacity var(--duration-slow) var(--ease-out)
}

.up-zone.just-uploaded .up-prev {
    animation: fadeScaleIn .35s var(--ease-spring)
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(.92)
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

.up-zone input {
    display: none
}

.up-info {
    display: flex;
    align-items: center;
    gap: 8px
}

.up-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0
}

.up-txt .l1 {
    font-size: 10px;
    font-weight: 500
}

.up-txt .l2 {
    font-size: 8px;
    color: var(--fg-tertiary);
    margin-top: 1px
}

.up-prev {
    width: 100%;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    display: none
}

.up-zone.has .up-prev {
    display: block
}

.up-zone.has .up-info {
    display: none
}

.rm-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 7px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: transform var(--duration-fast) var(--ease-spring)
}

.rm-btn:hover {
    transform: scale(1.15)
}

.up-zone.has .rm-btn {
    display: flex
}

/* ==================== CATEGORY BAR ==================== */
.cat-bar {
    display: flex;
    gap: 4px;
    padding: 0 0 8px;
    flex-wrap: wrap
}

.cat-btn {
    font-size: 10px;
    padding: 3px 8px;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--fg-tertiary);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    white-space: nowrap
}

.cat-btn:hover {
    border-color: var(--border-hover);
    color: var(--fg-secondary);
    transform: translateY(-1px)
}

.cat-btn.act {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--fg-inverted);
    font-weight: 600;
    box-shadow: var(--shadow-xs)
}

.tpl-cat-btn {
    font-size: 10px;
    padding: 3px 8px;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--fg-tertiary);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    white-space: nowrap
}

.tpl-cat-btn:hover {
    border-color: var(--border-hover);
    color: var(--fg-secondary)
}

.tpl-cat-btn.act {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--fg-inverted);
    font-weight: 600
}

/* ==================== LAYOUT GRID ==================== */
.lay-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px
}

.lay-opt {
    aspect-ratio: 16/10;
    background: var(--bg-root);
    border: 1.5px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px
}

.lay-opt:hover {
    border-color: var(--border-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm)
}

.lay-opt.act {
    border-color: var(--accent);
    background: var(--accent-softer);
    transform: scale(1.02);
    box-shadow: var(--shadow-accent)
}

.lay-opt svg {
    width: 100%;
    height: 100%;
    opacity: .45
}

.lay-opt.act svg {
    opacity: 1
}

/* ==================== THEME GRID ==================== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px
}

.theme-card {
    aspect-ratio: 16/10;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: 3px 5px
}

.theme-card:hover {
    border-color: var(--border-secondary);
    transform: scale(1.04);
    box-shadow: var(--shadow-md)
}

.theme-card.act {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow)
}

.theme-card span {
    font-size: 6px;
    color: rgba(255, 255, 255, .8);
    font-weight: 600;
    z-index: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .5)
}

/* ==================== BACKGROUND GRID ==================== */
.bg-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px
}

.bg-sw {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--duration-normal) var(--ease-spring)
}

.bg-sw:hover {
    transform: scale(1.12);
    box-shadow: var(--shadow-md)
}

.bg-sw.act {
    border-color: var(--fg-primary);
    box-shadow: 0 0 0 1px var(--bg-root), var(--shadow-accent)
}

/* ==================== TEMPLATE GRID ==================== */
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px
}

.tpl-card {
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1.5px solid var(--border-primary);
    transition: all var(--duration-normal) var(--ease-out);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px
}

.tpl-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg)
}

.tpl-card span {
    font-size: 7px;
    color: rgba(255, 255, 255, .8);
    font-weight: 600;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4)
}

.tpl-card small {
    font-size: 5px;
    color: rgba(255, 255, 255, .4);
    z-index: 1
}

/* ==================== FORM INPUTS ==================== */
.inp-g {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.inp-g label {
    font-size: 8px;
    color: var(--fg-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .4px
}

.inp-g input[type="text"],
.inp-g select,
.inp-g textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    padding: 5px 7px;
    color: var(--fg-primary);
    font-size: 10px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--duration-normal), box-shadow var(--duration-normal)
}

.inp-g input:focus,
.inp-g select:focus,
.inp-g textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-softer)
}

.inp-g textarea {
    resize: vertical;
    min-height: 40px
}

select {
    cursor: pointer
}

select option {
    background: var(--bg-primary)
}

.inp-row {
    display: flex;
    gap: 4px
}

.inp-row .inp-g {
    flex: 1
}

/* ==================== TOGGLE SWITCHES ==================== */
.tog-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1px 0
}

.tog-l {
    font-size: 9px;
    color: var(--fg-secondary)
}

.tog {
    width: 30px;
    height: 16px;
    background: var(--border-secondary);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: background var(--duration-normal) var(--ease-out);
    flex-shrink: 0
}

.tog.on {
    background: var(--accent)
}

.tog::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--duration-normal) var(--ease-spring);
    box-shadow: var(--shadow-xs)
}

.tog.on::after {
    transform: translateX(14px)
}

/* ==================== RANGE SLIDERS ==================== */
.rng-g {
    display: flex;
    flex-direction: column;
    gap: 3px
}

.rng-h {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.rng-h span {
    font-size: 8px;
    color: var(--fg-secondary)
}

.rng-h .rv {
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 2px;
    background: var(--border-secondary);
    border-radius: 2px;
    outline: none;
    transition: background var(--duration-fast)
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-spring), box-shadow var(--duration-fast)
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px var(--accent-soft)
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1)
}

/* ==================== BUTTONS ==================== */
.btn-p {
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--duration-normal) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px
}

.btn-p:hover {
    box-shadow: var(--shadow-accent);
    transform: translateY(-1px)
}

.btn-p:active {
    transform: translateY(0) scale(.98)
}

.btn-o {
    padding: 6px 8px;
    background: transparent;
    color: var(--fg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    font-size: 9px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--duration-fast)
}

.btn-o:hover {
    border-color: var(--border-hover);
    color: var(--fg-primary);
    transform: translateY(-1px)
}

.btn-o:active {
    transform: translateY(0) scale(.98)
}

.btn-s {
    padding: 4px 7px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-sm);
    font-size: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--duration-fast)
}

.btn-s:hover {
    background: var(--accent-soft);
    box-shadow: var(--shadow-xs);
    transform: translateY(-1px)
}

.btn-s:active {
    transform: translateY(0) scale(.97)
}

.btn-d {
    padding: 4px 7px;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm);
    font-size: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--duration-fast)
}

.btn-d:hover {
    background: var(--danger-soft);
    box-shadow: var(--shadow-xs)
}

/* Dynamic Screens Panel */
.dyn-add-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.dyn-add-btns .btn-s {
    flex: 1;
    min-width: 80px;
    font-size: 10px;
}

.dyn-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.dyn-empty {
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
    padding: 12px;
}

.dyn-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 10px;
}

.dyn-item-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dyn-item-remove {
    width: 18px;
    height: 18px;
    border: none;
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dyn-item-remove:hover {
    background: var(--danger);
    color: white;
}

.btn-d:active {
    transform: scale(.97)
}

.btn-row {
    display: flex;
    gap: 4px
}

.btn-row>* {
    flex: 1
}

/* ==================== COLOR PICKER ==================== */
.color-row {
    display: flex;
    align-items: center;
    gap: 6px
}

.color-row input[type="color"] {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    cursor: pointer;
    background: none;
    padding: 0
}

.color-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px
}

.color-row input[type="color"]::-webkit-color-swatch {
    border-radius: 3px;
    border: none
}

.color-row label {
    font-size: 9px;
    color: var(--fg-tertiary)
}

/* ==================== PRESET LIST ==================== */
.preset-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 140px;
    overflow-y: auto
}

.preset-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 6px;
    background: var(--bg-root);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-primary);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out)
}

.preset-item:hover {
    border-color: var(--accent-border);
    background: var(--accent-softer);
    transform: translateX(2px)
}

.preset-item .pi-n {
    font-size: 9px;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.preset-item .pi-d {
    font-size: 7px;
    color: var(--fg-muted);
    margin: 0 6px
}

.preset-item .pi-a {
    display: flex;
    gap: 3px
}

/* ==================== TEXT LIST ==================== */
.txt-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 140px;
    overflow-y: auto
}

.txt-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: var(--bg-root);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-primary);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out)
}

.txt-item:hover,
.txt-item.sel {
    border-color: var(--accent-border);
    background: var(--accent-softer)
}

.txt-item .ti-t {
    font-size: 9px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

/* ==================== IMAGE CONTROLS ==================== */
.img-ctrl {
    background: var(--bg-root);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 7px;
    display: flex;
    flex-direction: column;
    gap: 5px
}

.img-ctrl-h {
    font-size: 9px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px
}

/* ==================== UTILITY ==================== */
.hidden {
    display: none !important
}