/* ==========================================
   TOGYZ PRO — GLOBAL STYLES
   ========================================== */

:root {
    --bg-main: #eac875;
    --pit-bg: #a38e80;
    --stone-color: #4a3424;
    --border-bot: #4a3424;
    --border-player: #fce03b;
    --panel-bg: #eef0f2;
    --text-dark: #333333;
    --tab-bg: #dcc07c;
    --tab-active: #5d4037;
    --bg-menu-dark: #2a1b12;
    --bg-menu-card: #3d281a;
    --text-light: #f4ecd8;
    --accent-gold: #e6b325;
    --accent-gold-hover: #c99a1c;
    --nav-bg: #1a100a;
    --nav-inactive: #8c6f5d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-menu-dark);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    user-select: none;
    color: var(--text-light);
    transition: background-color 0.3s;
}

body.game-active {
    background-color: var(--bg-main);
    color: var(--text-dark);
}

.app-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-height: 0;
}

.screen.active {
    display: flex;
}

/* ==========================================
   ШАПКА
   ========================================== */
.home-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-menu-card);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border-bottom: 2px solid rgba(230,179,37,0.1);
    flex-shrink: 0;
}

.logo-text {
    font-size: 24px;
    font-weight: 900;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text .kumalak-icon {
    color: #6b3a20;
    font-size: 22px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-mini {
    width: 40px;
    height: 40px;
    background: var(--accent-gold);
    border-radius: 50%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--bg-menu-dark);
    font-size: 18px;
    flex-shrink: 0;
}

.user-name-mini { font-size: 14px; font-weight: bold; color: white; }
.user-rating-mini { font-size: 12px; color: var(--accent-gold); font-weight: bold; }

/* ==========================================
   КНОПКИ ГЛАВНОГО МЕНЮ
   ========================================== */
.main-menu-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
}

.big-btn {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-menu-card);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid rgba(255,255,255,0.05);
    outline: none;
    color: white;
    text-align: left;
    width: 100%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.big-btn:active { transform: scale(0.97); }

.big-btn.primary {
    background: linear-gradient(135deg, var(--accent-gold), #d49515);
    border: none;
    color: var(--bg-menu-dark);
}

.big-btn.primary .big-btn-desc { color: rgba(42,27,18,0.8); }
.big-btn i { font-size: 30px; width: 40px; text-align: center; }
.big-btn-title { font-size: 20px; font-weight: bold; margin-bottom: 5px; }
.big-btn-desc { font-size: 13px; color: rgba(244,236,216,0.6); }

/* ==========================================
   БОТ-НАСТРОЙКА
   ========================================== */
.setup-container {
    padding: 20px 20px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow-y: auto;
    flex: 1;
}

.menu-label {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-light);
    align-self: flex-start;
    width: 100%;
    max-width: 350px;
    margin: 0 auto -8px auto;
    opacity: 0.8;
}

.menu-select {
    width: 100%;
    max-width: 350px;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: var(--bg-menu-card);
    color: white;
    outline: none;
}

.start-game-btn {
    background: var(--accent-gold);
    color: var(--bg-menu-dark);
    border: none;
    padding: 18px 30px;
    font-size: 18px;
    border-radius: 10px;
    font-weight: bold;
    width: 100%;
    max-width: 350px;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(230,179,37,0.3);
}

.side-picker {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 350px;
}

.side-card {
    flex: 1;
    padding: 18px 12px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.08);
    background: var(--bg-menu-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--nav-inactive);
}

.side-card.selected {
    border-color: var(--accent-gold);
    background: rgba(230,179,37,0.1);
    color: white;
    box-shadow: 0 0 0 1px rgba(230,179,37,0.25);
}

.side-board-icon { font-size: 36px; line-height: 1; }
.side-card-title { font-size: 14px; font-weight: 800; }
.side-card-sub { font-size: 11px; opacity: 0.6; text-align: center; line-height: 1.4; }

/* ==========================================
   ВЫБОР ВРЕМЕНИ
   ========================================== */
.time-select-screen {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.time-select-scroll {
    padding: 16px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.time-category-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--nav-inactive);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -8px;
}

.time-category-label i { color: var(--accent-gold); font-size: 13px; }

.time-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.time-option {
    background: var(--bg-menu-card);
    border: 1.5px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 16px 8px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.18s;
}

.time-option:active { transform: scale(0.94); }

.time-option.selected {
    border-color: var(--accent-gold);
    background: rgba(230,179,37,0.12);
    box-shadow: 0 0 0 1px rgba(230,179,37,0.2);
}

.time-option-main { font-size: 20px; font-weight: 900; color: white; }
.time-option-inc { font-size: 11px; font-weight: 700; color: var(--accent-gold); }
.time-option-inc.no-inc { color: var(--nav-inactive); }
.time-option-type { font-size: 10px; color: var(--nav-inactive); text-transform: uppercase; }
.time-option.selected .time-option-main { color: var(--accent-gold); }

.search-with-time-btn {
    background: linear-gradient(135deg, var(--accent-gold), #d49515);
    color: var(--bg-menu-dark);
    border: none;
    padding: 18px 30px;
    font-size: 18px;
    border-radius: 14px;
    font-weight: 900;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(230,179,37,0.35);
    margin-top: 4px;
}

/* ==========================================
   ПОИСК СОПЕРНИКА
   ========================================== */
.searching-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 20px;
    padding: 30px;
}

.searching-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(230,179,37,0.3);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.searching-title { font-size: 22px; font-weight: bold; color: white; }
.searching-subtitle { font-size: 14px; color: var(--nav-inactive); text-align: center; }

.cancel-search-btn {
    margin-top: 20px;
    padding: 14px 30px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

/* ==========================================
   TOAST РЕЙТИНГА
   ========================================== */
.rating-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-menu-card);
    border: 1px solid var(--accent-gold);
    border-radius: 16px;
    padding: 14px 22px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 240px;
    max-width: 88vw;
    pointer-events: none;
}

.rating-toast.show { transform: translateX(-50%) translateY(0); }
.rating-toast-icon { font-size: 30px; }
.rating-toast-body { display: flex; flex-direction: column; gap: 3px; }
.rating-toast-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--nav-inactive);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.rating-toast-value { font-size: 22px; font-weight: 900; }
.rating-toast-value.positive { color: #4caf50; }
.rating-toast-value.negative { color: #f44336; }
.rating-toast-current { font-size: 12px; color: var(--text-light); opacity: 0.65; }

/* ==========================================
   ЛИГА / ЛИДЕРБОРД
   ========================================== */
.league-screen-inner { display: flex; flex-direction: column; flex: 1; overflow-y: auto; }

.league-season-banner {
    margin: 16px 16px 8px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #5a3a10, #3d281a);
    border-radius: 14px;
    border: 1px solid rgba(230,179,37,0.25);
    display: flex;
    align-items: center;
    gap: 16px;
}

.league-season-icon { font-size: 34px; }
.league-season-title { font-size: 16px; font-weight: 900; color: white; }
.league-season-sub { font-size: 12px; color: var(--nav-inactive); margin-top: 3px; }
.leaderboard-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px 30px; }

.lb-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-menu-card);
    border-radius: 14px;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.04);
}

.lb-card.rank-1 { border-color: rgba(230,179,37,0.45); background: linear-gradient(135deg, #4a2e0a, #3a2010); }
.lb-card.rank-2 { border-color: rgba(192,192,192,0.3); background: linear-gradient(135deg, #2e2e3e, #242434); }
.lb-card.rank-3 { border-color: rgba(176,108,54,0.4); background: linear-gradient(135deg, #3d2010, #2e1808); }
.lb-card.is-me { box-shadow: 0 0 0 2px var(--accent-gold); }
.lb-rank-icon { width: 34px; text-align: center; font-size: 20px; flex-shrink: 0; }
.lb-rank-num { width: 34px; text-align: center; font-size: 14px; font-weight: 700; color: var(--nav-inactive); flex-shrink: 0; }
.lb-avatar { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: bold; }
.lb-avatar.gold { background: linear-gradient(135deg, #f5d060, #e6b325); color: #3a2000; }
.lb-avatar.silver { background: linear-gradient(135deg, #e0e0e0, #a0a0a0); color: #2a2a2a; }
.lb-avatar.bronze { background: linear-gradient(135deg, #d4845a, #b06030); color: #2a1000; }
.lb-avatar.normal { background: rgba(255,255,255,0.08); color: var(--text-light); }
.lb-info { flex: 1; overflow: hidden; }
.lb-name { font-size: 15px; font-weight: 700; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name.is-me { color: var(--accent-gold); }
.lb-sub { font-size: 11px; color: var(--nav-inactive); }
.lb-rating { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.lb-rating-val { font-size: 19px; font-weight: 900; color: var(--accent-gold); }
.lb-rating-label { font-size: 10px; color: var(--nav-inactive); text-transform: uppercase; }

.league-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 16px;
    color: var(--nav-inactive);
    padding: 60px 20px;
}

.league-loading-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(230,179,37,0.2);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.league-error-btn {
    padding: 12px 26px;
    background: var(--bg-menu-card);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--accent-gold);
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

/* ==========================================
   НИЖНЯЯ НАВИГАЦИЯ
   ========================================== */
.bottom-nav {
    background: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 20px 0;
    border-top: 1px solid #111;
    z-index: 100;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--nav-inactive);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: 0.2s;
    position: relative;
}

.nav-item i { font-size: 22px; }
.nav-item.active { color: var(--accent-gold); }

.nav-badge {
    position: absolute;
    top: -4px;
    right: 8px;
    background: #f44336;
    color: white;
    font-size: 10px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    display: none;
}

.nav-badge.visible { display: block; }

/* ==========================================
   ИГРОВАЯ ДОСКА
   ========================================== */
.top-nav {
    display: flex;
    justify-content: space-between;
    background: var(--tab-bg);
    padding: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.nav-tab {
    flex: 1;
    text-align: center;
    padding: 12px 5px;
    font-size: 13px;
    font-weight: bold;
    color: var(--stone-color);
    border-radius: 8px;
    transition: 0.2s;
    cursor: pointer;
}

.nav-tab.active-tab { background: var(--tab-active); color: white; }
.tab-content { display: none; flex: 1; flex-direction: column; overflow-y: auto; padding: 10px 15px; }
.tab-content.active { display: flex; }

#screen-game #tab-board.tab-content.active {
    justify-content: center;
}

/* ==========================================
   ЗАДАЧА 4: Редизайн обвеса игровой доски
   ========================================== */
.game-board-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
    padding: 8px 0;
}

.game-board-layout { display: flex; flex: 1; width: 100%; justify-content: center; align-items: center; padding: 0; }

.game-side-panel {
    display: none;
    width: 340px;
    max-width: 38%;
    min-width: 280px;
    border-radius: 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 12px;
    box-sizing: border-box;
    overflow: hidden;
    flex-direction: column;
    gap: 10px;
}

.game-side-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.game-side-title {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--stone-color);
}

.game-side-chat-btn {
    border: none;
    border-radius: 10px;
    background: rgba(93,64,55,0.16);
    color: var(--stone-color);
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.game-lobby-desktop-section {
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

#game-lobby-list-desktop {
    min-height: 0;
    overflow-y: auto;
}

.game-players-toggle {
    display: none;
    margin-top: 10px;
    width: 100%;
    border: 1px solid rgba(93,64,55,0.28);
    background: rgba(93,64,55,0.1);
    color: var(--stone-color);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.game-players-toggle i {
    transition: transform 0.2s ease;
}

.game-players-toggle.open i {
    transform: rotate(180deg);
}

.game-lobby-collapse {
    display: none;
}

.game-lobby-collapse.open {
    display: block;
}

.game-lobby-mobile-section {
    margin: 10px 0 0;
}

.board-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.row-wrapper { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.row { display: flex; gap: 6px; justify-content: center; }
.numbers-row { display: flex; gap: 6px; justify-content: center; width: 100%; }
.num-label { width: 34px; text-align: center; font-size: 13px; font-weight: bold; color: var(--stone-color); }

.pit {
    width: 34px;
    height: 90px;
    background-color: var(--pit-bg);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 6px;
    position: relative;
    transition: transform 0.1s;
}

.pit.bot-pit { border: 2px solid var(--border-bot); }
.pit.player-pit { border: 3px solid var(--border-player); cursor: pointer; }
.pit.player-pit:active { transform: scale(0.95); }

.stones-grid {
    display: flex;
    flex-wrap: wrap-reverse;
    justify-content: center;
    width: 20px;
    gap: 2px;
    align-content: flex-start;
    margin-top: auto;
    margin-bottom: 28px;
}

.stone { width: 8px; height: 8px; background-color: var(--stone-color); border-radius: 50%; }

.count-badge {
    position: absolute;
    bottom: 4px;
    width: 22px;
    height: 22px;
    background-color: var(--stone-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    transition: transform 0.1s;
}

.pit.empty .count-badge { background-color: rgba(74,52,36,0.5); }
.pit.tuzdyk { background-color: #d1bfae; }
.pit.tuzdyk .count-badge { background-color: #c62828; }
.pit.tuzdyk::after { content: '❌'; position: absolute; top: 40%; font-size: 14px; opacity: 0.8; }

.scoreboard {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 2px;
    padding: 8px 15px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    align-self: stretch;
    flex-shrink: 0;
}

.score-box { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.score-title { font-size: 12px; font-weight: bold; color: #666; text-transform: uppercase; }

.score-value {
    width: 40px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    color: white;
}

.score-value.ai { background-color: #bdbdbd; }
.score-value.you { background-color: #5d4037; }
.score-divider { font-size: 24px; font-weight: bold; color: #333; }
.status-bar { text-align: center; font-size: 14px; font-weight: bold; color: #d32f2f; min-height: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

.history-box {
    background: white;
    border-radius: 16px;
    padding: 10px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex: 1;
    overflow-y: auto;
    font-family: "JetBrains Mono","Fira Code","Courier New",monospace;
}

.hist-header,
.hist-turn {
    display: grid;
    grid-template-columns: 40px 1fr 1fr;
    align-items: center;
    column-gap: 8px;
    font-size: 13px;
    padding: 4px 6px;
}

.hist-header {
    font-weight: 700;
    color: #555;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 1;
}

.hist-turn {
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #eeeeee;
    margin-top: 4px;
}

.hist-num {
    color: #999;
    text-align: right;
    padding-right: 4px;
}

.hist-w,
.hist-b {
    font-weight: 600;
    text-align: center;
}

.hist-w { color: #333; }
.hist-b { color: #666; }

.hist-last {
    background: #fff3cd;
    border-color: #ffe082;
}

/* Зебра для строк истории: чётные и нечётные с разным фоном */
.history-box .hist-turn:nth-child(2n+1) { /* учитывая заголовок как первый элемент */
    background: #f8f9fa;
}
.history-box .hist-turn:nth-child(2n) {
    background: #f1f3f4;
}

.eval-box {
    background: white;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.eval-title { font-size: 18px; font-weight: bold; color: var(--stone-color); }
.eval-score { font-size: 36px; font-weight: 900; color: #388e3c; }

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    gap: 10px;
}

.end-subtitle { font-size: 16px; color: rgba(255,255,255,0.6); margin-bottom: 10px; }

.flying-stone {
    position: fixed;
    width: 14px;
    height: 14px;
    background-color: var(--stone-color);
    border: 2px solid var(--border-player);
    border-radius: 50%;
    z-index: 9999;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.pit.last-move-highlight.player-pit {
    background-color: rgba(252,224,59,0.2) !important;
    box-shadow: inset 0 0 15px rgba(252,224,59,0.5) !important;
}

.pit.last-move-highlight.bot-pit {
    background-color: rgba(74,52,36,0.15) !important;
    box-shadow: inset 0 0 15px rgba(74,52,36,0.4) !important;
}

.back-btn-top {
    padding: 15px;
    color: var(--accent-gold);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-menu-card);
    cursor: pointer;
    font-weight: bold;
    flex-shrink: 0;
}

/* ==========================================
   ЧАСЫ — player info bars
   ========================================== */
.clock-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: rgba(255,255,255,0.07);
    border-radius: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.06);
}

.clock-bar-player {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 42px;
}

.clock-bar.clock-active .clock-bar-player { color: var(--stone-color); }
.clock-bar-icon { display: none; }

.clock-time {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    color: #aaa;
    transition: color 0.3s;
}

.clock-bar.clock-active .clock-time { color: #222; }
.clock-time.clock-low { color: #e53935 !important; animation: clockPulse 0.65s ease-in-out infinite; }
@keyframes clockPulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* ==========================================
   ПОДЭКРАНЫ (профиль, настройки, статистика)
   ========================================== */
.sub-screen-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-menu-card);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.sub-screen-back {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.07);
    border: none;
    color: var(--accent-gold);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sub-screen-title { font-size: 18px; font-weight: 900; color: white; }

.generic-scroll-screen {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0 24px;
}

.section-list {
    width: 100%;
    box-sizing: border-box;
}

.tournaments-scroll-screen {
    padding-top: 8px;
}

.tournaments-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tournaments-table-wrap table {
    min-width: 640px;
}

.profile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 40px;
    gap: 20px;
    overflow-y: auto;
    flex: 1;
}

.profile-avatar-big {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--accent-gold), #d49515);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    font-weight: 900;
    color: var(--bg-menu-dark);
    box-shadow: 0 8px 30px rgba(230,179,37,0.4);
}

.profile-name { font-size: 24px; font-weight: 900; color: white; }
.profile-username { font-size: 14px; color: var(--nav-inactive); margin-top: -12px; }

.profile-rating-chip {
    background: rgba(230,179,37,0.12);
    border: 1px solid rgba(230,179,37,0.3);
    border-radius: 30px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-rating-chip .chip-icon { font-size: 22px; }
.profile-rating-chip .chip-val { font-size: 28px; font-weight: 900; color: var(--accent-gold); }
.profile-rating-chip .chip-label { font-size: 11px; color: var(--nav-inactive); text-transform: uppercase; letter-spacing: 1px; }
.profile-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }

.profile-info-card {
    background: var(--bg-menu-card);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid rgba(255,255,255,0.04);
}

.profile-info-label { font-size: 11px; color: var(--nav-inactive); text-transform: uppercase; }
.profile-info-value { font-size: 20px; font-weight: 900; color: white; }

.stats-content { display: flex; flex-direction: column; padding: 20px; gap: 20px; overflow-y: auto; flex: 1; }

.stats-donut-container {
    background: var(--bg-menu-card);
    border-radius: 18px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    border: 1px solid rgba(255,255,255,0.04);
}

.stats-donut-title { font-size: 14px; font-weight: 700; color: var(--text-light); opacity: 0.7; }
.stats-donut-ring { position: relative; width: 150px; height: 150px; }
.stats-donut-ring svg { width: 150px; height: 150px; transform: rotate(-90deg); }
.stats-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stats-donut-pct { font-size: 30px; font-weight: 900; color: white; }
.stats-donut-sub { font-size: 11px; color: var(--nav-inactive); text-transform: uppercase; }
.stats-legend { display: flex; gap: 20px; }
.stats-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-light); }
.stats-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.stats-row-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }

.stat-box {
    background: var(--bg-menu-card);
    border-radius: 14px;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(255,255,255,0.04);
}

.stat-box-val { font-size: 24px; font-weight: 900; color: white; }
.stat-box-label { font-size: 10px; color: var(--nav-inactive); text-transform: uppercase; }
.settings-content { padding: 20px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.settings-section-label { font-size: 11px; font-weight: 700; color: var(--nav-inactive); text-transform: uppercase; letter-spacing: 1.5px; padding: 10px 4px 6px; }
.settings-card { background: var(--bg-menu-card); border-radius: 14px; overflow: hidden; border: 1px solid rgba(255,255,255,0.04); }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 18px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.settings-row:last-child { border-bottom: none; }
.settings-row-left { display: flex; align-items: center; gap: 14px; }
.settings-row-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.settings-row-icon.gold { background: rgba(230,179,37,0.15); color: var(--accent-gold); }
.settings-row-icon.blue { background: rgba(66,165,245,0.15); color: #42a5f5; }
.settings-row-icon.green { background: rgba(76,175,80,0.15); color: #4caf50; }
.settings-row-title { font-size: 16px; font-weight: 600; color: white; }
.settings-row-sub { font-size: 12px; color: var(--nav-inactive); margin-top: 1px; }

.toggle-switch { position: relative; width: 50px; height: 28px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 28px;
    transition: background 0.25s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .toggle-slider { background: var(--accent-gold); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }

/* ==========================================
   ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА
   ========================================== */
.lang-picker {
    display: flex;
    gap: 6px;
    align-items: center;
}

.lang-btn {
    min-width: 40px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: var(--nav-inactive);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.lang-btn.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--bg-menu-dark);
}

.lang-btn:active {
    transform: scale(0.96);
}

/* ==========================================
   ЭКРАН "ЕЩЁ"
   ========================================== */
.more-list { display: flex; flex-direction: column; padding: 10px 20px; overflow-y: auto; flex: 1; }
.list-item { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; }
.list-item-left { display: flex; align-items: center; gap: 15px; font-size: 16px; font-weight: 500; color: white; }
.list-item-left i { width: 25px; text-align: center; font-size: 18px; color: var(--accent-gold); opacity: 0.8; }
.list-item i.fa-chevron-right { color: rgba(255,255,255,0.2); font-size: 14px; }

/* ==========================================
   ДРУЗЬЯ И СООБЩЕНИЯ
   ========================================== */
.friend-screen-body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }

.search-bar-wrap {
    padding: 12px 16px;
    background: var(--bg-menu-card);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 15px;
    outline: none;
}

.search-input::placeholder { color: var(--nav-inactive); }

.friends-tabs {
    display: flex;
    background: var(--bg-menu-card);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.friends-tab {
    flex: 1;
    text-align: center;
    padding: 13px 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--nav-inactive);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}

.friends-tab.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }
.friends-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.friend-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s;
}

.friend-card:active { background: rgba(255,255,255,0.03); }

.friend-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    box-sizing: border-box;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: var(--text-light);
    flex-shrink: 0;
}

.friend-avatar.online { box-shadow: 0 0 0 2px #4caf50; }
.friend-info { flex: 1; overflow: hidden; }
.friend-name { font-size: 15px; font-weight: 700; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-sub { font-size: 12px; color: var(--nav-inactive); margin-top: 2px; }
.friend-sub.rating { color: var(--accent-gold); font-weight: 700; }
.friend-action { flex-shrink: 0; }

.btn-add {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1.5px solid var(--accent-gold);
    background: transparent;
    color: var(--accent-gold);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.btn-add:active { background: rgba(230,179,37,0.15); }
.btn-add.pending { border-color: var(--nav-inactive); color: var(--nav-inactive); cursor: default; }

.btn-accept {
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--accent-gold);
    border: none;
    color: var(--bg-menu-dark);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.btn-chat {
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 13px;
    cursor: pointer;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    padding: 40px 20px;
    color: var(--nav-inactive);
    text-align: center;
}

.empty-state i { font-size: 44px; opacity: 0.4; }
.empty-state p { font-size: 15px; line-height: 1.5; }

/* ==========================================
   ЭКРАН ЧАТА
   ========================================== */
.chat-header-name { font-size: 16px; font-weight: 900; color: white; }
.chat-header-sub  { font-size: 12px; color: var(--nav-inactive); }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-menu-dark);
}

.msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.msg-bubble.mine {
    background: var(--accent-gold);
    color: var(--bg-menu-dark);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-weight: 600;
}

.msg-bubble.theirs {
    background: var(--bg-menu-card);
    color: var(--text-light);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.msg-time { font-size: 10px; opacity: 0.55; margin-top: 4px; }

.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-menu-card);
    border-top: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 15px;
    outline: none;
    resize: none;
    max-height: 100px;
}

.chat-input::placeholder { color: var(--nav-inactive); }

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-gold);
    border: none;
    color: var(--bg-menu-dark);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send-btn:active { opacity: 0.85; }

.msg-loading { display: flex; justify-content: center; padding: 30px; color: var(--nav-inactive); }

.msg-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nav-inactive);
    animation: dotPulse 1.2s infinite;
    margin: 0 3px;
}

.msg-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.msg-loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse { 0%,80%,100%{opacity:0.3;transform:scale(0.8)} 40%{opacity:1;transform:scale(1)} }

/* ДИАЛОГИ */
.dialog-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s;
}

.dialog-card:active { background: rgba(255,255,255,0.03); }
.dialog-last-msg { font-size: 13px; color: var(--nav-inactive); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.dialog-unread { background: var(--accent-gold); color: var(--bg-menu-dark); font-size: 11px; font-weight: 900; padding: 2px 7px; border-radius: 10px; flex-shrink: 0; }

/* ==========================================
   ТЕМЫ ОФОРМЛЕНИЯ
   ========================================== */

/* ---- Chess.com Green (уже поддерживается theme-green) ---- */
body.theme-green {
    --bg-menu-dark: #262421;
    --bg-menu-card: #312e2b;
    --nav-bg: #1a1916;
    --nav-inactive: #7f7767;
    --text-light: #f0e9d9;
    --accent-gold: #81b64c;
    --accent-gold-hover: #6a9c3e;
}

/* ---- Deep Blue ---- */
body.theme-deepblue {
    --bg-menu-dark: #0d1b2a;
    --bg-menu-card: #162435;
    --nav-bg: #091420;
    --nav-inactive: #4a6c8c;
    --text-light: #c8dff0;
    --accent-gold: #5ba4e0;
    --accent-gold-hover: #4090cf;
}

/* ---- Light Wood ---- */
body.theme-wood {
    --bg-menu-dark: #f0e0c0;
    --bg-menu-card: #e2ceaa;
    --nav-bg: #cdb07a;
    --nav-inactive: #8b6830;
    --text-light: #3a2010;
    --accent-gold: #b07010;
    --accent-gold-hover: #955e0d;
}
body.theme-wood,
body.theme-wood .logo-text,
body.theme-wood .sub-screen-title,
body.theme-wood .profile-name,
body.theme-wood .settings-row-title { color: #3a2010; }
body.theme-wood .home-header { border-bottom-color: rgba(176,112,16,0.2); }

/* ==========================================
   МОДАЛЬНОЕ ОКНО ПОДДЕРЖКИ
   ========================================== */
.support-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    z-index: 6000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}
.support-modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.support-modal {
    background: var(--bg-menu-card);
    border-radius: 28px 28px 0 0;
    padding: 0 0 36px;
    width: 100%;
    max-width: 480px;
    transform: translateY(110%);
    transition: transform 0.38s cubic-bezier(0.34, 1.45, 0.64, 1);
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none;
}
.support-modal-overlay.open .support-modal { transform: translateY(0); }
.support-modal-handle {
    width: 44px; height: 4px;
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
    margin: 14px auto 22px;
}
.support-modal-title {
    font-size: 21px; font-weight: 900;
    color: white; text-align: center;
    padding: 0 24px 4px;
}
.support-modal-sub {
    font-size: 13px; color: var(--nav-inactive);
    text-align: center; margin-bottom: 24px;
    padding: 0 24px;
    line-height: 1.5;
}
.support-contact-list {
    display: flex; flex-direction: column;
    gap: 10px; padding: 0 18px;
}
.support-contact-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-menu-dark);
    border-radius: 16px; padding: 16px 18px;
    border: 1px solid rgba(255,255,255,0.05);
    text-decoration: none; cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.support-contact-item:active { background: rgba(255,255,255,0.05); }
.support-contact-icon {
    width: 46px; height: 46px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.support-contact-icon.tg  { background: rgba(41,182,246,0.15);  color: #29b6f6; }
.support-contact-icon.wa  { background: rgba(37,211,102,0.15);  color: #25d366; }
.support-contact-icon.gm  { background: rgba(234,67,53,0.15);   color: #ea4335; }
.support-contact-icon.ph  { background: rgba(230,179,37,0.15);  color: var(--accent-gold); }
.support-contact-label {
    font-size: 12px; font-weight: 700; color: var(--nav-inactive);
    text-transform: uppercase; letter-spacing: 0.8px;
}
.support-contact-value {
    font-size: 16px; font-weight: 600; color: white; margin-top: 3px;
}

/* ==========================================
   УЛУЧШЕННЫЙ АНАЛИЗ ПАРТИИ
   ========================================== */
.analysis-screen-wrap { flex: 1; overflow-y: auto; padding: 12px 0 24px; }
.analysis-card {
    background: var(--bg-menu-card);
    border-radius: 20px;
    padding: 20px;
    margin: 0 16px 14px;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex; flex-direction: column; gap: 14px;
}
.analysis-card-title {
    font-size: 12px; font-weight: 800; color: var(--nav-inactive);
    text-transform: uppercase; letter-spacing: 1.2px;
    display: flex; align-items: center; gap: 8px;
}
.analysis-card-title i { color: var(--accent-gold); font-size: 13px; }
.analysis-textarea {
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.09);
    border-radius: 12px;
    color: white; padding: 13px 14px;
    font-size: 15px; font-family: 'Courier New', monospace;
    outline: none; resize: none; width: 100%;
    transition: border-color 0.2s;
}
.analysis-textarea:focus { border-color: var(--accent-gold); }
.analysis-textarea::placeholder { color: var(--nav-inactive); }
.depth-row-new { display: flex; gap: 8px; }
.depth-btn-new {
    flex: 1; padding: 10px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.08);
    color: var(--nav-inactive); font-size: 13px; font-weight: 700;
    cursor: pointer; text-align: center; transition: all 0.18s;
}
.depth-btn-new.selected {
    border-color: var(--accent-gold);
    background: rgba(230,179,37,0.12);
    color: var(--accent-gold);
}
.analyze-btn-new {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
    border: none; border-radius: 13px; padding: 16px; width: 100%;
    color: var(--bg-menu-dark); font-size: 16px; font-weight: 900;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 4px 20px rgba(230,179,37,0.25);
    transition: opacity 0.2s;
}
.analyze-btn-new:active { opacity: 0.85; }
.analysis-result-card {
    background: var(--bg-menu-card);
    border-radius: 20px; padding: 22px;
    margin: 0 16px 14px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    border: 1px solid rgba(230,179,37,0.2);
    box-shadow: 0 4px 20px rgba(230,179,37,0.08);
}
.result-best-label {
    font-size: 11px; font-weight: 800; color: var(--nav-inactive);
    text-transform: uppercase; letter-spacing: 1.2px;
}
.result-best-pit {
    font-size: 64px; font-weight: 900; color: var(--accent-gold);
    line-height: 1; letter-spacing: -2px;
}
.result-score-chip {
    background: rgba(76,175,80,0.12);
    border: 1px solid rgba(76,175,80,0.3);
    border-radius: 20px; padding: 6px 18px;
    font-size: 13px; font-weight: 700; color: #4caf50;
}
.result-detail-text { font-size: 12px; color: var(--nav-inactive); text-align: center; }
.analysis-spinner-wrap {
    display: none; align-items: center; justify-content: center; gap: 12px;
    padding: 28px; color: var(--nav-inactive); font-size: 14px;
}
.analysis-spinner-wrap.visible { display: flex; }

/* ==========================================
   УЛУЧШЕННАЯ БАЗА ПАРТИЙ
   ========================================== */
.db-screen-inner { flex: 1; overflow-y: auto; }
.db-search-bar {
    margin: 14px 16px 10px; position: relative;
}
.db-search-input {
    width: 100%; padding: 12px 16px 12px 42px;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.08);
    background: var(--bg-menu-card);
    color: white; font-size: 14px; outline: none;
    transition: border-color 0.2s;
}
.db-search-input:focus { border-color: var(--accent-gold); }
.db-search-input::placeholder { color: var(--nav-inactive); }
.db-search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--nav-inactive); font-size: 15px;
}
.db-list-wrap { padding: 4px 0 24px; }
.db-game-card {
    background: var(--bg-menu-card);
    border-radius: 16px; padding: 16px 18px;
    margin: 0 16px 10px;
    border: 1px solid rgba(255,255,255,0.05);
    cursor: pointer; transition: background 0.15s;
    display: flex; flex-direction: column; gap: 10px;
    -webkit-tap-highlight-color: transparent;
}
.db-game-card:active { background: rgba(255,255,255,0.05); }
.db-game-top {
    display: flex; align-items: center; justify-content: space-between;
}
.db-game-vs {
    display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap;
}
.db-player {
    display: flex; align-items: center; gap: 6px;
    font-size: 15px; font-weight: 700; color: white;
}
.db-player-av {
    width: 28px; height: 28px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 900; flex-shrink: 0;
}
.db-player-av.white { background: #fff; color: #333; }
.db-player-av.black { background: #2a2a2a; color: #ddd; border: 1px solid rgba(255,255,255,0.1); }
.db-vs-text { font-size: 11px; color: var(--nav-inactive); font-weight: 700; }
.db-result-badge {
    padding: 4px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 900; flex-shrink: 0;
}
.db-result-badge.rw { background: rgba(255,255,255,0.12); color: white; }
.db-result-badge.rb { background: rgba(50,50,50,0.9); color: #bbb; border: 1px solid rgba(255,255,255,0.08); }
.db-result-badge.rd { background: rgba(230,179,37,0.15); color: var(--accent-gold); }
.db-game-meta {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.db-meta-tag {
    display: flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,0.04);
    border-radius: 7px; padding: 4px 9px;
    font-size: 12px; color: var(--nav-inactive);
}
.db-meta-tag i { font-size: 10px; color: var(--accent-gold); }
.db-replay-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px; padding: 9px 16px;
    color: var(--text-light); font-size: 13px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    align-self: flex-start; transition: background 0.15s;
}
.db-replay-btn:active { background: rgba(255,255,255,0.1); }
.db-replay-btn i { color: var(--accent-gold); }

/* ==========================================
   ВЫБОР ТЕМЫ В НАСТРОЙКАХ
   ========================================== */
.theme-picker-grid {
    display: flex; gap: 10px; flex-wrap: wrap;
}
.theme-swatch-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer;
}
.theme-swatch-circle {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}
.theme-swatch-circle.active { border-color: var(--accent-gold); transform: scale(1.12); }
.theme-swatch-circle::after {
    content: '✓';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white;
    background: rgba(0,0,0,0.3);
    opacity: 0; transition: opacity 0.2s;
    font-weight: 900;
}
.theme-swatch-circle.active::after { opacity: 1; }
.ts-dark   { background: #1a1916; }
.ts-green  { background: #81b64c; }
.ts-blue   { background: #5ba4e0; }
.ts-wood   { background: #cdb07a; }
.theme-swatch-label { font-size: 10px; color: var(--nav-inactive); font-weight: 600; white-space: nowrap; }

/* Кнопка начала обучения */
.learn-start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: calc(100% - 32px);
    max-width: 340px;
    margin: 20px auto;
    padding: 17px 24px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
    color: var(--bg-menu-dark);
    font-size: 17px;
    font-weight: 800;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(230,179,37,0.35);
    letter-spacing: 0.3px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.learn-start-btn:active { transform: scale(0.97); box-shadow: 0 2px 10px rgba(230,179,37,0.2); }

/* ==========================================
   ЛОББИ — КАРТОЧКИ ИГРОКОВ (исправленные)
   ========================================== */
.lobby-section {
    margin: 0 16px 16px;
    background: var(--bg-menu-card);
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
}

.lobby-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 10px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--nav-inactive);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.lobby-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 0 2px rgba(76,175,80,0.35);
    animation: dotBlink 2s ease-in-out infinite;
}
@keyframes dotBlink { 0%,100%{opacity:1} 50%{opacity:0.5} }

.lobby-empty {
    padding: 18px 16px;
    font-size: 14px;
    color: var(--nav-inactive);
    display: flex;
    align-items: center;
}

/* Новая карточка игрока в лобби */
.lobby-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}
.lobby-item:last-child { border-bottom: none; }
.lobby-item:active { background: rgba(255,255,255,0.04); }

.lobby-item-av {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-sizing: border-box;
    background: linear-gradient(135deg, rgba(230,179,37,0.25), rgba(230,179,37,0.1));
    border: 2px solid rgba(230,179,37,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    color: var(--accent-gold);
    flex-shrink: 0;
}

.lobby-item-info { flex: 1; overflow: hidden; }
.lobby-item-name {
    font-size: 15px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lobby-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    flex-wrap: wrap;
}
.lobby-item-rating { font-size: 12px; color: var(--accent-gold); font-weight: 700; }
.lobby-item-time { font-size: 12px; color: var(--nav-inactive); display: flex; align-items: center; gap: 4px; }
.lobby-item-time i { font-size: 10px; }

.lobby-challenge-btn {
    padding: 8px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2e7d32, #388e3c);
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(76,175,80,0.3);
    transition: opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.lobby-challenge-btn:active { opacity: 0.8; }
.lobby-challenge-btn i { font-size: 12px; }

/* ==========================================
   ТУРНИРЫ — Chess.com-стиль (переделано)
   ========================================== */
.tournament-card {
    display: flex;
    margin: 0 16px 12px;
    background: var(--bg-menu-card);
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* Акцентная полоса слева */
.tc-accent-bar {
    width: 4px;
    background: linear-gradient(180deg, var(--accent-gold), rgba(230,179,37,0.3));
    flex-shrink: 0;
}

.tc-body {
    flex: 1;
    padding: 16px 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tc-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.tc-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(230,179,37,0.12);
    border: 1px solid rgba(230,179,37,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.tc-main { flex: 1; overflow: hidden; }
.tc-title {
    font-size: 16px;
    font-weight: 900;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tc-desc {
    font-size: 12px;
    color: var(--nav-inactive);
    margin-top: 3px;
    line-height: 1.4;
}

/* Бейдж статуса */
.tc-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
    white-space: nowrap;
}
.ts-active   { background: rgba(76,175,80,0.15);  color: #4caf50; border: 1px solid rgba(76,175,80,0.3); }
.ts-upcoming { background: rgba(33,150,243,0.15); color: #42a5f5; border: 1px solid rgba(33,150,243,0.3); }
.ts-finished { background: rgba(158,158,158,0.1); color: #757575; border: 1px solid rgba(158,158,158,0.2); }

/* Метаданные */
.tc-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tc-prize-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(230,179,37,0.1);
    border: 1px solid rgba(230,179,37,0.2);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-gold);
}
.tc-prize-badge i { font-size: 11px; }

.tc-slots {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--nav-inactive);
}
.tc-slots i { font-size: 11px; color: var(--accent-gold); }

/* Прогресс-бар заполненности */
.tc-progress-wrap {
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
}
.tc-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-gold), #4caf50);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Кнопка участия */
.tc-join-btn {
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
    border: none;
    color: var(--bg-menu-dark);
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 3px 14px rgba(230,179,37,0.3);
    transition: opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.tc-join-btn:active { opacity: 0.85; }
.tc-join-btn.disabled {
    background: rgba(255,255,255,0.06);
    color: var(--nav-inactive);
    box-shadow: none;
    cursor: default;
}
.tc-join-btn i { font-size: 13px; }

/* Контейнер списка турниров */
#tournaments-list {
    display: flex;
    flex-direction: column;
    padding: 12px 0 24px;
}

/* ==========================================
   ГЛАВНЫЙ ЭКРАН — СЕРИЯ ДНЯ
   ========================================== */
.home-streak-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,100,0,0.15);
    border: 1px solid rgba(255,100,0,0.3);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 800;
}
.streak-fire  { font-size: 16px; }
.streak-count { color: #ff6d00; font-size: 15px; }
.streak-label { color: var(--nav-inactive); font-size: 11px; }

/* ==========================================
   АВАТАР — кнопка смены
   ========================================== */
.profile-avatar-big {
    position: relative;
    cursor: pointer;
    font-size: 54px;   /* для emoji */
    line-height: 1;
    width: 96px; height: 96px;
    border-radius: 50%;
    box-sizing: border-box;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(230,179,37,0.2), rgba(230,179,37,0.05));
    border: 2px solid rgba(230,179,37,0.3);
    box-shadow: 0 8px 30px rgba(230,179,37,0.25);
}
.avatar-edit-hint {
    position: absolute;
    bottom: -4px; right: -4px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: var(--bg-menu-dark);
    font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ==========================================
   МОДАЛЬНОЕ ОКНО ВЫБОРА АВАТАРА
   ========================================== */
.avatar-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 7000;
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
}
.avatar-modal-overlay.open { opacity: 1; pointer-events: all; }
.avatar-modal {
    background: var(--bg-menu-card);
    border-radius: 28px 28px 0 0;
    padding: 0 16px 32px;
    width: 100%; max-width: 480px;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.34, 1.45, 0.64, 1);
}
.avatar-modal-overlay.open .avatar-modal { transform: translateY(0); }
.avatar-modal-handle { width: 40px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; margin: 14px auto 16px; }
.avatar-modal-title { font-size: 18px; font-weight: 900; color: white; text-align: center; margin-bottom: 16px; }
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}
.av-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px;
    border-radius: 14px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    background: rgba(255,255,255,0.04);
}
.av-item.selected { border-color: var(--accent-gold); background: rgba(230,179,37,0.15); }
.av-item:active { transform: scale(0.92); }
.av-emoji { font-size: 28px; line-height: 1; }
.av-name  { font-size: 9px; color: var(--nav-inactive); text-align: center; font-weight: 600; }
.avatar-close-btn {
    width: 100%; margin-top: 14px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: white; font-size: 15px; font-weight: 700; cursor: pointer;
}

/* ==========================================
   ТУТОРИАЛ
   ========================================== */
.tutorial-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 8000;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.tutorial-bubble {
    background: var(--bg-menu-card);
    border-radius: 24px;
    padding: 28px 24px;
    width: 100%; max-width: 360px;
    display: flex; flex-direction: column; align-items: center;
    gap: 12px;
    border: 1px solid rgba(230,179,37,0.25);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(230,179,37,0.1);
}
.tutorial-step-dots { display: flex; gap: 6px; }
.tut-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: background 0.2s, transform 0.2s;
}
.tut-dot.active { background: var(--accent-gold); transform: scale(1.3); }
.tutorial-icon  { font-size: 56px; line-height: 1; }
.tutorial-title { font-size: 20px; font-weight: 900; color: white; text-align: center; }
.tutorial-text  { font-size: 15px; color: var(--text-light); text-align: center; line-height: 1.55; opacity: 0.85; }
.tutorial-btns  { display: flex; gap: 10px; width: 100%; margin-top: 4px; }
.tutorial-skip-btn {
    flex: 1; padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: var(--nav-inactive); font-size: 14px; font-weight: 600; cursor: pointer;
}
.tutorial-next-btn {
    flex: 2; padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
    border: none;
    color: var(--bg-menu-dark); font-size: 15px; font-weight: 900; cursor: pointer;
    box-shadow: 0 4px 14px rgba(230,179,37,0.35);
}

/* ==========================================
   ЭКРАН УЧЁБЫ
   ========================================== */
.learn-screen-body {
    flex: 1; overflow-y: auto;
    display: flex; flex-direction: column;
    padding: 20px 16px 40px; gap: 16px;
}
.learn-hero {
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; padding: 24px;
    background: linear-gradient(135deg, rgba(230,179,37,0.12), rgba(230,179,37,0.04));
    border-radius: 22px;
    border: 1px solid rgba(230,179,37,0.18);
}
.learn-hero-icon { font-size: 52px; line-height: 1; }
.learn-hero-title { font-size: 22px; font-weight: 900; color: white; }
.learn-hero-sub   { font-size: 13px; color: var(--nav-inactive); }
.learn-start-btn {
    padding: 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-gold), #d49515);
    border: none;
    color: var(--bg-menu-dark); font-size: 18px; font-weight: 900;
    display: flex; align-items: center; justify-content: center; gap: 12px;
    box-shadow: 0 6px 24px rgba(230,179,37,0.4);
    cursor: pointer;
}
.learn-start-btn i { font-size: 16px; }
.learn-chapters { display: flex; flex-direction: column; gap: 8px; }
.learn-chapter {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-menu-card);
    border-radius: 14px; padding: 14px 16px;
    border: 1px solid rgba(255,255,255,0.05);
}
.learn-chapter.done { border-color: rgba(76,175,80,0.25); }
.learn-ch-num {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.07);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; color: var(--nav-inactive);
    flex-shrink: 0;
}
.learn-chapter.done .learn-ch-num { background: rgba(76,175,80,0.2); color: #4caf50; }
.learn-ch-info { flex: 1; }
.learn-ch-title { font-size: 15px; font-weight: 700; color: white; }
.learn-ch-sub   { font-size: 12px; color: var(--nav-inactive); margin-top: 2px; }
.learn-ch-check { color: #4caf50; font-size: 18px; font-weight: 900; }

.learn-master-section {
    margin-top: 4px;
    background: var(--bg-menu-card);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    padding: 16px;
}

.learn-master-title {
    font-size: 16px;
    font-weight: 900;
    color: white;
    margin-bottom: 10px;
}

.learn-master-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.learn-master-list li {
    color: var(--text-light);
    font-size: 13px;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .sub-screen-header,
    .settings-content,
    .generic-scroll-screen,
    .tournaments-table-wrap,
    .support-modal,
    .avatar-modal,
    .tutorial-bubble {
        width: 100%;
        box-sizing: border-box;
        padding-left: 10px;
        padding-right: 10px;
    }

    .settings-content {
        padding-top: 10px;
        padding-bottom: 18px;
    }

    .settings-row {
        padding: 14px 12px;
        gap: 10px;
    }

    .settings-row-left {
        min-width: 0;
    }

    .settings-row-title {
        font-size: 15px;
    }

    .settings-row-sub {
        font-size: 11px;
    }

    .lang-picker {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    #tournaments-list {
        width: 100%;
        box-sizing: border-box;
        padding: 0 0 12px;
    }

    .tournaments-table-wrap {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tournament-card {
        margin: 0 0 12px;
        width: 100%;
        min-width: 320px;
    }

    .setup-container {
        width: 100%;
        box-sizing: border-box;
        padding: 12px 10px 24px;
        gap: 14px;
    }

    .menu-label,
    .menu-select,
    .start-game-btn,
    .side-picker,
    .side-card {
        width: 100%;
        max-width: none;
    }

    .side-picker {
        flex-direction: column;
        gap: 10px;
    }

    .side-card {
        flex: 0 0 auto;
    }

    .game-board-layout {
        width: 100%;
        justify-content: center;
        align-items: center;
    }
}

@media (min-width: 992px) {
    #screen-game #tab-board {
        padding: 12px;
    }

    #screen-game .game-side-panel {
        display: flex;
    }

    #screen-game .game-players-toggle,
    #screen-game .game-lobby-collapse {
        display: none !important;
    }
}

/* ==========================================
   НАГРАДЫ — DUOLINGO СТИЛЬ
   ========================================== */
.rewards-screen-body {
    flex: 1; overflow-y: auto;
    padding: 12px 0 32px;
    display: flex; flex-direction: column; gap: 4px;
}
.rewards-streak-banner {
    display: flex; align-items: center;
    margin: 0 16px 14px;
    background: linear-gradient(135deg, rgba(255,100,0,0.12), rgba(230,179,37,0.08));
    border: 1px solid rgba(255,100,0,0.25);
    border-radius: 18px;
    padding: 16px 20px; gap: 0;
}
.rsb-left, .rsb-right {
    flex: 1; display: flex; align-items: center; gap: 12px;
}
.rsb-right { justify-content: flex-end; }
.rsb-fire  { font-size: 32px; }
.rsb-bolt  { font-size: 28px; }
.rsb-val   { font-size: 28px; font-weight: 900; color: white; line-height: 1; }
.rsb-label { font-size: 11px; color: var(--nav-inactive); text-transform: uppercase; }
.rsb-divider {
    width: 1px; height: 40px;
    background: rgba(255,255,255,0.1);
    margin: 0 16px;
}
.rewards-progress-header {
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px 10px;
    font-size: 13px; color: var(--nav-inactive);
}
.rph-bar-wrap { flex:1; height:6px; background:rgba(255,255,255,0.08); border-radius:3px; overflow:hidden; }
.rph-bar      { height:100%; background:linear-gradient(90deg,var(--accent-gold),#4caf50); border-radius:3px; transition:width .5s ease; }
.rph-pct      { font-size:12px; font-weight:700; color:var(--accent-gold); }

.reward-duo-card {
    display: flex; align-items: center; gap: 14px;
    margin: 0 16px 10px;
    border-radius: 18px;
    padding: 16px;
    position: relative; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.07);
    min-height: 80px;
}
.reward-duo-card.locked { background: var(--bg-menu-card); opacity: 0.6; }
.reward-duo-card.unlocked { border-color: rgba(255,255,255,0.15); }
.rdc-bg {
    position: absolute; inset: 0; opacity: 0.18;
    border-radius: 18px;
}
.rdc-ornament {
    position: absolute; right: 56px; top: 8px;
    font-size: 48px; opacity: 0.07; color: white;
    font-weight: 900; pointer-events: none;
    font-family: serif;
}
.rdc-icon {
    font-size: 34px; position: relative; z-index: 1;
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.reward-duo-card.unlocked .rdc-icon {
    background: rgba(255,255,255,0.15);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.rdc-body    { flex: 1; position: relative; z-index: 1; }
.rdc-title   { font-size: 15px; font-weight: 800; color: white; }
.rdc-desc    { font-size: 12px; color: var(--nav-inactive); margin-top: 3px; line-height: 1.4; }
.rdc-badge   {
    position: relative; z-index: 1;
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.rdc-badge.done { background: rgba(76,175,80,0.2); color: #4caf50; font-weight: 900; font-size: 14px; }
.rdc-badge.lock { background: rgba(255,255,255,0.06); }
.rewards-list { padding: 0; }

/* ==========================================
   СЕРИЯ В ПРОФИЛЕ
   ========================================== */
.streak-card {
    border-color: rgba(255,100,0,0.15) !important;
}
.streak-card .profile-info-value { color: #ff6d00; }


/* ==========================================
   ЗАДАЧА 5: Лобби только на главном экране
   ========================================== */
/* По умолчанию lobby-section скрыт везде, только #screen-home его показывает */
.lobby-section { display: none; }
#screen-home .lobby-section { display: block; }

/* ==========================================
   ЗАДАЧА 2: Модальное окно создания турнира
   ========================================== */
.create-tournament-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 14px 16px 6px;
    padding: 13px 20px;
    background: linear-gradient(135deg, var(--accent-gold), #c99a1c);
    color: var(--bg-menu-dark);
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: opacity 0.2s;
}
.create-tournament-btn:active { opacity: 0.8; }

.create-tourn-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 999;
    align-items: flex-end;
    justify-content: center;
}
.create-tourn-overlay.open { display: flex; }

.create-tourn-modal {
    background: var(--bg-menu-card);
    border-radius: 22px 22px 0 0;
    padding: 20px 20px 32px;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-top: 2px solid rgba(230,179,37,0.2);
}
.create-tourn-handle {
    width: 40px; height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 0 auto 4px;
}
.create-tourn-title {
    font-size: 18px; font-weight: 900; color: white; text-align: center;
}
.create-tourn-label {
    font-size: 12px; font-weight: 700; color: var(--nav-inactive);
    text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: -8px;
}
.create-tourn-input,
.create-tourn-select {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    color: white;
    padding: 12px 14px;
    font-size: 15px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    -webkit-appearance: none;
}
.create-tourn-input:focus,
.create-tourn-select:focus {
    border-color: var(--accent-gold);
}
.create-tourn-select option { background: #2a1b12; }
.create-tourn-row { display: flex; gap: 10px; }
.create-tourn-row > * { flex: 1; }
.create-tourn-submit {
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-gold), #c99a1c);
    color: var(--bg-menu-dark);
    font-size: 16px; font-weight: 900;
    border: none; border-radius: 14px;
    cursor: pointer; margin-top: 4px;
    transition: opacity 0.2s;
}
.create-tourn-submit:active { opacity: 0.8; }

/* ==========================================
   ЗАДАЧА 1: Дополнительные мобильные правки
   ========================================== */
@media (max-width: 768px) {
    /* Турниры — горизонтальный скролл таблицы */
    .tournaments-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    .tournament-card {
        min-width: 280px;
    }

    /* Настройки бота — колонкой */
    .setup-container {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .side-picker {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    .side-card {
        width: 100%;
        flex: none;
    }
    #difficulty,
    .menu-select,
    .start-game-btn {
        width: 100%;
        max-width: none;
    }

    /* Game board на мобиле */
    .game-board-main {
        padding: 0 6px;
    }
    .clock-time { font-size: 22px; }

    /* Модальное окно турнира */
    .create-tourn-modal { padding: 16px 14px 28px; }
}

/* ==========================================
   ИСПРАВЛЕННЫЙ ПРЕМИУМ ДИЗАЙН ТУРНИРОВ 
   ========================================== */

.tournaments-content {
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-x: hidden;
}

/* 1. ЖЕСТКИЙ ФИКС СЪЕХАВШИХ КАРТОЧЕК */
#tournaments-list {
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 !important;
    margin: 0 !important; /* Убиваем отступы, из-за которых всё ехало */
}

.tournament-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important; /* Возвращаем карточки ровно по центру */
    position: relative !important;
    left: 0 !important;
    transform: none !important;
}

/* 2. ДОРОГАЯ КНОПКА СОЗДАНИЯ (вместо дешевого пунктира) */
#btn-show-create-tourn {
    background: var(--bg-menu-card, rgba(40, 40, 40, 0.6)) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    padding: 20px;
    text-align: center;
    color: #fff !important;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    transition: background 0.2s;
}
#btn-show-create-tourn:active { background: rgba(255, 255, 255, 0.1) !important; }
#btn-show-create-tourn i {
    font-size: 26px;
    margin-bottom: 8px;
    color: var(--accent-gold) !important; /* Идеально подстроится под твою зеленую тему */
}

/* Возвращаем родной красивый шрифт везде */
.btn-tourn-title { font-weight: 800; font-size: 15px; font-family: inherit !important; }
.btn-tourn-sub { font-size: 12px; opacity: 0.5; margin-top: 4px; font-family: inherit !important; }

/* 3. КРАСИВАЯ ФОРМА БЕЗ "УРОДЛИВЫХ" ШРИФТОВ */
#create-tournament-wrap {
    background: var(--bg-menu-card, rgba(30, 30, 30, 0.95));
    border-radius: 16px;
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.08);
}

.create-tourn-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.create-tourn-header h3 { margin: 0; font-size: 18px; color: white; font-weight: 800; font-family: inherit !important; }
.create-tourn-header i { color: var(--nav-inactive); font-size: 20px; cursor: pointer; }

.premium-input-group { margin-bottom: 14px; width: 100%; box-sizing: border-box; }
.premium-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; box-sizing: border-box; }
.premium-input-group label { font-size: 11px; color: var(--nav-inactive); margin-bottom: 6px; display: block; font-weight: 700; font-family: inherit !important; text-transform: uppercase; }

/* Дизайн полей ввода */
.premium-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: white !important;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit !important; 
}
.premium-input:focus { border-color: var(--accent-gold) !important; }

select.premium-input {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px;
}

/* 4. ИСПРАВЛЕНИЕ КНОПКИ "ЗАПУСТИТЬ" (Убрал светофор) */
.btn-launch-tourn {
    width: 100%;
    background: var(--accent-gold) !important; /* Теперь кнопка будет чистого цвета твоей темы */
    color: #fff !important;
    font-weight: 900;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    margin-top: 6px;
    cursor: pointer;
    box-sizing: border-box;
    font-family: inherit !important;
}

.tourn-label-row { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; }
.tourn-label-row i { font-size: 16px; color: var(--accent-gold); cursor: pointer; }
.tc-title, .tc-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ==========================================
   ФИКС ОБРЕЗАННЫХ КАРТОЧЕК ТУРНИРОВ
   ========================================== */

.tournament-card {
    height: auto !important; /* Убиваем фиксированную высоту, из-за которой всё обрезалось снизу */
    min-height: 120px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    margin-bottom: 12px !important;
    overflow: hidden !important; /* Сохраняем закругленные углы и прячем всё лишнее */
}

.tc-body {
    height: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important; /* Аккуратные отступы между строками внутри карточки */
}

.tc-top {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.tc-main {
    flex: 1 !important;
    min-width: 0 !important; /* КРИТИЧЕСКИ ВАЖНО: без этого текст не будет обрезаться троеточием */
    margin: 0 10px !important;
}

/* Длинные тексты аккуратно обрезаются троеточием */
.tc-title, .tc-desc {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    width: 100% !important;
}

/* Статус (ограничиваем ширину, чтобы баг с текстом "tournament-active..." не ломал дизайн) */
.tc-status-badge {
    flex-shrink: 0 !important;
    max-width: 100px !important; 
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 4px 8px !important;
}

.tc-meta-row {
    display: flex !important;
    gap: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.tc-progress-wrap {
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 4px !important;
}

.tc-join-btn {
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 6px !important;
}