/* ==========================================================================
   Apple macOS Crystal Light & Brand Blue Auth Modal Redesign (v2 Wide Edition)
   Matches Header 'U' Circuit Logo (#007bff -> #3b82f6 -> #60a5fa) & Desktop Wide Layout
   ========================================================================== */

#auth-apple-modal,
#consent-modal {
    padding: 20px;
    box-sizing: border-box;
}

/* Light, airy backdrop so the white page behind stays bright and clean */
#auth-apple-modal .ds-modal-overlay,
#consent-modal .ds-modal-overlay {
    background:
        radial-gradient(circle at 50% 18%, rgba(59, 130, 246, 0.14), transparent 55%),
        rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(12px) saturate(145%);
    -webkit-backdrop-filter: blur(12px) saturate(145%);
}

/* Outer window shell: desktop-wide proportions & pure crystal-white surface */
#auth-apple-modal .ds-modal-content,
#consent-modal .ds-modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(580px, 100%);
    max-width: 580px;
    max-height: min(92dvh, 860px);
    overflow: hidden !important;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.95);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    backdrop-filter: blur(36px) saturate(180%);
    -webkit-backdrop-filter: blur(36px) saturate(180%);
    box-shadow:
        inset 0 1px 0 0 #ffffff,
        0 28px 72px -12px rgba(0, 82, 204, 0.16),
        0 12px 28px -8px rgba(15, 23, 42, 0.08),
        0 0 0 1px rgba(59, 130, 246, 0.14);
    transition:
        max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s ease;
}

/* Desktop wide registration layout (matches user target frame ~650px) */
#auth-apple-modal.is-register .ds-modal-content-lg,
#auth-apple-modal[data-active-tab="register"] .ds-modal-content-lg {
    width: min(650px, 100%);
    max-width: 650px;
    max-height: min(93dvh, 880px);
}

/* Dynamic ambient spotlight using bright brand sky-blue (no dark purple) */
#auth-apple-modal .ds-macos-ambient-glow {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(
            420px circle at var(--macos-spot-x, 50%) var(--macos-spot-y, 0%),
            rgba(0, 123, 255, 0.07),
            transparent 70%
        ),
        radial-gradient(ellipse 85% 110px at 50% -15px, rgba(59, 130, 246, 0.09), transparent 75%);
}

/* Subtle macOS spring bounce when user clicks outside the modal (anti-misclick feedback) */
@keyframes macosModalBounce {
    0% { transform: scale(1); }
    35% {
        transform: scale(1.014);
        box-shadow:
            inset 0 1px 0 0 #ffffff,
            0 32px 80px -10px rgba(0, 123, 255, 0.26),
            0 0 0 2px rgba(0, 123, 255, 0.38);
    }
    70% { transform: scale(0.995); }
    100% { transform: scale(1); }
}

#auth-apple-modal .ds-modal-content.is-bouncing {
    animation: macosModalBounce 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   Header, Official 'U' Logo Badge & Bright Segmented Control
   ========================================================================== */

#auth-apple-modal .ds-modal-header {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    padding: 22px 32px 16px;
    border-bottom: 1px solid rgba(219, 230, 244, 0.75);
    background: rgba(255, 255, 255, 0.75);
    pointer-events: auto;
}

#auth-apple-modal .ds-modal-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

#auth-apple-modal .ds-modal-brand-group {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

/* Official Top-Left 'U' Logo Container */
#auth-apple-modal .ds-macos-brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 11px;
    background: transparent;
    box-shadow: none;
    filter: drop-shadow(0 6px 14px rgba(0, 123, 255, 0.24));
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

#auth-apple-modal .ds-macos-brand-badge:hover {
    transform: scale(1.05);
}

#auth-apple-modal .ds-macos-brand-badge svg.auth-modal-logo-svg {
    width: 42px;
    height: 42px;
    display: block;
}

#auth-apple-modal .ds-modal-title-stack {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

/* Title matches top navbar brand text & page section title gradient */
#auth-apple-modal .ds-modal-header .ds-modal-title {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    background: linear-gradient(135deg, #007bff 0%, #3b82f6 55%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #007bff;
}

#auth-apple-modal .ds-modal-header .ds-modal-title::after,
#auth-apple-modal .ds-modal-header .ds-modal-title::before {
    display: none !important;
    content: none !important;
}

#auth-apple-modal .ds-modal-subtitle {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.35;
}

#auth-apple-modal .ds-modal-close,
#consent-modal .ds-modal-close {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 999px;
    border: 1px solid #e2ecf8;
    background: #f4f8ff;
    color: #475569;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

#auth-apple-modal .ds-modal-close:hover,
#consent-modal .ds-modal-close:hover {
    background: #e6f0ff;
    border-color: #bfd7f6;
    color: #007bff;
    transform: scale(1.06);
}

/* Bright Ice-Blue Segmented Control with Pure White Glider */
#auth-apple-modal .ds-auth-tabs {
    position: relative;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    margin: 16px 0 0;
    border-radius: 13px;
    background: #eff6ff;
    border: 1px solid rgba(59, 130, 246, 0.14);
    box-shadow: inset 0 1px 2px rgba(0, 82, 204, 0.04);
}

#auth-apple-modal .ds-auth-tab-glider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 10px;
    background: #ffffff;
    box-shadow:
        0 2px 8px rgba(0, 123, 255, 0.12),
        0 0 0 1px rgba(59, 130, 246, 0.08);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    z-index: 0;
}

#auth-apple-modal.is-register .ds-auth-tab-glider,
#auth-apple-modal[data-active-tab="register"] .ds-auth-tab-glider {
    transform: translateX(100%);
}

#auth-apple-modal .ds-auth-tab {
    position: relative;
    z-index: 1;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 10px;
    transition: color 0.2s ease;
}

#auth-apple-modal .ds-auth-tab:hover {
    color: #1e40af;
}

#auth-apple-modal .ds-auth-tab.ds-auth-tab-active {
    color: #007bff;
    font-weight: 700;
}

/* ==========================================================================
   Scrollable Body & Invisible-Track macOS Scrollbar
   ========================================================================== */

#auth-apple-modal .ds-modal-body,
#consent-modal .ds-modal-body {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 20px 32px 26px;

    --scrollbar-thumb: rgba(59, 130, 246, 0.24);
    --scrollbar-track: transparent;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

#auth-apple-modal .ds-modal-body:hover,
#consent-modal .ds-modal-body:hover {
    --scrollbar-thumb: rgba(0, 123, 255, 0.42);
}

@supports not (scrollbar-color: auto) {
    #auth-apple-modal .ds-modal-body::-webkit-scrollbar,
    #consent-modal .ds-modal-body::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    #auth-apple-modal .ds-modal-body::-webkit-scrollbar-track,
    #consent-modal .ds-modal-body::-webkit-scrollbar-track {
        background: var(--scrollbar-track);
        margin-block: 10px;
    }

    #auth-apple-modal .ds-modal-body::-webkit-scrollbar-thumb,
    #consent-modal .ds-modal-body::-webkit-scrollbar-thumb {
        background: var(--scrollbar-thumb);
        border-radius: 999px;
    }
}

/* ==========================================================================
   Unified Form Layout & Modern Controls
   ========================================================================== */

#auth-apple-modal .ds-auth-form:not([style*="none"]) {
    display: flex !important;
    flex-direction: column;
    gap: 14px;
}

/* Hide redundant register hero since header displays official logo + title */
#auth-apple-modal .ds-register-hero {
    display: none;
}

/* Secondary Login Mode Switch (Password vs Email Code) */
#auth-apple-modal .auth-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 3.5px;
    border-radius: 11px;
    background: #f2f7ff;
    border: 1px solid rgba(59, 130, 246, 0.13);
}

#auth-apple-modal .auth-mode-switch button {
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    color: #64748b;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

#auth-apple-modal .auth-mode-switch button:hover {
    color: #007bff;
}

#auth-apple-modal .auth-mode-switch button[aria-pressed="true"] {
    background: #ffffff;
    color: #007bff;
    box-shadow:
        0 2px 6px rgba(0, 123, 255, 0.10),
        0 0 0 1px rgba(59, 130, 246, 0.08);
}

/* Labels & Inputs */
#auth-apple-modal .ds-form-group {
    margin: 0;
}

#auth-apple-modal .ds-form-label,
#auth-apple-modal .auth-flow label {
    display: block;
    margin-bottom: 6px;
    color: #1e293b;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

#auth-apple-modal .ds-required-mark {
    color: #ef4444;
    margin-left: 2px;
}

#auth-apple-modal .ds-auth-input,
#auth-apple-modal .auth-flow input:not([type="checkbox"]):not([type="hidden"]) {
    width: 100%;
    height: 43px;
    min-height: 43px;
    padding: 0 14px;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1.5px solid #dbe6f4;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
    transition:
        border-color 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease;
}

#auth-apple-modal .ds-auth-input::placeholder,
#auth-apple-modal .auth-flow input:not([type="checkbox"]):not([type="hidden"])::placeholder {
    color: #94a3b8;
}

#auth-apple-modal .ds-password-wrapper .ds-auth-input {
    padding-right: 42px;
}

#auth-apple-modal .ds-password-toggle {
    color: #64748b;
    border-radius: 8px;
}

#auth-apple-modal .ds-password-toggle:hover {
    color: #007bff;
    background: #eff6ff;
}

#auth-apple-modal .ds-auth-input:hover,
#auth-apple-modal .auth-flow input:not([type="checkbox"]):not([type="hidden"]):hover {
    border-color: #93c5fd;
    background: #ffffff;
}

#auth-apple-modal .ds-auth-input:focus,
#auth-apple-modal .auth-flow input:not([type="checkbox"]):not([type="hidden"]):focus {
    outline: none;
    border-color: #007bff;
    background: #ffffff;
    box-shadow: 0 0 0 3.5px rgba(0, 123, 255, 0.13);
}

#auth-apple-modal .ds-field-note {
    margin-top: 5px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

/* Side-by-side Password & Confirm Password Grid */
#auth-apple-modal .ds-password-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

#auth-apple-modal .ds-password-feedback-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: -4px;
    min-height: 20px;
}

#auth-apple-modal .ds-password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    flex: 1;
}

#auth-apple-modal .ds-strength-meter {
    flex: 1;
    max-width: 140px;
    height: 6px;
    margin: 0;
    border-radius: 999px;
    background: #e2ecf8;
    overflow: hidden;
}

#auth-apple-modal .ds-strength-text {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

#auth-apple-modal .ds-password-match {
    margin: 0;
    min-height: 0;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* Horizontal Remember Me & Forgot Password Bar */
#auth-apple-modal .ds-auth-options {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: -2px 0 0;
}

#auth-apple-modal .ds-auth-options-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

#auth-apple-modal .auth-password-footer {
    margin: 0;
    font-size: 13px;
}

#auth-apple-modal .auth-password-footer a {
    color: #007bff;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.18s ease;
}

#auth-apple-modal .auth-password-footer a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

#auth-apple-modal .ds-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

#auth-apple-modal .ds-checkbox {
    width: 17px;
    height: 17px;
    border-radius: 5px;
    border: 1.5px solid #93c5fd;
    accent-color: #007bff;
    cursor: pointer;
}

#auth-apple-modal .ds-checkbox-label {
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #475569 !important;
    user-select: none;
}

/* Remove duplicate green checkmark pseudo-element from legacy CSS */
#auth-apple-modal .ds-checkbox-wrapper .ds-checkbox:checked + .ds-checkbox-label::after,
#consent-modal .ds-checkbox-wrapper .ds-checkbox:checked + .ds-checkbox-label::after {
    content: none !important;
    display: none !important;
}

#auth-apple-modal .ds-checkbox-wrapper .ds-checkbox:checked + .ds-checkbox-label {
    color: #0f172a !important;
}

/* Optional Personal & Company Details Accordion (Bright Ice-Blue Card) */
#auth-apple-modal .ds-register-details {
    min-width: 0;
    border-radius: 14px;
    border: 1px solid #dbe8f8;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
    transition: all 0.2s ease;
}

#auth-apple-modal .ds-register-details:hover {
    border-color: #bfd7f6;
}

#auth-apple-modal .ds-register-details[open] {
    background: #ffffff;
    border-color: #93c5fd;
    box-shadow: 0 6px 20px -6px rgba(0, 123, 255, 0.10);
}

#auth-apple-modal .ds-register-details summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 13px;
    color: #1e293b;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

#auth-apple-modal .ds-register-details summary::-webkit-details-marker {
    display: none;
}

#auth-apple-modal .ds-register-optional {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 11.5px;
    font-weight: 600;
}

#auth-apple-modal .ds-register-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.10);
    font-size: 15px;
    line-height: 1;
    color: #007bff;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease;
}

#auth-apple-modal .ds-register-details[open] .ds-register-chevron {
    transform: rotate(180deg);
    background: rgba(0, 123, 255, 0.16);
}

#auth-apple-modal .ds-register-details-body {
    display: grid;
    gap: 12px;
    padding: 8px 16px 16px;
    border-top: 1px solid #e6effa;
}

#auth-apple-modal .ds-register-details-body p {
    margin: 2px 0 0;
    color: #64748b;
    font-size: 12.5px;
    line-height: 1.45;
}

#auth-apple-modal .ds-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Horizontal Security Verification Pod (Seamless Crop of hCaptcha 1px Grey Box) */
#auth-apple-modal .ds-captcha-group {
    margin: 2px 0;
}

#auth-apple-modal .ds-captcha-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 0;
    padding: 11px 14px 11px 16px;
    border-radius: 16px;
    border: 1px solid #d5e5f8;
    background: linear-gradient(135deg, #f5f9ff 0%, #edf5ff 100%);
    box-shadow:
        inset 0 1px 0 #ffffff,
        0 6px 18px -6px rgba(0, 123, 255, 0.09);
    transition:
        border-color 0.25s ease,
        background 0.25s ease,
        box-shadow 0.25s ease;
}

#auth-apple-modal .ds-captcha-wrapper:hover {
    border-color: #b4d2f7;
    box-shadow:
        inset 0 1px 0 #ffffff,
        0 8px 22px -6px rgba(0, 123, 255, 0.14);
}

#auth-apple-modal .ds-captcha-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

#auth-apple-modal .ds-captcha-shield {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 11px;
    color: #ffffff;
    background: linear-gradient(135deg, #007bff 0%, #3b82f6 60%, #0ea5e9 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.42),
        0 6px 14px -3px rgba(0, 123, 255, 0.32);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease, box-shadow 0.25s ease;
}

#auth-apple-modal .ds-captcha-wrapper:hover .ds-captcha-shield {
    transform: scale(1.04);
}

#auth-apple-modal .ds-captcha-shield svg {
    width: 19px;
    height: 19px;
}

#auth-apple-modal .ds-captcha-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

#auth-apple-modal .ds-captcha-title {
    margin: 0 !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.25 !important;
    letter-spacing: -0.01em;
}

#auth-apple-modal .ds-captcha-desc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: #475569;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#auth-apple-modal .ds-captcha-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    flex-shrink: 0;
    background: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

/* Precision Rounded Viewport that Clips hCaptcha's Outer 1px #d3d3d3 Square Frame */
#auth-apple-modal .ds-captcha-stage {
    position: relative;
    width: 298px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #cfe0f6;
    background: #fafafa;
    box-shadow:
        0 3px 10px -2px rgba(0, 82, 204, 0.08),
        inset 0 0 0 1px rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#auth-apple-modal .ds-captcha-wrapper:hover .ds-captcha-stage {
    border-color: #93c5fd;
}

#auth-apple-modal .ds-captcha-stage .h-captcha {
    margin: -2px !important;
    width: 302px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#auth-apple-modal .ds-captcha-stage .h-captcha iframe {
    display: block;
    border: 0 !important;
}

/* Verified State (Emerald Glow) */
#auth-apple-modal .ds-captcha-wrapper.is-verified {
    border-color: #a7f3d0;
    background: linear-gradient(135deg, #f0fdf7 0%, #e8faef 100%);
    box-shadow:
        inset 0 1px 0 #ffffff,
        0 6px 18px -6px rgba(16, 185, 129, 0.14);
}

#auth-apple-modal .ds-captcha-wrapper.is-verified .ds-captcha-shield {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.42),
        0 6px 14px -3px rgba(16, 185, 129, 0.34);
}

#auth-apple-modal .ds-captcha-wrapper.is-verified .ds-captcha-desc {
    color: #047857;
    font-weight: 600;
}

#auth-apple-modal .ds-captcha-wrapper.is-verified .ds-captcha-dot {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

#auth-apple-modal .ds-captcha-wrapper.is-verified .ds-captcha-stage {
    border-color: #6ee7b7;
}

#auth-apple-modal .ds-terms-wrapper {
    padding: 11px 15px;
    border: 1px solid #dbe8f8;
    border-radius: 13px;
    background: #f8fbff;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

#auth-apple-modal .ds-terms-wrapper:hover {
    border-color: #93c5fd;
    background: #f2f8ff;
}

#auth-apple-modal .ds-terms-wrapper .ds-checkbox-wrapper {
    align-items: center;
}

#auth-apple-modal .ds-terms-label {
    font-size: 12.5px !important;
    line-height: 1.5 !important;
}

#auth-apple-modal .ds-link {
    color: #007bff !important;
    font-weight: 600;
}

/* Primary Submit Buttons: Exact match with top navbar '登录' button gradient + shimmer */
#auth-apple-modal .ds-auth-submit {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 46px;
    padding: 11px 20px;
    margin-top: 2px;
    border-radius: 13px;
    border: none !important;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #ffffff !important;
    background: linear-gradient(135deg, #007bff 0%, #3b82f6 55%, #0ea5e9 100%) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.38),
        0 8px 22px -4px rgba(0, 123, 255, 0.38) !important;
    transition:
        transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.2s ease,
        opacity 0.2s ease !important;
}

#auth-apple-modal .ds-auth-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    transition: left 0.55s ease;
    pointer-events: none;
}

#auth-apple-modal .ds-auth-submit:hover:not(:disabled):not(.disabled-state) {
    transform: translateY(-1.5px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.48),
        0 12px 26px -4px rgba(0, 123, 255, 0.48) !important;
}

#auth-apple-modal .ds-auth-submit:hover:not(:disabled):not(.disabled-state)::before {
    left: 100%;
}

#auth-apple-modal .ds-auth-submit:active:not(:disabled):not(.disabled-state) {
    transform: translateY(0);
}

/* Bright sky-blue disabled state (never muddy grey-purple) */
#auth-apple-modal .ds-auth-submit:disabled,
#auth-apple-modal .ds-auth-submit.disabled-state {
    background: linear-gradient(135deg, #60a5fa 0%, #38bdf8 100%) !important;
    color: #ffffff !important;
    opacity: 0.86 !important;
    filter: none !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 6px 16px -4px rgba(56, 189, 248, 0.30) !important;
}

#auth-apple-modal .ds-register-signin {
    margin: 2px 0 0;
    color: #64748b;
    text-align: center;
    font-size: 13px;
}

#auth-apple-modal .ds-register-signin button {
    border: 0;
    background: none;
    color: #007bff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0 3px;
}

#auth-apple-modal .ds-register-signin button:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Dark Theme (macOS Dark Obsidian Glass)
   ========================================================================== */

html[data-theme="dark"] #auth-apple-modal .ds-modal-content,
html[data-theme="dark"] #consent-modal .ds-modal-content {
    background: linear-gradient(165deg, rgba(24, 32, 48, 0.94) 0%, rgba(15, 23, 38, 0.96) 100%);
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.14),
        0 32px 84px -12px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] #auth-apple-modal .ds-modal-header {
    background: rgba(15, 23, 42, 0.45);
    border-bottom-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] #auth-apple-modal .ds-modal-subtitle,
html[data-theme="dark"] #auth-apple-modal .ds-field-note,
html[data-theme="dark"] #auth-apple-modal .ds-strength-text,
html[data-theme="dark"] #auth-apple-modal .ds-register-signin {
    color: #94a3b8;
}

html[data-theme="dark"] #auth-apple-modal .ds-modal-close,
html[data-theme="dark"] #consent-modal .ds-modal-close {
    background: rgba(51, 65, 85, 0.65);
    border-color: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

html[data-theme="dark"] #auth-apple-modal .ds-modal-close:hover,
html[data-theme="dark"] #consent-modal .ds-modal-close:hover {
    background: rgba(71, 85, 105, 0.85);
    color: #f8fafc;
}

html[data-theme="dark"] #auth-apple-modal .ds-auth-tabs,
html[data-theme="dark"] #auth-apple-modal .auth-mode-switch {
    background: rgba(15, 23, 42, 0.65);
    border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] #auth-apple-modal .ds-auth-tab-glider,
html[data-theme="dark"] #auth-apple-modal .auth-mode-switch button[aria-pressed="true"] {
    background: rgba(51, 65, 85, 0.92);
    color: #60a5fa;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 6px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] #auth-apple-modal .ds-auth-tab,
html[data-theme="dark"] #auth-apple-modal .auth-mode-switch button {
    color: #94a3b8;
}

html[data-theme="dark"] #auth-apple-modal .ds-auth-tab.ds-auth-tab-active {
    color: #60a5fa;
}

html[data-theme="dark"] #auth-apple-modal .ds-form-label,
html[data-theme="dark"] #auth-apple-modal .auth-flow label {
    color: #e2e8f0;
}

html[data-theme="dark"] #auth-apple-modal .ds-auth-input,
html[data-theme="dark"] #auth-apple-modal .auth-flow input:not([type="checkbox"]):not([type="hidden"]) {
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.65);
    border-color: rgba(100, 116, 139, 0.45);
}

html[data-theme="dark"] #auth-apple-modal .ds-auth-input:focus,
html[data-theme="dark"] #auth-apple-modal .auth-flow input:not([type="checkbox"]):not([type="hidden"]):focus {
    background: rgba(15, 23, 42, 0.9);
    border-color: #3b82f6;
    box-shadow: 0 0 0 3.5px rgba(59, 130, 246, 0.25);
}

html[data-theme="dark"] #auth-apple-modal .ds-register-details,
html[data-theme="dark"] #auth-apple-modal .ds-terms-wrapper,
html[data-theme="dark"] #auth-apple-modal .ds-captcha-wrapper {
    background: rgba(30, 41, 59, 0.55);
    border-color: rgba(100, 116, 139, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] #auth-apple-modal .ds-captcha-title {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] #auth-apple-modal .ds-captcha-desc {
    color: #94a3b8;
}

html[data-theme="dark"] #auth-apple-modal .ds-captcha-stage {
    border-color: rgba(100, 116, 139, 0.45);
}

html[data-theme="dark"] #auth-apple-modal .ds-register-details summary,
html[data-theme="dark"] #auth-apple-modal .ds-checkbox-label {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] #auth-apple-modal .ds-register-optional {
    background: rgba(51, 65, 85, 0.8);
    color: #93c5fd;
}

html[data-theme="dark"] #auth-apple-modal .ds-auth-submit:disabled,
html[data-theme="dark"] #auth-apple-modal .ds-auth-submit.disabled-state {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.45) 0%, rgba(14, 165, 233, 0.42) 100%) !important;
    color: rgba(241, 245, 249, 0.75) !important;
}

/* ==========================================================================
   Responsive & Reduced Motion
   ========================================================================== */

@media (max-width: 640px) {
    #auth-apple-modal,
    #consent-modal {
        padding: 12px;
        align-items: center;
    }

    #auth-apple-modal .ds-modal-content,
    #auth-apple-modal.is-register .ds-modal-content-lg,
    #auth-apple-modal[data-active-tab="register"] .ds-modal-content-lg {
        max-height: calc(100dvh - 24px);
        border-radius: 20px;
    }

    #auth-apple-modal .ds-modal-header {
        padding: 16px 20px 12px;
    }

    #auth-apple-modal .ds-modal-body {
        padding: 16px 20px 20px;
    }

    #auth-apple-modal .ds-password-grid,
    #auth-apple-modal .ds-form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #auth-apple-modal .ds-password-feedback-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    #auth-apple-modal .ds-captcha-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 12px;
    }

    #auth-apple-modal .ds-captcha-info {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #auth-apple-modal .ds-auth-tab-glider,
    #auth-apple-modal .ds-register-chevron,
    #auth-apple-modal .ds-modal-content {
        transition: none;
    }

    #auth-apple-modal .ds-modal-content.is-bouncing {
        animation: none;
    }
}
