:root {
    /* TOKKS logo palette: indigo/violet outline + coral/orange faces */
    --bg: #0b0b12;
    --bg-card: #15151f;
    --bg-elevated: #1e1e2a;
    --accent: #FF6B4A;
    --accent-hot: #FF5E8A;
    --accent-orange: #FF8C42;
    --accent-pink: #FF5E8A;
    --accent-purple: #5B4CDB;
    --accent-indigo: #3B5BDB;
    --gradient-brand: linear-gradient(135deg, #FF6B4A 0%, #FF8C42 45%, #FF5E8A 100%);
    --gradient-outline: linear-gradient(135deg, #3B5BFF 0%, #FF2D1A 100%);
    --text: #f4f4f8;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --success: #34d399;
    --border: #2a2a38;
    --nav-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --shout-shadow: 0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,107,74,0.22);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    height: 100%;
    height: 100dvh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; border: none; background: none; color: inherit; }
.hidden { display: none !important; }
input, select { color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

#app {
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    background: var(--bg);
    width: 100%;
}

.screen {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}
.screen.active { display: flex; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-shrink: 0;
    z-index: 50;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    min-width: 64px;
    min-height: 44px;
    justify-content: center;
}
.nav-item.active { color: var(--accent); }
.nav-item .nav-icon-wrap {
    width: 44px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 16px;
    font-size: 20px;
}
.nav-item.active .nav-icon-wrap { background: rgba(255,107,74,0.18); }

/* ===== DISCOVER ===== */
.discover-header {
    position: absolute; top: 0; left: 0; right: 0; z-index: 10;
    display: flex; justify-content: space-between; align-items: center;
    padding: calc(12px + var(--safe-top)) 16px 12px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
    gap: 12px;
}
.discover-header .brand-logo {
    flex-shrink: 0;
}
.discover-header button, .header-right button {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(0,0,0,0.45); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.header-right { display: flex; gap: 8px; }

.discover-bg {
    position: absolute; inset: 0; background: #15151e; overflow: hidden;
}
.placeholder-avatar {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(72px, 22vw, 110px);
    font-weight: 700;
    color: #3a3a4a;
    background: linear-gradient(160deg, #252532 0%, #12121a 100%);
}

.discover-content {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 5;
    padding: 20px 16px 16px;
    background: linear-gradient(to top, rgba(13,13,18,0.97) 50%, transparent);
}

.filter-row, .interest-filters {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.filter-row::-webkit-scrollbar, .interest-filters::-webkit-scrollbar { display: none; }

.filter-chip {
    flex-shrink: 0;
    padding: 10px 16px; border-radius: 999px;
    font-size: 13px; font-weight: 600;
    background: var(--bg-elevated); color: var(--text);
    border: 1.5px solid transparent;
    white-space: nowrap;
    transition: all 0.15s;
    min-height: 40px;
}
.filter-chip.active {
    background: var(--gradient-brand); color: #fff; border-color: transparent;
    box-shadow: 0 2px 12px rgba(255,107,74,0.4);
}

.online-count {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-muted); margin-bottom: 14px;
}
.online-count .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success); box-shadow: 0 0 8px var(--success);
}

.btn-start {
    width: 100%; padding: 16px;
    border-radius: 999px;
    background: var(--gradient-brand);
    color: #fff;
    font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 4px 24px rgba(255,107,74,0.4);
    min-height: 52px;
}
.btn-start:active { transform: scale(0.98); }
.btn-start:disabled { opacity: 0.55; }

/* ===== CHATS ===== */
.chats-header {
    padding: calc(16px + var(--safe-top)) 16px 10px;
    display: flex; align-items: center; justify-content: space-between;
}
.chats-header h1 { font-size: 26px; font-weight: 700; }
.chats-header .actions button {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg-elevated); font-size: 16px;
    display: flex; align-items: center; justify-content: center;
}

.online-row {
    display: flex; gap: 14px; padding: 6px 16px 14px;
    overflow-x: auto; scrollbar-width: none;
}
.online-row::-webkit-scrollbar { display: none; }
.online-user {
    display: flex; flex-direction: column; align-items: center; gap: 5px; flex-shrink: 0;
}
.online-user .av {
    width: 58px; height: 58px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 20px; color: #fff;
    border: 2.5px solid var(--accent-pink); position: relative;
}
.online-user .status-dot {
    position: absolute; bottom: 1px; right: 1px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--success); border: 2px solid var(--bg);
}
.online-user span { font-size: 11px; color: var(--text-muted); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.section-title {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 16px 8px; font-size: 14px; font-weight: 600;
}
.section-title span { color: var(--accent-pink); font-size: 13px; }

.chat-list { flex: 1; overflow-y: auto; padding: 0 6px 12px; -webkit-overflow-scrolling: touch; min-height: 0; }
.chat-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 10px; border-radius: 12px;
    min-height: 64px;
}
.chat-item:active { background: var(--bg-elevated); }
.chat-item .av {
    width: 50px; height: 50px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px; color: #fff; flex-shrink: 0; position: relative;
}
.chat-item .status-dot {
    position: absolute; bottom: 0; right: 0;
    width: 11px; height: 11px; border-radius: 50%;
    background: var(--success); border: 2px solid var(--bg);
}
.chat-item .info { flex: 1; min-width: 0; }
.chat-item .name-row { display: flex; gap: 6px; align-items: baseline; margin-bottom: 2px; }
.chat-item .name { font-weight: 600; font-size: 15px; }
.chat-item .loc { font-size: 12px; color: var(--text-muted); }
.chat-item .preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chat-item .time { font-size: 11px; color: var(--text-muted); }
.chat-item .badge {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

.empty-chats {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-muted); padding: 40px 20px; text-align: center;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-chats p { font-size: 14px; line-height: 1.5; }

/* ===== PROFILE ===== */
.profile-header {
    padding: calc(12px + var(--safe-top)) 16px 0;
    display: flex; justify-content: space-between; align-items: center;
}
.profile-header button {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg-elevated); font-size: 14px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    padding: 0 12px; width: auto; min-width: 44px;
}

.profile-body {
    flex: 1; overflow-y: auto; padding: 8px 16px 24px;
    text-align: center; -webkit-overflow-scrolling: touch; min-height: 0;
}

.profile-avatar-wrap { position: relative; display: inline-block; margin-bottom: 10px; }
.profile-avatar {
    width: 100px; height: 100px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; font-weight: 700; color: #fff;
    border: 3px solid var(--border);
}
.online-indicator {
    position: absolute; bottom: 4px; right: 4px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--success); border: 3px solid var(--bg);
}

.profile-name { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.profile-meta {
    margin-bottom: 20px;
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center;
}
.gender-select {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 12px; font-size: 13px; outline: none;
    min-height: 40px;
}

.stats-row { display: flex; gap: 10px; margin-bottom: 24px; }
.stat-card {
    flex: 1; background: var(--bg-card); border-radius: 14px;
    padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.stat-card .icon { font-size: 18px; }
.stat-card .num { font-size: 18px; font-weight: 700; }
.stat-card .label { font-size: 11px; color: var(--text-muted); }

.interests-section { text-align: left; margin-bottom: 20px; }
.interests-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.interest-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.interest-tag {
    padding: 8px 14px; border-radius: 999px;
    background: var(--bg-elevated); font-size: 12px; font-weight: 500;
    cursor: pointer; border: 1.5px solid transparent;
    min-height: 36px;
}
.interest-tag.selected { background: rgba(255,107,74,0.18); border-color: var(--accent); color: var(--accent); }

.name-edit { text-align: left; margin-bottom: 20px; }
.name-edit label { font-size: 13px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.name-row { display: flex; gap: 8px; }
.name-row input {
    flex: 1; background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 10px; padding: 12px; font-size: 14px; outline: none;
    min-height: 44px;
}
.btn-save-name {
    padding: 12px 16px; border-radius: 10px;
    background: var(--accent); color: #0d0d12; font-weight: 600; font-size: 13px;
    min-height: 44px;
}

.menu-list { text-align: left; }
.menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px; background: var(--bg-card); border-radius: 12px;
    margin-bottom: 8px; font-size: 14px; font-weight: 500;
    min-height: 52px;
}
.menu-item .icon-box {
    width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.menu-item .icon-box.safety { background: rgba(167,139,250,0.15); }
.menu-item .icon-box.premium { background: rgba(251,191,36,0.15); }
.menu-item .icon-box.rules { background: rgba(74,222,128,0.15); }
.menu-item .arrow { margin-left: auto; color: var(--text-muted); font-size: 18px; }

/* ===== CALL SCREEN ===== */
#call-screen {
    position: fixed; inset: 0; z-index: 100;
    background: #000; display: none; flex-direction: column;
    max-width: 480px; margin: 0 auto;
    width: 100%;
}
#call-screen.active { display: flex; }

.call-remote { flex: 1; position: relative; background: #111; min-height: 0; }
.call-remote video { width: 100%; height: 100%; object-fit: cover; }
/* Top bar sits above PiP — no overlap */
.call-top-bar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    padding: calc(10px + var(--safe-top)) 12px 10px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
    min-height: calc(52px + var(--safe-top));
    pointer-events: none;
}
.call-top-bar > * { pointer-events: auto; }
.call-brand {
    display: flex; align-items: center; gap: 8px;
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
}
.call-brand-logo {
    width: 34px; height: 34px;
    border-radius: 9px;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.2);
}
.call-brand-name {
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.call-top-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    pointer-events: none;
}
.call-top-actions {
    display: flex; gap: 8px; flex-shrink: 0;
}
.call-top-bar button {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}

/* Partner chip below top bar, left — clear of PiP */
.partner-info {
    position: absolute;
    top: calc(58px + var(--safe-top));
    left: 12px;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(6px);
    padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
    z-index: 20; max-width: calc(100% - 120px);
}

/* Local PiP below top bar on the right — no overlap with controls */
.call-local {
    position: absolute;
    top: calc(58px + var(--safe-top));
    right: 12px;
    width: 96px; height: 136px;
    border-radius: 14px; overflow: hidden;
    border: 2px solid rgba(255,255,255,0.35);
    z-index: 25;
    box-shadow: 0 4px 18px rgba(0,0,0,0.55);
}
.call-local video { width: 100%; height: 100%; object-fit: cover; }

.call-status {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    z-index: 15; text-align: center;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(12px);
    padding: 28px 32px; border-radius: 20px; max-width: 280px; width: 90%;
}
.call-status.hidden { display: none; }
.call-status h2 { font-size: 18px; margin: 12px 0 6px; }
.call-status p { font-size: 13px; color: var(--text-muted); }
.spinner {
    width: 32px; height: 32px; margin: 0 auto;
    border: 3px solid rgba(255,255,255,0.2); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.call-bottom-ui {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    pointer-events: none;
    background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.35) 55%, transparent 100%);
    padding-top: 28px;
}
.call-bottom-ui > * { pointer-events: auto; }
.call-chat-overlay {
    position: relative;
    bottom: auto; left: auto; right: auto;
    z-index: 1;
    padding: 0 12px 8px;
    max-height: 28vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
}
.call-chat-overlay .msg {
    max-width: 78%; padding: 8px 12px; border-radius: 16px;
    font-size: 13px; pointer-events: auto; word-break: break-word;
}
.call-chat-overlay .msg.them {
    align-self: flex-start; background: rgba(40,40,50,0.88);
    backdrop-filter: blur(8px); border-bottom-left-radius: 4px;
}
.call-chat-overlay .msg.me {
    align-self: flex-end; background: var(--gradient-brand); color: #fff;
    border-bottom-right-radius: 4px;
}

.call-input-bar {
    position: relative;
    bottom: auto; left: auto; right: auto;
    z-index: 2;
    display: flex; gap: 8px;
    padding: 0 12px 10px;
    align-items: center;
}
.call-input-bar input {
    flex: 1; background: rgba(40,40,50,0.88); backdrop-filter: blur(10px);
    border: none; border-radius: 22px; padding: 12px 16px;
    color: var(--text); font-size: 16px; outline: none;
    min-height: 44px;
}
.call-input-bar .send-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg-elevated); display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 16px;
}

.call-controls {
    position: relative;
    bottom: auto; left: auto; right: auto;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 4px 16px calc(12px + var(--safe-bottom));
}
.ctrl-btn {
    width: 52px; height: 52px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(50,50,60,0.9); backdrop-filter: blur(8px); font-size: 20px;
}
.ctrl-btn:active { transform: scale(0.92); }
.ctrl-btn.next { width: 60px; height: 60px; background: var(--gradient-brand); color: #fff; font-size: 22px; }
.ctrl-btn.end { background: var(--danger); color: #fff; }
.ctrl-btn.muted { background: var(--danger); color: #fff; }

/* ===== MODAL (history) ===== */
.modal {
    position: fixed; inset: 0; z-index: 200;
    background: var(--bg); display: flex; flex-direction: column;
    max-width: 480px; margin: 0 auto;
    width: 100%;
}
.modal.hidden { display: none; }
.modal-content { display: flex; flex-direction: column; height: 100%; height: 100dvh; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(12px + var(--safe-top)) 12px 12px;
    border-bottom: 1px solid var(--border); font-weight: 600;
}
.modal-header button { width: 44px; height: 44px; font-size: 20px; }
.modal-messages {
    flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px;
    min-height: 0; -webkit-overflow-scrolling: touch;
}
.modal-messages .msg {
    max-width: 80%; padding: 10px 14px; border-radius: 16px; font-size: 14px;
}
.modal-messages .msg.me { align-self: flex-end; background: var(--gradient-brand); color: #fff; }
.modal-messages .msg.them { align-self: flex-start; background: var(--bg-elevated); }
.modal-input {
    display: flex; gap: 8px; padding: 12px 12px calc(12px + var(--safe-bottom));
    border-top: 1px solid var(--border);
}
.modal-input input {
    flex: 1; background: var(--bg-elevated); border: none; border-radius: 22px;
    padding: 12px 16px; font-size: 16px; outline: none; min-height: 44px;
}
.modal-input button {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--gradient-brand); color: #fff; font-weight: 700;
}

/* Age filter */
.age-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.age-filter-row input {
    width: 56px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    color: var(--text);
    text-align: center;
    font-size: 13px;
    min-height: 36px;
}

.age-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    width: 80px;
    margin-left: 0;
    outline: none;
    min-height: 40px;
}

.call-top-actions { display: flex; gap: 8px; }
.call-top-actions button {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}

.section-block {
    text-align: left;
    margin-bottom: 20px;
}
.section-block h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}
.friend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 13px;
    flex-wrap: wrap;
}
.friend-row button {
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-elevated);
    min-height: 32px;
}
.friend-row .btn-accept { background: var(--gradient-brand); color: #fff; }
.friend-row .btn-decline { background: var(--danger); color: #fff; }
.muted { color: var(--text-muted); font-size: 13px; }
.muted.small { font-size: 12px; margin-top: 12px; }

.badge-guest {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.auth-content { max-width: 360px; margin: 0 auto; width: 100%; }
.auth-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auth-body h3 { font-size: 16px; margin-top: 8px; }
.auth-body input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    font-size: 16px;
    outline: none;
    min-height: 48px;
}
.auth-body hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.btn-auth {
    padding: 14px;
    border-radius: 10px;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    min-height: 48px;
}

/* Light theme */
[data-theme="light"] {
    --bg: #f4f4f8;
    --bg-card: #ffffff;
    --bg-elevated: #e8e8ef;
    --text: #1a1a22;
    --text-muted: #6b7280;
    --border: #d1d5db;
    --danger: #dc2626;
    --success: #16a34a;
}
[data-theme="light"] .discover-bg .placeholder-avatar {
    background: linear-gradient(160deg, #e0e0e8 0%, #f4f4f8 100%);
    color: #a0a0b0;
}
[data-theme="light"] .btn-start { box-shadow: 0 4px 24px rgba(255,107,74,0.45); }
[data-theme="light"] .call-remote { background: #ccc; }
[data-theme="light"] .modal { background: var(--bg); }
[data-theme="light"] .call-chat-overlay .msg.them {
    background: rgba(255,255,255,0.9); color: #1a1a22;
}
[data-theme="light"] .call-input-bar input {
    background: rgba(255,255,255,0.9); color: #1a1a22;
}
[data-theme="light"] .discover-header button,
[data-theme="light"] .header-right button {
    background: rgba(255,255,255,0.7); color: #1a1a22;
}

/* ===== RESPONSIVE ===== */

/* Small phones */
@media (max-width: 360px) {
    .filter-chip { padding: 8px 12px; font-size: 12px; }
    .btn-start { font-size: 15px; padding: 14px; }
    .call-local { width: 72px; height: 102px; }
    .ctrl-btn { width: 46px; height: 46px; }
    .ctrl-btn.next { width: 52px; height: 52px; }
    .stats-row { gap: 6px; }
    .stat-card { padding: 10px 4px; }
}

/* Landscape phones / short height */
@media (max-height: 500px) and (orientation: landscape) {
    .discover-content { padding: 8px 16px; }
    .filter-row, .interest-filters { padding-bottom: 4px; gap: 6px; }
    .filter-chip { padding: 6px 12px; font-size: 12px; min-height: 32px; }
    .age-filter-row { margin-bottom: 6px; }
    .btn-start { padding: 10px; font-size: 14px; min-height: 40px; }
    .online-count { margin-bottom: 8px; font-size: 12px; }
    .call-controls { gap: 10px; padding: 6px 12px calc(6px + var(--safe-bottom)); }
    .ctrl-btn { width: 42px; height: 42px; font-size: 16px; }
    .ctrl-btn.next { width: 48px; height: 48px; }
    .call-local { width: 64px; height: 90px; top: calc(8px + var(--safe-top)); right: 8px; }
    .call-input-bar { bottom: auto; }
    .call-chat-overlay { bottom: auto; max-height: 18vh; }
    .partner-info { top: calc(52px + var(--safe-top)); font-size: 12px; }
    .bottom-nav { height: calc(52px + var(--safe-bottom)); }
    .nav-item { min-height: 40px; font-size: 10px; }
}

/* Tablet and up – phone frame centered */
@media (min-width: 481px) {
    body {
        background: #050508;
        display: flex; align-items: center; justify-content: center;
        padding: 0;
    }
    #app, #call-screen, .modal {
        height: min(100dvh, 900px);
        max-height: 100dvh;
        border-radius: 0;
        box-shadow: 0 0 80px rgba(0,0,0,0.7);
    }
    [data-theme="light"] body { background: #e5e5ea; }
}

@media (min-width: 768px) {
    #app, #call-screen, .modal {
        max-width: 420px;
        border-radius: 24px;
        overflow: hidden;
    }
    body { padding: 16px; }
}

@media (min-width: 1024px) {
    #app, #call-screen, .modal {
        max-width: 400px;
        border-left: 1px solid #1a1a24;
        border-right: 1px solid #1a1a24;
    }
}

/* Very large screens – still phone-like for consistent UX */
@media (min-width: 1400px) {
    #app, #call-screen, .modal {
        max-width: 420px;
        height: min(100dvh, 920px);
    }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .spinner { animation: none; border-top-color: var(--accent); }
    .btn-start:active, .ctrl-btn:active { transform: none; }
}

/* Ensure body doesn't scroll when in call */
body.in-call { overflow: hidden; position: fixed; width: 100%; height: 100%; }

/* ===== SVG ICONS ===== */
.svg-icon {
    width: 22px;
    height: 22px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.svg-icon.sm {
    width: 16px;
    height: 16px;
}
.svg-icon.xl {
    width: 96px;
    height: 96px;
    opacity: 0.35;
}
.muted-icon {
    opacity: 0.45;
    color: var(--text-muted);
}

.discover-header button .svg-icon,
.header-right button .svg-icon,
.call-top-bar button .svg-icon,
.call-top-actions button .svg-icon,
.modal-header button .svg-icon {
    width: 20px;
    height: 20px;
}

.ctrl-btn .svg-icon {
    width: 24px;
    height: 24px;
}
.ctrl-btn.next .svg-icon {
    width: 26px;
    height: 26px;
    color: #0d0d12;
}
.ctrl-btn.end .svg-icon {
    color: #fff;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.filter-chip .svg-icon {
    opacity: 0.9;
}
.filter-chip.active .svg-icon {
    opacity: 1;
}

.btn-start {
    gap: 10px;
}
.btn-start .svg-icon {
    width: 22px;
    height: 22px;
    color: #fff;
    stroke: #fff;
    flex-shrink: 0;
}

.nav-icon-wrap .svg-icon {
    width: 22px;
    height: 22px;
}
.nav-item.active .nav-icon-wrap .svg-icon {
    stroke-width: 2.25;
}

.stat-card .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}
.stat-card .icon .svg-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-pink);
}

.icon-box .svg-icon {
    width: 18px;
    height: 18px;
}
.icon-box.rules {
    background: rgba(74,222,128,0.15);
    color: var(--success);
}

.send-btn .svg-icon,
.modal-input button .svg-icon {
    width: 18px;
    height: 18px;
}
.modal-input button .svg-icon {
    color: #0d0d12;
}

.call-input-bar .send-btn .svg-icon {
    color: var(--text);
}

.empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.placeholder-avatar {
    font-size: 0; /* hide text letter when SVG present; JS may set letter */
    color: #3a3a4a;
}
.placeholder-avatar .svg-icon.xl {
    color: #3a3a4a;
}
/* When JS sets a letter, show it */
.placeholder-avatar:not(:has(svg)) {
    font-size: clamp(80px, 25vw, 120px);
}

.friend-row .row-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    color: var(--text-muted);
}
.friend-row .row-icon .svg-icon {
    width: 16px;
    height: 16px;
}

/* UI polish */
.discover-content {
    padding-bottom: max(16px, var(--safe-bottom));
}

.filter-chip:active {
    transform: scale(0.96);
}

.btn-start {
    letter-spacing: 0.01em;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn-start:hover {
    box-shadow: 0 6px 28px rgba(255,107,74,0.45);
}

.ctrl-btn {
    transition: transform 0.12s, background 0.15s;
}
.ctrl-btn:hover {
    background: rgba(70,70,80,0.95);
}

.nav-item {
    transition: color 0.15s;
}
.nav-item .nav-icon-wrap {
    transition: background 0.15s;
}

.chat-item {
    transition: background 0.12s;
}
.chat-item:hover {
    background: var(--bg-elevated);
}

.interest-tag {
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.interest-tag:hover {
    border-color: var(--accent-pink);
}

.age-sep {
    color: var(--text-muted);
    font-weight: 500;
}

/* Soft glass on header buttons */
.discover-header button,
.header-right button {
    transition: background 0.15s, transform 0.12s;
}
.discover-header button:active,
.header-right button:active {
    transform: scale(0.92);
}

/* Call screen send button */
.call-input-bar .send-btn {
    background: rgba(50,50,60,0.95);
    transition: background 0.15s, transform 0.12s;
}
.call-input-bar .send-btn:active {
    transform: scale(0.92);
}

/* Better focus rings for a11y */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-pink);
    outline-offset: 2px;
}

/* Light theme SVG adjustments */
[data-theme="light"] .placeholder-avatar .svg-icon.xl {
    color: #a0a0b0;
}
[data-theme="light"] .discover-header button .svg-icon,
[data-theme="light"] .header-right button .svg-icon {
    color: #1a1a22;
}
[data-theme="light"] .ctrl-btn.next .svg-icon {
    color: #0d0d12;
}
[data-theme="light"] .call-input-bar .send-btn {
    background: rgba(255,255,255,0.9);
}
[data-theme="light"] .call-input-bar .send-btn .svg-icon {
    color: #1a1a22;
}

/* ===== PREVIEW VIDEO ===== */
.preview-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}
.preview-video.hidden { display: none; }
.placeholder-avatar.hidden { display: none; }

.preview-cam-btn {
    position: absolute;
    bottom: 200px;
    right: 16px;
    z-index: 12;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255,255,255,0.2);
}
.preview-cam-btn:active { transform: scale(0.92); }

/* ===== CALL TIMER & QUALITY ===== */
.call-timer {
    position: static;
    top: auto; left: auto; transform: none;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    opacity: 0;
    color: #fff;
    letter-spacing: 0.5px;
}
.call-timer.visible { opacity: 1; }

.conn-quality {
    position: static;
    top: auto; right: auto;
    display: none;
    gap: 3px;
    align-items: flex-end;
    height: 14px;
    padding: 0;
    background: transparent;
}
.conn-quality.visible { display: flex; }
.cq-bar {
    width: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.25);
    transition: background 0.2s, height 0.2s;
}
.cq-bar:nth-child(1) { height: 4px; }
.cq-bar:nth-child(2) { height: 7px; }
.cq-bar:nth-child(3) { height: 11px; }
.cq-bar:nth-child(4) { height: 15px; }
.cq-bar.on { background: var(--success); }
.cq-bar.on.weak { background: #fbbf24; }

.pip-hint {
    position: absolute;
    bottom: 4px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9px;
    color: rgba(255,255,255,0.7);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.call-local:active .pip-hint,
.call-local.show-hint .pip-hint { opacity: 1; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(88px + var(--safe-bottom));
    transform: translateX(-50%) translateY(12px);
    z-index: 300;
    max-width: min(90vw, 360px);
    padding: 12px 18px;
    border-radius: 14px;
    background: rgba(30,30,40,0.95);
    backdrop-filter: blur(12px);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.out {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
}
.toast.hidden { display: none; }
#call-screen.active ~ .toast,
body.in-call .toast {
    bottom: calc(100px + var(--safe-bottom));
}
[data-theme="light"] .toast {
    background: rgba(255,255,255,0.96);
    color: #1a1a22;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

/* ===== BOTTOM SHEETS ===== */
.sheet-modal {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.sheet-modal.hidden { display: none; }
.sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
}
.sheet-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 12px 20px calc(20px + var(--safe-bottom));
    animation: sheetUp 0.28s ease-out;
}
@keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 0 auto 16px;
}
.sheet-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
}
.sheet-content > .muted {
    text-align: center;
    margin-bottom: 16px;
}
.reason-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.reason-chip {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--bg-elevated);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    min-height: 48px;
    transition: background 0.15s;
}
.reason-chip:active {
    background: rgba(244,114,182,0.2);
    color: var(--accent-pink);
}
.btn-sheet-cancel {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    min-height: 48px;
}
.sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.sheet-actions .btn-sheet-cancel,
.sheet-actions .btn-sheet-danger {
    flex: 1;
}
.btn-sheet-danger {
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    background: var(--danger);
    color: #fff;
    min-height: 48px;
}

/* ===== SETTINGS TOGGLES ===== */
.settings-block { text-align: left; }
.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
}
.toggle-row input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-ui {
    margin-left: auto;
    width: 48px;
    height: 28px;
    border-radius: 14px;
    background: var(--bg-elevated);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-ui::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    transition: transform 0.2s;
}
.toggle-row input:checked + .toggle-ui {
    background: var(--accent);
}
.toggle-row input:checked + .toggle-ui::after {
    transform: translateX(20px);
}
.toggle-row input:checked + .toggle-ui::after {
    background: #fff;
}

/* ===== SCREEN TRANSITIONS ===== */
.screen-enter {
    animation: fadeSlide 0.28s ease-out;
}
@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Searching pulse on call status */
.call-status .spinner {
    box-shadow: 0 0 0 0 rgba(255,107,74,0.4);
    animation: spin 0.8s linear infinite, pulseRing 1.6s ease-out infinite;
}
@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(255,107,74,0.35); }
    70% { box-shadow: 0 0 0 14px rgba(255,107,74,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,107,74,0); }
}

/* Partner info polish */
.partner-info:empty { display: none; }

/* Landscape adjustments for new elements */
@media (max-height: 500px) and (orientation: landscape) {
    .preview-cam-btn { bottom: 120px; width: 40px; height: 40px; }
    .call-timer { font-size: 12px; }
    .conn-quality { }
    .toast { bottom: 72px; }
}

[data-theme="light"] .preview-cam-btn {
    background: rgba(255,255,255,0.75);
    color: #1a1a22;
}
[data-theme="light"] .sheet-content {
    background: var(--bg-card);
}
[data-theme="light"] .call-timer,
[data-theme="light"] .conn-quality {
    background: rgba(0,0,0,0.55);
    color: #fff;
}

/* ===== COUNTRY FILTER ===== */
.country-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.country-select {
    flex: 1;
    max-width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    min-height: 40px;
}
.profile-meta .country-select {
    max-width: 140px;
}

/* Friend call UI */
.online-pill {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--success);
    background: rgba(74,222,128,0.15);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
}
.btn-call-friend {
    margin-left: auto !important;
    padding: 6px 14px !important;
    border-radius: 999px !important;
    background: var(--accent) !important;
    color: #0d0d12 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
}
.friend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.btn-sheet-accept {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    background: var(--accent);
    color: #0d0d12;
    min-height: 48px;
}

/* Chat list call-from-history hint */
.chat-item .preview { max-width: 100%; }

/* ===== SETTINGS TOGGLE ROWS (improved) ===== */
.toggle-row {
    align-items: flex-start;
}
.toggle-row > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}
.toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.toggle-desc {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.35;
}
.toggle-row .toggle-ui {
    margin-top: 2px;
}

/* Preview video soft vignette when active */
.preview-video:not(.hidden) ~ .placeholder-avatar {
    display: none;
}
.discover-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to top, rgba(13,13,18,0.75) 0%, transparent 42%);
}

/* Country select polish */
.country-filter-row .country-select,
.profile-meta .country-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* Hide legacy floating preview btn if present */
.preview-cam-btn { display: none !important; }

/* Stronger start button when preview is live */
.discover-content {
    z-index: 5;
}

/* Profile avatar online glow */
.online-indicator {
    box-shadow: 0 0 0 0 rgba(74,222,128,0.5);
    animation: onlinePulse 2s ease-out infinite;
}
@keyframes onlinePulse {
    0% { box-shadow: 0 0 0 0 rgba(74,222,128,0.45); }
    70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
    100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

/* Smoother modal sheet */
.sheet-content {
    box-shadow: 0 -8px 40px rgba(0,0,0,0.35);
}

/* Filter chips slightly tighter on small screens */
@media (max-width: 380px) {
    .filter-chip { padding: 8px 12px; font-size: 12px; gap: 4px; }
    .country-filter-row { flex-wrap: wrap; }
    .country-filter-row .country-select { max-width: 100%; width: 100%; }
}

/* ===== TOKKS Brand ===== */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    user-select: none;
}
.brand-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 2px 14px rgba(59, 91, 255, 0.4);
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
}
.brand-name {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 1.5px;
    background: var(--gradient-outline);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
[data-theme="light"] .brand-name {
    background: var(--gradient-outline);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
[data-theme="light"] .brand-img {
    box-shadow: 0 2px 14px rgba(59, 91, 219, 0.35);
}

/* Discover header layout without theme button */
.discover-header {
    justify-content: space-between;
}

/* Smoother start button hover */
.btn-start {
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s;
}
.btn-start:hover {
    box-shadow: 0 6px 28px rgba(255, 107, 74, 0.55);
}

/* Better online pulse */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.25); }
}
.online-count .dot {
    animation: pulse-dot 1.8s ease-in-out infinite;
}

/* Subtle screen transitions */
.screen {
    animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* ===== Static pages (About, Privacy, Terms, Rules) ===== */
.page {
    max-width: 640px;
    margin: 0 auto;
    padding: calc(24px + var(--safe-top)) 20px calc(40px + var(--safe-bottom));
    overflow-y: auto;
    height: 100%;
    height: 100dvh;
    line-height: 1.6;
}
.page .back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--accent-pink);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.page .back-link:hover { text-decoration: underline; }
.page h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}
.page h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 28px 0 10px;
    color: var(--accent);
}
.page p, .page li {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 10px;
}
.page ul {
    padding-left: 20px;
    margin-bottom: 16px;
}
.page strong { color: var(--text); }
.page em { color: var(--text-muted); }
.page .btn, .page .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 999px;
    background: var(--accent);
    color: #0d0d12;
    font-weight: 700;
    text-decoration: none;
    font-size: 15px;
    min-height: 44px;
}
.page .btn:hover, .page .btn-primary:hover {
    box-shadow: 0 4px 20px rgba(255, 107, 74, 0.4);
}


/* ===== SHOUT MODALS (attention-grabbing) ===== */
.shout-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    padding-bottom: calc(24px + var(--safe-bottom));
}
.shout-modal.hidden { display: none; }
.shout-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 12, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: shoutFade 0.2s ease;
}
.shout-card {
    position: relative;
    width: 100%;
    max-width: 340px;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 28px 22px 22px;
    box-shadow: var(--shout-shadow);
    border: 1px solid rgba(255, 107, 74, 0.28);
    text-align: center;
    animation: shoutPop 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.shout-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
}
.shout-icon.warn {
    background: var(--gradient-outline);
}
.shout-icon.report {
    background: linear-gradient(135deg, #ef4444, #f97316);
}
.shout-icon.match {
    background: var(--gradient-brand);
}
.shout-icon.call {
    background: var(--gradient-outline);
}
.shout-card h3 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}
.shout-card > .muted {
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.45;
}
.shout-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.btn-shout-primary,
.btn-shout-danger,
.btn-shout-secondary {
    flex: 1;
    padding: 14px 12px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    min-height: 50px;
    transition: transform 0.12s ease, opacity 0.12s;
}
.btn-shout-primary:active,
.btn-shout-danger:active,
.btn-shout-secondary:active {
    transform: scale(0.97);
}
.btn-shout-primary {
    background: var(--gradient-brand);
    color: #fff;
    box-shadow: 0 4px 16px rgba(255,107,74,0.35);
}
.btn-shout-danger {
    background: var(--danger);
    color: #fff;
}
.btn-shout-secondary {
    background: var(--bg-elevated);
    color: var(--text-muted);
    width: 100%;
    margin-top: 8px;
}
.shout-actions .btn-shout-secondary {
    margin-top: 0;
    width: auto;
}
.reason-chip:active {
    background: rgba(91, 76, 219, 0.22) !important;
    color: var(--accent) !important;
}
@keyframes shoutPop {
    from { opacity: 0; transform: scale(0.82) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes shoutFade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.pulse-ring {
    animation: pulseRing 1.4s ease-out infinite;
}
@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(91, 76, 219, 0.55); }
    70% { box-shadow: 0 0 0 16px rgba(91, 76, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(91, 76, 219, 0); }
}
.match-card .shout-icon.match {
    animation: shoutPop 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Keep legacy sheet classes as aliases so older JS/HTML still works */
.sheet-modal { /* legacy */ }
.sheet-content { /* legacy */ }

[data-theme="light"] .shout-card {
    background: #fff;
    border-color: rgba(91, 76, 219, 0.18);
    box-shadow: 0 24px 64px rgba(59, 91, 219, 0.18);
}
[data-theme="light"] .shout-backdrop {
    background: rgba(15, 15, 30, 0.55);
}
[data-theme="light"] .btn-shout-secondary {
    background: #f1f5f9;
}

/* Nav active tint */
.nav-item.active .nav-icon-wrap {
    background: rgba(255, 107, 74, 0.18);
}
.nav-item.active {
    color: var(--accent);
}

/* Online dot uses success but brand tint */
.online-count .dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Interest selected */
.interest-tag.selected {
    background: rgba(255, 107, 74, 0.18);
    border-color: var(--accent);
    color: var(--accent);
}

/* Page primary buttons */
.page .btn, .page .btn-primary {
    background: var(--gradient-brand) !important;
    color: #fff !important;
}

body.modal-open {
    overflow: hidden;
}
/* Ensure shout sits above call screen */
#call-screen.active ~ .shout-modal,
body.in-call .shout-modal {
    z-index: 400;
}


/* ===== Discover filters button + summary ===== */
.btn-filters {
    width: 100%;
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    transition: border-color 0.15s, background 0.15s;
}
.btn-filters:active {
    transform: scale(0.98);
}
.btn-filters .svg-icon {
    width: 18px;
    height: 18px;
    opacity: 0.9;
}
.btn-filters.has-filters {
    border-color: rgba(255,107,74,0.55);
    background: rgba(255,107,74,0.12);
    color: var(--accent);
}
.filter-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--gradient-brand);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.filter-badge.hidden { display: none; }
.filter-summary {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.35;
    padding: 0 8px;
}

/* Filters modal card */
.filters-card {
    max-width: 380px;
    max-height: min(88dvh, 640px);
    padding: 0 !important;
    text-align: left !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.filters-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}
.filters-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
}
.filters-body {
    padding: 14px 18px 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}
.filter-section {
    margin-bottom: 18px;
}
.filter-section-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.filter-row.wrap,
.interest-filters.wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
}
.filters-card .filter-chip {
    flex-shrink: 0;
}
.modal-age {
    margin: 0;
}
.modal-age input {
    flex: 1;
    max-width: 100px;
}
.country-select.full {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    min-height: 48px;
    color: var(--text);
}
.filters-footer {
    display: flex;
    gap: 10px;
    padding: 14px 18px calc(14px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.filters-footer .btn-shout-secondary,
.filters-footer .btn-shout-primary {
    flex: 1;
    margin: 0;
}
.filters-footer .btn-shout-secondary {
    width: auto;
}

/* Compact discover content now that filters moved out */
.discover-content {
    padding-top: 24px;
}

[data-theme="light"] .btn-filters {
    background: #fff;
}
[data-theme="light"] .btn-filters.has-filters {
    background: rgba(255,107,74,0.1);
}

/* ===== Profile setup modal ===== */
.setup-card {
    text-align: left !important;
    max-width: 360px;
}
.setup-card .shout-icon {
    margin-left: auto;
    margin-right: auto;
}
.setup-card h3,
.setup-card > .muted {
    text-align: center;
}
.setup-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.setup-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 8px;
}
.setup-input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    color: var(--text);
    min-height: 48px;
    outline: none;
}
.setup-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,107,74,0.2);
}
.setup-hint {
    font-size: 12px;
    margin: 2px 0 0;
}
.setup-actions {
    margin-top: 16px;
}
.setup-input.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}
[data-theme="light"] .setup-input {
    background: #f8fafc;
}


/* ===== Call bottom stack (chat + input + controls) ===== */
.call-bottom-ui .call-chat-overlay .msg {
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.call-bottom-ui .call-input-bar input {
    flex: 1;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 22px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    min-height: 44px;
    outline: none;
}
.call-bottom-ui .call-input-bar input::placeholder { color: rgba(255,255,255,0.55); }

/* ===== Chats tabs ===== */
.chats-tabs {
    display: flex;
    gap: 6px;
    padding: 0 16px 12px;
    flex-shrink: 0;
}
.chats-tab {
    flex: 1;
    padding: 10px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-elevated);
    min-height: 40px;
}
.chats-tab.active {
    background: var(--gradient-brand);
    color: #fff;
    box-shadow: 0 2px 12px rgba(255,107,74,0.35);
}
.chats-tab-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
}
.chats-tab-panel.active { display: block; }
.social-list { padding-bottom: 8px; }
#screen-chats {
    display: none;
    flex-direction: column;
}
#screen-chats.active { display: flex; }

/* ===== Profile avatar photo ===== */
.profile-avatar-wrap {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 12px;
}
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
}
.profile-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
}
.profile-avatar-img.hidden { display: none; }
.avatar-edit-btn {
    position: absolute;
    right: -2px;
    bottom: -2px;
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(255,107,74,0.45);
    border: 2px solid var(--bg);
}
.profile-meta-line {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    min-height: 18px;
}
.btn-edit-profile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 20px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    min-height: 42px;
}
.btn-edit-profile:active { transform: scale(0.98); }
.profile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(16px + var(--safe-top)) 16px 8px;
}
.profile-header h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

/* Discover avatar photo preview */
#discoverAvatar.has-photo {
    background-size: cover !important;
    background-position: center !important;
    color: transparent !important;
}
#discoverAvatar.has-photo .svg-icon { display: none; }

/* ===== Legal / static pages extras ===== */
.legal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
}
.legal-nav a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.legal-nav a:hover { text-decoration: underline; }
.page-fineprint {
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
}
.page a:not(.back-link):not(.btn) {
    color: var(--accent);
}
.support-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    line-height: 1.6;
}
.discover-legal {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    opacity: 0.9;
}
.discover-legal a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.profile-legal-note {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin: 16px 8px 8px;
    line-height: 1.45;
}
a.menu-item {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}
.setup-agree {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 12px;
    cursor: pointer;
}
.setup-agree input {
    margin-top: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}
.setup-agree a {
    color: var(--accent);
    font-weight: 600;
}
.page ol {
    padding-left: 20px;
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 15px;
}
.page ol li { margin-bottom: 8px; }
.page code {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 13px;
}

/* Auth tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    margin: 0 16px;
    border-bottom: 1px solid var(--border);
}
.auth-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.auth-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.auth-body .field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 10px 0 4px;
}
.auth-body input, .auth-body select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 15px;
    margin-bottom: 4px;
}
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.auth-agree { margin: 12px 0; }
.auth-guest-note { text-align: center; margin-top: 14px; }
.btn-auth {
    width: 100%;
    margin-top: 14px;
    padding: 14px;
    border: 0;
    border-radius: 14px;
    font-weight: 800;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(135deg, #FF6B4A, #FF8C42, #FF5E8A);
    cursor: pointer;
}

/* Danger zone / delete account */
.danger-zone {
    margin: 24px 12px 8px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
    text-align: center;
}
.section-title.danger { color: #f87171; font-size: 14px; margin: 0 0 10px; }
.btn-danger-outline {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #ef4444;
    background: transparent;
    color: #f87171;
    font-weight: 700;
    cursor: pointer;
}
.btn-danger-outline:hover { background: rgba(239,68,68,0.12); }

/* Coach */
.coach-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.72);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 24px;
}
.coach-overlay.hidden { display: none; }
.coach-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    border: 1px solid var(--border);
    margin-bottom: 40px;
}
.coach-card h3 { margin: 0 0 8px; }
.coach-card .btn-shout-primary { width: 100%; margin-top: 16px; }

/* Reconnect */
.reconnect-banner {
    position: fixed;
    top: calc(12px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    background: rgba(20,20,30,0.92);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 10px 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.reconnect-banner.hidden { display: none; }
.reconnect-banner button {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #FF6B4A, #FF5E8A);
    color: #fff;
    cursor: pointer;
}

/* Remote media flags */
.remote-media-flags {
    position: absolute;
    left: 12px;
    bottom: 120px;
    z-index: 18;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.media-flag {
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}
.media-flag.hidden { display: none; }

/* Empty states */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--text);
}
.empty-state .muted { margin-top: 6px; }
.empty-cta { margin-top: 16px; }

/* ===== Auth modal – fixed layout ===== */
#authModal.modal {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0,0,0,0.65);
    z-index: 100;
    padding: 0;
}
#authModal.modal.hidden { display: none; }
#authModal .auth-content {
    max-width: 440px;
    width: 100%;
    max-height: min(92dvh, 720px);
    height: auto;
    margin: 0 auto;
    border-radius: 20px 20px 0 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#authModal .modal-header {
    flex-shrink: 0;
}
#authModal .auth-tabs { flex-shrink: 0; }
#authModal .auth-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 18px 28px;
    flex: 1;
    max-height: none;
}
body.modal-open { overflow: hidden; }

/* ===== Fully responsive layout ===== */
html, body {
    width: 100%;
    overscroll-behavior: none;
}

#app {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100%;
    min-height: 100dvh;
}

.screen {
    width: 100%;
    min-height: 0;
}

.profile-body, .chats-body, .discover-actions {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Safe areas on notches */
.discover-header,
.profile-header,
.chats-header {
    padding-left: max(12px, var(--safe-left));
    padding-right: max(12px, var(--safe-right));
}

.bottom-nav {
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

#call-screen {
    width: 100%;
    height: 100%;
    height: 100dvh;
}

.call-local {
    width: clamp(72px, 24vw, 110px);
    height: clamp(102px, 34vw, 156px);
}

.call-bottom-ui {
    padding-bottom: max(8px, var(--safe-bottom));
}

.call-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 8px 10px max(12px, var(--safe-bottom));
}

.shout-card, .coach-card {
    width: min(100%, 400px);
    max-height: 90dvh;
    overflow-y: auto;
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    padding-left: max(16px, var(--safe-left));
    padding-right: max(16px, var(--safe-right));
    overflow-y: auto;
    min-height: 100dvh;
}

/* Small phones */
@media (max-width: 360px) {
    .brand-name { font-size: 16px; }
    .start-btn { font-size: 16px; padding: 14px 20px; }
    .call-top-actions button { width: 38px; height: 38px; }
    .call-brand-name { display: none; }
    .nav-item { min-width: 56px; font-size: 10px; }
    .auth-row { grid-template-columns: 1fr; }
}

/* Landscape phones */
@media (max-height: 480px) and (orientation: landscape) {
    .discover-header { padding-top: 6px; }
    .online-count { display: none; }
    .call-local {
        width: 70px;
        height: 96px;
        top: calc(48px + var(--safe-top));
    }
    .call-bottom-ui { padding-top: 8px; }
    .call-chat-overlay { max-height: 18vh; }
    #authModal .auth-content {
        border-radius: 16px;
        max-height: 96dvh;
        margin: 8px;
    }
}

/* Tablets / desktop */
@media (min-width: 481px) {
    #app {
        max-width: 480px;
        box-shadow: 0 0 0 1px var(--border), 0 24px 80px rgba(0,0,0,0.45);
        border-radius: 0;
    }
    body {
        background: #050508;
    }
    #authModal.modal {
        align-items: center;
        padding: 16px;
    }
    #authModal .auth-content {
        border-radius: 20px;
        border-bottom: 1px solid var(--border);
        max-height: min(90dvh, 680px);
    }
}

@media (min-width: 768px) {
    #app {
        max-width: 430px;
        min-height: min(900px, 100dvh);
        margin-top: 0;
    }
    #call-screen {
        max-width: 430px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Large desktop – centered phone frame */
@media (min-width: 1024px) {
    body {
        display: flex;
        justify-content: center;
        align-items: stretch;
        background:
            radial-gradient(ellipse at 20% 20%, rgba(255,107,74,0.08), transparent 50%),
            radial-gradient(ellipse at 80% 80%, rgba(59,91,255,0.08), transparent 50%),
            #050508;
    }
    #app {
        max-width: 420px;
        border-radius: 24px;
        margin: 16px 0;
        min-height: calc(100dvh - 32px);
        overflow: hidden;
    }
    #call-screen {
        max-width: 420px;
        border-radius: 24px;
        overflow: hidden;
    }
}

/* Prevent iOS zoom on inputs */
@media (max-width: 480px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Toast safe */
.toast-container, #toast {
    bottom: calc(80px + var(--safe-bottom)) !important;
    left: 50%;
    transform: translateX(-50%);
    max-width: min(92vw, 400px);
}

/* Profile scroll */
#screen-profile .profile-body {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 24px;
}
#screen-chats {
    overflow: hidden;
}
#screen-chats .chats-body,
#messagesList, #friendsList, #blocksList {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Force auth modal overlay (beats generic .modal) */
#authModal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 300 !important;
    max-width: none !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    background: rgba(0,0,0,0.72) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end;
    justify-content: center;
}
#authModal.hidden { display: none !important; }
#authModal .modal-content.auth-content {
    height: auto !important;
    max-height: min(92dvh, 720px) !important;
}
@media (min-width: 481px) {
    #authModal { align-items: center; }
}


/* ========== AUTH MODAL v2 (production) ========== */
.auth-modal#authModal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 300 !important;
    max-width: none !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    background: rgba(0,0,0,0.72) !important;
    display: flex !important;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    border: 0;
}
.auth-modal#authModal.hidden { display: none !important; }

.auth-sheet {
    width: 100%;
    max-width: 440px;
    max-height: min(92dvh, 720px);
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.4);
}

.auth-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px 8px;
    flex-shrink: 0;
}
.auth-sheet-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    text-align: center;
}
.auth-close, .auth-close-spacer {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text);
}
.auth-close:hover { background: var(--bg-elevated); }

.auth-tabs {
    display: flex;
    margin: 0 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.auth-tab {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: -1px;
}
.auth-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.auth-body {
    padding: 12px 18px calc(20px + var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.auth-pane { display: block; }
.auth-pane.hidden { display: none !important; }

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 12px 0 6px;
    line-height: 1.3;
}
.field-label .optional {
    font-weight: 500;
    opacity: 0.7;
    font-size: 11px;
}

.auth-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 16px;
    line-height: 1.3;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
}
.auth-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: transparent;
}
select.auth-input {
    cursor: pointer;
}

.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.auth-field { min-width: 0; }

/* Agree checkbox – fixed size, never full-width */
.agree-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 14px 0 4px;
    cursor: pointer;
    text-align: left;
}
.agree-check {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    max-width: 18px;
    margin: 2px 0 0 !important;
    padding: 0 !important;
    flex-shrink: 0;
    accent-color: var(--accent);
    border-radius: 4px;
    cursor: pointer;
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
}
.agree-text {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    flex: 1;
}
.agree-text a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.agree-text a:hover { text-decoration: underline; }

.btn-auth {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    border: 0;
    border-radius: 14px;
    font-weight: 800;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(135deg, #FF6B4A, #FF8C42, #FF5E8A);
    cursor: pointer;
    min-height: 48px;
}
.btn-auth:disabled { opacity: 0.6; cursor: wait; }
.btn-auth:hover { filter: brightness(1.05); }

.auth-guest-note {
    text-align: center;
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-muted);
}

@media (min-width: 481px) {
    .auth-modal#authModal {
        align-items: center;
        padding: 16px;
    }
    .auth-sheet {
        border-radius: 20px;
        border-bottom: 1px solid var(--border);
        max-height: min(90dvh, 680px);
    }
}

@media (max-width: 360px) {
    .auth-row { grid-template-columns: 1fr; }
}

/* Start button polish */
.btn-start {
    color: #fff !important;
}
.btn-start .svg-icon,
.btn-start svg {
    color: #fff !important;
    stroke: currentColor !important;
}

/* UI polish pass */
.discover-actions {
    padding-bottom: max(12px, var(--safe-bottom));
}
.filter-summary {
    font-size: 12px;
    opacity: 0.85;
}
.online-count {
    font-size: 13px;
}
.brand-name {
    letter-spacing: 1.5px;
}

/* Prevent checkbox/radio getting text-input styles */
.auth-body input[type="checkbox"],
.auth-body input[type="radio"],
.setup-agree input[type="checkbox"],
input.agree-check {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}
