/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--ca-font);
}

body {
    background-color: #0f1117;
    color: #ffffff;
    min-height: 100vh;
}

/* Контейнер */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Верхняя служебная панель */
.top-bar {
    background: linear-gradient(to bottom, #0a0b10, #0f1117);
    height: 32px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    color: #8b949e;
}

.status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.online-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-dot {
    width: 8px;
    height: 8px;
    background-color: #00ff9d;
    border-radius: 50%;
    animation: pulse 2s infinite;
    transition: background-color .2s ease;
}
/* Состояния соединения (data-state ставит gpSetOnline). */
.online-status[data-state="online"]     .online-dot { background-color: #00ff9d; }
.online-status[data-state="connecting"] .online-dot { background-color: #e0a52c; }
.online-status[data-state="offline"]    .online-dot { background-color: #d05a4e; animation: none; }
/* Когда связь есть — индикатор не нужен: он не несёт информации и только шумит.
   Прячем целиком при online (отзыв #73). Показываем ТОЛЬКО когда что-то не так. */
.online-status[data-state="online"] { display: none; }
/* Оффлайн — это поломка (ходы не уходят на сервер): делаем плашку ЗАМЕТНОЙ,
   а не приглушённой — красный фон/обводка, чтобы игрок сразу увидел проблему. */
.online-status[data-state="offline"] {
    background: rgba(208, 90, 78, .14);
    border: 1px solid rgba(208, 90, 78, .55);
    border-radius: 999px;
    padding: 2px 10px;
    color: #d05a4e;
    font-weight: 600;
}

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

.announcement {
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Модальное окно авторизации */
.auth-modal {
    display: none;
    position: absolute;
    top: 32px;
    right: 24px;
    width: 300px;
    background-color: #1a1d28;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
    margin-top: 5px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
}

.auth-modal.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

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

.auth-header h3 {
    font-family: var(--ca-font);
    font-size: 18px;
    color: #ffffff;
}

.close-auth {
    color: #8b949e;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
}

.close-auth:hover {
    color: #ffffff;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;   /* кнопки одной ширины по центру (Google-iframe тоже) */
    gap: 12px;
    margin-bottom: 20px;
}

.auth-btn {
    padding: 14px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.google-btn {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #ddd;
}

/* Кнопки внешних провайдеров входа (Яндекс/VK) — брендовые цвета.
   Размеры под кнопку Google GSI (large, rectangular): 280×40, радиус 4px,
   чтобы все три кнопки в модалке были единого вида. Яндекс — ссылка <a>,
   VK — <button> (VK ID SDK); правила общие. */
.yandex-login-btn,
.vk-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 280px;
    height: 40px;
    padding: 0 14px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s;
}
.yandex-login-btn { background-color: #fc3f1d; }
.vk-login-btn { background-color: #0077ff; }
.yandex-login-btn:hover,
.vk-login-btn:hover { opacity: 0.92; }

.google-btn:hover {
    background-color: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.yandex-btn {
    background-color: #fc3f1d;
    color: white;
}

.yandex-btn:hover {
    background-color: #e63616;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(252, 63, 29, 0.3);
}

.email-btn {
    background-color: transparent;
    color: #8b949e;
    border: 1px solid #434956;
}

.email-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #434956;
}

.auth-divider span {
    background-color: #1a1d28;
    padding: 0 10px;
    color: #8b949e;
    font-size: 12px;
    position: relative;
    z-index: 1;
}

.auth-footer {
    text-align: center;
    font-size: 13px;
    color: #8b949e;
}

.register-link {
    color: #00d1ff;
    text-decoration: none;
    font-weight: 500;
}

.register-link:hover {
    text-decoration: underline;
}

/* Затемнение фона при открытой модалке */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1500;
}

.overlay.active {
    display: block;
}

.lang-switcher {
    display: flex;
    gap: 8px;
}

.lang-switcher a {
    color: #8b949e;
    text-decoration: none;
    transition: color 0.2s;
}

.lang-switcher a:hover,
.lang-switcher a.active {
    color: #00d1ff;
}

.top-links a {
    color: #8b949e;
    text-decoration: none;
    transition: color 0.2s;
    position: relative;
}

.top-links a:hover {
    color: #ffffff;
}

.separator {
    color: #434956;
}

/* Основной хедер */
.main-header {
    background-color: rgba(15, 17, 23, 0.95);
    backdrop-filter: blur(20px);
    height: 80px;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.main-header.scrolled {
    height: 64px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

/* Логотип */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00d1ff, #8a2be2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.logo-text {
    font-family: var(--ca-font);
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(to right, #00d1ff, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Навигационное меню */
.nav-menu {
    display: flex;
    gap: 32px;
    margin-left: 40px;
}

.nav-item {
    position: relative;
    list-style: none;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-family: var(--ca-font);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link:hover {
    color: #00d1ff;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #00d1ff;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.dropdown-arrow {
    font-size: 12px;
    margin-top: 2px;
}

.badge {
    background-color: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* Правая часть хедера */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.action-icon {
    width: 24px;
    height: 24px;
    color: #8b949e;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.action-icon:hover {
    color: #ffffff;
    transform: translateY(-2px);
}

.icon-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #00d1ff;
    color: white;
    font-size: 10px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Кнопка "Играть сейчас" */
.play-button {
    background: linear-gradient(45deg, #00d1ff, #0099ff);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: var(--ca-font);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 209, 255, 0.4);
    margin-left: 12px;
}

.play-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 209, 255, 0.6);
}

/* Поиск */
.search-container {
    position: relative;
}

.search-input {
    width: 0;
    opacity: 0;
    padding: 8px 16px 8px 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    transition: all 0.3s ease;
    position: absolute;
    right: 0;
    top: -8px;
}

.search-input.active {
    width: 240px;
    opacity: 1;
}

.search-input:focus {
    outline: none;
    border-color: #00d1ff;
    background-color: rgba(255, 255, 255, 0.08);
}

.search-icon {
    position: relative;
    z-index: 2;
}

/* Мобильное меню */
.mobile-menu-btn {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: #8b949e;
}

/* Контент для демонстрации */
.demo-content {
    max-width: 800px;
    margin: 60px auto;
    padding: 40px;
    background-color: rgba(26, 29, 40, 0.5);
    border-radius: 20px;
    text-align: center;
}

.demo-content h1 {
    font-family: var(--ca-font);
    font-size: 36px;
    margin-bottom: 20px;
    color: #00d1ff;
}

.demo-content p {
    color: #b0b7c3;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 20px;
        margin-left: 20px;
    }
}

@media (max-width: 1024px) {
    .nav-menu {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .top-bar {
        font-size: 11px;
        padding: 0 16px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .top-bar {
        flex-direction: column;
        height: auto;
        padding: 8px 16px;
        gap: 8px;
        text-align: center;
    }
    
    .status, .top-links {
        width: 100%;
        justify-content: center;
    }
    
    .main-header {
        height: 70px;
    }
    
    .header-actions {
        gap: 12px;
    }
    
    .play-button {
        padding: 10px 16px;
        font-size: 14px;
        margin-left: 0;
    }
    
    .logo-text {
        display: none;
    }

    .auth-modal {
        right: 50%;
        transform: translateX(50%) translateY(-10px);
        width: 280px;
    }
    
    .auth-modal.active {
        transform: translateX(50%) translateY(0);
    }
}

@media (max-width: 480px) {
    .header-actions .action-icon:nth-child(2),
    .header-actions .action-icon:nth-child(3) {
        display: none;
    }
    
    .play-button span {
        display: none;
    }
    
    .play-button::before {
        content: "🎮";
        font-size: 18px;
    }
}

/* Табло времени для игр «на время» (tc-режим).
   Оформление — в общей идиоме сайта (токены --ca-*, см. ca-theme.css): тёплая
   бумага, мягкая обводка, чернильный акцент. Табло СКРЫТО по умолчанию (управляет
   Vue-обёртка через timerVisible/localStorage), кнопка-глаз показывает/прячет его.
   Видимостью теперь рулит v-if, поэтому старый класс .hidden и компенсирующие
   отступы `~ .game-area` больше не нужны. */

.gp-tc-timer {
    z-index: 100;
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.gp-tc-timer__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid var(--ca-line-soft);
    border-radius: var(--ca-radius);
    background: var(--ca-surface);
    color: var(--ca-muted);
    box-shadow: var(--ca-raise);
    font-size: 14px;
    cursor: pointer;
    transition: color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.gp-tc-timer__toggle:hover {
    color: var(--ca-accent);
    box-shadow: var(--ca-raise-hi);
    transform: translateY(-1px);
}

.stopwatch-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--ca-surface);
    border: 1px solid var(--ca-line-soft);
    border-radius: var(--ca-radius);
    box-shadow: var(--ca-raise);
    color: var(--ca-text);
    font-family: var(--ca-font);
    padding: 8px 12px;
}

.stopwatch-display .time-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 3px 6px;
    border-radius: 6px;
    transition: background .15s ease;
}

.stopwatch-display .time-row .time {
    color: var(--ca-text);
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1.1;
    letter-spacing: .5px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.stopwatch-display .time-row .label {
    display: block;
    color: var(--ca-muted);
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.stopwatch-display .time-row.active {
    background: var(--ca-accent-soft);
    box-shadow: inset 0 0 0 1px var(--ca-line-soft);
}
.stopwatch-display .time-row.active .time { color: var(--ca-accent); }

@media (max-width: 1024px) {
    /* Мобилка: табло в НОРМАЛЬНОМ потоке над полем, а не absolute-оверлеем
       (иначе накрывает верх доски — поле обёрнуто в .gp-game-wrap). */
    .gp-tc-timer {
        position: static;
        top: auto;
        left: auto;
        margin: 12px auto 0;
        justify-content: center;
        align-items: center;
        width: fit-content;
    }
    .stopwatch-display {
        flex-direction: row;
        align-items: center;
        gap: 14px;
        padding: 6px 12px;
    }
    .stopwatch-display .time-row {
        align-items: center;
    }
    .stopwatch-display .time-row .time {
        font-size: 1.15rem;
    }
    .stopwatch-display .time-row .label {
        font-size: 0.62rem;
    }
}
