/* ==========================================================================
   1. GLOBALE VARIABLEN & DESIGN-SYSTEM
   ========================================================================== */
:root {
    --bg-main: #0c0c0e;
    --bg-card: #141416;
    --border-color: #222226;
    --text-main: #e1e1e6;
    --text-muted: #888894;
    --primary: #00e676;
    --primary-hover: #00c865;
    --accent-glow: rgba(0, 230, 118, 0.15);
    
    /* Touch-Optimierung für Mobilgeräte */
    --touch-target: 44px; 
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh; /* Dynamische Höhe für mobile Browser-Leisten */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* ==========================================================================
   2. START-SCREEN (LANDINGPAGE & ANMELDUNG) - PERFEKT FÜR HOCHKANT
   ========================================================================== */
#login-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; 
    height: 100vh; height: 100dvh;
    background: radial-gradient(circle at 50% 30%, #16161a 0%, var(--bg-main) 80%);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Verhindert das Abschneiden auf kurzen Bildschirmen im Hochkantmodus */
    padding: 24px 12px;
    overflow-y: auto; /* Aktiviert sauberes Scrollen, falls der Inhalt höher als das Display ist */
}

.login-wrapper {
    margin: auto; /* Zentriert die Box perfekt vertikal, solange genug Platz da ist */
    display: grid;
    grid-template-columns: 1fr; /* Standard: 1 Spalte für mobile Geräte & Hochkant */
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 950px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    overflow: hidden;
}

/* Linke Spalte: Hero-Bereich (Wird im Hochkant-Modus ausgeblendet) */
.login-hero-side {
    display: none; 
    padding: 40px;
    background: linear-gradient(135deg, #111113 0%, #080809 100%);
    border-right: 1px solid var(--border-color);
    flex-direction: column;
    justify-content: center;
}

.brand-title {
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}
.brand-title span {
    color: var(--primary);
    text-shadow: 0 0 15px var(--accent-glow);
}

.brand-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 30px 0;
    line-height: 1.5;
}

.feat-card {
    display: flex;
    gap: 15px;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.01);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.feat-card:hover {
    border-color: rgba(0, 230, 118, 0.15);
    background: rgba(255,255,255,0.02);
}
.feat-icon { font-size: 24px; line-height: 1; }
.feat-text h4 { margin: 0 0 4px 0; font-size: 15px; color: #fff; }
.feat-text p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Rechte Spalte: Anmeldeformular */
.login-form-side {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #141416;
}

.form-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #fff;
    letter-spacing: -0.3px;
}

.login-form-side input, .login-form-side select {
    width: 100%;
    height: var(--touch-target);
    padding: 0 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    margin-bottom: 12px;
    box-sizing: border-box;
    font-size: 14px;
    transition: all 0.2s ease;
}
.login-form-side input:focus, .login-form-side select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 10px var(--accent-glow);
}
.entry-language-select {
    font-weight: 700;
    border-color: rgba(255,255,255,0.16) !important;
    background: linear-gradient(135deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)) !important;
}
.entry-language-select option {
    color: #111;
}

.disclaimer-box {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 11px;
    color: var(--text-muted);
    max-height: 120px;
    overflow-y: auto;
    margin: 4px 0 14px 0;
    line-height: 1.45;
}
.disclaimer-box strong { color: var(--text-main); }

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--text-main);
    text-align: left;
    margin-bottom: 20px;
    cursor: pointer;
    line-height: 1.4;
    user-select: none;
}
.checkbox-container input {
    width: 16px; height: 16px;
    margin: 2px 0 0 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.start-btn {
    background: var(--primary);
    color: #000;
    font-weight: bold;
    border: none;
    height: 48px;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
}
.start-btn:hover { background: var(--primary-hover); }
.start-btn:active { transform: scale(0.98); }

/* ==========================================================================
   3. MAIN APPLICATION INTERFACE & SIDEBAR OPTIMIERUNG
   ========================================================================== */
#app-container {
    display: flex;
    width: 100vw;
    height: 100vh; height: 100dvh;
    background: var(--bg-main);
}

#sidebar {
    width: 100%; /* Mobil-First */
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

#app-container.chat-active #sidebar { display: none; }

/* Schwebendes Premium-Design für die eigene Profilkarte */
.profile-card {
    margin: 14px 14px 6px 14px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: border-color 0.3s ease;
}
.profile-card:hover {
    border-color: rgba(255,255,255,0.05);
}
.profile-card.gender-M { border-left: 4px solid #52a3ff; }
.profile-card.gender-W { border-left: 4px solid #ff52a3; }
.profile-card.gender-D { border-left: 4px solid #a352ff; }

.profile-nick-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3px;
    --user-accent: #fff;
}
.profile-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
}
.profile-nick-text {
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    color: var(--user-accent);
}
.profile-language-select {
    max-width: 132px;
    min-height: 26px;
    padding: 2px 22px 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.04);
    color: var(--text-main);
    font-size: 12px;
    cursor: pointer;
}
.profile-language-select:focus {
    outline: none;
    border-color: var(--primary);
}
.profile-language-select option {
    color: #111;
}

.sidebar-header {
    padding: 15px 20px 5px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: bold;
}

#chat-stats {
    margin: 4px 10px 4px 10px;
    padding: 7px 9px;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(0,230,118,0.065), rgba(255,255,255,0.02));
    box-shadow: 0 2px 9px rgba(0,0,0,0.14);
}
.chat-stats-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    color: var(--text-main);
    font-size: 10px;
    line-height: 1.25;
}
.chat-stats-mainline {
    justify-content: space-between;
    margin-bottom: 4px;
}
.chat-stats-main {
    color: var(--text-main);
    font-weight: 800;
}
.chat-stats-main b {
    color: var(--primary);
    font-size: 17px;
    line-height: 1;
}
.chat-stats-muted {
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
}
.chat-stats-details span {
    color: var(--text-muted);
    white-space: nowrap;
}
.chat-stats-details span:nth-child(1),
.chat-stats-details span:nth-child(2) {
    color: var(--text-main);
    font-weight: 700;
}

#user-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.lang-group-header {
    font-size: 11px;
    color: var(--primary);
    padding: 12px 10px 6px 10px;
    font-weight: bold;
    text-transform: uppercase;
}
.active-chats-header { color: #ffb300; }

.chatter-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.02), 0 4px 14px rgba(0,0,0,0.28);
}
.chatter-avatar.is-generic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--avatar-accent, #a352ff), rgba(255,255,255,0.12));
}
.user-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.user-item-copy {
    min-width: 0;
    flex: 1;
}
.user-item-top {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex-wrap: wrap;
}
.user-nick {
    color: var(--user-accent, #fff);
    font-weight: 700;
}
.user-age {
    font-size: 12px;
    color: var(--text-muted);
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.02);
    transition: all 0.15s ease;
}
.user-item:hover { background: rgba(255,255,255,0.05); }
.user-item.selected { background: rgba(0, 230, 118, 0.08); border-color: rgba(0, 230, 118, 0.15); }
.user-item.gender-M .user-tag { background: rgba(82,163,255,0.12); color: #52a3ff; }
.user-item.gender-W .user-tag { background: rgba(255,82,163,0.12); color: #ff52a3; }
.user-item.gender-D .user-tag { background: rgba(163,82,255,0.12); color: #a352ff; }

.user-tag {
    font-size: 10px;
    font-weight: bold;
    padding: 3px 7px;
    border-radius: 4px;
}

.unread-dot {
    width: 8px; height: 8px; background: #ff5252; border-radius: 50%;
    display: inline-block; margin-left: 6px;
}

/* Chat-Fenster */
#chat-window {
    display: none;
    flex: 1;
    flex-direction: column;
    background: var(--bg-main);
    position: relative;
    height: 100%;
}

#app-container.chat-active #chat-window { display: flex; }

#chat-header-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 55px;
}

#back-btn {
    display: block;
    background: transparent; border: none; color: #fff; 
    font-size: 22px; cursor: pointer; padding: 4px 8px;
}

#chat-header { font-weight: bold; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
#chat-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#block-btn,
#clear-history-btn {
    border: 1px solid rgba(255, 82, 82, 0.35);
    background: rgba(255, 82, 82, 0.12);
    color: #ff8a8a;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
#clear-history-btn {
    border-color: rgba(255, 179, 0, 0.35);
    background: rgba(255, 179, 0, 0.12);
    color: #ffc857;
}
#block-btn:hover { background: rgba(255, 82, 82, 0.20); }
#clear-history-btn:hover { background: rgba(255, 179, 0, 0.20); }
#block-btn:disabled,
#clear-history-btn:disabled { opacity: 0.45; cursor: not-allowed; }
#block-btn[hidden],
#clear-history-btn[hidden] { display: none; }

#chatbox {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
}
.msg.me {
    background: var(--primary);
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}
.msg.partner {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.msg-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.msg-avatar {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}
.msg-meta { font-size: 10px; color: var(--text-muted); margin-bottom: 0; font-weight: bold; }
.msg-meta-name { color: var(--user-accent, var(--text-muted)); }
.msg.me .msg-meta-name { color: rgba(0, 0, 0, 0.72); }
.msg-time {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    line-height: 1;
    color: var(--text-muted);
    text-align: right;
    opacity: 0.78;
    user-select: none;
}
.msg.me .msg-time {
    color: rgba(0, 0, 0, 0.55);
}

.system-msg {
    align-self: center;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    margin: 6px 0;
    text-align: center;
    max-width: 90%;
}

.system-msg.system-error {
    color: #ff5252;
    font-weight: bold;
    border-color: rgba(255, 82, 82, 0.35);
}

#chat-input-area {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#message-input {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    height: var(--touch-target);
    padding: 0 12px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
}
#message-input:disabled { opacity: 0.5; cursor: not-allowed; }

.file-label {
    background: var(--border-color);
    color: #fff;
    height: var(--touch-target);
    width: var(--touch-target);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}
.file-label:hover { background: #32323a; }

#send-btn {
    background: var(--primary);
    color: #000; font-weight: bold; border: none;
    height: var(--touch-target);
    padding: 0 16px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Banner */
#ad-banner {
    background: #1a160c;
    border: 1px solid #ffb30022;
    margin: 0 12px 10px 12px;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.ad-body { display: flex; flex-direction: column; gap: 2px; }
.ad-meta { display: flex; align-items: center; gap: 6px; }
.ad-badge { font-size: 9px; background: #ffb300; color: #000; padding: 1px 4px; border-radius: 3px; font-weight: bold; }
.ad-title { font-size: 12px; font-weight: bold; color: #ffb300; }
.ad-subtitle { font-size: 11px; color: var(--text-muted); }
.ad-action-btn { background: #ffb300; color: #000; text-decoration: none; font-size: 11px; font-weight: bold; padding: 6px 10px; border-radius: 4px; white-space: nowrap; }

/* Thumbnails */
.chat-image, .chat-video { cursor: zoom-in; transition: transform 0.2s, opacity 0.2s; max-width: 100%; max-height: 220px; border-radius: 6px; margin-top: 5px; display: block; -webkit-touch-callout: default; user-select: auto; }
.chat-image:hover, .chat-video:hover { transform: scale(1.01); opacity: 0.9; }

/* KUGELSICHERE LUPEN-STYLING ENGINE */
.chat-lightbox {
    display: none; position: fixed; top: 0; left: 0; 
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.96); z-index: 99999; 
    justify-content: center; align-items: center;
    cursor: zoom-out; opacity: 0; transition: opacity 0.2s ease-in-out;
    padding: 16px;
}
.chat-lightbox.show { display: flex; opacity: 1; }

#chat-lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
.chat-lightbox-actions {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    display: flex;
    gap: 8px;
    z-index: 100000;
}
.chat-lightbox-btn {
    appearance: none;
    border: 1px solid rgba(255,255,255,0.20);
    background: rgba(20,20,22,0.88);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    line-height: 1;
    font-weight: 700;
    border-radius: 999px;
    padding: 10px 12px;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0,0,0,0.35);
}
.chat-lightbox-btn:hover { background: rgba(40,40,44,0.95); }
.chat-lightbox-close {
    font-size: 22px;
    min-width: 42px;
    padding: 7px 12px 9px;
}
/* Zwingt jedes Riesenbild mathematisch exakt in das Browserfenster */
#chat-lightbox-content img, 
#chat-lightbox-content video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
    -webkit-touch-callout: default;
    user-select: auto;
    touch-action: manipulation;
}

/* ==========================================================================
   4. MEDIA QUERIES (UPGRADES FÜR TABLETS & DESKTOPS / PERFEKTES HOCHKANT)
   ========================================================================== */
@media (min-width: 769px) and (min-aspect-ratio: 1/1) {
    #sidebar { width: 320px; display: flex !important; }
    #chat-window { display: flex !important; }
    #back-btn { display: none; }
    #chat-header-bar { padding: 15px 20px; }
    #chatbox { padding: 20px; }
    .msg { max-width: 70%; }
    #chat-input-area { padding: 15px 20px; gap: 12px; }
    #ad-banner { margin: 0 20px 15px 20px; padding: 12px; }
}

/* 11-Zoll-Tablet im Hochformat: links schmale Liste, rechts Chat sofort sichtbar */
@media (min-width: 700px) and (max-aspect-ratio: 1/1) {
    #sidebar {
        width: 260px;
        min-width: 260px;
        max-width: 260px;
        display: flex !important;
    }

    #app-container.chat-active #sidebar {
        display: flex !important;
    }

    #chat-window {
        display: flex !important;
    }

    #back-btn {
        display: none;
    }

    #chat-header-bar {
        padding: 14px 16px;
    }

    #chatbox {
        padding: 18px;
    }

    .msg {
        max-width: 78%;
    }

    #chat-input-area {
        padding: 14px 16px;
        gap: 10px;
    }

    #ad-banner {
        margin: 0 16px 12px 16px;
    }

    .user-item {
        padding: 12px 9px;
    }

    .user-item-main {
        gap: 8px;
    }

    .chatter-avatar {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }
}

@media (min-width: 821px) and (min-aspect-ratio: 1/1) {
    .login-wrapper { grid-template-columns: 1.1fr 0.9fr; }
    .login-hero-side { display: flex; }
    .login-form-side { padding: 40px; }
    #login-screen { padding: 20px; }
}

/* ==========================================================================
   5. BROWSER SPECIFIC CONTRAST FIXES
   ========================================================================== */
select option {
    background-color: #141416 !important;
    color: #ffffff !important;
}
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
select:-webkit-autofill {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0px 1000px #0c0c0e inset !important;
    transition: background-color 5000s ease-in-out 0s;
}
::placeholder {
    color: #666670 !important;
    opacity: 1;
}
/* ==========================================================================
   6. RESPONSIVE FEINSCHLIFF: SICHTBARKEIT & ELEGANZ
   ========================================================================== */
#sidebar {
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
}

#chat-window,
#chat-input-area,
#chat-header-bar,
.user-item,
.user-item > div:first-child {
    min-width: 0;
}

#chatbox {
    width: 100%;
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
}

#message-input {
    min-width: 0;
}

#chat-header {
    min-width: 0;
}

#chat-input-area {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

@media (max-width: 420px) {
    #chat-input-area {
        gap: 7px;
        padding-left: 10px;
        padding-right: 10px;
    }

    #send-btn {
        padding-left: 13px;
        padding-right: 13px;
    }

    .msg {
        max-width: calc(100% - 18px);
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    .login-wrapper {
        grid-template-columns: 1fr;
        max-width: 460px;
    }

    .login-hero-side {
        display: none !important;
    }

    .login-form-side {
        padding: 20px;
    }

    #login-screen {
        align-items: flex-start;
        padding: 14px;
    }
}

/* Tablet-Hochformat: Hinweise auf dem Startscreen sichtbar halten */
@media (min-width: 700px) and (max-aspect-ratio: 1/1) {
    #login-screen {
        padding: 24px;
    }

    .login-wrapper {
        max-width: 680px;
        grid-template-columns: 1fr;
    }

    .login-hero-side {
        display: flex;
        padding: 28px 32px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        justify-content: flex-start;
    }

    .brand-title {
        font-size: 26px;
        margin-bottom: 8px;
    }

    .brand-subtitle {
        margin-bottom: 16px;
    }

    .feat-card {
        margin-bottom: 10px;
        padding: 12px 14px;
    }

    .login-form-side {
        padding: 28px 32px 32px;
    }
}

/* Sehr niedrige Tablet-Hochformate: Hinweise kompakter machen statt ausblenden */
@media (min-width: 700px) and (max-aspect-ratio: 1/1) and (max-height: 900px) {
    .login-hero-side {
        padding-top: 22px;
        padding-bottom: 12px;
    }

    .brand-subtitle {
        display: none;
    }

    .feat-card {
        margin-bottom: 8px;
        padding: 10px 12px;
    }

    .feat-icon {
        font-size: 21px;
    }

    .feat-text p {
        font-size: 11px;
        line-height: 1.3;
    }

    .login-form-side {
        padding-top: 22px;
    }
}


@media (max-width: 520px) {
    #block-btn,
    #clear-history-btn { font-size: 0; padding: 6px 8px; }
    #block-btn::before { content: "🚫"; font-size: 14px; }
    #clear-history-btn::before { content: "🗑️"; font-size: 14px; }
}

@media (max-width: 520px) {
    .chat-lightbox-actions {
        left: 10px;
        right: 10px;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .chat-lightbox-btn {
        font-size: 12px;
        padding: 10px 11px;
    }
}

.preferred-lang-header {
    color: var(--primary);
    background: rgba(0, 230, 118, 0.035);
    border-radius: 6px;
}


/* ==========================================================================
   SEO LANDING PAGE / PRE-CHAT PROMO
   ========================================================================== */
body.landing-active,
body.landing-only {
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100vh;
    height: auto;
}
body.landing-active #login-screen,
body.landing-active #app-container,
body.landing-active #chat-lightbox,
body.landing-only #login-screen,
body.landing-only #app-container,
body.landing-only #chat-lightbox {
    display: none !important;
}
.seo-landing {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    background:
        radial-gradient(circle at 50% 0%, rgba(0, 230, 255, 0.18), transparent 38%),
        linear-gradient(180deg, #071533 0%, #092f62 48%, #07101f 100%);
    color: #fff;
    padding: 28px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.seo-landing-shell {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(300px, 1fr);
    gap: 30px;
    align-items: center;
}
.seo-landing-copy {
    padding: 22px 8px 22px 20px;
}
.seo-kicker {
    margin: 0 0 14px 0;
    color: #8ee9ff;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 13px;
}
.seo-landing h1 {
    margin: 0;
    font-size: clamp(38px, 6vw, 76px);
    line-height: 0.98;
    letter-spacing: -0.06em;
    font-weight: 950;
}
.seo-lead {
    max-width: 560px;
    margin: 22px 0 0 0;
    color: rgba(255,255,255,0.82);
    font-size: clamp(17px, 2vw, 22px);
    line-height: 1.45;
}
.seo-cta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 28px;
}
.seo-primary-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 0;
    border-radius: 999px;
    padding: 15px 24px;
    font-size: 16px;
    font-weight: 900;
    color: #06121f;
    background: linear-gradient(135deg, #72f7ff, #00e676);
    box-shadow: 0 0 22px rgba(0,230,255,0.28), 0 10px 28px rgba(0,0,0,0.36);
    cursor: pointer;
}
.seo-primary-cta:active { transform: translateY(1px); }
.seo-url {
    font-weight: 950;
    font-size: clamp(24px, 3vw, 38px);
    color: #fff;
    text-shadow: 0 0 16px rgba(0,174,255,0.95);
    letter-spacing: -0.03em;
}
.seo-trust-list {
    list-style: none;
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 30px 0 0 0;
    color: rgba(255,255,255,0.82);
    font-size: 15px;
}
.seo-trust-list li::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 50%;
    color: #06121f;
    background: #00e676;
    font-weight: 900;
}
.seo-landing-visual {
    display: flex;
    justify-content: center;
}
.seo-landing-visual img {
    width: min(100%, 560px);
    height: auto;
    display: block;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.48), 0 0 36px rgba(0,174,255,0.28);
}
@media (max-width: 860px) {
    .seo-landing {
        padding: 20px 12px 30px;
        align-items: flex-start;
    }
    .seo-landing-shell {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .seo-landing-copy {
        text-align: center;
        padding: 10px 4px 0;
    }
    .seo-lead { margin-left: auto; margin-right: auto; }
    .seo-cta-row { justify-content: center; }
    .seo-trust-list {
        text-align: left;
        width: min(430px, 100%);
        margin-left: auto;
        margin-right: auto;
    }
    .seo-landing-visual img {
        width: min(100%, 430px);
        border-radius: 18px;
    }
}

.seo-legal-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    color: rgba(255,255,255,0.55);
    font-size: 13px;
}
.seo-legal-links a,
.login-legal-links a {
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    font-weight: 700;
}
.seo-legal-links a:hover,
.login-legal-links a:hover {
    color: #8ee9ff;
    text-decoration: underline;
}
.login-legal-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    font-size: 12px;
    color: rgba(255,255,255,0.45);
}
@media (max-width: 860px) {
    .seo-legal-links {
        justify-content: center;
        margin-top: 22px;
    }
}

/* Legal placeholder pages */
body.legal-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #071533 0%, #07101f 100%);
    color: #fff;
    display: block;
    overflow-y: auto;
    padding: 24px 14px;
}
.legal-shell {
    width: min(860px, 100%);
    margin: 0 auto;
}
.legal-back {
    display: inline-flex;
    margin-bottom: 22px;
    color: #8ee9ff;
    text-decoration: none;
    font-weight: 800;
}
.legal-shell h1 {
    margin: 0 0 18px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1;
    letter-spacing: -0.05em;
}
.legal-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 18px;
    padding: 20px;
    margin-top: 16px;
    color: rgba(255,255,255,0.84);
    box-shadow: 0 16px 45px rgba(0,0,0,0.25);
}
.legal-card h2 {
    margin: 0 0 12px;
    color: #fff;
}
.legal-card p {
    margin: 9px 0;
    line-height: 1.55;
}


.seo-language-note {
    margin: 12px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.92rem;
    line-height: 1.45;
    max-width: 560px;
}
.seo-language-note strong {
    color: #ffffff;
}


.seo-language-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 10px;
    margin-top: 22px;
    max-width: 620px;
}
.seo-language-switcher a {
    color: rgba(255,255,255,0.84);
    text-decoration: none;
    font-size: 12px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
}
.seo-language-switcher a:hover {
    color: #ffffff;
    background: rgba(0,230,255,0.16);
}


/* ==========================================================================
   LANDING MOBILE/TABLET RESPONSIVE FIX
   ========================================================================== */
body.landing-only {
    min-height: 100svh;
    height: auto;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    align-items: initial;
    justify-content: initial;
    -webkit-text-size-adjust: 100%;
}
body.landing-only .seo-landing {
    min-height: 100svh;
    height: auto;
}
.seo-language-note {
    color: rgba(255,255,255,0.72);
    line-height: 1.5;
}
.seo-language-note a {
    color: #8ee9ff;
    font-weight: 900;
}
.seo-language-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}
.seo-language-switcher a {
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 750;
    background: rgba(255,255,255,0.045);
}
.seo-language-switcher a:hover {
    color: #06121f;
    background: linear-gradient(135deg, #72f7ff, #00e676);
}

@media (min-width: 861px) and (max-width: 1180px) {
    .seo-landing {
        padding: 26px 18px;
    }
    .seo-landing-shell {
        grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.82fr);
        gap: 22px;
    }
    .seo-landing h1 {
        font-size: clamp(40px, 5.4vw, 62px);
    }
    .seo-lead {
        font-size: 18px;
    }
    .seo-landing-visual img {
        width: min(100%, 430px);
        max-height: 72svh;
        object-fit: contain;
    }
}

@media (min-width: 700px) and (max-width: 1024px) and (orientation: portrait) {
    .seo-landing {
        padding: 22px 18px 34px;
        align-items: flex-start;
    }
    .seo-landing-shell {
        grid-template-columns: 1fr;
        gap: 18px;
        max-width: 720px;
    }
    .seo-landing-copy {
        text-align: center;
        padding: 8px 8px 0;
    }
    .seo-landing h1 {
        font-size: clamp(42px, 7vw, 60px);
        line-height: 1.02;
    }
    .seo-lead {
        margin-left: auto;
        margin-right: auto;
    }
    .seo-cta-row {
        justify-content: center;
    }
    .seo-trust-list {
        width: min(520px, 100%);
        margin-left: auto;
        margin-right: auto;
        grid-template-columns: 1fr;
        text-align: left;
    }
    .seo-landing-visual {
        order: 2;
    }
    .seo-landing-visual img {
        width: min(76vw, 440px);
        max-height: 44svh;
        border-radius: 20px;
        object-fit: contain;
    }
    .seo-language-switcher,
    .seo-legal-links {
        justify-content: center;
    }
}

@media (max-width: 699px) {
    .seo-landing {
        padding: 14px 12px 24px;
        align-items: flex-start;
        justify-content: flex-start;
    }
    .seo-landing-shell {
        grid-template-columns: 1fr;
        gap: 14px;
        width: 100%;
    }
    .seo-landing-copy {
        padding: 4px 0 0;
        text-align: center;
    }
    .seo-kicker {
        font-size: 10px;
        margin-bottom: 8px;
        letter-spacing: 0.1em;
    }
    .seo-landing h1 {
        font-size: clamp(30px, 10vw, 42px);
        line-height: 1.03;
        letter-spacing: -0.045em;
    }
    .seo-lead {
        margin: 12px auto 0;
        font-size: 15px;
        line-height: 1.42;
    }
    .seo-cta-row {
        margin-top: 16px;
        justify-content: center;
        gap: 10px;
    }
    .seo-primary-cta {
        width: min(100%, 360px);
        min-height: 48px;
        padding: 13px 18px;
        font-size: 15px;
    }
    .seo-url {
        width: 100%;
        font-size: clamp(24px, 8vw, 34px);
    }
    .seo-trust-list {
        width: min(100%, 380px);
        margin: 18px auto 0;
        gap: 8px;
        font-size: 13px;
        text-align: left;
    }
    .seo-language-note {
        margin-left: auto;
        margin-right: auto;
        width: min(100%, 390px);
        font-size: 12px;
    }
    .seo-language-switcher {
        justify-content: center;
        max-height: 92px;
        overflow-y: auto;
        padding: 2px 4px 6px;
        -webkit-overflow-scrolling: touch;
        mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
    }
    .seo-language-switcher a {
        font-size: 11px;
        padding: 6px 9px;
    }
    .seo-landing-visual {
        order: 2;
        margin-top: 2px;
    }
    .seo-landing-visual img {
        width: min(88vw, 330px);
        max-height: 42svh;
        object-fit: contain;
        border-radius: 16px;
        box-shadow: 0 18px 48px rgba(0,0,0,0.42), 0 0 24px rgba(0,174,255,0.22);
    }
    .seo-legal-links {
        justify-content: center;
        margin-top: 18px;
        font-size: 12px;
    }
}

@media (max-width: 420px) and (max-height: 760px) {
    .seo-landing h1 {
        font-size: clamp(27px, 9vw, 36px);
    }
    .seo-lead {
        font-size: 14px;
    }
    .seo-trust-list {
        margin-top: 14px;
    }
    .seo-landing-visual img {
        max-height: 35svh;
        width: min(84vw, 285px);
    }
}

@media (max-height: 560px) and (orientation: landscape) {
    body.landing-only .seo-landing {
        padding: 10px 12px;
    }
    .seo-landing-shell {
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.65fr);
        gap: 14px;
    }
    .seo-landing-copy {
        text-align: left;
    }
    .seo-landing h1 {
        font-size: clamp(28px, 5vw, 42px);
    }
    .seo-lead,
    .seo-language-note {
        font-size: 13px;
        margin-top: 8px;
    }
    .seo-cta-row {
        margin-top: 12px;
    }
    .seo-trust-list,
    .seo-language-switcher {
        display: none;
    }
    .seo-landing-visual img {
        max-height: 82svh;
        width: auto;
    }
}
