/* ============================================================
   KZ Windows 主题中心（独立面板）  kz-win-theme.css
   —— 独立窗口，只作用于 Windows 桌面；不加载到安卓页
   ============================================================ */

.kzwt {
    position: fixed;
    inset: 0;
    z-index: 320;                /* 高于普通窗口(100)、低于开始菜单(999) */
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, .42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-family: inherit;
}
.kzwt.kz-open { display: flex; animation: kzwtFade .22s ease; }
@keyframes kzwtFade { from { opacity: 0; } to { opacity: 1; } }

.kzwt-win {
    width: min(940px, 94vw);
    height: min(620px, 88vh);
    border-radius: 16px;
    background: #f6f7fb;
    box-shadow: 0 30px 80px rgba(2, 6, 23, .5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: kzwtUp .26s cubic-bezier(.2, .8, .2, 1);
}
@keyframes kzwtUp { from { transform: translateY(16px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }

.kzwt-head {
    height: 46px;
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 16px;
    background: #fff;
    border-bottom: 1px solid rgba(15, 23, 42, .07);
}
.kzwt-head b { font-size: 13px; color: #0f172a; font-weight: 700; }
.kzwt-head .kzwt-sub { font-size: 11px; color: #64748b; }
.kzwt-x {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    font-size: 16px;
    cursor: pointer;
}
.kzwt-x:hover { background: #ef4444; color: #fff; }

.kzwt-body { flex: 1; display: flex; min-height: 0; }

.kzwt-nav {
    width: 156px;
    flex: none;
    padding: 10px 8px;
    background: #eef1f7;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.kzwt-nav button {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    font-size: 12.5px;
    cursor: pointer;
    text-align: left;
    position: relative;
}
.kzwt-nav button:hover { background: rgba(255, 255, 255, .7); }
.kzwt-nav button.kz-on { background: #fff; font-weight: 700; color: #0f172a; box-shadow: 0 1px 4px rgba(15, 23, 42, .08); }
.kzwt-nav button.kz-on::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, #22d3ee, #6366f1);
}

.kzwt-main { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.kzwt-main::-webkit-scrollbar { width: 8px; }
.kzwt-main::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .3); border-radius: 9px; }

.kzwt-pane { display: none; }
.kzwt-pane.kz-on { display: block; }
.kzwt-h { font-size: 13px; font-weight: 800; color: #0f172a; margin: 0 0 4px; }
.kzwt-p { font-size: 11.5px; color: #64748b; line-height: 1.7; margin: 0 0 12px; }

/* 壁纸网格 */
.kzwt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.kzwt-wall {
    position: relative;
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    padding: 0;
    background: #0f172a;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}
.kzwt-wall img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kzwt-wall:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15, 23, 42, .22); }
.kzwt-wall.kz-cur { border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34, 211, 238, .25); }
.kzwt-wall span {
    position: absolute;
    inset: auto 0 0 0;
    padding: 14px 8px 5px;
    font-size: 10.5px;
    color: #fff;
    text-align: left;
    background: linear-gradient(0deg, rgba(2, 6, 23, .88), transparent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kzwt-wall em {
    position: absolute;
    top: 5px;
    right: 5px;
    font-style: normal;
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 99px;
    background: rgba(2, 6, 23, .5);
    color: #e0f2fe;
}

.kzwt-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 12.5px; color: #1e293b; }
.kzwt-row > label { flex: 1; }
.kzwt-row input[type=range] { width: 150px; accent-color: #6366f1; }

.kzwt-btn {
    height: 30px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: #fff;
    color: #334155;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.kzwt-btn:hover { border-color: #6366f1; color: #4338ca; }
.kzwt-btn.kz-main { background: linear-gradient(90deg, #22d3ee, #6366f1); color: #fff; border: 0; font-weight: 700; }
.kzwt-btn.kz-danger { color: #dc2626; border-color: rgba(220, 38, 38, .25); }

.kzwt-sws { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.kzwt-sw {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 11px;
    border-radius: 99px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: #fff;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
}
.kzwt-sw.kz-on {
    background: linear-gradient(90deg, rgba(34, 211, 238, .16), rgba(99, 102, 241, .18));
    border-color: rgba(99, 102, 241, .5);
    color: #312e81;
    font-weight: 700;
}
.kzwt-sw i { font-style: normal; }

.kzwt-layouts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 6px; }
.kzwt-lay {
    aspect-ratio: 16 / 11;
    border-radius: 10px;
    border: 2px solid rgba(15, 23, 42, .1);
    background: #fff;
    cursor: pointer;
    position: relative;
    padding: 8px;
    display: flex;
    gap: 4px;
}
.kzwt-lay.kz-on { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.kzwt-lay i {
    display: block;
    background: linear-gradient(160deg, #c7d2fe, #a5b4fc);
    border-radius: 3px;
}
.kzwt-lay[data-lay="left"] { flex-direction: column; align-items: flex-start; }
.kzwt-lay[data-lay="left"] i { width: 62%; height: 18%; }
.kzwt-lay[data-lay="top"] { align-items: flex-start; }
.kzwt-lay[data-lay="top"] i { width: 30%; height: 46%; }
.kzwt-lay[data-lay="right"] { flex-direction: column; align-items: flex-end; }
.kzwt-lay[data-lay="right"] i { width: 62%; height: 18%; }
.kzwt-lay[data-lay="grid"] { flex-wrap: wrap; align-content: flex-start; }
.kzwt-lay[data-lay="grid"] i { width: 46%; height: 38%; }

/* 图标管理 */
.kzwt-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kzwt-ic {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    font-size: 12px;
    color: #1e293b;
}
.kzwt-ic .dot {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: linear-gradient(140deg, #93c5fd, #6366f1);
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.kzwt-ic span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kzwt-ic button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 11px;
    color: #64748b;
    padding: 2px 4px;
}
.kzwt-ic button:hover { color: #dc2626; }
.kzwt-ic.kz-off { opacity: .45; }

.kzwt-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.kzwt-form input {
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(15, 23, 42, .14);
    padding: 0 10px;
    font-size: 12px;
    outline: none;
    background: #fff;
    color: #0f172a;
    min-width: 0;
}
.kzwt-form input:focus { border-color: #6366f1; }
.kzwt-form input.kz-name { width: 120px; }
.kzwt-form input.kz-url { flex: 1; }

.kzwt-tip {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(99, 102, 241, .07);
    font-size: 11.5px;
    line-height: 1.75;
    color: #475569;
}

/* 桌面上的入口图标 */
#kzThemeEntry img { width: 44px; height: 44px; }
#kzThemeEntry .kz-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    border-radius: 99px;
    padding: 0 4px;
}

/* 拖动中的桌面图标 */
.kz-icon-dragging { opacity: .85; transform: scale(1.06); z-index: 20; }
#windowsDesktopIcons.kz-icon-free { position: relative; }

@media (max-width: 720px) {
    .kzwt-win { width: 96vw; height: 90vh; }
    .kzwt-nav { width: 96px; }
    .kzwt-nav button { font-size: 11px; padding: 0 6px; }
    .kzwt-layouts { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   【20261031V】主题包：壁纸 + 排版 + 配色 + 3D
   ------------------------------------------------------------
   变量由 kz-theme-pack.js 写入：
     --kz-ico-cell   桌面图标格子宽度
     --kz-ico-gap    图标间距
     --kz-ico-radius 图标/底板圆角
     --kz-apps-col   开始菜单每行几列
   ============================================================ */

/* ---------- 主题中心里那条控制栏 ---------- */
.kz-tp-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 12px 0 4px;
    padding: 9px 12px;
    border: 1px solid rgba(15, 23, 42, .10);
    border-radius: 11px;
    background: rgba(255, 255, 255, .72);
    font: 400 12px/1.3 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    color: #0f172a;
}

.kz-tp-bar .kz-tp-sw {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
}

.kz-tp-bar .kz-tp-sw input { accent-color: #7c3aed; }

.kz-tp-bar .kz-tp-rg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.kz-tp-bar .kz-tp-rg input[type="range"] { width: 88px; accent-color: #7c3aed; }

.kz-tp-bar .kzwt-btn { padding: 4px 10px; font-size: 12px; }

/* ---------- 桌面图标：位置 / 大小 / 间距 / 圆角 跟着主题走 ---------- */
@media (min-width: 769px) {
    body.kz-theme-pack #windowsDesktopSystem > .desktop-icons {
        grid-template-columns: repeat(auto-fill, var(--kz-ico-cell, 100px)) !important;
        gap: var(--kz-ico-gap, 15px) !important;
    }

    body.kz-theme-pack #windowsDesktopSystem > .desktop-icons > .icon {
        width: var(--kz-ico-cell, 100px) !important;
        border-radius: var(--kz-ico-radius, 16px) !important;
    }
}

/* ---------- 开始菜单：每行几列也跟主题走 ---------- */
body.kz-theme-pack #windowsDesktopSystem .start-apps {
    grid-template-columns: repeat(var(--kz-apps-col, 3), 1fr) !important;
}

/* ---------- 3D 立体图标 ---------- */
body.kz-ico-3d #windowsDesktopSystem .icon {
    transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s ease, filter .18s ease;
    transform-style: preserve-3d;
    will-change: transform;
}

body.kz-ico-3d #windowsDesktopSystem .icon:hover {
    transform: perspective(700px) translateZ(16px) rotateX(6deg) rotateY(-4deg) scale(1.06);
    box-shadow: 0 18px 32px rgba(2, 6, 23, .38), 0 2px 6px rgba(2, 6, 23, .22);
    filter: saturate(1.08);
    z-index: 6;
}

body.kz-ico-3d #windowsDesktopSystem .icon:active {
    transform: perspective(700px) translateZ(6px) scale(.98);
}

/* 开始菜单的磁贴也能浮起来一点，跟桌面统一 */
body.kz-ico-3d #windowsDesktopSystem .start-app {
    transition: transform .16s ease, box-shadow .16s ease;
}

body.kz-ico-3d #windowsDesktopSystem .start-app:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 20px rgba(2, 6, 23, .28);
}
