body:has(#udid) {
    --primary-color: #087f8c;
    --primary-gradient: #087f8c;
    --body-bg: #edf2f3;
    --card-bg: #ffffff;
    --card-header-bg: #ffffff;
    --card-footer-bg: #f6f8f8;
    --text-dark: #172326;
    --text-light: #5b6a6e;
    --border-color: #dce5e6;
    --input-bg: #ffffff;
    --shadow-color: rgba(22, 46, 51, 0.08);
    --border-radius: 8px;
    --card-shadow: 0 8px 24px rgba(22, 46, 51, 0.07);
    color: var(--text-dark);
    padding: 32px 0 40px;
    background-color: var(--body-bg) !important;
    letter-spacing: 0;
}

html.dark-mode body:has(#udid),
.dark-mode body:has(#udid) {
    --primary-color: #46c8c3;
    --primary-gradient: #167f7c;
    --body-bg: #141b1d;
    --card-bg: #20292b;
    --card-header-bg: #20292b;
    --card-footer-bg: #1b2426;
    --text-dark: #edf4f4;
    --text-light: #b3c0c2;
    --border-color: #364447;
    --input-bg: #182123;
    --shadow-color: rgba(0, 0, 0, 0.22);
    --card-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

body:has(#udid) .container {
    width: 100%;
    max-width: 720px;
    padding: 0 18px;
}

body:has(#udid)::before { display: none !important; }

.container:has(#udid) > .card {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    animation: none;
}

.container:has(#udid) > .card:first-child {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.container:has(#udid) > .card:first-child .card-header {
    padding: 0 0 20px;
    border: 0;
    background: transparent;
}

.container:has(#udid) > .card:first-child .card-body:has(#notice-box[style*="display:none"], #notice-box[style*="display: none"]):has(#action-btn-group[style*="display: none"]) {
    display: none;
}

body:has(#udid) .app-header { gap: 14px; }
body:has(#udid) .app-icon {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    margin: 0;
    border-radius: 12px;
    box-shadow: none;
}
body:has(#udid) .app-title {
    margin: 0;
    color: var(--text-dark);
    font-size: 24px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
body:has(#udid) .app-info { min-width: 0; flex: 1; }

body:has(#udid) .card-header { border-color: var(--border-color); }
body:has(#udid) .card-body { padding: 24px; }
body:has(#udid) .card-footer {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    padding: 16px 24px 20px;
    border-color: var(--border-color);
}
body:has(#udid) .form-label { color: var(--text-dark); }
body:has(#udid) .form-group { margin-bottom: 18px; }
body:has(#udid) .form-control {
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    color: var(--text-dark);
    background: var(--input-bg);
}
body:has(#udid) .form-control::placeholder { color: #849397; }
body:has(#udid) .form-control:focus {
    border-color: var(--primary-color);
    outline: 3px solid color-mix(in srgb, var(--primary-color) 18%, transparent);
    box-shadow: none;
}

body:has(#udid) .app-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
body:has(#udid) .radio-option label {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 9px 8px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    color: var(--text-dark);
    background: var(--input-bg);
    line-height: 1.35;
}
body:has(#udid) .radio-option input[type="radio"]:focus-visible + label {
    outline: 3px solid color-mix(in srgb, var(--primary-color) 28%, transparent);
    outline-offset: 2px;
}
body:has(#udid) .radio-option input[type="radio"]:checked + label {
    color: var(--text-dark);
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 12%, var(--input-bg));
    box-shadow: inset 0 0 0 1px var(--primary-color);
}

body:has(#udid) #simple-sign-apps label {
    flex-direction: column;
    gap: 9px;
    min-height: 102px;
    position: relative;
}
body:has(#udid) .fq-app-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: contain;
    flex: 0 0 38px;
}
body:has(#udid) .fq-app-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 12%, var(--input-bg));
}
body:has(#udid) .fq-selected {
    position: absolute;
    top: 7px;
    right: 7px;
    color: var(--primary-color);
    visibility: hidden;
    font-size: 13px;
}
body:has(#udid) input:checked + label .fq-selected { visibility: visible; }

body:has(#udid) .btn,
body:has(#udid) .btn-get-udid {
    min-height: 48px;
    border-radius: 7px;
    font-weight: 650;
}
body:has(#udid) .btn-primary,
body:has(#udid) .btn-get-udid {
    color: #ffffff;
    background: var(--primary-gradient);
    box-shadow: none;
}
body:has(#udid) .btn-outline {
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}
body:has(#udid) .btn-block { margin: 0; }
body:has(#udid) .btn:focus { box-shadow: none; }
body:has(#udid) #agreement {
    flex: 0 0 18px;
    width: 18px !important;
    height: 18px !important;
    accent-color: var(--primary-color);
}

.container:has(#udid) > .card:nth-of-type(3) {
    border: 0;
    background: transparent;
    box-shadow: none;
}
.container:has(#udid) > .card:nth-of-type(3) .card-body { padding: 4px 4px 0; }
.container:has(#udid) > .card:nth-of-type(3) h3 { margin-bottom: 10px; }
.container:has(#udid) > .card:nth-of-type(3) ul { margin: 0; padding-left: 20px; }
.container:has(#udid) > .card:nth-of-type(3) li { margin: 6px 0; padding-left: 2px; }

body:has(#udid) .theme-toggle {
    position: static;
    flex: 0 0 42px;
    margin-left: auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 0 3px 12px var(--shadow-color);
}

body:has(#udid) button:focus-visible,
body:has(#udid) a:focus-visible,
body:has(#udid) #themeToggle:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary-color) 35%, transparent);
    outline-offset: 2px;
}

@media (min-width: 600px) {
    body:has(#udid) .app-options { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    body:has(#udid) .card-body > .form-group:first-child {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 146px;
        column-gap: 10px;
    }
    body:has(#udid) .card-body > .form-group:first-child > .form-label,
    body:has(#udid) .card-body > .form-group:first-child > div { grid-column: 1 / -1; }
    body:has(#udid) .btn-get-udid { margin-top: 0; }
}

@media (max-width: 480px) {
    body:has(#udid) { padding: 14px 0 28px; }
    body:has(#udid) .container { padding: 0 12px; }
    .container:has(#udid) > .card { margin-bottom: 12px; }
    body:has(#udid) .card-body { padding: 16px; }
    body:has(#udid) .card-footer { padding: 12px 16px 16px; }
    .container:has(#udid) > .card:first-child .card-header { padding: 8px 4px 12px; }
    body:has(#udid) .app-title { font-size: 22px; }
    body:has(#udid) .app-icon { width: 48px; height: 48px; flex-basis: 48px; border-radius: 8px; }
    body:has(#udid) #simple-sign-apps label { min-height: 94px; font-size: 13px; }
    body:has(#udid) .form-control { font-size: 16px; }
}

@media (max-width: 360px) {
    body:has(#udid) .app-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    body:has(#udid),
    body:has(#udid) *,
    body:has(#udid) *::before,
    body:has(#udid) *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
