.desktop-wallpaper-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    user-select: none;
}

.desktop-container {
    position: relative;
    z-index: 1;
}

.app-icon {
    position: relative;
    overflow: hidden;
}

.app-icon > .appearance-applied-icon {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
    pointer-events: none;
}

body.is-appearance-open .desktop-container,
body.is-appearance-open .pagination,
body.is-appearance-open .dock-container,
body.is-appearance-open .system-status-bar {
    visibility: hidden;
    pointer-events: none;
}

.appearance-view {
    --appearance-ink: #1a1d21;
    --appearance-muted: #777c83;
    --appearance-line: #eceef1;
    position: fixed;
    inset: 0;
    z-index: 900;
    min-width: 280px;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    background: #ffffff;
    color: var(--appearance-ink);
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
}

.appearance-view,
.appearance-view * {
    box-sizing: border-box;
    letter-spacing: 0;
    -webkit-tap-highlight-color: transparent;
}

.appearance-view button:focus-visible,
.appearance-view input:focus-visible {
    outline: 2px solid #20242a;
    outline-offset: 3px;
}

.appearance-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: calc(72px + var(--safe-top));
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: end;
    gap: 12px;
    padding: var(--safe-top) max(18px, var(--safe-right)) 14px max(18px, var(--safe-left));
    border-bottom: 1px solid rgba(19, 23, 29, 0.045);
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 8px 24px rgba(26, 30, 37, 0.055);
}

.appearance-nav h1 {
    min-width: 0;
    overflow: hidden;
    color: #16191d;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 44px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appearance-back,
.appearance-dialog-header > button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 16px;
    background: #ffffff;
    color: #2d3137;
    font-size: 1.35rem;
    box-shadow:
        6px 6px 14px rgba(25, 30, 38, 0.09),
        -5px -5px 14px #ffffff,
        inset 1px 1px 0 rgba(255, 255, 255, 0.96);
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.appearance-back:active,
.appearance-dialog-header > button:active {
    transform: scale(0.94);
    box-shadow:
        inset 3px 3px 7px rgba(25, 30, 38, 0.08),
        inset -3px -3px 7px #ffffff;
}

.appearance-nav-spacer {
    width: 44px;
    height: 44px;
}

.appearance-content {
    width: min(100%, 860px);
    margin-inline: auto;
    padding: 30px max(22px, var(--safe-right)) calc(46px + var(--safe-bottom)) max(22px, var(--safe-left));
}

.appearance-section + .appearance-section {
    margin-top: 42px;
}

.appearance-section-heading {
    margin: 0 6px 18px;
}

.appearance-section-kicker {
    display: block;
    margin-bottom: 5px;
    color: #a0a4aa;
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.14em;
}

.appearance-section-heading h2 {
    color: #191c20;
    font-size: 1.15rem;
    font-weight: 720;
    line-height: 1.3;
}

.appearance-section-heading p {
    margin-top: 5px;
    color: var(--appearance-muted);
    font-size: 0.79rem;
    line-height: 1.55;
}

.appearance-surface {
    border: 1px solid rgba(22, 26, 33, 0.035);
    border-radius: 28px;
    background: #ffffff;
    box-shadow:
        13px 13px 30px rgba(25, 30, 38, 0.085),
        -10px -10px 28px #ffffff,
        inset 1px 1px 0 rgba(255, 255, 255, 0.96);
}

.appearance-wallpaper-surface {
    padding: 16px;
}

.appearance-wallpaper-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    overflow: hidden;
    border: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, #e3e8ed 0%, #f6f7f8 58%, #e9eff2 100%);
    box-shadow:
        inset 4px 4px 12px rgba(24, 29, 36, 0.08),
        inset -4px -4px 12px rgba(255, 255, 255, 0.92);
    isolation: isolate;
}

.appearance-wallpaper-preview::after {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, transparent 54%, rgba(13, 16, 21, 0.24));
    content: "";
    pointer-events: none;
}

.appearance-wallpaper-preview > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.appearance-wallpaper-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 7px;
    color: #858b92;
    font-size: 0.74rem;
    font-weight: 650;
}

.appearance-wallpaper-placeholder i {
    font-size: 2rem;
}

.appearance-preview-badge {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #272b30;
    font-size: 0.68rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 20, 26, 0.12);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.appearance-wallpaper-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.appearance-action,
.appearance-reset,
.appearance-dialog-local,
.appearance-dialog-reset,
.appearance-url-form button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 15px;
    background: #ffffff;
    color: #282d33;
    font-size: 0.79rem;
    font-weight: 680;
    box-shadow:
        6px 6px 14px rgba(25, 30, 38, 0.085),
        -5px -5px 14px #ffffff,
        inset 1px 1px 0 #ffffff;
    transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.appearance-action-primary,
.appearance-dialog-local,
.appearance-url-form button {
    background: #1c2025;
    color: #ffffff;
    box-shadow:
        5px 6px 14px rgba(22, 26, 32, 0.2),
        inset 1px 1px 0 rgba(255, 255, 255, 0.14);
}

.appearance-action:active,
.appearance-reset:active,
.appearance-dialog-local:active,
.appearance-dialog-reset:active,
.appearance-url-form button:active {
    transform: scale(0.97);
    box-shadow:
        inset 3px 3px 7px rgba(25, 30, 38, 0.12),
        inset -2px -2px 6px rgba(255, 255, 255, 0.6);
}

.appearance-action:disabled,
.appearance-reset:disabled,
.appearance-dialog-local:disabled,
.appearance-dialog-reset:disabled,
.appearance-url-form button:disabled {
    cursor: wait;
    opacity: 0.48;
}

.appearance-reset {
    width: 100%;
    margin-top: 12px;
    color: #666c73;
    box-shadow: inset 2px 2px 7px rgba(25, 30, 38, 0.06), inset -2px -2px 7px #ffffff;
}

.appearance-reset:disabled {
    cursor: default;
    opacity: 0.42;
}

.appearance-icon-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 14px;
}

.appearance-icon-card {
    min-width: 0;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 8px 2px;
    background: transparent;
    text-align: center;
    transition: transform 150ms ease;
}

.appearance-icon-card:active {
    transform: scale(0.97);
}

.appearance-icon-card-preview {
    position: relative;
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(24, 28, 34, 0.035);
    border-radius: 19px;
    background: #ffffff;
    color: #20242a;
    font-size: 1.75rem;
    box-shadow:
        6px 6px 14px rgba(25, 30, 38, 0.1),
        -5px -5px 14px #ffffff,
        inset 1px 1px 0 #ffffff;
}

.appearance-icon-card-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
}

.appearance-icon-card-name {
    max-width: 100%;
    overflow: hidden;
    color: #2b3036;
    font-size: 0.76rem;
    font-weight: 680;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appearance-icon-card-hint {
    color: #a0a4aa;
    font-size: 0.62rem;
    line-height: 1;
}

.appearance-lock-section {
    padding-bottom: 4px;
}

.appearance-lock-row {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
}

.appearance-lock-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.appearance-lock-copy strong {
    font-size: 0.9rem;
    font-weight: 700;
}

.appearance-lock-copy small {
    margin-top: 4px;
    color: var(--appearance-muted);
    font-size: 0.72rem;
}

.appearance-switch {
    position: relative;
    width: 52px;
    height: 30px;
    flex: 0 0 52px;
}

.appearance-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.appearance-switch > span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #eceef1;
    box-shadow:
        inset 3px 3px 7px rgba(24, 29, 36, 0.12),
        inset -3px -3px 7px #ffffff;
    opacity: 0.78;
}

.appearance-switch > span::after {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 3px 3px 8px rgba(25, 30, 38, 0.16), -2px -2px 6px #ffffff;
    content: "";
    transition: transform 160ms ease;
}

.appearance-switch input:checked + span::after {
    transform: translateX(22px);
}

.appearance-status {
    min-height: 20px;
    margin-top: 24px;
    color: #60666d;
    font-size: 0.72rem;
    text-align: center;
}

.appearance-status[data-tone="error"] {
    color: #a13e47;
}

.appearance-image-dialog {
    width: min(calc(100% - 28px), 460px);
    max-width: none;
    max-height: min(720px, calc(100% - 28px));
    margin: auto;
    overflow: visible;
    border: 0;
    border-radius: 30px;
    background: transparent;
    color: var(--appearance-ink);
}

.appearance-image-dialog::backdrop {
    background: rgba(26, 29, 34, 0.3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.appearance-dialog-shell {
    max-height: min(720px, calc(100vh - 28px));
    padding: 22px;
    overflow-y: auto;
    border: 1px solid rgba(22, 26, 33, 0.04);
    border-radius: 30px;
    background: #ffffff;
    box-shadow:
        18px 20px 50px rgba(18, 22, 28, 0.2),
        -10px -10px 28px rgba(255, 255, 255, 0.86),
        inset 1px 1px 0 #ffffff;
    overscroll-behavior: contain;
}

.appearance-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.appearance-dialog-header small {
    display: block;
    margin-bottom: 2px;
    color: #9a9fa5;
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.12em;
}

.appearance-dialog-header h2 {
    font-size: 1.08rem;
    font-weight: 720;
}

.appearance-dialog-preview {
    position: relative;
    width: 94px;
    height: 94px;
    display: grid;
    place-items: center;
    margin: 4px auto 22px;
    overflow: hidden;
    border: 1px solid rgba(22, 26, 33, 0.035);
    border-radius: 26px;
    background: #ffffff;
    color: #6f757c;
    font-size: 2rem;
    box-shadow:
        10px 10px 22px rgba(25, 30, 38, 0.1),
        -8px -8px 20px #ffffff,
        inset 1px 1px 0 #ffffff;
}

.appearance-dialog-preview.is-wallpaper {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 19px;
    background: linear-gradient(135deg, #e3e8ed 0%, #f6f7f8 58%, #e9eff2 100%);
}

.appearance-dialog-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
}

.appearance-dialog-preview > span {
    display: grid;
    place-items: center;
}

.appearance-dialog-local,
.appearance-dialog-reset {
    width: 100%;
}

.appearance-dialog-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 14px;
    color: #a2a6ac;
    font-size: 0.65rem;
}

.appearance-dialog-divider::before,
.appearance-dialog-divider::after {
    height: 1px;
    flex: 1;
    background: var(--appearance-line);
    content: "";
}

.appearance-url-form label {
    display: block;
    margin: 0 2px 7px;
    color: #666c73;
    font-size: 0.7rem;
    font-weight: 680;
}

.appearance-url-form > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.appearance-url-form input {
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(25, 29, 36, 0.055);
    border-radius: 14px;
    background: #ffffff;
    color: #252a30;
    font-size: 0.78rem;
    box-shadow:
        inset 3px 3px 8px rgba(25, 30, 38, 0.075),
        inset -3px -3px 8px #ffffff;
    outline: none;
}

.appearance-url-form input::placeholder {
    color: #b1b5ba;
}

.appearance-url-form button {
    min-width: 72px;
    min-height: 46px;
    padding-inline: 16px;
}

.appearance-dialog-reset {
    margin-top: 14px;
    color: #676d74;
    box-shadow: inset 2px 2px 7px rgba(25, 30, 38, 0.055), inset -2px -2px 7px #ffffff;
}

.appearance-dialog-reset[hidden] {
    display: none;
}

.appearance-dialog-status {
    min-height: 19px;
    margin-top: 13px;
    color: #6e747a;
    font-size: 0.7rem;
    text-align: center;
}

.appearance-dialog-status[data-tone="error"] {
    color: #a13e47;
}

@media (hover: hover) and (pointer: fine) {
    .appearance-icon-card:hover,
    .appearance-action:hover,
    .appearance-dialog-local:hover,
    .appearance-url-form button:hover {
        transform: translateY(-2px);
    }

}

@media (max-width: 560px) {
    .appearance-nav {
        min-height: calc(68px + var(--safe-top));
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        padding-inline: max(14px, var(--safe-left)) max(14px, var(--safe-right));
        padding-bottom: 12px;
    }

    .appearance-back,
    .appearance-nav-spacer {
        width: 42px;
        height: 42px;
    }

    .appearance-nav h1 {
        line-height: 42px;
    }

    .appearance-content {
        padding-top: 24px;
        padding-inline: max(16px, var(--safe-right)) max(16px, var(--safe-left));
    }

    .appearance-section + .appearance-section {
        margin-top: 36px;
    }

    .appearance-wallpaper-surface {
        padding: 12px;
        border-radius: 24px;
    }

    .appearance-icon-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px 8px;
    }

    .appearance-icon-card {
        min-height: 106px;
        padding-inline: 0;
    }

    .appearance-icon-card-preview {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
        border-radius: 17px;
        font-size: 1.55rem;
    }

    .appearance-dialog-shell {
        padding: 18px;
        border-radius: 26px;
    }
}

@media (max-width: 370px) {
    .appearance-icon-grid {
        gap-inline: 5px;
    }

    .appearance-wallpaper-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .appearance-view *,
    .appearance-view *::before,
    .appearance-view *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: more) {
    .appearance-surface,
    .appearance-dialog-shell {
        border-color: rgba(20, 24, 30, 0.32);
    }
}
