* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Переменные тем ── */
:root {
    --bg: #f8fffe;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-input: rgba(255, 255, 255, 0.9);
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --border: rgba(0, 128, 128, 0.15);
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --teal: #008080;
    --teal-mid: #00BFA5;
    --teal-light: #00F0E0;
    --green: #34c759;
    --shadow: 0 4px 24px rgba(0, 128, 128, 0.1);
    --shadow-hover: 0 8px 32px rgba(0, 128, 128, 0.2);
}

body.dark {
    --bg: #050f0f;
    --bg-card: rgba(15, 30, 30, 0.8);
    --bg-input: rgba(20, 40, 40, 0.9);
    --text: #f0fafa;
    --text-muted: #7a9e9e;
    --border: rgba(0, 191, 165, 0.2);
    --accent: #0a84ff;
    --accent-hover: #1b9fff;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 8px 32px rgba(0, 191, 165, 0.15);
}

/* ── Анимированный фон ── */
html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    color: var(--text);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    transition: color 0.4s ease;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background: var(--bg);
    transition: background 0.4s ease;
}

/* Переливающиеся пятна как лавовая лампа */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 20% 20%, rgba(0, 128, 128, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 80% 80%, rgba(0, 191, 165, 0.1) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 60% 10%, rgba(0, 240, 224, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 55% 45% at 10% 80%, rgba(0, 128, 128, 0.07) 0%, transparent 70%);
    animation: lava 18s ease-in-out infinite alternate;
}

body.dark::after {
    background:
        radial-gradient(ellipse 60% 50% at 20% 20%, rgba(0, 128, 128, 0.2) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 80% 80%, rgba(0, 191, 165, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 60% 10%, rgba(0, 240, 224, 0.1) 0%, transparent 70%),
        radial-gradient(ellipse 55% 45% at 10% 80%, rgba(0, 77, 77, 0.2) 0%, transparent 70%);
    animation: lava 18s ease-in-out infinite alternate;
}

@keyframes lava {
    0%   { transform: scale(1)    translate(0px, 0px); }
    25%  { transform: scale(1.05) translate(20px, -15px); }
    50%  { transform: scale(0.97) translate(-10px, 20px); }
    75%  { transform: scale(1.03) translate(15px, 10px); }
    100% { transform: scale(1)    translate(-5px, -10px); }
}

/* ── Header ── */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 40px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 12px rgba(0, 128, 128, 0.2);
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--teal), var(--teal-mid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.online-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.online-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--green); }
    50%       { opacity: 0.4; box-shadow: none; }
}

/* ── Кнопка темы ── */
.theme-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    border-color: var(--teal-mid);
    box-shadow: 0 0 12px rgba(0, 191, 165, 0.3);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sun-icon  { opacity: 1; transform: rotate(0deg); }
.moon-icon { opacity: 0; transform: rotate(-90deg); }

body.dark .sun-icon  { opacity: 0; transform: rotate(90deg); }
body.dark .moon-icon { opacity: 1; transform: rotate(0deg); }

/* ── Main ── */
.main {
    flex: 1;
    padding: 60px 40px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    margin-bottom: 80px;
}

/* ── Левая секция ── */
.left-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.title {
    font-size: 44px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.telegram-highlight {
    background: linear-gradient(135deg, var(--teal), var(--teal-mid), var(--teal-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.description {
    font-size: 17px;
    color: var(--text-muted);
    line-height: 1.6;
}

.description-note {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    opacity: 0.7;
}

/* ── Правая секция ── */
.right-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Кнопка подключить ── */
.connect-btn {
    width: 100%;
    padding: 22px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-mid) 60%, var(--teal-light) 100%);
    color: white;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 20px rgba(0, 128, 128, 0.4);
    min-height: 68px;
    letter-spacing: 0.2px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 191, 165, 0.5);
}

.connect-btn:active {
    transform: scale(0.97);
    box-shadow: 0 3px 10px rgba(0, 128, 128, 0.3);
}

/* ── Три маленькие кнопки ── */
.info-qr-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.button-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.info-btn,
.mtproto-btn,
.qr-btn {
    width: 100%;
    min-height: 54px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    backdrop-filter: blur(10px);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    padding: 0;
}

.info-btn:hover,
.qr-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 3px 10px rgba(0, 113, 227, 0.3);
}

.info-btn:active,
.qr-btn:active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(0.95);
}

.mtproto-btn:hover {
    background: linear-gradient(135deg, var(--teal), var(--teal-mid));
    color: white;
    border-color: var(--teal-mid);
    box-shadow: 0 3px 10px rgba(0, 191, 165, 0.35);
}

.mtproto-btn:active {
    background: linear-gradient(135deg, var(--teal), var(--teal-mid));
    color: white;
    border-color: var(--teal-mid);
    transform: scale(0.95);
}

.info-btn svg,
.mtproto-btn svg,
.qr-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.button-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.2px;
    user-select: none;
}

/* ── Модальные окна ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 460px;
    position: relative;
    box-shadow: var(--shadow);
    animation: popIn 0.25s ease;
    transition: background 0.4s ease;
}

@keyframes popIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bg-input);
    border-radius: 50%;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
    background: var(--border);
}

.modal-content h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-right: 30px;
}

/* ── Поля данных прокси ── */
.info-columns {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.info-box {
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-weight: 500;
    color: var(--text);
    transition: border-color 0.2s ease;
}

.info-box:hover {
    border-color: var(--teal-mid);
}

.info-secret-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}

#secretDisplay {
    flex: 1;
    word-break: break-all;
    font-size: 12px;
    letter-spacing: 1px;
    line-height: 1.4;
}

.secret-toggle {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    background: linear-gradient(135deg, var(--teal), var(--teal-mid));
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.secret-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 128, 128, 0.4);
}

.secret-toggle svg {
    width: 16px;
    height: 16px;
}

/* ── QR Modal ── */
.modal-qr {
    max-width: 360px;
}

.qr-container {
    display: flex;
    justify-content: center;
    margin: 16px 0;
    padding: 16px;
    background: white;
    border-radius: 12px;
}

.qr-hint {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── MTProto Info ── */
.mtproto-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mtproto-info p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.mtproto-info h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: -6px;
}

.mtproto-info ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mtproto-info li {
    font-size: 13px;
    color: var(--text-muted);
    padding-left: 20px;
    position: relative;
    line-height: 1.5;
}

.mtproto-info li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--teal-mid);
    font-weight: 700;
}

.mtproto-footer-note {
    font-size: 12px !important;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    opacity: 0.7;
}

/* ── Счётчик ── */
.trust-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px 10px;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    backdrop-filter: blur(10px);
}

.trust-badge-dot {
    width: 7px;
    height: 7px;
    background: var(--teal-mid);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px var(--teal-mid);
    animation: blink 2s ease-in-out infinite;
}

.trust-badge-text {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.trust-badge-count {
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--teal), var(--teal-mid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.trust-note {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.55;
}

/* ── Инструкции ── */
.instructions {
    padding-top: 60px;
    border-top: 1px solid var(--border);
}

.instructions h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 32px;
    text-align: center;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.instruction-card {
    padding: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: all 0.3s ease;
}

.instruction-card:hover {
    border-color: var(--teal-mid);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.instruction-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--teal), var(--teal-mid));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 14px;
}

.instruction-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.instruction-card p,
.instruction-data p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.instruction-data {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.instruction-data strong {
    color: var(--text);
    font-weight: 600;
}

/* ── Footer ── */
.footer {
    padding: 32px 40px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    transition: background 0.4s ease;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.footer-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.footer-link:hover {
    border-color: var(--teal-mid);
    color: var(--teal-mid);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 191, 165, 0.15);
}

.telegram-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.footer-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.6;
    text-align: center;
}

/* ── Адаптив ── */
@media (max-width: 1024px) {
    .instructions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header { padding: 12px 20px; }
    .logo { width: 56px; height: 56px; }
    .logo-name { font-size: 15px; }

    .main { padding: 28px 20px; }

    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 28px;
        margin-bottom: 40px;
    }

    .title { font-size: 28px; }
    .description { font-size: 15px; }

    .connect-btn { font-size: 16px; min-height: 60px; }

    .info-qr-wrapper {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .info-btn,
    .mtproto-btn,
    .qr-btn {
        height: 48px;
        border-radius: 10px;
    }

    .button-label { font-size: 10px; }

    .instructions { padding-top: 36px; }
    .instructions h2 { font-size: 20px; margin-bottom: 16px; }
    .instructions-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .instruction-card { padding: 14px; }
    .instruction-number { width: 30px; height: 30px; font-size: 14px; margin-bottom: 10px; }
    .instruction-card h3 { font-size: 13px; }

    .trust-badge { padding: 8px 16px; }
    .trust-badge-text { font-size: 12px; }
    .trust-badge-count { font-size: 14px; }

    .footer { padding: 20px; }
    .footer-links { flex-direction: column; width: 100%; }
    .footer-link { justify-content: center; }

    .modal-content { padding: 22px; }
    .modal-content h2 { font-size: 18px; }
}

@media (max-width: 480px) {
    .header { padding: 10px 14px; }
    .logo { width: 44px; height: 44px; }
    .logo-name { font-size: 13px; }
    .online-indicator { font-size: 10px; }
    .theme-toggle { width: 38px; height: 38px; }

    .main { padding: 20px 14px; }
    .title { font-size: 22px; line-height: 1.25; }
    .description { font-size: 14px; }
    .description-note { font-size: 11px; }

    .connect-btn { font-size: 15px; min-height: 56px; padding: 18px; }

    .info-qr-wrapper {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .info-btn,
    .mtproto-btn,
    .qr-btn {
        height: 44px;
    }

    .info-btn svg,
    .mtproto-btn svg,
    .qr-btn svg {
        width: 16px;
        height: 16px;
    }

    .button-label { font-size: 9px; }

    .instructions { padding-top: 28px; }
    .instructions h2 { font-size: 18px; margin-bottom: 14px; }
    .instructions-grid { grid-template-columns: 1fr; gap: 8px; }
    .instruction-card { padding: 12px; }

    .trust-section { padding: 28px 14px 8px; }
    .trust-badge { padding: 8px 14px; gap: 6px; flex-wrap: wrap; justify-content: center; }
    .trust-badge-text { font-size: 11px; }
    .trust-badge-count { font-size: 13px; }

    .footer { padding: 16px 14px; }
    .footer-link { font-size: 12px; padding: 9px 14px; }

    .modal-content { padding: 18px; border-radius: 14px; }
    .modal-content h2 { font-size: 16px; margin-bottom: 16px; }
    .info-box { font-size: 12px; padding: 10px 12px; }
    #secretDisplay { font-size: 11px; }

    .qr-container { padding: 12px; }
    .qr-container canvas { width: 180px !important; height: 180px !important; }
}
