/* MAX massengers v2 landing */
:root {
            --bg-dark: #0a0a0b;
            --card-bg: rgba(20, 20, 22, 0.95);
            --accent-start: #1e88e5;
            --accent-end: #ab47bc;
            --text-white: #ffffff;
            --text-grey: #8e8e93;
            --input-bg: rgba(255, 255, 255, 0.05);
            --border: rgba(255, 255, 255, 0.1);
        }

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

        body {
            font-family: 'Inter', -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, sans-serif;
            background-color: var(--bg-dark);
            background-image: url('/static/bg_pattern.png');
            background-repeat: repeat;
            background-size: 400px;
            color: var(--text-white);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            overflow-x: hidden;
            position: relative;
        }

        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at center, rgba(10, 10, 11, 0.4) 0%, rgba(10, 10, 11, 0.8) 100%);
            z-index: 0;
            pointer-events: none;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 40px;
            position: relative;
            z-index: 10;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 12px;
            text-decoration: none;
            cursor: pointer;
        }

        .logo img {
            width: 32px;
            height: 32px;
            border-radius: 8px;
        }

        .logo span {
            font-weight: 700;
            font-size: 24px;
            color: #fff;
            letter-spacing: -0.5px;
        }

        .btn-download-header {
            background: #2196f3;
            color: #fff;
            padding: 8px 16px;
            border-radius: 10px;
            font-weight: 600;
            font-size: 13px;
            text-decoration: none;
            transition: 0.2s;
            border: none;
            cursor: pointer;
        }

        .main-container {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 16px;
            position: relative;
            z-index: 5;
        }

        .login-card {
            background: var(--card-bg);
            border-radius: 28px;
            padding: 40px;
            width: 100%;
            max-width: 420px;
            text-align: center;
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
            border: 1px solid var(--border);
        }

        .card-title {
            font-size: 22px;
            font-weight: 700;
            margin-bottom: 8px;
            line-height: 1.3;
            color: #fff;
        }

        .card-subtitle {
            font-size: 14px;
            font-weight: 600;
            color: rgba(255,255,255,0.5);
            margin-bottom: 24px;
            line-height: 1.4;
        }

        .input-wrapper {
            background: var(--input-bg);
            border: 1.5px solid var(--border);
            border-radius: 16px;
            display: flex;
            align-items: center;
            position: relative;
            z-index: 10;
            padding: 14px 20px;
            margin-bottom: 20px;
            transition: 0.3s;
        }
        .input-wrapper:has(.country-wrap) { padding-left: 0; }

        .input-wrapper:focus-within {
            border-color: rgba(30, 136, 229, 0.5);
            background: rgba(255, 255, 255, 0.08);
        }

        .prefix {
            color: #fff;
            font-weight: 600;
            font-size: 17px;
            margin-right: 12px;
        }

        .country-wrap { position: relative; display: flex; align-items: center; flex-shrink: 0; }
        .country-btn { display: flex; align-items: center; gap: 6px; border: none; background: transparent; cursor: pointer; padding: 0 12px 0 14px; font-size: 15px; font-family: inherit; height: 100%; }
        .country-btn .c-flag { font-size: 20px; line-height: 1; }
        .country-btn .c-code { font-weight: 700; color: var(--text-white, #fff); }
        .country-btn::after { content: "\25BE"; color: rgba(255,255,255,.4); font-size: 10px; margin-left: 2px; }
        .country-drop { display: none; position: absolute; left: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px; border-radius: 14px; background: var(--bg-secondary, #1a1a2e); border: 1px solid rgba(255,255,255,.12); box-shadow: 0 12px 32px rgba(0,0,0,.4); z-index: 999; }
        .country-drop.open { display: block; }
        .country-opt { width: 100%; border: none; background: transparent; display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; color: #fff; text-align: left; }
        .country-opt:hover, .country-opt.active { background: rgba(255,255,255,.08); }
        .country-opt .c-cd { margin-left: auto; color: rgba(255,255,255,.45); font-weight: 700; }

        #phone-input {
            background: transparent;
            border: none;
            color: #fff;
            font-size: 17px;
            width: 100%;
            outline: none;
            font-family: inherit;
        }

        .btn-gradient {
            background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
            color: #fff;
            border: none;
            border-radius: 18px;
            padding: 18px;
            width: 100%;
            font-size: 17px;
            font-weight: 700;
            cursor: pointer;
            transition: 0.3s;
            box-shadow: 0 10px 30px rgba(30, 136, 229, 0.2);
        }

        .legal-text {
            margin-top: 24px;
            font-size: 12px;
            color: var(--text-grey);
            line-height: 1.6;
        }

        .legal-text a {
            color: var(--accent-start);
            text-decoration: none;
            cursor: pointer;
        }

        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            backdrop-filter: blur(8px);
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal-card {
            background: #1c1c1e;
            border-radius: 32px;
            padding: 40px;
            max-width: 400px;
            width: 90%;
            text-align: center;
            border: 1px solid var(--border);
        }

        .hidden {
            display: none;
        }

        .error-msg {
            color: #ff3b30;
            font-size: 14px;
            margin-top: 12px;
            font-weight: 500;
        }

        .sms-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 8px;
            margin-bottom: 24px;
        }

        .otp-input {
            width: 100%;
            height: 54px;
            background: var(--input-bg);
            border: 1.5px solid var(--border);
            border-radius: 12px;
            text-align: center;
            font-size: 22px;
            font-weight: 700;
            color: #fff;
            outline: none;
        }

        .otp-input:focus {
            border-color: var(--accent-start);
            background: rgba(255, 255, 255, 0.1);
        }

        /* ── VIEW TRANSITIONS ── */
        .login-card {
            transition: opacity 0.35s ease, transform 0.35s ease;
        }

        .login-card.slide-out {
            opacity: 0;
            transform: translateX(-30px) scale(0.96);
            pointer-events: none;
        }

        .login-card.slide-in {
            animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateX(30px) scale(0.96);
            }

            to {
                opacity: 1;
                transform: translateX(0) scale(1);
            }
        }

        /* ── DOWNLOAD POPUP ── */
        .popup-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 999;
            backdrop-filter: blur(8px);
        }

        .popup-overlay.active {
            display: flex;
        }

        .popup-card {
            background: #1c1c1e;
            border-radius: 24px;
            padding: 36px;
            max-width: 380px;
            width: 90%;
            text-align: center;
            border: 1px solid var(--border);
            box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
            animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        @keyframes popIn {
            from {
                opacity: 0;
                transform: scale(0.85) translateY(20px);
            }

            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }

        .popup-icon {
            width: 56px;
            height: 56px;
            background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 20px;
            font-size: 28px;
        }

        .popup-title {
            font-size: 18px;
            font-weight: 700;
            margin-bottom: 10px;
        }

        .popup-text {
            font-size: 14px;
            color: var(--text-grey);
            line-height: 1.6;
            margin-bottom: 24px;
        }

        .popup-btn {
            background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
            color: #fff;
            border: none;
            border-radius: 14px;
            padding: 14px;
            width: 100%;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            transition: 0.2s;
        }

        .popup-btn:hover {
            filter: brightness(1.1);
            transform: translateY(-2px);
        }

        /* ── PASS MODAL ── */
        .pass-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            backdrop-filter: blur(14px);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            z-index: 2000;
        }
        .pass-overlay.hidden { display: none; }
        .pass-modal {
            width: 100%;
            max-width: 380px;
            background: rgba(18, 18, 20, 0.97);
            border: 1px solid rgba(255,255,255,0.09);
            border-radius: 28px;
            overflow: hidden;
            box-shadow: 0 40px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
            animation: popIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
        }
        .pass-modal-header {
            position: relative;
            height: 170px;
            overflow: hidden;
        }
        .pass-modal-header img {
            width: 100%; height: 100%;
            object-fit: cover; display: block;
            filter: brightness(0.7) saturate(1.15);
        }
        .pass-modal-header-grad {
            position: absolute; inset: 0;
            background: linear-gradient(to bottom, transparent 30%, rgba(18,18,20,0.97) 100%);
        }
        .pass-modal-body {
            padding: 24px 26px 28px;
            text-align: center;
        }
        .pass-modal-icon {
            width: 56px; height: 56px;
            border-radius: 18px;
            background: linear-gradient(135deg, #1e88e5, #ab47bc);
            display: flex; align-items: center; justify-content: center;
            font-size: 26px;
            box-shadow: 0 8px 28px rgba(30,136,229,0.35);
            margin: 0 auto 16px;
        }
        .pass-modal-body h3 {
            margin: 0 0 6px;
            font-size: 20px; font-weight: 700;
            color: #fff; letter-spacing: -0.3px;
        }
        .pass-modal-subtitle {
            font-size: 13.5px;
            color: rgba(255,255,255,0.38);
            margin: 0 0 22px;
            line-height: 1.5;
        }
        .pass-modal-steps {
            list-style: none; padding: 0;
            margin: 0 0 22px;
            display: flex; flex-direction: column; gap: 10px;
            text-align: left;
        }
        .pass-step {
            display: flex; align-items: center; gap: 13px;
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(255,255,255,0.07);
            border-radius: 14px;
            padding: 11px 14px;
        }
        .pass-step-num {
            min-width: 26px; height: 26px;
            border-radius: 8px;
            background: linear-gradient(135deg, rgba(30,136,229,0.25), rgba(171,71,188,0.25));
            border: 1px solid rgba(255,255,255,0.1);
            display: flex; align-items: center; justify-content: center;
            font-size: 12px; font-weight: 700;
            color: rgba(255,255,255,0.55);
        }
        .pass-step-text {
            font-size: 13.5px;
            color: rgba(255,255,255,0.55);
            line-height: 1.45;
        }
        .pass-step-text b { color: rgba(255,255,255,0.88); font-weight: 600; }
        .pass-modal-btn {
            width: 100%; border: none;
            border-radius: 18px; padding: 16px;
            background: linear-gradient(90deg, #1e88e5, #ab47bc);
            color: #fff; font-size: 16px; font-weight: 700;
            cursor: pointer; font-family: inherit;
            transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
            box-shadow: 0 8px 28px rgba(30,136,229,0.28);
        }
        .pass-modal-btn:hover {
            opacity: 0.92; transform: translateY(-2px);
            box-shadow: 0 14px 36px rgba(30,136,229,0.38);
        }

        /* ── TIMERS ── */
        .timer-text {
            font-size: 13px;
            color: var(--text-grey);
            margin-top: 10px;
            text-align: center;
        }
        .timer-text b { color: rgba(255,255,255,0.65); font-variant-numeric: tabular-nums; }
        .requests-warn {
            font-size: 12px;
            color: #ff9500;
            margin-top: 6px;
            text-align: center;
        }

        /* ── Telegram WebApp ── */
        .tg-contact-block { display: none; flex-direction: column; gap: 10px; margin-bottom: 16px; }
        .tg-contact-block.vis { display: flex; }
        .tg-manual-link { background: none; border: none; color: var(--accent-start); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 8px; text-align: center; transition: color 0.15s; }
        .tg-manual-link:hover { color: var(--accent-end); }

/* ── Views (landing-auth.js) ── */
.view { display: none; }
.view.active { display: block; }

/* ── QR login (v2-only stylesheet — no html.land-v2 prefix) ── */
html.qr-mode .header { display: none; }
html.qr-mode .main-container { padding-top: 24px; }

#view-qr.login-card {
  max-width: 740px;
  width: 100%;
  text-align: left;
  padding: 36px 40px;
}

.qr-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  text-align: left;
}

.qr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  width: 232px;
}

.qr-info-col { flex: 1; min-width: 0; }

.qr-frame {
  width: 232px;
  height: 232px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 24px rgba(30, 136, 229, 0.15);
}

.qr-frame .qr-image {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  position: relative;
  z-index: 1;
}

.qr-frame .qr-image[hidden],
.qr-frame .qr-loader[hidden] {
  display: none !important;
}

.qr-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  z-index: 3;
}

.qr-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid rgba(255, 255, 255, 0.15);
  border-top-color: #1e88e5;
  border-radius: 50%;
  animation: qrSpin 0.8s linear infinite;
}

.qr-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}

.qr-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-wait {
  background: rgba(30, 136, 229, 0.12);
  border-color: rgba(30, 136, 229, 0.25);
  color: #64b5f6;
}

.badge-wait .qr-badge__dot {
  background: #1e88e5;
  animation: qrPulseGlow 1.4s ease-in-out infinite;
}

.badge-scan,
.badge-ok {
  background: rgba(52, 199, 89, 0.12);
  border-color: rgba(52, 199, 89, 0.25);
  color: #81c784;
}

.badge-err {
  background: rgba(255, 59, 48, 0.12);
  border-color: rgba(255, 59, 48, 0.25);
  color: #ff8a80;
}

.badge-err .qr-badge__dot { background: #ff3b30; }

.qr-timer {
  font-size: 13px;
  color: var(--text-grey);
  width: 100%;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.qr-timer b {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
}

.qr-info-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.qr-info-desc {
  font-size: 14px;
  color: var(--text-grey);
  line-height: 1.55;
  margin-bottom: 22px;
}

.qr-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.qr-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.qr-step-n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(30, 136, 229, 0.15);
  color: #64b5f6;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qr-step-n.done {
  background: rgba(52, 199, 89, 0.2);
  color: #81c784;
  font-size: 0;
}

.qr-step-n.done::after {
  content: "";
  display: block;
  width: 10px;
  height: 6px;
  border-left: 2px solid #81c784;
  border-bottom: 2px solid #81c784;
  transform: rotate(-45deg);
  margin-top: -2px;
}

.qr-step-txt {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
  padding-top: 4px;
}

.qr-step-txt b {
  color: #fff;
  font-weight: 600;
}

.qr-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(30, 136, 229, 0.25);
  transition: 0.2s;
}

.qr-refresh-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.qr-refresh-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.qr-success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 0;
}

.qr-success-screen[hidden] { display: none !important; }

.qr-success-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(52, 199, 89, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #81c784;
}

.qr-success-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.qr-success-desc {
  font-size: 14px;
  color: var(--text-grey);
  text-align: center;
}

.qr-frame .qr-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 22, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 4;
  border-radius: inherit;
}

.qr-app-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 24px;
  background: rgba(30, 136, 229, 0.22);
  color: #90caf9;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(100, 181, 246, 0.45);
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
  transition: background 0.2s, border-color 0.2s;
}

.qr-app-login-btn:hover {
  background: rgba(30, 136, 229, 0.32);
  border-color: rgba(100, 181, 246, 0.65);
  color: #bbdefb;
}

.qr-app-login-btn[hidden] { display: none !important; }

.tg-contact-block {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.tg-contact-block.vis { display: flex; }

.tg-manual-link {
  background: none;
  border: none;
  color: var(--text-grey);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}

.timer-text,
.timer-row {
  font-size: 13px;
  color: var(--text-grey);
  margin-top: 8px;
}

.requests-warn {
  font-size: 13px;
  color: #ffb74d;
  margin-top: 8px;
}

.btn-resend-link,
.btn-back-link {
  background: none;
  border: none;
  color: var(--accent-start);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  margin-top: 12px;
  text-decoration: underline;
  display: block;
  width: 100%;
}

.btn-main {
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 18px;
  width: 100%;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
  box-shadow: 0 10px 30px rgba(30, 136, 229, 0.2);
}

.btn-main:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.btn-main.ready { opacity: 1; }

@keyframes qrSpin { to { transform: rotate(360deg); } }

@keyframes qrPulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@media (max-width: 680px) {
  .qr-layout {
    flex-direction: column;
    align-items: center;
  }

  .qr-info-col { text-align: center; }

  .qr-step { text-align: left; }

  #view-qr.login-card { padding: 28px 20px; }
}
