.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(10, 14, 20, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.25s ease-in-out;
    padding-top: env(safe-area-inset-top, 1rem);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: rgba(23, 30, 39, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: min(92%, 420px);
    max-height: calc(100dvh - 140px);
    padding: clamp(1rem, 4vw, 1.75rem);
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    color: #f8fafc;
    overflow-y: auto;
    box-sizing: border-box;
    margin: auto;
}

@media (max-width: 480px) {
    .modal-card {
        border-radius: 12px;
        gap: 1rem;
        width: 92%;
        max-height: calc(100dvh - 100px);
    }

    .modal-overlay {
        align-items: flex-start;
        padding-top: max(1.5rem, 6vh);
    }
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 1rem;
}

.spinner-container p {
    color: #94a3b8;
    font-size: 0.9rem;
    margin: 0;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.offer-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.85rem;
    line-height: 1.15;
}

.offer-details.error {
    color: #f87171;
    font-weight: 600;
    margin: 1rem 0;
    line-height: 1.35;
}

.offer-details span.highlight {
    color: #fff;
    text-shadow: 1px 1px #696969;
}

.offer-thumbnail {
    width: 88px;
    height: 88px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.offer-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
    line-height: 1.35;
}

.offer-provider-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.offer-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.25);
}

.offer-devices-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: -0.25rem;
}

.device-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    padding: 0.35rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.device-badge:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 10px;
    text-decoration: none;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-1px);
}

.btn-signup {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}

.btn-signup:hover {
    background: linear-gradient(135deg, #a78bfa, #4f46e5);
    box-shadow: 0 6px 20px rgba(167, 139, 250, 0.5);
    transform: translateY(-1px);
}

.modal-footer-cta {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.1rem;
    text-align: center;
}

.modal-footer-cta p {
    margin: 0 0 0.65rem 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

.modal-bottom-ad-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px;
    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    flex-shrink: 0;
}

.modal-bottom-ad {
    max-width: 728px;
    width: 100%;
    max-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.modal-bottom-ad img,
.modal-bottom-ad-wrapper img {
    max-width: 100%;
    height: auto;
    max-height: 130px;
    display: block;
    border-radius: 6px;
    object-fit: contain;
}

@media (max-width: 600px) {
    .modal-bottom-ad-wrapper {
        padding: 0.5rem;
    }

    .modal-bottom-ad img {
        max-height: 50px;
    }
}

.settings-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #94a3b8;
    padding: 0.1rem 0.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-btn p {
    text-shadow: 1px 1px #0f172a;
    margin-right: 4px;
    text-decoration: none;
    color: #ebebeb;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 14px;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.settings-tooltip {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-btn:hover .settings-tooltip {
    opacity: 1;
}

.modal-card.settings-card {
    max-height: 85vh;
    padding: 1.5rem;
    gap: 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.settings-body {
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-body::-webkit-scrollbar {
    width: 6px;
}

.settings-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setting-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f8fafc;
}

.setting-desc {
    font-size: 0.8rem;
    color: #94a3b8;
}

.setting-select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
    max-width: 140px;
}

.setting-select option {
    background: #171e27;
    color: #f8fafc;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .25s ease;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .25s ease;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2563eb;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.settings-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.75rem;
}