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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ── Страница ──────────────────────────────────────────────────────────────── */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
}

/* ── Шапка ─────────────────────────────────────────────────────────────────── */

.header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 14px 20px;
    color: white;
}

.tournament-title {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}

.tournament-desc {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 2px;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.header-username {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ── Подсказка правил ───────────────────────────────────────────────────────── */

.rules-hint {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 14px 18px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rules-hint p {
    margin: 0;
}

.rules-hint ul {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rules-hint strong {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* ── Сетка ─────────────────────────────────────────────────────────────────── */

.bracket {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    align-items: flex-start;
    padding-bottom: 8px;
    transition: opacity 0.2s;
}

/* ── Колонка (= этап) ──────────────────────────────────────────────────────── */

.bracket-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 210px;
    flex-shrink: 0;
}

.col-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.6);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* ── Бой ───────────────────────────────────────────────────────────────────── */

.match {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: background 0.2s;
}

.match:hover {
    background: rgba(255, 255, 255, 0.2);
}

.match--upper { border-left: 3px solid #3b82f6; }
.match--lower { border-left: 3px solid #ef4444; }
.match--grand { border-left: 3px solid #f59e0b; }

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

.match-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* ── Участники ─────────────────────────────────────────────────────────────── */

.participants {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.participants li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.participants li:last-child {
    border-bottom: none;
}

.participant-name {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.75rem;
    padding: 2.6px 6px;
}

.participant-score {
    font-weight: 700;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    min-width: 20px;
    text-align: right;
}

.participant-select {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 3px 24px 3px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.5)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
}

.participant-select:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.18);
}

.participant-select option {
    background: #4a3a6e;
    color: white;
}

/* ── Кнопка назад ───────────────────────────────────────────────────────────── */

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

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 14px;
    transition: background 0.2s, color 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.save-btn {
    background: rgba(34, 197, 94, 0.3);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.4);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.save-btn:hover {
    background: rgba(34, 197, 94, 0.5);
}

.save-status {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 100px;
}

.save-status--ok  { color: #86efac; }
.save-status--err { color: #fca5a5; }

/* ── Страница участников ────────────────────────────────────────────────────── */

.picks-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 500px;
}

.edit-picks-btn {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
    align-self: flex-start;
}

.edit-picks-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.participants-section__title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.participants-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.participants-list__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 16px;
    color: white;
}

.participants-list__item:hover {
    background: rgba(255, 255, 255, 0.18);
}

.participants-list__item--you {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.participants-list__item--you:hover {
    background: rgba(255, 255, 255, 0.25);
}

.participants-list__empty {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
    padding: 10px 0;
}

.participant-email {
    font-size: 0.9rem;
}

.participant-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
}

.you-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    vertical-align: middle;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Карточка игрока (results) ──────────────────────────────────────────────── */

.user-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 16px 20px;
    color: white;
    flex-wrap: wrap;
}

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

.user-summary__name {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-summary__rank {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 2px;
}

.user-summary__score {
    font-size: 1.8rem;
    font-weight: 800;
    color: #a5b4fc;
    white-space: nowrap;
}

.user-summary__score span {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
}

.result-rank {
    display: inline-block;
    min-width: 22px;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    margin-right: 6px;
}

.result-score {
    font-size: 1rem;
    font-weight: 700;
    color: #a5b4fc;
    min-width: 30px;
    text-align: right;
}

.participants-list__item--col {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.participants-list__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gf-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.gf-chip {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.gf-chip--hit      { background: rgba(253, 224, 71, 0.2);  color: #fde047; }
.gf-chip--correct  { background: rgba(134, 239, 172, 0.2); color: #86efac; }
.gf-chip--champion { background: rgba(239, 68, 68, 0.25);  color: #fca5a5; font-weight: 700; }

.my-gf-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Просмотр пиков ─────────────────────────────────────────────────────────── */

.viewer-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.viewer-label--own {
    color: #86efac;
}

.participant-name--empty {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

.participant-name--hit {
    background: rgba(253, 224, 71, 0.25);
    border-radius: 3px;
}

.participant-name--correct {
    background: rgba(134, 239, 172, 0.25);
    border-radius: 3px;
}

.participant-name--champion {
    background: rgba(239, 68, 68, 0.3);
    border-radius: 3px;
    font-weight: 700;
}

/* ── Меню турниров ──────────────────────────────────────────────────────────── */

.tournament-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 600px;
}

.tournament-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 20px 24px;
    text-decoration: none;
    color: white;
    transition: background 0.2s;
}

.tournament-card:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tournament-card__name {
    font-size: 1rem;
    font-weight: 700;
}

.tournament-card__desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

.tournament-card__state {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.state--voting   { background: rgba(34, 197, 94, 0.25);  color: #86efac; }
.state--wait     { background: rgba(234, 179, 8, 0.25);  color: #fde047; }
.state--results  { background: rgba(99, 102, 241, 0.25); color: #a5b4fc; }

/* ── index.html (форма входа) ──────────────────────────────────────────────── */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    color: white;
    text-align: center;
}

.login-card__title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.login-card__sub {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 16px;
}

.google-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    color: #3c3c3c;
    border: none;
    padding: 11px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.google-btn:hover {
    opacity: 0.92;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ── Адаптив (мобильные) ────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .page {
        padding: 12px;
        gap: 12px;
    }

    .header {
        padding: 12px 14px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .tournament-title {
        font-size: 1rem;
    }

    .header-right {
        align-items: flex-start;
        width: 100%;
    }

    .header-actions {
        justify-content: flex-start;
        gap: 6px;
        flex-wrap: wrap;
    }

    .back-btn,
    .logout-btn,
    .save-btn {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Сетка: горизонтальный скролл, чуть уже колонки */
    .bracket {
        padding-bottom: 12px;
    }

    .bracket-col {
        min-width: 160px;
    }

    /* Список участников: на всю ширину */
    .picks-page {
        max-width: 100%;
    }

    .participants-list__item {
        padding: 12px 14px;
        min-height: 44px;
    }

    .participant-email {
        font-size: 0.85rem;
    }

    /* Карточка итогов */
    .user-summary {
        padding: 14px 16px;
        gap: 12px;
    }

    .user-summary__score {
        font-size: 1.5rem;
    }

    /* Меню турниров */
    .tournament-list {
        max-width: 100%;
    }

    .tournament-card {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .tournament-card__state {
        align-self: flex-start;
    }
}
