/* ── for. Landing Page — Ultra Minimal ── */

:root {
    --background: #f2efeb;
    /* Slightly warmer cinematic white */
    --foreground: #101010;
    --muted-foreground: #606060;
    --border: rgba(0, 0, 0, 0.05);
    --secondary: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] {
    --background: #080808;
    /* Deeper black */
    --foreground: #e0e0e0;
    --muted-foreground: #707070;
    --border: rgba(255, 255, 255, 0.05);
    --secondary: rgba(255, 255, 255, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.nowrap {
    white-space: nowrap;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* Base background with top-center highlight */
    background: var(--background);
    color: var(--foreground);
    transition: background-color 0.8s ease, color 0.8s ease, opacity 0.4s ease-in-out;
    position: relative;
    width: 100%;
    min-height: 100vh;
}

.content {
    text-align: center;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.logo {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: 80px;
    letter-spacing: -3px;
    margin-bottom: 24px;
    line-height: 1;
}

.slogan-top {
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted-foreground);
    margin-bottom: 32px;
}

.slogan-price {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: 32px;
    line-height: 1;
    letter-spacing: -0.5px;
    color: var(--foreground);
    max-width: 650px;
}

.support-link {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    text-align: center;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.3s ease;
}

.support-link a {
    color: var(--foreground);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.3s ease;
}

.support-link:hover,
.support-link a:hover {
    color: var(--foreground);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px 48px;
    border-radius: 100px;
    background: var(--foreground);
    color: var(--background);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.2px;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: scale(1.04);
}

.btn-primary:active {
    transform: scale(0.96);
    opacity: 0.9;
}

.btn-group {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 48px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px 32px;
    border-radius: 100px;
    background: transparent;
    color: var(--foreground);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.2px;
    border: 1.5px solid currentColor;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.btn-secondary:hover {
    transform: scale(1.04);
}

.btn-secondary:active {
    transform: scale(0.96);
    opacity: 0.9;
}

@media (max-width: 600px) {
    .btn-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 340px;
    }

    .btn-secondary {
        text-align: center;
    }
}

/* Floating Navigation & Controls */
.back-nav,
.controls {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

/* Privacy Page Header */
.back-nav {
    padding: 32px 40px 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    background: none;
    /* Background moved to ::before */
}

.back-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: linear-gradient(to bottom,
            var(--background) 0%,
            var(--background) 50%,
            rgba(var(--background-rgb), 0) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    /* Seamless blur feathering - only on the background layer */
    mask-image: linear-gradient(to bottom, black 0%, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 50%, transparent 100%);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--foreground);
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-style: italic;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.back-btn:hover {
    opacity: 1;
}

.back-nav * {
    pointer-events: auto;
}

/* Base controls (used on Home/Privacy) */
.controls {
    display: flex;
    gap: 16px;
    top: auto;
    left: auto;
    right: auto;
    pointer-events: auto;
}

.controls.nav-hidden,
.back-nav.nav-hidden {
    transform: translateY(-200px) !important;
    opacity: 0 !important;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 600px) {
    .controls {
        top: 32px;
        right: 24px;
    }

    .back-nav {
        padding: 32px 24px;
    }

    .back-btn span {
        display: none;
    }

    footer {
        bottom: 24px;
        padding: 0 24px;
    }
}

footer {
    position: fixed;
    bottom: 0px;
    left: 0;
    right: 0;
    padding: 0 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 100;
    pointer-events: none;
}

footer * {
    pointer-events: auto;
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 140px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    list-style: none;
    margin: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lang-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--secondary);
    color: var(--foreground);
}

.dropdown-item.active {
    color: var(--foreground);
    font-weight: 500;
    background-color: var(--secondary);
}

.dropdown-item+.dropdown-item {
    margin-top: 2px;
}

.dropdown-trigger svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.lang-dropdown.active .dropdown-trigger svg {
    transform: rotate(180deg);
}

@media (min-width: 601px) {
    footer {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        flex-direction: row;
        bottom: 10px;
        gap: 0;
    }

    .footer-links {
        justify-self: start;
    }

    .controls {
        position: static;
        justify-self: end;
    }

    /* Open UP only in the footer (bottom of screen) */
    footer .dropdown-menu {
        top: auto;
        bottom: calc(100% + 12px);
        transform: translateY(10px);
    }

    footer .lang-dropdown.active .dropdown-menu {
        transform: translateY(0);
    }
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-links a:hover {
    color: var(--foreground);
}

.footer-links a svg {
    flex-shrink: 0;
}

/* Controls are positioned via .controls class now */

.control-btn {
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.3s ease, background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
}

.control-btn:hover {
    color: var(--foreground);
}

@media (max-width: 600px) {
    .logo {
        font-size: 64px;
    }

    .slogan {
        font-size: 16px;
    }

    footer {
        flex-direction: column-reverse;
        gap: 24px;
        padding: 20px 24px;
        width: 100%;
    }

    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        display: flex;
    }

    .footer-links a {
        text-align: center;
        line-height: 1.4;
    }
}

/* ── MTProto Proxy Page ── */

.proxy-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
}

.proxy-logo {
    position: absolute;
    top: 32px;
    left: 40px;
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: 30px;
    letter-spacing: -1.5px;
    line-height: 1;
    color: var(--foreground);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.proxy-logo:hover {
    opacity: 1;
}

.proxy-updated {
    position: absolute;
    top: 40px;
    right: 40px;
    font-size: 11px;
    letter-spacing: 0.2px;
    color: var(--muted-foreground);
}

.proxy-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    width: 100%;
    max-width: 560px;
}

/* Liquid glass nav buttons */
.proxy-nav-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--foreground);
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1),
                box-shadow 0.3s ease,
                opacity 0.3s ease;
}

/* Optical correction: chevron visual mass pulls inward, nudge back out */
#proxy-prev svg { transform: translateX(-1.5px); }
#proxy-next svg { transform: translateX(1.5px); }

.proxy-nav-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.proxy-nav-btn:active {
    transform: scale(0.93);
    opacity: 0.8;
}

.proxy-nav-btn:disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
    transform: none;
}

[data-theme="dark"] .proxy-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .proxy-nav-btn:hover {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Liquid glass card */
.proxy-card {
    flex: 1;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 28px;
    padding: 36px;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.07),
        0 1px 2px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .proxy-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.09);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.45),
        0 1px 2px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.proxy-body {
    transition: opacity 0.16s ease;
}

.proxy-body.changing {
    opacity: 0;
}

.proxy-fields {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 28px;
}

.proxy-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.proxy-field:hover {
    opacity: 0.7;
}

.proxy-field:active {
    opacity: 0.5;
}

.proxy-field:first-child {
    padding-top: 0;
}

.proxy-field:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.proxy-label {
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted-foreground);
    font-weight: 500;
}

.proxy-value {
    font-size: 15px;
    color: var(--foreground);
    font-weight: 400;
    word-break: break-all;
}

.proxy-secret {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    opacity: 0.8;
    word-break: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toast notification */
.proxy-toast {
    position: fixed;
    bottom: 96px;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: var(--foreground);
    color: var(--background);
    padding: 9px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.1px;
    opacity: 0;
    pointer-events: none;
    z-index: 9000;
    white-space: nowrap;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.proxy-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.proxy-connect-btn {
    width: 100%;
    margin-top: 0;
    gap: 9px;
}

/* Location check status (shown after check completes) */
.proxy-location-status {
    margin-top: 10px;
    min-height: 16px;
    font-size: 11px;
    letter-spacing: 0.2px;
    color: var(--muted-foreground);
    text-align: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.proxy-location-status.visible {
    opacity: 1;
}

/* Checking overlay — sits on top of card content while check runs */
.proxy-check-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    letter-spacing: 0.2px;
    color: var(--foreground);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 20;
    background: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .proxy-check-overlay {
    background: rgba(0, 0, 0, 0.55);
}

.proxy-card.is-checking .proxy-check-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Blur card content while checking */
.proxy-card.is-checking .proxy-body,
.proxy-card.is-checking .proxy-counter {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.25s ease;
}

@keyframes proxy-pulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1;   }
}

.proxy-check-overlay span {
    animation: proxy-pulse 1.6s ease-in-out infinite;
}

/* Pagination counter */
.proxy-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}

.proxy-counter-current {
    color: var(--foreground);
    font-weight: 500;
}

.proxy-counter-sep {
    opacity: 0.4;
}

.proxy-source {
    margin-top: 20px;
    font-size: 12px;
    color: var(--muted-foreground);
    text-align: center;
}

.proxy-source a {
    color: var(--foreground);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease;
}

.proxy-source a:hover {
    opacity: 0.7;
}

@media (max-width: 600px) {
    .proxy-logo {
        top: 24px;
        left: 24px;
        font-size: 24px;
    }

    .proxy-updated {
        top: 28px;
        right: 24px;
        font-size: 10px;
    }

    .proxy-wrapper {
        gap: 14px;
    }

    .proxy-nav-btn {
        width: 44px;
        height: 44px;
    }

    .proxy-card {
        padding: 28px 24px;
        border-radius: 22px;
    }
}

/* ── MTPP: status bar (attempt counter + countdown) ── */

.mtpp-status-bar {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 12px;
    letter-spacing: 0.2px;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}

.mtpp-status-sep {
    opacity: 0.3;
}

/* ── MTPP: expiry modal ── */

.mtpp-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .mtpp-modal {
    background: rgba(0, 0, 0, 0.45);
}

.mtpp-modal.visible {
    display: flex;
}

.mtpp-modal-box {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 40px 36px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow:
        0 16px 60px rgba(0, 0, 0, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

[data-theme="dark"] .mtpp-modal-box {
    box-shadow:
        0 16px 60px rgba(0, 0, 0, 0.55),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.mtpp-modal-msg {
    font-size: 16px;
    font-weight: 500;
    color: var(--foreground);
    letter-spacing: -0.2px;
    line-height: 1.4;
}

.mtpp-modal-counter {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: 40px;
    letter-spacing: -1.5px;
    color: var(--foreground);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.mtpp-modal-reset {
    font-size: 12px;
    color: var(--muted-foreground);
    letter-spacing: 0.2px;
    min-height: 16px;
}

.mtpp-modal-box .btn-primary {
    width: 100%;
    padding: 16px 32px;
    font-size: 15px;
}

.mtpp-modal-box .btn-primary:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
    transform: none;
}

@media (max-width: 600px) {
    .mtpp-modal-box {
        padding: 32px 24px;
        border-radius: 22px;
        gap: 16px;
    }

    .mtpp-modal-counter {
        font-size: 32px;
    }
}