/* ============================================
   SOOMATHON (숨통) — WIA SOOM Community Platform
   Discord-like layout + WIA SOOM branding
   ============================================ */

/* Google Fonts loaded via <link> in index.html for faster rendering */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* WIA SOOM brand */
    --soom-green: #00c853;
    --soom-green-dim: rgba(0, 200, 83, 0.15);
    --soom-green-glow: rgba(0, 200, 83, 0.4);
    --soom-purple: #9c27b0;
    --soom-purple-dim: rgba(156, 39, 176, 0.15);
    --soom-blue: #667eea;

    /* Dark backgrounds */
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-sidebar: rgba(10, 10, 18, 0.95);
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-input: rgba(255, 255, 255, 0.06);
    --bg-hover: rgba(255, 255, 255, 0.08);
    --bg-message-hover: rgba(255, 255, 255, 0.03);

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Status */
    --success: #00c853;
    --warning: #ffc107;
    --error: #ff5252;
    --info: #667eea;

    /* Borders */
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(0, 200, 83, 0.4);

    /* Difficulty */
    --diff-easy: #00c853;
    --diff-medium: #ffc107;
    --diff-hard: #ff5252;
    --diff-legendary: #9c27b0;

    /* Sizes */
    --sidebar-width: 240px;
    --right-panel-width: 280px;
    --header-height: 50px;
    --channel-header-height: 48px;
    --input-area-height: 68px;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ============ TOP NAV ============ */
.top-nav {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: relative;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: var(--soom-green);
    text-decoration: none;
}

.nav-brand .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--soom-green), var(--soom-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    font-weight: 700;
}

.nav-brand .brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    font-family: inherit;
}
.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.user-avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s;
}
.user-avatar-small:hover { transform: scale(1.1); }

.brand-icon-img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: contain;
}

.user-avatar-small-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}
.user-avatar-small-img:hover { transform: scale(1.1); }

/* ============ MAIN LAYOUT ============ */
.app-layout {
    display: flex;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s;
}

.sidebar-search {
    padding: 12px;
}
.sidebar-search input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.sidebar-search input:focus {
    border-color: var(--border-active);
}
.sidebar-search input::placeholder {
    color: var(--text-muted);
}

.sidebar-channels {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.channel-category {
    padding: 16px 8px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s;
    margin-bottom: 1px;
}
.channel-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.channel-item.active {
    background: var(--soom-green-dim);
    color: var(--soom-green);
}
.channel-item .ch-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    opacity: 0.7;
}
.channel-item.active .ch-icon { opacity: 1; }
.channel-item .ch-name { flex: 1; }
.channel-item .ch-unread {
    background: var(--error);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
}

/* Challenge items in sidebar */
.challenge-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    transition: all 0.15s;
    margin-bottom: 1px;
}
.challenge-sidebar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.challenge-sidebar-item.active {
    background: var(--soom-purple-dim);
    color: var(--soom-purple);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-footer .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-footer .user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.sidebar-footer .user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-footer .user-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-footer .user-plan {
    font-size: 10px;
    color: var(--soom-green);
    font-weight: 500;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
}

/* Channel Header */
.channel-header {
    height: var(--channel-header-height);
    min-height: var(--channel-header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.channel-header .ch-title {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.channel-header .ch-title .hash {
    color: var(--text-muted);
    font-size: 18px;
}
.channel-header .ch-desc {
    color: var(--text-muted);
    font-size: 12px;
    border-left: 1px solid var(--border);
    padding-left: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.channel-header .ch-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.channel-header .ch-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}
.channel-header .ch-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 20px;
}
.welcome-message h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.welcome-message p {
    color: var(--text-secondary);
    font-size: 14px;
}
.welcome-message .welcome-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    padding: 6px 8px;
    transition: background 0.1s;
}
.message:hover {
    background: var(--bg-message-hover);
}

.message .msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
}

.message .msg-content {
    flex: 1;
    min-width: 0;
}
.message .msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}
.message .msg-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}
.message .msg-time {
    font-size: 11px;
    color: var(--text-muted);
}
.message .msg-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-one_soom { background: var(--soom-green-dim); color: var(--soom-green); }
.badge-two_soom { background: rgba(102, 126, 234, 0.15); color: var(--soom-blue); }
.badge-three_soom { background: var(--soom-purple-dim); color: var(--soom-purple); }
.badge-four_soom { background: rgba(255, 193, 7, 0.15); color: var(--warning); }
.badge-admin { background: rgba(255, 82, 82, 0.15); color: var(--error); }

.message .msg-body {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
}

.message .msg-body code {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.message .msg-body pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
}

/* System message */
.message.system-message {
    justify-content: center;
    padding: 4px 0;
}
.message.system-message .msg-body {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    text-align: center;
}

/* AI message */
.message.ai-message {
    background: linear-gradient(135deg, rgba(0,200,83,0.05), rgba(156,39,176,0.05));
    border-left: 3px solid var(--soom-green);
    border-radius: 0 6px 6px 0;
}

/* Typing indicator */
.typing-indicator {
    padding: 4px 16px;
    font-size: 12px;
    color: var(--text-muted);
    min-height: 20px;
}
.typing-dots {
    display: inline-flex;
    gap: 3px;
}
.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ============ INPUT AREA ============ */
.input-area {
    border-top: 1px solid var(--border);
    padding: 12px 16px;
}
.input-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}
.input-toolbar button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}
.input-toolbar button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.input-row textarea {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 120px;
    min-height: 40px;
    transition: border-color 0.2s;
}
.input-row textarea:focus {
    border-color: var(--border-active);
}
.input-row textarea::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--soom-green);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.btn-send:hover {
    background: #00e05a;
    transform: scale(1.05);
}
.btn-send:disabled {
    opacity: 0.4;
    cursor: default;
    transform: none;
}

/* ============ RIGHT PANEL ============ */
.right-panel {
    width: var(--right-panel-width);
    min-width: var(--right-panel-width);
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
}
.right-panel.hidden {
    display: none;
}

.right-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.right-section h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Challenge Info Card */
.challenge-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}
.challenge-info-card .ci-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}
.challenge-info-card .ci-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.challenge-info-card .ci-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.challenge-info-card .btn-join-challenge {
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    border-radius: 6px;
    background: var(--soom-green);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.challenge-info-card .btn-join-challenge:hover {
    background: #00e05a;
}

/* Leaderboard */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    transition: background 0.15s;
}
.lb-item:hover { background: var(--bg-hover); }
.lb-rank {
    width: 20px;
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
}
.lb-item.rank-1 .lb-rank { color: #ffd700; }
.lb-item.rank-2 .lb-rank { color: #c0c0c0; }
.lb-item.rank-3 .lb-rank { color: #cd7f32; }
.lb-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.lb-name { flex: 1; color: var(--text-primary); }
.lb-score {
    font-weight: 600;
    color: var(--soom-green);
    font-family: 'JetBrains Mono', monospace;
}

/* Online Users */
.online-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.online-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}
.online-user .online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}
.online-user .online-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* ============ CHALLENGE VIEW ============ */
.challenge-view {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.challenge-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s;
}
.challenge-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
}
.challenge-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.challenge-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.challenge-badge.active { background: rgba(0,200,83,0.15); color: var(--success); }
.challenge-badge.upcoming { background: rgba(102,126,234,0.15); color: var(--info); }
.challenge-badge.completed { background: rgba(255,255,255,0.1); color: var(--text-muted); }

.challenge-difficulty {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.challenge-difficulty.easy { background: rgba(0,200,83,0.15); color: var(--diff-easy); }
.challenge-difficulty.medium { background: rgba(255,193,7,0.15); color: var(--diff-medium); }
.challenge-difficulty.hard { background: rgba(255,82,82,0.15); color: var(--diff-hard); }
.challenge-difficulty.legendary { background: var(--soom-purple-dim); color: var(--diff-legendary); }

.challenge-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
}
.challenge-card .challenge-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.6;
}
.challenge-meta-row {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.challenge-card .btn-join {
    padding: 8px 20px;
    border-radius: 6px;
    background: var(--soom-green);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.challenge-card .btn-join:hover {
    background: #00e05a;
}

/* ============ UPGRADE GATE ============ */
.upgrade-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 40px;
    text-align: center;
    background: var(--bg-primary);
}
.upgrade-gate .gate-icon {
    font-size: 64px;
    margin-bottom: 24px;
}
.upgrade-gate h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.upgrade-gate p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
    max-width: 400px;
}
.plan-highlight {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--soom-green-dim);
    border: 1px solid var(--soom-green-glow);
    border-radius: 12px;
    margin-bottom: 24px;
}
.plan-highlight .plan-name {
    font-weight: 700;
    font-size: 18px;
    color: var(--soom-green);
}
.plan-highlight .plan-price {
    font-size: 14px;
    color: var(--text-secondary);
}
.btn-upgrade {
    display: inline-block;
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--soom-green), var(--soom-blue));
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
}
.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 200, 83, 0.3);
}

/* ============ LOGIN PROMPT ============ */
.login-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 40px;
    text-align: center;
    background: var(--bg-primary);
}
.login-prompt h1 {
    font-size: 36px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--soom-green), var(--soom-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-prompt .tagline {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}
.btn-login {
    display: inline-block;
    padding: 14px 40px;
    background: var(--soom-green);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-login:hover {
    background: #00e05a;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 200, 83, 0.3);
}

/* ============ LOADING ============ */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--soom-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ MOBILE TOGGLE ============ */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .right-panel { display: none; }
}

@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }

    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        z-index: 300;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
        z-index: 250;
    }
}

@media (max-width: 480px) {
    .channel-header .ch-desc { display: none; }
    .nav-brand .brand-sub { display: none; }
}

/* ============ LANG SELECT ============ */
select.nav-btn {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath fill='%23888' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 22px;
}
select.nav-btn option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ============ PROFILE POPUP ============ */
.profile-popup {
    position: fixed;
    bottom: 60px;
    left: 16px;
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-active);
    border-radius: 12px;
    padding: 16px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.profile-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.profile-popup-header h3 {
    font-size: 15px;
    color: var(--text-primary);
}
.profile-popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}
.profile-popup-section {
    margin-bottom: 14px;
}
.profile-popup-section label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.profile-popup-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
.profile-popup-input:focus {
    border-color: var(--soom-green);
}
.profile-emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.emoji-btn {
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.emoji-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.15);
}
.emoji-btn.selected {
    border-color: var(--soom-green);
    background: var(--soom-green-dim);
}
.emoji-clear {
    font-size: 14px;
    color: var(--text-muted);
}
.profile-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.profile-preview-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}
.profile-upload-btn {
    padding: 6px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.profile-upload-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.profile-popup-actions {
    text-align: right;
}
.profile-save-btn {
    padding: 8px 24px;
    background: var(--soom-green);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.profile-save-btn:hover {
    filter: brightness(1.1);
}

/* ============ LANGUAGE MODAL ============ */
#lang-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.lang-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.lang-modal-content {
    position: relative; width: 90vw; max-width: 900px; max-height: 85vh;
    background: var(--bg-primary); border-radius: 16px;
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lang-modal-header {
    padding: 20px 24px 12px; text-align: center; position: relative;
}
.lang-modal-header h2 { margin: 0 0 4px; font-size: 20px; color: var(--soom-green); }
.lang-modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer;
    width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.lang-modal-close:hover { background: var(--bg-card); color: #ff5555; }
.lang-tabs {
    display: flex; gap: 6px; padding: 8px 16px 12px; overflow-x: auto; flex-shrink: 0;
}
.lang-tab {
    padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
    background: transparent; color: var(--text-secondary); font-size: 12px;
    cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.lang-tab:hover { background: var(--bg-card); }
.lang-tab.active { background: var(--soom-green); color: #000; border-color: var(--soom-green); font-weight: 600; }
.lang-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px; padding: 8px 16px 20px; overflow-y: auto; flex: 1;
}
.lang-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-radius: 8px; cursor: pointer; border: 1px solid transparent;
    transition: all 0.15s; font-size: 13px; color: var(--text-primary);
}
.lang-item:hover { background: var(--bg-card); border-color: var(--border); }
.lang-item.active { border-color: var(--soom-green); background: rgba(0,200,83,0.08); }
.lang-flag { font-size: 16px; width: 24px; text-align: center; }
.lang-code { font-size: 10px; color: var(--text-muted); min-width: 28px; }
.lang-native { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-check { color: var(--soom-green); font-weight: 700; }

.lang-btn-login {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-secondary); padding: 6px 14px; border-radius: 20px;
    cursor: pointer; font-size: 13px; transition: all 0.2s;
}
.lang-btn-login:hover { background: rgba(255,255,255,0.2); color: var(--text-primary); }

/* ============ UTILITY ============ */
.hidden { display: none !important; }
.text-green { color: var(--soom-green); }
.text-muted { color: var(--text-muted); }
