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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f6f4fa;
    color: #1d1b26;
    line-height: 1.5;
    min-height: 100vh;
}

/* ---- Auth pages ---- */
/* Сбрасываем верхний отступ content на auth-страницах,
   чтобы карточка по-настоящему центрировалась. */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px 0;
    margin-top: -40px; /* компенсирует margin: 40px auto от .content */
    margin-bottom: -40px;
}

.auth-card {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(45, 20, 80, 0.10);
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 32px;
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: #6b6577;
    margin-bottom: 24px;
}

/* ---- Forms ---- */
.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d6d1de;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s;
}

.form-field input:focus {
    border-color: #4a1d7a;
}

.form-checkbox {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s;
}

.btn-primary {
    background: #4a1d7a;
    color: #fff;
    width: 100%;
    margin-top: 8px;
}

.btn-primary:hover {
    background: #371458;
}

.btn-secondary {
    background: #ece6f2;
    color: #1d1b26;
    margin-top: 8px;
}

.btn-secondary:hover {
    background: #ddd4e6;
}

.btn-link {
    background: none;
    border: none;
    color: #4a1d7a;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    font-family: inherit;
}

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

/* ---- Alerts ---- */
.error-box {
    background: #ffe5e5;
    color: #8b0000;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.success-box {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* ---- Site header / nav ---- */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e0ec;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    color: #4a1d7a;
}

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

.site-nav a,
.site-nav .nav-user {
    color: #1d1b26;
    text-decoration: none;
}

.site-nav a:hover {
    color: #4a1d7a;
}

.nav-user {
    font-weight: 500;
}

/* ---- Content ---- */
.content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
}

.content h1 {
    font-size: 28px;
    margin-bottom: 16px;
}

.content p {
    margin-bottom: 16px;
}

/* ---- Debug ---- */
.debug {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-top: 40px;
    font-family: "Courier New", monospace;
}

.debug h3 {
    margin-bottom: 12px;
}

.debug ul {
    list-style: none;
    padding-left: 0;
}

.debug li {
    padding: 4px 0;
}

/* ---- Lobby blocks ---- */
.lobby-block {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(45, 20, 80, 0.06);
}

.lobby-block h2 {
    font-size: 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.lobby-block .badge {
    background: #4a1d7a;
    color: #fff;
    font-size: 13px;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.muted {
    color: #86808f;
}

.btn-large {
    font-size: 18px;
    padding: 14px 28px;
}

/* Активная партия */
.lobby-active {
    background: #fff8e6;
    border-left: 4px solid #ffaa00;
}

.active-game-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.game-info {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.game-info > div {
    color: #555;
}

/* Приглашения */
.invitations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.invitation-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f6f3fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.invitation-meta {
    color: #86808f;
    font-size: 14px;
    margin-top: 4px;
}

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

.invitation-actions .btn {
    width: auto;
    margin: 0;
}

.invitation-timer.expired {
    color: #c00;
    font-weight: 500;
}

/* Создание стола */
.lobby-cta {
    text-align: center;
    background: linear-gradient(135deg, #4a1d7a 0%, #2d0e52 100%);
    color: #fff;
}

.lobby-cta h2 {
    color: #fff;
}

.lobby-cta .muted {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 20px;
}

.lobby-cta .btn-primary {
    background: #fff;
    color: #4a1d7a;
    width: auto;
}

.lobby-cta .btn-primary:hover {
    background: #f0e9f7;
}

/* Онлайн-игроки */
.online-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.online-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f9f0;
    padding: 6px 12px;
    border-radius: 20px;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34c759;
    box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.2);
}

/* Таблица последних партий */
.games-table {
    width: 100%;
    border-collapse: collapse;
}

.games-table th,
.games-table td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 1px solid #ece6f2;
}

.games-table th {
    font-weight: 500;
    color: #86808f;
    font-size: 14px;
}

.games-table tr:last-child td {
    border-bottom: none;
}

/* ---- Форма создания стола ---- */
.game-create-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 500;
}

.target-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.target-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid #d6d1de;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}

.target-option:has(input:checked) {
    background: #4a1d7a;
    color: #fff;
    border-color: #4a1d7a;
}

.target-option input {
    margin: 0;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.player-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid #d6d1de;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
    transition: all 0.15s;
}

.player-option:has(input:checked) {
    background: #f0f9f0;
    border-color: #34c759;
}

.player-option input {
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.form-actions .btn {
    width: auto;
    margin: 0;
}

/* ---- Экран партии ---- */
.game-screen .game-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.game-screen h2 {
    margin-bottom: 4px;
}

.game-status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-waiting { background: #fff8e6; color: #b87900; }
.status-in_progress { background: #d4edda; color: #155724; }
.status-finished { background: #e5e0ec; color: #555; }
.status-abandoned { background: #ffe5e5; color: #8b0000; }

.invite-cta {
    background: #fff8e6;
    border-left: 4px solid #ffaa00;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.invite-cta p {
    margin: 0;
}

.players-title {
    font-size: 16px;
    margin: 24px 0 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.players-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f6f3fa;
    border-radius: 8px;
}

.player-row-declined,
.player-row-expired {
    opacity: 0.5;
}

.player-row-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.seat-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ece6f2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
}

.player-name {
    font-weight: 500;
}

.player-tag {
    background: #4a1d7a;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 6px;
    font-weight: 500;
    vertical-align: middle;
}

.player-row-status {
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.accepted { background: #34c759; }
.status-dot.pending { background: #ffaa00; }
.status-dot.declined { background: #aaa; }

.game-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.game-actions .btn {
    width: auto;
    margin: 0;
}

.refresh-hint {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
}

.game-placeholder {
    margin-top: 24px;
    padding: 40px;
    text-align: center;
    background: #f6f3fa;
    border-radius: 8px;
}

.game-placeholder p {
    margin: 4px 0;
}

/* ---- Перетасовка порядка ---- */
.players-reorderable .player-row-reorderable {
    cursor: default;
}

.player-row-actions {
    display: flex;
    gap: 4px;
}

.reorder-btn {
    background: #fff;
    border: 1px solid #d6d1de;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    transition: all 0.15s;
    padding: 0;
    line-height: 1;
}

.reorder-btn:hover {
    background: #4a1d7a;
    color: #fff;
    border-color: #4a1d7a;
}

.reorder-btn:active {
    transform: scale(0.95);
}

.reorder-status {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: #86808f;
    min-height: 20px;
}

.reorder-status.saved {
    color: #34c759;
}

.reorder-status.error {
    color: #c00;
}

/* ---- Опасные кнопки ---- */
.btn-danger {
    background: #c00;
    color: #fff;
}

.btn-danger:hover {
    background: #a00;
}
/* Активный игрок в таблице ходов */
.seat-num-current {
    background: #4a1d7a;
    color: #fff;
}

/* ---- Профиль игрока ---- */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

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

.profile-name {
    font-size: 28px;
    margin: 0;
}

.profile-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-actions .btn {
    width: auto;
    margin: 0;
}

/* Сводка */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.stat-card {
    padding: 16px;
    background: #f9f9fb;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.stat-label {
    font-size: 13px;
    color: #86868b;
    margin-top: 4px;
}

.stat-sub {
    font-size: 11px;
    margin-top: 4px;
}

/* Рейтинги */
.ratings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.rating-card {
    padding: 14px 16px;
    background: linear-gradient(135deg, #f5f9fc, #ffffff);
    border-radius: 8px;
    border: 1px solid #e8eef5;
}

.rating-target {
    font-size: 12px;
    color: #86868b;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
}

.rating-row {
    padding: 8px 0;
    border-top: 1px solid #f0f0f2;
}

.rating-row:first-of-type {
    border-top: none;
    padding-top: 0;
}

.rating-row:last-of-type {
    padding-bottom: 0;
}

.rating-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.rating-row-bottom {
    font-size: 11px;
    margin-top: 2px;
}

.rating-season {
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rating-row.rating-current .rating-season {
    color: #34c759;
    font-weight: 500;
}

.rating-row.rating-leader .rating-season {
    color: #b87900;
    font-weight: 600;
}

.rating-row.rating-leader {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.08), transparent);
    border-radius: 4px;
    padding-left: 8px;
    padding-right: 8px;
    margin-left: -8px;
    margin-right: -8px;
}

.rating-value {
    font-size: 22px;
    font-weight: 700;
    color: #0066cc;
    line-height: 1;
}

.rating-row.rating-archive .rating-value {
    color: #555;
    font-size: 18px;
}

.rating-row.rating-leader .rating-value {
    color: #b87900;
}

.rating-badge {
    font-size: 14px;
}

/* График */
.chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}

.chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868b;
    font-size: 14px;
    background: #f9f9fb;
    border-radius: 8px;
}

.chart-tab.chart-tab-active-season::after {
    content: ' •';
    color: #34c759;
}

.chart-tab.chart-tab-active-season.active::after {
    color: #fff;
}

/* Ачивки */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.achievement-card {
    padding: 14px;
    border-radius: 8px;
    background: #f9f9fb;
    position: relative;
}

.achievement-card.unlocked {
    background: linear-gradient(135deg, #fff8e6, #fff4d6);
    border-left: 3px solid #ffaa00;
}

.achievement-card.locked {
    opacity: 0.55;
}

.achievement-points {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #0066cc;
}

.achievement-card.locked .achievement-points {
    color: #86868b;
}

.achievement-title {
    font-weight: 600;
    margin-bottom: 4px;
    padding-right: 50px;
}

.achievement-desc {
    font-size: 13px;
    color: #555;
}

.achievement-date {
    font-size: 11px;
    color: #86868b;
    margin-top: 6px;
}

.achievements-locked {
    margin-top: 16px;
}

.achievements-locked summary {
    cursor: pointer;
    color: #86868b;
    font-size: 14px;
    user-select: none;
}

.achievements-locked summary:hover {
    color: #0066cc;
}

/* Партии в профиле */
.games-table tr.is-winner {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.08), transparent);
}

.games-table .positive {
    color: #34c759;
}

.games-table .negative {
    color: #c00;
}

.games-table .btn-link {
    color: #0066cc;
    text-decoration: none;
}

.games-table .btn-link:hover {
    text-decoration: underline;
}

/* ---- Группы статистики (миниблоки внутри секций) ---- */
.stats-group {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f2;
}

.stats-group:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.stats-group-title {
    font-size: 14px;
    font-weight: 500;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 12px;
}

.stats-group-title-toggle {
    font-size: 14px;
    font-weight: 500;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    margin-bottom: 12px;
}

.stats-group-title-toggle::before {
    content: '▸ ';
    display: inline-block;
    transition: transform 0.15s;
}

details[open] > .stats-group-title-toggle::before {
    transform: rotate(90deg);
}

.stats-group-title-toggle:hover {
    color: #0066cc;
}

/* ---- Иконки ачивок ---- */
.achievement-icon {
    position: absolute;
    top: 12px;
    left: 14px;
    font-size: 18px;
    color: #ffaa00;
    line-height: 1;
}

.achievement-card.locked .achievement-icon {
    color: #c5c5cf;
}

.achievement-card .achievement-title {
    padding-left: 24px;
    padding-right: 50px;
}

.achievement-card .achievement-desc {
    padding-left: 24px;
}

.achievement-card .achievement-date {
    padding-left: 24px;
}

/* ---- Маленькие кнопки ---- */
.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    width: auto;
    margin: 0;
}

/* ---- Табы графика ---- */
.chart-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.chart-tab {
    background: #f9f9fb;
    border: 1px solid #e5e5ea;
    color: #555;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    font-family: inherit;
}

.chart-tab:hover {
    background: #f0f0f2;
    color: #1d1d1f;
}

.chart-tab.active {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

/* ---- Аватары ---- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #0066cc, #4ecdc4);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 28px;
}

/* Шапка профиля — теперь использует .avatar-lg, удаляем старый .profile-avatar */
.profile-id {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Online-item с аватаром */
.online-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f9f0;
    padding: 6px 12px 6px 6px;
    border-radius: 20px;
}

/* Player-row с аватаром */
.player-row-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Аватар в таблицах партий */
.games-table .avatar-sm {
    margin-right: 6px;
    vertical-align: middle;
}

/* Скрытый input для загрузки аватара */
.avatar-upload-form {
    display: inline-block;
}

/* ---- История партий: фильтры ---- */
.history-filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: #f9f9fb;
    border-radius: 8px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-field label {
    font-size: 12px;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
}

.filter-field select {
    padding: 6px 10px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    min-width: 150px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fff8e6;
    border-left: 3px solid #ffaa00;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.filter-pill-clear {
    color: #b87900;
    text-decoration: none;
    font-weight: 700;
    padding: 0 4px;
    border-radius: 4px;
}

.filter-pill-clear:hover {
    background: rgba(184, 121, 0, 0.15);
}

/* ---- Пагинация ---- */
.pagination-wrap {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.pagination-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.page-item {
    list-style: none;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    background: #fff;
    color: #1d1d1f;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    user-select: none;
}

.page-link:hover {
    background: #0066cc;
    border-color: #0066cc;
    color: #fff;
}

.page-item.active .page-link {
    background: #0066cc;
    border-color: #0066cc;
    color: #fff;
    cursor: default;
}

.page-item.disabled .page-link {
    color: #c5c5cf;
    background: #f9f9fb;
    border-color: #e5e5ea;
    cursor: default;
    pointer-events: none;
}

.pagination-info {
    font-size: 12px;
    color: #86868b;
}

/* ---- Заголовок секции стат с табами ---- */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.stats-header h2 {
    margin: 0;
}

/* ---- Детали партии: победитель ---- */
.winner-banner {
    background: linear-gradient(135deg, #fff8e6, #fff4d6);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ffaa00;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.winner-name {
    font-size: 22px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 2px 0;
}

/* ---- Таблица деталей участников ---- */
.game-details-table-wrap {
    overflow-x: auto;
}

.game-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.game-details-table th,
.game-details-table td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid #f0f0f2;
    vertical-align: middle;
}

.game-details-table th {
    font-weight: 500;
    color: #86868b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.game-details-table tr.is-winner {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.08), transparent);
}

.game-details-table tr.is-kicked {
    opacity: 0.6;
}

.game-details-table tr:last-child td {
    border-bottom: none;
}

/* ---- Хронология ходов ---- */
.timeline-details {
    margin-top: 24px;
}

.timeline-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13px;
}

.timeline-table th,
.timeline-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #f5f5f7;
}

.timeline-table th {
    font-weight: 500;
    color: #86868b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #f9f9fb;
}

.timeline-table tr.is-zonk td {
    color: #aaa;
}

.timeline-table tr.is-penalty td {
    color: #c00;
}

/* ---- Админка ---- */
.admin-wrap {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: flex-start;
}

.admin-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 16px;
}

.admin-sidebar-title {
    font-size: 12px;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
    margin: 0 0 12px;
    padding: 0 12px;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-nav-link {
    padding: 8px 12px;
    border-radius: 6px;
    color: #1d1d1f;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
}

.admin-nav-link:hover {
    background: #f0f0f2;
}

.admin-nav-link.active {
    background: #0066cc;
    color: #fff;
    font-weight: 500;
}

.admin-content {
    min-width: 0; /* для grid: чтобы контент не растягивал колонку */
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-section-header h2 {
    margin: 0;
}

.admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.grant-form {
    margin-top: 12px;
}

/* На узких экранах — admin sidebar сверху */
@media (max-width: 768px) {
    .admin-wrap {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        position: static;
    }
    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
}