#theme-app-root{display:flex;flex-direction:column;height:100%}
.theme-scroll{overflow-y:auto;padding-bottom:calc(20px + var(--sab))}
.theme-section-label{font-size:12px;font-weight:800;color:var(--ink2);padding:16px 4px 6px}
.theme-empty-hint{font-size:12.5px;color:var(--ink2);line-height:1.55;padding:10px 4px 4px}

/* ── live preview mockup (compact, DOM/CSS only, no images) ── */
.theme-preview-frame{position:relative;margin:4px 4px 10px;border-radius:20px;padding:14px 16px 12px;box-shadow:var(--shadow-md);background:var(--bg);display:flex;flex-direction:column;gap:8px}
.theme-preview-clock{font-family:var(--font-display);font-size:24px;font-weight:300;color:var(--ink);text-align:center}
.theme-preview-sub{font-size:11px;color:var(--ink2);text-align:center;margin-top:-6px}
.theme-preview-icons{display:flex;justify-content:center;gap:16px}
.theme-preview-icon{width:28px;height:28px;border-radius:var(--icon-radius,19px);background:color-mix(in srgb,var(--icon-bg-color,var(--desktop-icon-glass-bg)) calc(var(--icon-bg-opacity,1)*100%),transparent);box-shadow:var(--icon-shadow,var(--desktop-icon-glass-shadow),inset 0 1px 0 var(--desktop-icon-glass-highlight));border:var(--icon-border,1px solid var(--desktop-icon-glass-line));backdrop-filter:var(--icon-backdrop,blur(10px) saturate(140%));-webkit-backdrop-filter:var(--icon-backdrop,blur(10px) saturate(140%))}
.theme-preview-icon.lg{width:44px;height:44px}
.theme-preview-card{background:var(--surface);box-shadow:var(--shadow-in);border-radius:12px;padding:10px 12px;display:flex;flex-direction:column;gap:6px}
.theme-preview-card-bar{height:6px;border-radius:3px;background:var(--ink);width:60%}
.theme-preview-card-bar.short{background:var(--ink2);width:38%}
.theme-preview-bubbles{display:flex;flex-direction:column;gap:4px}
.theme-preview-bub{max-width:70%;padding:5px 9px;border-radius:var(--bub-r,18px);font-size:10px;color:var(--ink)}
.theme-preview-bub.a{align-self:flex-start;background:var(--bub-a);border-top-left-radius:3px}
.theme-preview-bub.u{align-self:flex-end;background:var(--bub-u);border-top-right-radius:3px}
.theme-current-caption{font-size:12px;color:var(--ink2);text-align:center;padding:0 0 4px}

.theme-icon-preview-row{display:flex;justify-content:space-around;padding:14px 10px 4px}

/* ── mode / preset selectors ── */
.theme-mode-row{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:4px 0 4px}
.theme-mode-row.four{grid-template-columns:repeat(4,1fr)}
.theme-mode-btn{border:none;border-radius:12px;background:var(--surface);box-shadow:var(--shadow);color:var(--ink2);font-family:inherit;font-size:12px;font-weight:700;padding:9px 4px}
.theme-mode-btn.active{background:var(--pri-pale);box-shadow:var(--shadow-in),inset 0 0 0 1.5px var(--pri-deep);color:var(--accent-text)}
.theme-inline-toggle{display:flex;gap:6px}
.theme-inline-btn{border:none;border-radius:999px;background:var(--surface-alt);color:var(--ink2);font-family:inherit;font-size:11.5px;font-weight:700;padding:6px 11px}
.theme-inline-btn.active{background:var(--pri-pale);color:var(--accent-text)}

/* ── horizontally-scrollable theme-card row ── */
.theme-card-track{display:flex;gap:12px;overflow-x:auto;padding:2px 2px 10px;scrollbar-width:none}
.theme-card-track::-webkit-scrollbar{display:none}
.theme-card{flex:0 0 auto;width:72px;display:flex;flex-direction:column;align-items:center;gap:6px;border:none;background:none;padding:0;font-family:inherit}
.theme-card-bg{width:72px;height:72px;border-radius:16px;box-shadow:var(--shadow);padding:8px;box-sizing:border-box;display:flex;align-items:flex-end}
.theme-card.active .theme-card-bg{box-shadow:var(--shadow),0 0 0 2px var(--pri-deep)}
.theme-card-surface{width:100%;border-radius:10px;padding:6px;display:flex;flex-direction:column;gap:3px;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.theme-card-accent{width:14px;height:14px;border-radius:50%}
.theme-card-line{height:3px;border-radius:2px;width:70%}
.theme-card-line.short{width:45%}
.theme-card-name{font-size:11.5px;font-weight:700;color:var(--ink2);display:flex;align-items:center;gap:3px}
.theme-card.active .theme-card-name{color:var(--accent-text)}
.theme-card-name svg{width:12px;height:12px;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}

/* ── action buttons (also reused by wallpaper-upload / reset) ── */
.theme-goto-desk-edit{width:100%;border:none;border-radius:14px;background:var(--pri-pale);color:var(--accent-text);font-family:inherit;font-size:13px;font-weight:700;padding:12px;margin-top:8px}
.theme-reset-btn{width:100%;border:none;border-radius:14px;background:var(--surface);box-shadow:var(--shadow);color:var(--coral-text);font-family:inherit;font-size:13px;font-weight:700;padding:12px;margin-top:20px}

/* ── per-instance photo settings ── */
.theme-photo-preview{padding:6px 4px 4px}
.theme-photo-preview .desk-widget-inner{width:100%;border-radius:18px;overflow:hidden;position:relative;background:var(--surface-alt)}
.theme-photo-thumbs{display:flex;flex-wrap:wrap;gap:8px;padding:10px 2px}
.theme-photo-thumb-cell{position:relative;width:64px;height:64px;border-radius:12px;overflow:hidden;background:var(--surface-alt);cursor:pointer}
.theme-photo-thumb-cell img{width:100%;height:100%;object-fit:cover;display:block}
.theme-photo-thumb-cell button{position:absolute;top:2px;right:2px;width:18px;height:18px;border:none;border-radius:50%;background:rgba(0,0,0,.45);color:#fff;display:flex;align-items:center;justify-content:center}
.theme-photo-thumb-cell button svg{width:11px;height:11px;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.theme-photo-add-cell{width:64px;height:64px;border-radius:12px;border:1.5px dashed var(--border);background:none;color:var(--ink2);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:10.5px}
.theme-photo-add-cell svg{width:17px;height:17px}
.theme-random-char-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.theme-random-char-chip{border:none;border-radius:999px;background:var(--surface-alt);color:var(--ink2);font-family:inherit;font-size:12px;font-weight:700;padding:7px 13px}
.theme-random-char-chip.active{background:var(--pri-pale);color:var(--accent-text)}

.theme-focus-stage{position:relative;width:100%;aspect-ratio:1;border-radius:14px;background-size:cover;background-position:center;background-color:var(--surface-alt);margin:6px 0 10px;cursor:crosshair}
.theme-focus-marker{position:absolute;width:22px;height:22px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1.5px var(--pri),0 2px 8px rgba(0,0,0,.35);transform:translate(-50%,-50%);pointer-events:none}

/* ── gallery picker (shared with desktop add-flow) ── */
.photo-gallery-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;max-height:46vh;overflow-y:auto;padding:2px}
.photo-gallery-cell{position:relative;border:2px solid transparent;border-radius:12px;overflow:hidden;aspect-ratio:1;padding:0;background:var(--surface-alt)}
.photo-gallery-cell img{width:100%;height:100%;object-fit:cover;display:block}
.photo-gallery-cell span{position:absolute;left:0;right:0;bottom:0;font-size:9.5px;color:#fff;background:linear-gradient(0deg,var(--overlay-scrim-deep),var(--overlay-scrim) 70%,rgba(12,18,28,0));padding:8px 5px 3px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.photo-gallery-cell.sel{border-color:var(--pri)}

/* ── photo desktop widget (rendered on the actual desktop + previews) ── */
.desk-widget-inner.photo-widget{position:relative;overflow:hidden;background:var(--surface-alt);cursor:pointer;opacity:var(--desk-widget-opacity)}
/* An empty photo widget should read as "tap to add a photo", not as an unexplained solid tile. */
.desk-widget-inner.photo-widget:has(.photo-widget-empty){background:none;border:1.5px dashed var(--border);border-radius:var(--r-sm)}
.photo-widget-empty{position:absolute;inset:0;border:none;background:none;color:var(--ink2);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:11px;text-align:center;padding:8px}
.photo-widget-empty svg{width:20px;height:20px}
.photo-widget-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:var(--surface-alt)}
.photo-load-failed .photo-widget-img{opacity:0}
.photo-load-failed::after{content:'';position:absolute;inset:0;background:linear-gradient(150deg,var(--pri-pale),var(--surface-alt))}
.photo-widget-overlay{position:absolute;inset:0;background:#000}
.photo-widget-title,.photo-widget-date{position:absolute;left:8px;right:8px;font-size:11px;font-weight:700;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.45);background:var(--overlay-scrim);padding:1px 6px;border-radius:6px;box-sizing:border-box}
.photo-widget-title{right:auto;max-width:calc(100% - 16px)}
.photo-widget-date{font-size:9.5px;font-weight:600;opacity:.9}
.photo-widget-title.bottom{bottom:6px}
.photo-widget-title.top{top:6px}
.photo-widget-date.bottom{bottom:6px;left:auto;right:8px}
.photo-widget-date.top{top:6px;left:auto;right:8px}
.photo-widget-dots{position:absolute;left:0;right:0;bottom:5px;display:flex;justify-content:center;gap:3px}
.photo-widget-dots i{width:4px;height:4px;border-radius:50%;background:rgba(255,255,255,.55)}
.photo-widget-dots i.active{background:#fff}
.photo-widget-collage{position:absolute;inset:0;display:flex}
.photo-widget-collage.layout-side{flex-direction:row;gap:2px}
.photo-widget-collage.layout-stack{flex-direction:column;gap:2px}
.photo-widget-collage.layout-overlap{display:block}
.photo-widget-collage-cell{overflow:hidden;position:relative}
.photo-widget-collage.layout-side .photo-widget-collage-cell{flex:1}
.photo-widget-collage.layout-stack .photo-widget-collage-cell{flex:1}
.photo-widget-collage.layout-overlap .photo-widget-collage-cell.a{position:absolute;inset:0;width:82%;height:82%}
.photo-widget-collage.layout-overlap .photo-widget-collage-cell.b{position:absolute;right:0;bottom:0;width:60%;height:60%;border-radius:12px;box-shadow:0 4px 14px rgba(0,0,0,.28);border:2px solid var(--surface)}
.photo-widget-collage-cell img{width:100%;height:100%;object-fit:cover;display:block}

.photo-viewer-ov{position:fixed;inset:0;z-index:999;background:rgba(6,10,14,.92);display:flex;align-items:center;justify-content:center}
.photo-viewer-ov img{max-width:92vw;max-height:82vh;border-radius:14px;object-fit:contain}
.photo-viewer-close{position:absolute;top:calc(16px + env(safe-area-inset-top,0px));right:16px;width:34px;height:34px;border:none;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;display:flex;align-items:center;justify-content:center}
.photo-viewer-close svg{width:17px;height:17px;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.photo-viewer-nav{position:absolute;top:50%;transform:translateY(-50%);width:38px;height:38px;border:none;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;display:flex;align-items:center;justify-content:center}
.photo-viewer-nav.prev{left:12px}
.photo-viewer-nav.next{right:12px}
.photo-viewer-nav svg{width:18px;height:18px;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* ── wallpaper ── */
.theme-swatch-row{display:flex;flex-wrap:wrap;gap:10px;padding:6px 2px}
.theme-swatch-row.compact{gap:6px;flex:1}
.theme-swatch{width:34px;height:34px;border-radius:50%;border:2px solid transparent;box-shadow:var(--shadow)}
.theme-swatch.small{width:20px;height:20px}
.theme-swatch.active{border-color:var(--pri-deep)}

/* ── custom colors ── */
.theme-color-field{display:flex;flex-direction:column;gap:6px;padding:10px 2px}
.theme-color-field>span{font-size:12.5px;font-weight:700;color:var(--ink2)}
.theme-color-field-row{display:flex;align-items:center;gap:10px}
.theme-color-field-row input[type=color]{width:38px;height:38px;border:none;border-radius:12px;padding:0;background:none;flex-shrink:0}

/* ── chat bubble preview ── */
.theme-bubble-preview{background:var(--surface);border-radius:16px;box-shadow:var(--shadow);padding:14px 12px;margin:6px 0 4px}
.theme-bubble-preview .msg-row{margin-bottom:8px}

/* ═══ 主题 glass (2026-10-14, hand-written, keep LAST) ═══
   The page shell, cards, rows, segments and their light/dark variables come from settings.css (glass v2 covers #theme-app-root).
   Here: the preset swatches (option A) and the theme-only controls the sub-pages still use (.theme-mode-row / .theme-reset-btn),
   restyled as the same jelly / glass so they sit on the glass background. */
#theme-app-root .theme-label-row{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
#theme-app-root .theme-label-row em{font-style:normal;font-size:12px;font-weight:500;letter-spacing:0;color:var(--ink2)}
#theme-app-root .theme-swatches{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
#theme-app-root .theme-swatch{width:auto;min-width:0;display:flex;flex-direction:column;align-items:center;gap:9px;border:none;background:none;padding:0;font-family:inherit;cursor:pointer;height:auto}
.theme-swatch-win{position:relative;flex:none;align-self:stretch;aspect-ratio:1;border-radius:18px;background:var(--sw-grad);border:1px solid var(--g-line);box-shadow:inset 0 1px 0 var(--g-line),0 8px 16px -10px color-mix(in srgb,var(--ink) 50%,transparent);transition:box-shadow .18s}
.theme-swatch-win::before{content:"";position:absolute;left:18%;right:18%;bottom:16%;height:30%;border-radius:9px;background:var(--g-bg-strong);border:1px solid var(--g-line)}
.theme-swatch.active .theme-swatch-win{box-shadow:0 0 0 2px var(--surface),0 0 0 3.5px color-mix(in srgb,var(--sw-ring) 70%,transparent),0 10px 18px -10px color-mix(in srgb,var(--ink) 55%,transparent)}
.theme-swatch-check{position:absolute;right:-5px;top:-5px;width:20px;height:20px;border-radius:50%;display:none;place-items:center;background:var(--j-on);border:1px solid var(--j-on-line);box-shadow:var(--j-on-shadow);color:var(--ink)}
.theme-swatch-check svg{width:11px;height:11px;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.theme-swatch.active .theme-swatch-check{display:grid}
#theme-app-root .theme-swatch .theme-card-name{font-size:13.5px;font-weight:500;color:var(--ink2)}
#theme-app-root .theme-swatch.active .theme-card-name{color:var(--ink);font-weight:700}
#theme-app-root .theme-swatch:focus-visible{outline:none}
#theme-app-root .theme-swatch:focus-visible .theme-swatch-win{box-shadow:0 0 0 3px color-mix(in srgb,var(--pri) 45%,transparent)}
#theme-app-root .theme-reset-group{margin-top:24px}
@media (prefers-reduced-motion:reduce){.theme-swatch-win{transition:none}}

/* sub-pages: jelly segments and a glass reset button, same variables as 设置 */
#theme-app-root .theme-mode-row{gap:4px;padding:4px;border:1px solid var(--j-off-line);border-radius:20px;background:var(--j-track);box-shadow:inset 0 1px 3px color-mix(in srgb,var(--ink) 12%,transparent)}
#theme-app-root .theme-mode-btn{border:1px solid transparent;border-radius:16px;background:none;box-shadow:none;color:var(--ink2);font-size:13.5px;font-weight:500;min-height:40px}
#theme-app-root .theme-mode-btn.active{background:var(--j-on);border-color:var(--j-on-line);box-shadow:var(--j-on-shadow);color:var(--ink);font-weight:700}
#theme-app-root .theme-reset-btn{background:var(--g-bg);border:1px solid var(--g-line);box-shadow:var(--g-shadow);-webkit-backdrop-filter:var(--g-blur);backdrop-filter:var(--g-blur);border-radius:24px;min-height:52px}
#theme-app-root .settings-row.danger .settings-row-label{color:var(--coral-text)}
