/* Main containers, lobby, filters, and stats */

/* ==========================================================================
   Main Containers — no border-radius
   ========================================================================== */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 28px 20px;
    background: var(--surface);
    border: none;
    border-radius: 0;
    box-shadow: none;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.container::-webkit-scrollbar {
    display: none;
}

#start-screen {
    position: relative;
}

#top-left-controls {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    display: flex;
    gap: 8px;
    align-items: center;
}

#notifications-container {
    position: relative;
}

#theme-toggle-container {
    display: none; /* toggle removed from UI — dark-only mode */
}

.brand-block {
    position: relative;
    margin-top: 10px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

#main-logo, .main-logo-img {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    object-fit: contain;
    margin-bottom: -45px;
}

.brand-title {
    text-align: center;
    margin: 0;
    color: var(--accent-color);
    font-size: 60px;
    letter-spacing: 1px;
}

.brand-telegram-btn {
    position: absolute;
    top: 60px;
    right: 15px;
    z-index: 10;
    text-decoration: none;
    /* Plain icon only — override .top-icon-btn's shared badge chrome */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    color: var(--text-2) !important;
    opacity: 0.65;
    transition: opacity 0.2s ease, color 0.2s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.brand-telegram-btn:hover {
    background: transparent !important;
    border: none !important;
    opacity: 1;
    color: #229ED9 !important;
}


/* ==========================================================================
   Phase 2 — Lobby Components
   ========================================================================== */

/* --- 2.1 Tabs Header --- */

.tab-content {
    display: none;
    animation: fadeIn 0.25s ease-out forwards;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.user-rep-display {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

body.light .user-rep-display {
    background: transparent;
    box-shadow: none;
}

/* Premium Header Badges */
.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 6px 12px;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    border: 1px solid var(--border-2);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
    cursor: default;
    appearance: none;
}

body.light .header-badge {
    background: rgba(0, 0, 0, 0.035);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.header-badge--rep {
    border-color: color-mix(in srgb, var(--accent-color) 35%, transparent);
    background: color-mix(in srgb, var(--accent-color) 8%, transparent);
    color: var(--accent-color);
}

.header-badge--rep:hover {
    background: color-mix(in srgb, var(--accent-color) 14%, transparent);
}

.header-badge--mastery {
    border-color: rgba(167, 139, 250, 0.35);
    background: rgba(167, 139, 250, 0.08);
    color: #c084fc;
}

.header-badge--mastery:hover {
    background: rgba(167, 139, 250, 0.14);
}

.header-badge--katy {
    border-color: rgba(234, 179, 8, 0.35);
    background: rgba(234, 179, 8, 0.08);
    color: #facc15;
    cursor: pointer;
}

.header-badge--katy:hover,
.header-badge--katy:focus-visible {
    background: rgba(234, 179, 8, 0.15);
    outline: none;
}

body.light .header-badge--mastery {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.06);
    border-color: rgba(124, 58, 237, 0.25);
}

body.light .header-badge--katy {
    color: #a16207;
    background: rgba(234, 179, 8, 0.09);
    border-color: rgba(161, 98, 7, 0.24);
}

.header-badge-icon {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-badge-value {
    font-weight: 900;
    font-size: 14px;
}

.header-badge-label {
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    opacity: 0.86;
}

/* Screen reader utility for accessibility and smoke tests */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.user-rep-display .rank-badge {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 18px;
    padding: 1px 6px;
    font-size: 10px;
}

.form-row {
    margin-bottom: 16px;
}

.filter-group {
    margin-bottom: 16px;
}

/* --- 2.3 Filter Titles --- */
.filter-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-2);
    font-size: var(--fs-sm);
    letter-spacing: 0.01em;
}

.filter-title-compact {
    margin-bottom: 6px;
}

.label-required {
    color: #ef4444;
    font-size: 12px;
    font-weight: 400;
}

.label-muted {
    color: #888;
    font-size: 12px;
    font-weight: 400;
}

.age-error-msg {
    color: #ef4444;
    font-weight: bold;
    text-align: center;
    margin-top: 16px;
    margin-bottom: 16px;
}

.adult-warning {
    background: linear-gradient(135deg, #4c0519, #881337);
    border: 1px solid #e11d48;
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 16px;
    text-align: center;
}

.adult-warning-icon-wrap {
    margin-bottom: 8px;
}

.adult-warning-icon {
    width: 36px;
    height: 36px;
    vertical-align: middle;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.adult-warning-title {
    font-weight: bold;
    color: #fda4af;
    font-size: var(--fs-base);
    margin-bottom: 6px;
}

.adult-warning-copy {
    font-size: 12px;
    color: #fda4af;
    opacity: 0.85;
}

/* Light theme overrides for adult warning banner */
body.light .adult-warning {
    background: linear-gradient(135deg, #fff1f2, #ffe4e6);
    border: 1px solid #fda4af;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.05);
}

body.light .adult-warning-title {
    color: #9f1239;
}

body.light .adult-warning-copy {
    color: #be123c;
    opacity: 0.9;
}

body.light .adult-warning-icon {
    color: #e11d48 !important;
    filter: drop-shadow(0 1px 2px rgba(225, 29, 72, 0.12));
}

/* --- 2.6 Online Stats --- */
.online-stats-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding: 16px 0;
}

.online-stat-main {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--text);
}

.online-stat-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-badge {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
}

.stat-badge.purple {
    color: #a78bfa;
}

.stat-badge.gray {
    color: var(--text-3);
}

.stat-badge.blue {
    color: #60a5fa;
}

.stat-badge.green {
    color: #34d399;
}

.stat-badge.red {
    color: #fb7185;
}

/* ── 8: Stats Tab ──────── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

.stat-header {
    font-size: var(--fs-lg);
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-2);
}

.stat-bar-container {
    height: 6px;
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.5s var(--ease);
}

.stat-val-count {
    font-size: var(--fs-xs);
    color: var(--text-3);
    text-align: right;
}

/* Specific colors */
.stat-card-blue .stat-bar-fill {
    background: #3b82f6;
}

.stat-card-blue .stat-header {
    color: #3b82f6;
}

.stat-card-violet .stat-bar-fill {
    background: var(--c-rp);
}

.stat-card-violet .stat-header {
    color: var(--c-rp);
}

.stat-card-red .stat-bar-fill {
    background: var(--c-flirt);
}

.stat-card-red .stat-header {
    color: var(--c-flirt);
}

.stats-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 24px;
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--text-2);
}

/* ==============================================================
   MOBILE OVERRIDES
   ============================================================== */
@media (max-width: 768px) {
    .container {
        padding: 4px 15px max(15px, env(safe-area-inset-bottom));
        width: 100%;
        height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
        max-width: none;
        margin: 0;
    }

    #top-left-controls,
    #theme-toggle-container {
        top: 6px;
    }

    .brand-block {
        margin-top: 4px;
        margin-bottom: 12px;
    }

    .brand-telegram-btn {
        top: 45px;
    }

    body.light .container {
        border-radius: 0;
    }

    .toggle-row.two-col {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .toggle-row {
        gap: 8px;
    }

    .toggle-label {
        min-width: 0;
        padding: 12px 8px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow-wrap: anywhere;
    }

    .tabs-header {
        width: 100%;
        overflow: hidden;
        white-space: normal;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 4px;
        padding: 5px;
        border-radius: 12px;
        margin-left: 0;
        margin-right: 0;
    }

    .tab-btn {
        flex: 1 1 calc(33.333% - 4px);
        padding: 8px 10px;
        font-size: 13px;
        margin: 0;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Icon-only tabs (stats, account) — fixed size so they don't
       stretch to fill an entire row when wrapping */
    .tab-btn[data-target="tab-stats"],
    .tab-btn[data-target="tab-account"] {
        flex: 0 0 auto;
        width: 44px;
        padding: 8px;
    }

    .flirt-badge {
        flex: 0 0 auto;
    }

    .start-chat-btn {
        width: 100%;
        max-width: none;
        margin: 20px 0 32px 0;
    }

    .online-stat-badges {
        gap: 4px;
        justify-content: center;
    }

    .stat-badge {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    button.action-btn {
        padding: 10px 11px;
        font-size: 13px;
        min-height: 44px;
    }

    .agreement-modal-actions {
        flex-direction: column;
    }

    #captcha-modal,
    #endorse-modal {
        width: calc(100% - 24px) !important;
        max-width: none !important;
        padding: 18px !important;
    }

    #report-modal.report-modal {
        width: calc(100% - 24px) !important;
        max-width: none !important;
        padding: 0 !important;
    }

    .modal-actions {
        flex-direction: column;
    }

    .stat-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .stat-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* ==============================================================
   Phase 4 — Modals & Overlays
   ============================================================== */

/* Hide bottom online stats block — moved to Статистика tab */
.online-stats-container {
    display: none;
}

/* Margin-bottom for the plot prologue block */
.plot-prologue-group {
    margin-bottom: 16px;
}

/* --- Start Screen Footer for SEO & UX --- */
.start-screen-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 36px;
    margin-bottom: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.footer-link {
    font-size: var(--fs-xs, 12px);
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}

.footer-link:hover {
    color: var(--accent-color);
    text-shadow: 0 0 4px color-mix(in srgb, var(--accent-color) 20%, transparent);
}

@media (max-width: 560px) {
    .user-rep-display {
        position: static;
        width: auto;
        display: none;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        margin: 0 auto 16px;
    }
}

/* ==============================================================
   Premium Brand Online Stats Widget
   ============================================================== */
.brand-online-title-mobile {
    display: none;
}

.brand-online-stats {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 5;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body.light .brand-online-stats {
    background: rgba(0, 0, 0, 0.025);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.brand-online-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
}

.brand-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px currentColor;
    animation: online-pulse 2.8s infinite ease-in-out;
}

.brand-online-dot--basic {
    background-color: #10b981;
    color: #10b981;
}

.brand-online-dot--rp {
    background-color: #7a5af8;
    color: #7a5af8;
}

.brand-online-dot--flirt {
    background-color: #e85d75;
    color: #e85d75;
}

.brand-online-label {
    font-weight: 600;
    color: var(--text-3);
}

.brand-online-val {
    font-family: monospace;
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    margin-left: auto;
}

@keyframes online-pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

@media (max-width: 768px) {
    .brand-online-title-mobile {
        display: block;
        width: 100%;
        text-align: center;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--text-2);
        opacity: 0.85;
        margin-top: 2px;
        margin-bottom: -6px;
    }

    .brand-online-stats {
        position: static;
        transform: none;
        flex-direction: row;
        justify-content: center;
        gap: 16px;
        padding: 6px 12px;
        margin-top: 0px;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        width: 100%;
    }
    
    .brand-online-label {
        display: none;
    }
    
    .brand-online-item {
        background: var(--surface-2);
        border: 1px solid var(--border);
        padding: 4px 10px;
        border-radius: var(--radius-sm);
    }
}

/* ==============================================================
   Hybrid Records & Leaderboard Stats Styling
   ============================================================== */
.stat-records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.record-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.record-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.record-icon {
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.record-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.record-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.gender-bar-wrapper {
    margin-bottom: 14px;
}

.gender-bar-wrapper:last-child {
    margin-bottom: 0;
}

.gender-bar-title {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 6px;
}

.gender-bar-track {
    height: 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    overflow: hidden;
    display: flex;
}

.gender-bar-fill {
    height: 100%;
    transition: width 0.5s var(--ease);
}

.gender-bar-fill--m {
    background: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.gender-bar-fill--f {
    background: #ec4899;
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
}

.stat-records-two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

.tag-cloud-item {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    cursor: default;
}

.tag-cloud-item:hover {
    background: var(--surface-4);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: scale(1.05);
}

.tag-cloud-item.empty-state {
    color: var(--text-3);
    font-style: italic;
    border: none;
    background: transparent;
    padding: 0;
}

.stat-card-gold .stat-header {
    color: #eab308;
}

.stat-card-gold {
    border-color: rgba(234, 179, 8, 0.25);
}

.stat-card-green .stat-header {
    color: #10b981;
}

.stat-card-green {
    border-color: rgba(16, 185, 129, 0.25);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.leaderboard-list::-webkit-scrollbar {
    display: none;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
}

.leaderboard-rank {
    width: 24px;
    font-weight: 800;
    color: #eab308;
}

.leaderboard-name {
    color: var(--text);
    margin-left: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-val {
    font-family: monospace;
    font-weight: 800;
    color: var(--accent-color);
    margin-left: auto;
}

/* Social Link Showcase (docs/planning/social_link_showcase_roadmap.md §9) */
.leaderboard-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    color: var(--text-secondary, var(--text));
    opacity: 0.75;
    flex-shrink: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.leaderboard-social-link:hover,
.leaderboard-social-link:focus-visible {
    opacity: 1;
    color: var(--accent-color);
}

.leaderboard-social-icon {
    display: block;
}

.leaderboard-empty {
    font-size: 13px;
    color: var(--text-3);
    font-style: italic;
    text-align: center;
    padding: 12px 0;
}

/* Stats Page - Weekly Theme Banner styling */
.stats-theme-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 5px solid var(--theme-color, var(--accent-color));
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    transition: background var(--duration) ease, border-color var(--duration) ease, box-shadow var(--duration) ease;
    text-align: left;
    box-sizing: border-box;
}

.stats-theme-banner.is-hidden {
    display: none !important;
}

.stats-theme-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
}

.stats-theme-badge {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    color: var(--theme-color, var(--accent-color));
    background: var(--theme-color-op, rgba(58, 174, 122, 0.1));
    border: 1px solid var(--theme-color-op-strong, rgba(58, 174, 122, 0.25));
}

.stats-theme-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--theme-color, var(--accent-color));
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-theme-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.stats-theme-body {
    font-size: 14px;
    color: var(--text-2);
    margin: 0;
    line-height: 1.6;
    font-weight: 500;
}
