:root {
    --bg: #1a1a2e;
    --bg-secondary: #16213e;
    --text: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #e94560;
    --input-bg: #0f3460;
    --border: #2a2a4a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    direction: rtl;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: 600;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--input-bg);
    color: var(--text);
}

.btn-danger {
    background: #ff4444;
    color: white;
}

.btn-danger:hover {
    background: #cc0000;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--input-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

.card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.badge-level {
    background: var(--accent);
    color: white;
}

.badge-xp {
    background: #ffd700;
    color: #333;
}

.badge-rank {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-new {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
}

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-logo {
    font-size: 22px;
    font-weight: bold;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-nav a {
    color: var(--text-secondary);
    transition: color 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.header-nav a:hover {
    color: var(--accent);
    text-decoration: none;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-secondary) 100%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    text-align: center;
    padding: 40px 32px;
}

.auth-card h1 {
    font-size: 36px;
    margin-bottom: 8px;
    color: var(--accent);
    text-shadow: 0 2px 10px rgba(233, 69, 96, 0.3);
}

.auth-card .subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 16px;
}

.auth-card .form-group {
    text-align: right;
}

.auth-card .btn {
    width: 100%;
    padding: 16px;
    font-size: 18px;
}

.auth-links {
    margin-top: 24px;
    color: var(--text-secondary);
}

.error-msg {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: none;
    font-weight: 500;
}

.error-msg.show {
    display: block;
}

.success-msg {
    background: linear-gradient(135deg, #44ff44, #22bb22);
    color: white;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: none;
    font-weight: 500;
}

.success-msg.show {
    display: block;
}

.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr 260px;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    letter-spacing: 1px;
}

.room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 4px;
}

.room-item:hover {
    background: var(--input-bg);
    transform: translateX(-4px);
}

.room-item.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}

.room-icon {
    font-size: 22px;
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.room-count {
    font-size: 11px;
    color: var(--text-secondary);
}

.room-item.active .room-count {
    color: rgba(255, 255, 255, 0.8);
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.user-item:hover {
    background: var(--input-bg);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: white;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.user-avatar.online::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 12px;
    height: 12px;
    background: #44ff44;
    border-radius: 50%;
    border: 3px solid var(--bg-secondary);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-title {
    font-size: 11px;
    color: var(--text-secondary);
}

.chat-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
}

.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info h2 {
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
    padding: 12px;
    border-radius: 12px;
    transition: background 0.2s;
}

.message:hover {
    background: rgba(255, 255, 255, 0.02);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.message-author {
    font-weight: 600;
    font-size: 14px;
}

.message-level {
    font-size: 10px;
    background: var(--accent);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.message-title {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--input-bg);
    padding: 2px 8px;
    border-radius: 8px;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.message-text {
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

.message-reactions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.reaction-btn {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.reaction-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.reaction-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.reaction-count {
    font-size: 11px;
    font-weight: 600;
}

.message-delete {
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
}

.message:hover .message-delete {
    opacity: 1;
}

.message-delete:hover {
    background: #ff4444;
    color: white;
}

.chat-input-area {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--input-bg);
    border: 2px solid var(--border);
    border-radius: 24px;
    padding: 14px 22px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 50px;
    line-height: 1.4;
    transition: border-color 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

.chat-input-actions {
    display: flex;
    gap: 8px;
}

.chat-input-actions .btn-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.leaderboard-table tr:hover {
    background: var(--input-bg);
}

.rank-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.rank-1 { background: linear-gradient(135deg, #ffd700, #ffed4a); color: #333; }
.rank-2 { background: linear-gradient(135deg, #c0c0c0, #e8e8e8); color: #333; }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #daa520); color: white; }
.rank-other { background: var(--input-bg); color: var(--text); }

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.achievement-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s;
}

.achievement-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.achievement-card.earned {
    border-color: var(--accent);
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.2);
}

.achievement-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.achievement-name {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.achievement-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.achievement-xp {
    font-size: 12px;
    color: #ffd700;
    font-weight: 600;
}

.poll-container {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
}

.poll-question {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
}

.poll-option {
    position: relative;
    margin-bottom: 10px;
    cursor: pointer;
}

.poll-option-bar {
    height: 48px;
    background: var(--input-bg);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.poll-option:hover .poll-option-bar {
    border-color: var(--accent);
    transform: scale(1.01);
}

.poll-option-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.5s ease;
    opacity: 0.3;
}

.poll-option-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    z-index: 1;
    font-weight: 500;
}

.poll-option-percent {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: bold;
    z-index: 1;
    color: var(--accent);
}

.gift-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
}

.gift-item {
    background: var(--input-bg);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.gift-item:hover {
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.gift-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.gift-name {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.gift-cost {
    font-size: 11px;
    color: #ffd700;
    font-weight: 600;
}

.gift-rarity-common { border-left: 4px solid #aaa; }
.gift-rarity-rare { border-left: 4px solid #64b5f6; }
.gift-rarity-epic { border-left: 4px solid #ab47bc; }
.gift-rarity-legendary { border-left: 4px solid #ffd700; }

.challenge-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.challenge-item {
    background: var(--input-bg);
    border-radius: 12px;
    padding: 14px 16px;
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.challenge-name {
    font-size: 13px;
    font-weight: 600;
}

.challenge-reward {
    font-size: 11px;
    color: #ffd700;
    font-weight: 600;
}

.challenge-progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.challenge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff6b6b);
    transition: width 0.5s ease;
    border-radius: 4px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 20px;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--accent);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.theme-option {
    background: var(--input-bg);
    border: 3px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

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

.theme-option.active {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}

.theme-preview {
    width: 100%;
    height: 48px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.theme-name {
    font-size: 13px;
    font-weight: 600;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    width: 60px;
    height: 44px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.typing-indicator {
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}

.online-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #44ff44;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.bg-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.snowflake {
    position: absolute;
    color: white;
    font-size: 14px;
    opacity: 0.7;
    animation: fall linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

.star {
    position: absolute;
    background: white;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    animation: twinkle 2s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.rain-drop {
    position: absolute;
    width: 2px;
    height: 20px;
    background: linear-gradient(transparent, rgba(174, 194, 224, 0.5));
    animation: rain linear infinite;
}

@keyframes rain {
    to {
        transform: translateY(100vh);
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text);
}

.empty-state p {
    font-size: 14px;
}

.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    border-radius: 12px 12px 0 0;
    transition: all 0.3s;
    font-weight: 600;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--input-bg);
}

.tab-btn.active {
    color: var(--accent);
    background: var(--input-bg);
}

.create-room-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.create-room-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}

.room-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.room-item:hover .room-actions {
    opacity: 1;
}

.room-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.room-action-btn:hover {
    background: var(--border);
    color: var(--text);
}

.room-action-btn.delete:hover {
    background: #ff4444;
    color: white;
}

.level-card {
    background: linear-gradient(135deg, var(--accent), var(--bg-secondary));
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    color: white;
    position: relative;
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.level-card-content {
    position: relative;
    z-index: 1;
}

.level-big {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 8px;
}

.level-title {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 16px;
}

.level-progress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.level-progress-fill {
    height: 100%;
    background: white;
    border-radius: 8px;
    transition: width 0.5s ease;
}

.level-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    opacity: 0.8;
}

.unlocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.unlock-item {
    background: var(--input-bg);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.unlock-item.locked {
    opacity: 0.5;
    filter: grayscale(50%);
}

.unlock-item.unlocked {
    border-color: #44ff44;
    background: rgba(68, 255, 68, 0.1);
}

.unlock-icon {
    font-size: 28px;
}

.unlock-info {
    flex: 1;
}

.unlock-name {
    font-weight: 600;
    font-size: 14px;
}

.unlock-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.unlock-level {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
        position: fixed;
        top: 56px;
        right: 0;
        width: 280px;
        height: calc(100vh - 56px);
        z-index: 200;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        display: block;
    }

    .right-panel {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        width: 280px;
        height: calc(100vh - 56px);
        z-index: 200;
        box-shadow: 5px 0 20px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s ease;
    }

    .right-panel.show {
        display: block;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: var(--input-bg);
        border: none;
        color: var(--text);
        font-size: 20px;
        cursor: pointer;
    }

    .header-nav {
        gap: 6px;
    }

    .header-nav a {
        font-size: 13px;
        padding: 6px;
    }

    .header-nav .desktop-nav:not(:last-child):not(:nth-last-child(2)):not(:nth-last-child(3)) {
        display: none;
    }

    .chat-header {
        padding: 12px 14px;
        border-radius: 0;
    }

    .chat-messages {
        padding: 10px;
        gap: 6px;
    }

    .chat-input-area {
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .message {
        padding: 8px 10px;
        gap: 10px;
        border-radius: 14px;
    }

    .message-avatar {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .message-text {
        font-size: 14px;
        line-height: 1.5;
    }

    .message-header {
        gap: 6px;
        flex-wrap: wrap;
    }

    .message-author {
        font-size: 13px;
    }

    .message-level {
        font-size: 9px;
        padding: 2px 8px;
    }

    .message-title {
        font-size: 10px;
    }

    .message-time {
        font-size: 10px;
    }

    .chat-input {
        padding: 12px 18px;
        font-size: 15px;
        min-height: 46px;
        border-radius: 24px;
    }

    .chat-input-actions .btn-icon {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }

    .achievement-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gift-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .unlocks-grid {
        grid-template-columns: 1fr;
    }

    .tab-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 10px 16px;
    }

    .sidebar-section {
        margin-bottom: 16px;
    }

    .room-item {
        padding: 10px 12px;
        border-radius: 10px;
    }

    .room-name {
        font-size: 13px;
    }

    .user-item {
        padding: 8px 10px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .reaction-btn {
        padding: 4px 10px;
        font-size: 13px;
    }

    .message-reactions {
        gap: 4px;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 8px 10px;
    }

    .header-logo {
        font-size: 17px;
    }

    .header-nav .desktop-nav {
        display: none !important;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .container {
        padding: 8px;
    }

    .auth-container {
        padding: 12px;
    }

    .auth-card {
        padding: 24px 18px;
        border-radius: 16px;
    }

    .auth-card h1 {
        font-size: 26px;
    }

    .auth-card .subtitle {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .chat-messages {
        padding: 8px;
        gap: 4px;
    }

    .message {
        gap: 8px;
        padding: 6px 8px;
    }

    .message-avatar {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .message-text {
        font-size: 14px;
    }

    .chat-input {
        padding: 10px 14px;
        font-size: 15px;
        min-height: 44px;
    }

    .chat-input-actions .btn-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .level-big {
        font-size: 36px;
    }

    .modal {
        padding: 20px 16px;
        margin: 8px;
        border-radius: 16px;
    }

    .modal-title {
        font-size: 18px;
    }

    .toast {
        right: 50%;
        transform: translateX(50%);
        bottom: 80px;
        left: 50%;
        width: calc(100% - 32px);
        max-width: 360px;
    }

    .poll-option-bar {
        height: 42px;
    }

    .gift-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .gift-item {
        padding: 14px 10px;
    }

    .gift-icon {
        font-size: 32px;
        margin-bottom: 6px;
    }

    #emojiPanel {
        width: calc(100% - 16px) !important;
        right: 8px !important;
        bottom: 70px !important;
        max-height: 350px !important;
    }

    .sidebar-overlay {
        transition: opacity 0.3s ease;
    }

    .chat-input-area {
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        position: sticky;
        bottom: 0;
    }

.mobile-bottom-nav {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

.sidebar-overlay.show {
    display: block;
}

/* Theme: Light Blue */
.theme-light-blue {
    --bg: #f0f4f8;
    --bg-secondary: #ffffff;
    --text: #1a202c;
    --text-secondary: #718096;
    --accent: #4299e1;
    --input-bg: #edf2f7;
    --border: #e2e8f0;
}

/* Theme: Dark Purple */
.theme-dark-purple {
    --bg: #1a1025;
    --bg-secondary: #2d1f42;
    --text: #e8e0f0;
    --text-secondary: #9f8fc0;
    --accent: #9f7aea;
    --input-bg: #3d2a5c;
    --border: #4a3670;
}

/* Theme: Neon Green */
.theme-neon-green {
    --bg: #0a0f0a;
    --bg-secondary: #141f14;
    --text: #00ff00;
    --text-secondary: #00cc00;
    --accent: #39ff14;
    --input-bg: #1a2a1a;
    --border: #2a3a2a;
}

/* Theme: Ocean Blue */
.theme-ocean-blue {
    --bg: #0a192f;
    --bg-secondary: #112240;
    --text: #ccd6f6;
    --text-secondary: #8892b0;
    --accent: #64ffda;
    --input-bg: #1d3557;
    --border: #233554;
}

/* Theme: Sunset Orange */
.theme-sunset-orange {
    --bg: #1a0f0a;
    --bg-secondary: #2d1f17;
    --text: #ffe0cc;
    --text-secondary: #cc9980;
    --accent: #ff6b35;
    --input-bg: #3d2a1f;
    --border: #5c3d2a;
}

/* Theme: Pure Light */
.theme-pure-light {
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --text: #1e293b;
    --text-secondary: #64748b;
    --accent: #6366f1;
    --input-bg: #f1f5f9;
    --border: #e2e8f0;
}

/* Theme: Midnight */
.theme-midnight {
    --bg: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --text: #e8e8f0;
    --text-secondary: #8888aa;
    --accent: #e94560;
    --input-bg: #252540;
    --border: #2a2a4a;
}

/* Theme: Cyber Pink */
.theme-cyber-pink {
    --bg: #120018;
    --bg-secondary: #1f0028;
    --text: #f0e0ff;
    --text-secondary: #b090cc;
    --accent: #ff00ff;
    --input-bg: #2a003a;
    --border: #4a0066;
}

/* Theme: Forest Green */
.theme-forest-green {
    --bg: #0b1a0b;
    --bg-secondary: #132613;
    --text: #d4edda;
    --text-secondary: #81c784;
    --accent: #4caf50;
    --input-bg: #1b3a1b;
    --border: #2e5c2e;
}

/* Theme: Royal Gold */
.theme-royal-gold {
    --bg: #1a1505;
    --bg-secondary: #2d2510;
    --text: #fff5d4;
    --text-secondary: #ccaa66;
    --accent: #ffd700;
    --input-bg: #3d3015;
    --border: #5c4a20;
}

/* Level Unlock Animations */
.unlock-item {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1100;
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    font-size: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
}

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block !important;
    }
}

.dm-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: calc(100vh - 56px);
    overflow: hidden;
}

@media (max-width: 768px) {
    .dm-layout {
        grid-template-columns: 1fr;
    }
}
