.theme-global-beautify-entry {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.theme-global-beautify-entry-copy {
    min-width: 0;
}

.theme-global-beautify-entry-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2a34;
}

.theme-global-beautify-entry-sub {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.45;
    color: #7c8792;
}

.theme-global-beautify-page {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: #f3f5f8;
}

.theme-global-beautify-page.active {
    display: flex;
}

.theme-global-beautify-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 12px 96px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.theme-global-beautify-body::-webkit-scrollbar {
    display: none;
}

.theme-global-beautify-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(40, 50, 60, 0.06);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 10px 28px rgba(43, 55, 68, 0.08);
}

.theme-global-beautify-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 800;
    color: #17212b;
}

.theme-global-beautify-hint {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #7b8794;
}

.theme-global-beautify-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.theme-global-beautify-preset {
    border: 1px solid rgba(70, 90, 110, 0.12);
    border-radius: 12px;
    padding: 10px 8px;
    background: #fff;
    color: #253140;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.theme-global-beautify-preset.is-active {
    border-color: var(--preview-accent, #6b91d8);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--preview-accent, #6b91d8) 20%, transparent);
}

.theme-global-beautify-preview {
    border-radius: 18px;
    border: 1px solid rgba(20, 30, 40, 0.08);
    overflow: hidden;
    background: var(--preview-main-bg, #eaf2ff);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.theme-global-beautify-preview-main,
.theme-global-beautify-preview-sub {
    padding: 12px;
}

.theme-global-beautify-preview-sub {
    background: var(--preview-sub-bg, #f4f9ff);
    border-top: 1px solid rgba(20, 30, 40, 0.08);
}

.theme-global-beautify-preview-label {
    margin-bottom: 9px;
    color: var(--preview-text, #2a3542);
    font-size: 12px;
    font-weight: 800;
}

.theme-global-beautify-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.theme-global-beautify-preview-btn {
    min-height: 56px;
    border-radius: 14px;
    background: var(--preview-component, rgba(255,255,255,.78));
    border: 1px solid var(--preview-border, rgba(255,255,255,.64));
    box-shadow: 0 8px 18px var(--preview-shadow, rgba(65, 86, 110, 0.12));
}

.theme-global-beautify-preview-dock {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: var(--preview-button, rgba(255,255,255,.66));
}

.theme-global-beautify-preview-dot {
    height: 24px;
    border-radius: 999px;
    background: var(--preview-button-text, #5278ba);
    opacity: 0.5;
}

.theme-global-beautify-preview[data-preview-style="material"] .theme-global-beautify-preview-btn {
    border: 0;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 4px 10px var(--preview-shadow, rgba(65, 86, 110, 0.16));
}

.theme-global-beautify-preview[data-preview-style="minimal"] .theme-global-beautify-preview-btn {
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.theme-global-beautify-preview[data-preview-style="retro"] .theme-global-beautify-preview-btn {
    border: 2px solid var(--preview-border, #d1b979);
    border-radius: 6px;
    box-shadow: 4px 4px 0 var(--preview-shadow, rgba(31, 125, 147, 0.22));
    background: var(--preview-component, #fff8de);
}

.theme-global-beautify-preview[data-preview-style="glass"] .theme-global-beautify-preview-btn {
    border: 1px solid var(--preview-border, rgba(255,255,255,.68));
    border-radius: 18px;
    background: var(--preview-component, rgba(255,255,255,.54));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 18px var(--preview-shadow, rgba(138, 95, 230, 0.14));
}

.theme-global-beautify-import-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.theme-global-beautify-file-label {
    min-width: 0;
    border: 1px dashed rgba(80, 100, 120, 0.22);
    border-radius: 12px;
    padding: 11px 12px;
    background: #fbfcfe;
    font-size: 12px;
    color: #667482;
}

.theme-global-beautify-saved-list {
    display: none;
}

.theme-global-beautify-saved-chip {
    border: 1px solid rgba(80, 100, 120, 0.14);
    border-radius: 999px;
    padding: 8px 11px;
    background: #fff;
    color: #334250;
    font-size: 12px;
}

.theme-global-beautify-modal {
    position: absolute;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(20, 24, 30, 0.28);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.theme-global-beautify-modal.show {
    display: flex;
}

.theme-global-beautify-modal-panel {
    width: min(100%, 330px);
    max-height: min(78vh, 520px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(40, 50, 60, 0.08);
    box-shadow: 0 18px 48px rgba(30, 38, 48, 0.22);
}

.theme-global-beautify-modal-panel h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 800;
    color: #17212b;
}

.theme-global-beautify-modal-panel p {
    margin: 0 0 14px;
    font-size: 12px;
    line-height: 1.55;
    color: #74808d;
}

.theme-global-beautify-name-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d9e2ea;
    border-radius: 12px;
    padding: 12px;
    background: #fbfdff;
    color: #263442;
    font-size: 14px;
    outline: none;
}

.theme-global-beautify-name-input:focus {
    border-color: #8fa8c0;
    box-shadow: 0 0 0 3px rgba(120, 150, 180, 0.14);
}

.theme-global-beautify-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.theme-global-beautify-modal-actions .theme-btn {
    flex: 1;
}

.theme-btn-danger {
    border-color: rgba(220, 72, 72, 0.16);
    background: #f16f6f;
    color: #fff;
}

.theme-btn-danger:active {
    transform: translateY(1px);
    filter: brightness(0.96);
}

.theme-global-beautify-scheme-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-global-beautify-scheme-item {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.theme-global-beautify-scheme-row {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(80, 100, 120, 0.14);
    border-radius: 12px;
    padding: 11px 12px;
    background: #fff;
    color: #2f3d4a;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.theme-global-beautify-scheme-delete {
    flex: 0 0 auto;
    min-width: 58px;
    min-height: 44px;
    border: 1px solid rgba(220, 72, 72, 0.14);
    border-radius: 12px;
    padding: 0 12px;
    background: #fff5f5;
    color: #d84d4d;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.theme-global-beautify-scheme-delete:active {
    transform: translateY(1px);
    background: #ffe8e8;
}

.theme-global-beautify-scheme-row.is-active {
    border-color: var(--lmg-button-text, #456ca9);
    background: var(--lmg-button-bg, #edf4ff);
}

.theme-global-beautify-scheme-radio {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #aab6c2;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.theme-global-beautify-scheme-row.is-active .theme-global-beautify-scheme-radio {
    border-color: var(--lmg-button-text, #456ca9);
    box-shadow: inset 0 0 0 3px #fff;
    background: var(--lmg-button-text, #456ca9);
}

.theme-global-beautify-scheme-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-global-beautify-scheme-empty {
    border: 1px dashed rgba(80, 100, 120, 0.22);
    border-radius: 12px;
    padding: 14px;
    color: #7a8794;
    font-size: 13px;
    line-height: 1.55;
    background: #fbfcfe;
}

.theme-global-beautify-confirm-panel strong {
    display: inline-block;
    margin-top: 8px;
    max-width: 100%;
    color: #17212b;
    font-size: 14px;
    word-break: break-word;
}

.theme-global-beautify-editor {
    width: 100%;
    min-height: 210px;
    resize: vertical;
    border: 1px solid #d9e2ea;
    border-radius: 12px;
    padding: 12px;
    box-sizing: border-box;
    background: #fbfdff;
    color: #263442;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.55;
    outline: none;
}

.theme-global-beautify-editor:focus {
    border-color: #8fa8c0;
    box-shadow: 0 0 0 3px rgba(120, 150, 180, 0.14);
}

.theme-global-beautify-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.theme-global-beautify-footer {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.theme-global-beautify-footer .theme-btn {
    flex: 1;
}

html[data-global-beautify="1"] {
    --lmg-main-bg: linear-gradient(145deg, #dfeaff 0%, #f7fbff 56%, #d7e6ff 100%);
    --lmg-sub-bg: linear-gradient(145deg, rgba(244, 249, 255, 0.92), rgba(226, 237, 255, 0.92));
    --lmg-main-component-bg: rgba(255, 255, 255, 0.76);
    --lmg-sub-component-bg: rgba(255, 255, 255, 0.7);
    --lmg-button-bg: rgba(105, 141, 210, 0.2);
    --lmg-button-text: #456aa8;
    --lmg-text: #26384e;
    --lmg-border: rgba(255, 255, 255, 0.56);
    --lmg-shadow: rgba(70, 96, 130, 0.16);
    --lmg-icon-bg: rgba(105, 141, 210, 0.16);
    --lmg-active-bg: rgba(105, 141, 210, 0.2);
}

html[data-global-beautify="1"] #home-screen {
    --home-default-page-bg: var(--lmg-main-bg);
    background: var(--lmg-main-bg);
}

html[data-global-beautify="1"] .home-screen-bg-layer {
    background: var(--lmg-main-bg);
}

html[data-global-beautify="1"] .home-sub-screen-page {
    background: var(--lmg-sub-bg) !important;
}

html[data-global-beautify="1"][data-user-home-wallpaper="1"] #home-screen {
    background: transparent;
}

html[data-global-beautify="1"][data-user-home-wallpaper="1"] .home-screen-bg-layer {
    background-color: transparent;
}

html[data-global-beautify="1"][data-user-home-wallpaper="1"] .home-sub-screen-page {
    background: transparent !important;
}

html[data-global-beautify="1"] .function-item,
html[data-global-beautify="1"] .bottom-nav,
html[data-global-beautify="1"] .nav-item,
html[data-global-beautify="1"] .music-player-card,
html[data-global-beautify="1"] .main-card:not(.main-card--wallpaper),
html[data-global-beautify="1"] .theme-section-card {
    background: var(--lmg-main-component-bg);
    border-color: var(--lmg-border);
    box-shadow: 0 12px 28px var(--lmg-shadow);
    color: var(--lmg-text);
}

html[data-global-beautify="1"] .card-content {
    background: var(--lmg-main-component-bg);
}

html[data-global-beautify="1"][data-global-beautify-preset="vanilla-cyan"] .main-card:not(.main-card--wallpaper) {
    background: transparent;
}

html[data-global-beautify="1"][data-global-beautify-preset="gentle-pink"] .main-card:not(.main-card--wallpaper) {
    background: transparent;
}

html[data-global-beautify="1"][data-global-beautify-preset="vanilla-cyan"] .main-card .card-content {
    background: rgba(255, 255, 250, 0.3);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

html[data-global-beautify="1"][data-global-beautify-preset="gentle-pink"] .main-card .card-content {
    background: rgba(255, 255, 255, 0.25);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

html[data-global-beautify="1"][data-user-card-wallpaper="1"] .main-card.main-card--wallpaper {
    background: transparent;
    isolation: isolate;
    overflow: hidden;
    border-color: var(--lmg-border);
    box-shadow: 0 12px 28px var(--lmg-shadow);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

html[data-global-beautify="1"][data-user-card-wallpaper="1"] .main-card.main-card--wallpaper .card-background {
    opacity: 1 !important;
    background-color: rgba(255, 255, 255, 0.18);
    background-blend-mode: normal;
    mix-blend-mode: normal;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

html[data-global-beautify="1"][data-user-card-wallpaper="1"] .main-card.main-card--wallpaper .card-content {
    border-radius: 0 0 var(--main-card-radius) var(--main-card-radius);
    background: var(--lmg-main-component-bg);
    position: relative;
    z-index: 1;
}

html[data-global-beautify="1"][data-global-beautify-preset="vanilla-cyan"][data-user-card-wallpaper="1"] .main-card.main-card--wallpaper .card-content {
    background: rgba(255, 255, 250, 0.3);
}

html[data-global-beautify="1"][data-global-beautify-preset="gentle-pink"][data-user-card-wallpaper="1"] .main-card.main-card--wallpaper .card-content {
    background: rgba(255, 255, 255, 0.25);
}

html[data-global-beautify="1"] .sub-screen-action--light,
html[data-global-beautify="1"] .sub-screen-film,
html[data-global-beautify="1"] .sub-screen-cal-wrap,
html[data-global-beautify="1"] .wechat-memory-calendar-card,
html[data-global-beautify="1"] .sub-screen-note-card,
html[data-global-beautify="1"] .home-desktop-page-indicator {
    background: var(--lmg-sub-component-bg);
    border-color: var(--lmg-border);
    box-shadow: 0 12px 28px var(--lmg-shadow);
    color: var(--lmg-text);
}

html[data-global-beautify="1"] .function-icon,
html[data-global-beautify="1"] .nav-icon,
html[data-global-beautify="1"] .sub-screen-action-icon {
    background: var(--lmg-icon-bg);
    border-color: var(--lmg-border);
    box-shadow: 0 6px 16px var(--lmg-shadow);
}

html[data-global-beautify="1"] .function-icon img,
html[data-global-beautify="1"] .nav-icon img,
html[data-global-beautify="1"] .sub-screen-action-icon-img {
    opacity: 0.96;
}

html[data-global-beautify="1"] .function-name,
html[data-global-beautify="1"] .nav-name,
html[data-global-beautify="1"] .sub-screen-action-label,
html[data-global-beautify="1"] .user-name,
html[data-global-beautify="1"] .user-signature {
    color: var(--lmg-text);
}

html[data-global-beautify="1"] .nav-item:active,
html[data-global-beautify="1"] .function-item:active,
html[data-global-beautify="1"] .sub-screen-action:active {
    background: var(--lmg-active-bg);
}

@media (hover: hover) and (pointer: fine) {
    html[data-global-beautify="1"] .function-item:hover,
    html[data-global-beautify="1"] .nav-item:hover,
    html[data-global-beautify="1"] .sub-screen-action:hover {
        background: var(--lmg-active-bg);
    }
}

html[data-global-beautify="1"][data-global-beautify-style="material"] .function-item,
html[data-global-beautify="1"][data-global-beautify-style="material"] .nav-item,
html[data-global-beautify="1"][data-global-beautify-style="material"] .sub-screen-action--light {
    border: 0;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 4px 12px var(--lmg-shadow);
}

html[data-global-beautify="1"][data-global-beautify-style="material"] .function-icon,
html[data-global-beautify="1"][data-global-beautify-style="material"] .nav-icon,
html[data-global-beautify="1"][data-global-beautify-style="material"] .sub-screen-action-icon {
    border: 0;
    border-radius: 16px;
    background: var(--lmg-button-bg);
}

html[data-global-beautify="1"][data-global-beautify-style="minimal"] .function-item,
html[data-global-beautify="1"][data-global-beautify-style="minimal"] .nav-item,
html[data-global-beautify="1"][data-global-beautify-style="minimal"] .sub-screen-action--light {
    border-width: 0 0 1px;
    border-style: solid;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    letter-spacing: 0.02em;
}

html[data-global-beautify="1"][data-global-beautify-style="minimal"] .bottom-nav {
    border: 1px solid var(--lmg-border);
    border-radius: 16px;
    box-shadow: none;
}

html[data-global-beautify="1"][data-global-beautify-style="minimal"] .function-icon,
html[data-global-beautify="1"][data-global-beautify-style="minimal"] .nav-icon,
html[data-global-beautify="1"][data-global-beautify-style="minimal"] .sub-screen-action-icon {
    background: transparent;
    border: 0;
    box-shadow: none;
}

html[data-global-beautify="1"][data-global-beautify-style="retro"] .function-item,
html[data-global-beautify="1"][data-global-beautify-style="retro"] .nav-item,
html[data-global-beautify="1"][data-global-beautify-style="retro"] .sub-screen-action--light {
    border: 2px solid var(--lmg-border);
    border-radius: 6px;
    box-shadow: 4px 4px 0 var(--lmg-shadow);
    letter-spacing: 0.06em;
}

html[data-global-beautify="1"][data-global-beautify-style="retro"] .bottom-nav {
    border: 2px solid var(--lmg-border);
    border-radius: 8px;
    box-shadow: 4px 4px 0 var(--lmg-shadow);
}

html[data-global-beautify="1"][data-global-beautify-style="retro"] .function-icon,
html[data-global-beautify="1"][data-global-beautify-style="retro"] .nav-icon,
html[data-global-beautify="1"][data-global-beautify-style="retro"] .sub-screen-action-icon {
    border: 2px solid var(--lmg-button-text);
    border-radius: 4px;
    background: var(--lmg-icon-bg);
    box-shadow: 3px 3px 0 var(--lmg-shadow);
}

html[data-global-beautify="1"][data-global-beautify-style="glass"] .function-item,
html[data-global-beautify="1"][data-global-beautify-style="glass"] .bottom-nav,
html[data-global-beautify="1"][data-global-beautify-style="glass"] .nav-item,
html[data-global-beautify="1"][data-global-beautify-style="glass"] .sub-screen-action--light,
html[data-global-beautify="1"][data-global-beautify-style="glass"] .main-card:not(.main-card--wallpaper),
html[data-global-beautify="1"][data-global-beautify-style="glass"] .card-content {
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--lmg-border);
    border-radius: 18px;
    box-shadow: 0 8px 24px var(--lmg-shadow);
}

html[data-global-beautify="1"][data-global-beautify-style="glass"][data-user-card-wallpaper="1"] .main-card.main-card--wallpaper .card-content {
    border-width: 0;
    border-radius: 0 0 var(--main-card-radius) var(--main-card-radius);
}

html[data-global-beautify="1"][data-global-beautify-style="glass"] .function-icon,
html[data-global-beautify="1"][data-global-beautify-style="glass"] .nav-icon,
html[data-global-beautify="1"][data-global-beautify-style="glass"] .sub-screen-action-icon {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--lmg-border);
    border-radius: 999px;
    background: var(--lmg-icon-bg);
}

@supports not (color: color-mix(in srgb, white 50%, black)) {
    .theme-global-beautify-preset.is-active {
        box-shadow: 0 0 0 3px rgba(107, 145, 216, 0.2);
    }
}

@media (max-width: 380px) {
    .theme-global-beautify-presets,
    .theme-global-beautify-actions {
        grid-template-columns: 1fr;
    }
}
