.tai-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(102, 126, 234, 0.22), transparent 36%),
        radial-gradient(circle at bottom right, rgba(245, 87, 108, 0.16), transparent 32%),
        rgba(4, 8, 20, 0.78);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 12000;
}

.tai-modal-overlay.open {
    display: flex;
}

body.tai-modal-open {
    overflow: hidden;
}

.tai-modal-shell {
    position: relative;
    width: min(720px, 100%);
    border-radius: 28px;
    padding: 32px;
    border: 1px solid rgba(134, 144, 255, 0.22);
    background:
        linear-gradient(155deg, rgba(18, 24, 44, 0.98) 0%, rgba(10, 14, 26, 0.96) 100%);
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.tai-modal-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(130deg, rgba(102, 126, 234, 0.16), transparent 42%),
        linear-gradient(310deg, rgba(245, 87, 108, 0.12), transparent 48%);
    pointer-events: none;
}

.tai-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.tai-modal-close:hover {
    transform: translateY(-1px);
    background: rgba(245, 87, 108, 0.14);
    border-color: rgba(245, 87, 108, 0.32);
}

.tai-modal-hero,
.tai-settings-grid,
.tai-modal-guest-note {
    position: relative;
    z-index: 1;
}

.tai-modal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #dbe6ff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.tai-modal-title {
    margin: 0;
    font-size: clamp(1.65rem, 2vw, 2.3rem);
    line-height: 1.08;
    color: #ffffff;
}

.tai-modal-copy {
    margin: 14px 0 0;
    max-width: 600px;
    color: rgba(226, 232, 240, 0.82);
    font-size: 0.98rem;
    line-height: 1.7;
}

.tai-modal-guest-note {
    margin-top: 22px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #dbe6ff;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.tai-modal-guest-note.is-hidden {
    display: none;
}

.tai-settings-grid {
    margin-top: 26px;
    display: grid;
    gap: 16px;
}

.tai-setting-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tai-setting-copy-wrap {
    min-width: 0;
}

.tai-setting-label {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.tai-setting-copy-text {
    margin-top: 6px;
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.92rem;
    line-height: 1.55;
}

.tai-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 132px;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.tai-switch:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.12);
}

.tai-switch.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(245, 87, 108, 0.92));
    box-shadow: 0 14px 30px rgba(102, 126, 234, 0.24);
}

.tai-switch-track {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: rgba(10, 14, 26, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tai-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.24);
    transition: transform 0.2s ease;
}

.tai-switch.active .tai-switch-thumb {
    transform: translateX(20px);
}

.tai-switch-state {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

@media (max-width: 768px) {
    .tai-modal-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    .tai-modal-shell {
        width: 100%;
        padding: 24px 18px 18px;
        border-radius: 24px 24px 18px 18px;
        max-height: min(88vh, 760px);
        overflow-y: auto;
    }

    .tai-setting-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .tai-switch {
        width: 100%;
        min-width: 0;
    }
}
