/* ================================================================
   Кубок субъектов Russialoppet - лендинг зачётов
   Дизайн-система унаследована от regions-cup-demino / organizer-demino
   ================================================================ */

:root {
    /* Цвета */
    --bg: #ffffff;
    --bg-soft: #f6f7f9;
    --bg-dark: #0a0a0a;
    --text: #111111;
    --text-soft: #5f6670;
    --text-faint: #8a9099;
    --text-invert: #ffffff;

    --blue: #1d4ed8;
    --blue-deep: #173ea6;
    --blue-soft: #eaf0ff;
    --red: #dc2626;
    --red-soft: #fdecec;
    --gold: #b8860b;
    --silver: #6c757d;
    --bronze: #a05a2c;

    --border: #e5e7eb;
    --border-soft: #eef0f3;

    /* Тени */
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

    /* Радиусы */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-full: 50%;

    /* Шрифты */
    --font-display: 'Bebas Neue Pro', 'Arial Narrow', sans-serif;
    --font-text: 'Yandex Sans Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Размеры */
    --max-width: 1120px;
    --hero-height: 440px;
    --hero-height-mobile: 260px;
    --avatar-size: 128px;
    --avatar-size-mobile: 84px;
}

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

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-text);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ================================================================
   ШАПКА (Facebook-style)
   ================================================================ */

.hero {
    margin-bottom: 16px;
}

.hero-cover {
    position: relative;
    height: var(--hero-height);
    overflow: hidden;
    background: #0a0a0a;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.15) 0%,
            rgba(0, 0, 0, 0.35) 45%,
            rgba(0, 0, 0, 0.72) 100%
        );
    pointer-events: none;
}

.hero-panel {
    position: absolute;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%);
    text-align: center;
    padding: 24px 44px;
    background: rgba(10, 10, 10, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: calc(100% - 48px);
}

.hero-title {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 1;
    color: var(--text-invert);
    text-transform: uppercase;
    white-space: nowrap;
}

.hero-subtitle {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.5px;
}

.hero-region {
    font-weight: 600;
    color: #ffffff;
}

.hero-dot {
    color: rgba(255, 255, 255, 0.45);
}

.hero-district {
    font-weight: 400;
}

.hero-bar {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    height: 0;
}

.hero-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: var(--radius-full);
    border: 5px solid var(--bg);
    background: var(--bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 2;
}

.hero-avatar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hero-avatar-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
}

/* ================================================================
   КЛЮЧЕВЫЕ ЦИФРЫ
   ================================================================ */

.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 40px 0 48px;
}

.stat-cell {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-cell:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-cell-value {
    font-family: var(--font-display);
    font-size: 44px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    color: var(--text);
}

.stat-cell-value.accent-blue { color: var(--blue); }
.stat-cell-value.accent-red { color: var(--red); }

.stat-cell-label {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

/* ================================================================
   СЕКЦИИ
   ================================================================ */

.section {
    margin-bottom: 56px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text);
    text-transform: uppercase;
    margin-bottom: 26px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--border-soft);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 64px;
    height: 2px;
    background: var(--blue);
}

/* ================================================================
   ТУРНИРНАЯ ТАБЛИЦА
   ================================================================ */

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

.region-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.region-card:hover {
    box-shadow: var(--shadow);
}

.region-card.is-open {
    border-color: #c7d4f5;
    box-shadow: var(--shadow);
}

.region-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
}

.region-head:hover {
    background: var(--bg-soft);
}

.region-rank {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-soft);
    min-width: 44px;
    text-align: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.region-rank.region-rank-1 { color: var(--gold); }
.region-rank.region-rank-2 { color: var(--silver); }
.region-rank.region-rank-3 { color: var(--bronze); }

.region-logo {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.region-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.region-name {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text);
    text-transform: uppercase;
    flex: 1;
    min-width: 0;
}

.region-points {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--blue);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.region-points-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.region-points-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-faint);
    line-height: 1.2;
    white-space: nowrap;
}

.region-chevron {
    width: 12px;
    height: 12px;
    border-right: 2px solid var(--text-soft);
    border-bottom: 2px solid var(--text-soft);
    transform: rotate(45deg);
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 4px;
}

.region-card.is-open .region-chevron {
    transform: rotate(-135deg);
}

/* --- Раскрытое содержимое региона --- */
.region-body {
    border-top: 1px solid var(--border-soft);
    padding: 20px 22px 24px;
    background: #fbfcfe;
}

.region-subtitle {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text);
    text-transform: uppercase;
    margin-bottom: 14px;
}

.participant-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
}

.participant {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-soft);
}

.participant:last-child {
    border-bottom: none;
}

.participant-place {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: var(--bg-soft);
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
}

.participant-place.place-1 { background: #f7e9c3; color: #8a6d1a; }
.participant-place.place-2 { background: #eceff2; color: #5f6670; }
.participant-place.place-3 { background: #f3e4d9; color: #a05a2c; }

.participant-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-name:hover {
    color: var(--blue);
    text-decoration: underline;
}

.participant-yob {
    font-size: 12px;
    color: var(--text-faint);
    flex-shrink: 0;
}

.participant-points {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.region-all {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.region-all-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    font-family: var(--font-text);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.region-all-toggle:hover {
    border-color: var(--text);
}

.region-all-list {
    margin-top: 14px;
}

/* --- Возрастные группы --- */
.age-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.age-group {
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--blue);
    border-radius: var(--radius-sm);
    background: #fbfcfe;
}

.age-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.age-group-label {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text);
    text-transform: uppercase;
}

.age-group-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    white-space: nowrap;
}

.age-group .participant-list {
    grid-template-columns: 1fr;
}

/* ================================================================
   КУБОК СУБЪЕКТОВ: навигация и «Этапы в зачёте» (общий зачёт)
   ================================================================ */

.cup-nav {
    margin: 76px 0 0;
}

.cup-nav + .stats-strip {
    margin-top: 16px;
}

.cup-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-soft);
    text-decoration: none;
    transition: color 0.2s;
}

.cup-nav-link::before {
    content: '\2190';
    font-size: 16px;
    line-height: 1;
}

.cup-nav-link:hover {
    color: var(--blue);
}

.cup-stages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cup-stage {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: #fbfcfe;
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--blue);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.cup-stage:hover {
    background: var(--bg);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.cup-stage-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cup-stage-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.cup-stage:hover .cup-stage-name {
    color: var(--blue);
}

.cup-stage-date {
    font-size: 12px;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cup-stage-points {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--blue);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* --- Строка этапа в зачёте субъекта: мини-лого марафона --- */

.cup-stage-logo {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cup-stage-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* --- Этапы сезона (главная страница кубка) --- */

.events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.event-card:hover {
    border-color: #c7d4f5;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.event-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.event-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.event-card:hover .event-name {
    color: var(--blue);
}

.event-meta {
    font-size: 13px;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* В подписи слева дата видна только на мобильных (на десктопе она справа) */
.event-meta .em-date,
.event-meta .em-sep {
    display: none;
}

/* Справа от названия (десктоп): крупная красная дата + статус, затем флаг */
.event-date-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 8px;
}

.event-date {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1;
    color: var(--text);
    white-space: nowrap;
}

.event-status {
    display: block;
    white-space: nowrap;
}

.event-flag {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 2px solid var(--border-soft);
    background: var(--bg-soft);
}

.event-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Мини-кружок с флагом региона этапа (строка «Этапы в зачёте») --- */

.cup-stage-flag {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.cup-stage-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Незачётные этапы (мелкие блоки по несколько в ряд) --- */

.region-other {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.cup-stages-mini {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.cup-stage-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    min-width: 0;
    background: var(--bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cup-stage-mini:hover {
    border-color: #c7d4f5;
    box-shadow: var(--shadow-sm);
}

.cup-stage-mini-logo {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cup-stage-mini-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cup-stage-mini-flag {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.cup-stage-mini-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cup-stage-mini-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.cup-stage-mini-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.cup-stage-mini:hover .cup-stage-mini-name {
    color: var(--blue);
}

.cup-stage-mini-date {
    font-size: 11px;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cup-stage-mini-points {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--blue);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1000px) {
    .cup-stages-mini {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .cup-stages-mini {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* --- Загрузка данных --- */

.loading-block {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 64px 0;
}

.spinner {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    animation: spin 0.8s linear infinite;
}

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

/* --- Этап без опубликованных результатов --- */

.empty-state {
    padding: 48px 24px;
    text-align: center;
    background: var(--bg-soft);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 15px;
    color: var(--text-soft);
    max-width: 560px;
    margin: 0 auto;
}

/* ================================================================
   ПОДВАЛ
   ================================================================ */

.footer {
    background: var(--bg-dark);
    color: var(--text-invert);
    padding: 36px 0;
    margin-top: 16px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
}

.footer-link {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #7aa0ff;
}

/* ================================================================
   АДАПТИВ
   ================================================================ */

@media (max-width: 1000px) {
    .stats-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .participant-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    :root {
        --hero-height: var(--hero-height-mobile);
        --avatar-size: var(--avatar-size-mobile);
    }

    .hero-panel {
        bottom: 56px;
        padding: 16px 22px;
        max-width: calc(100% - 32px);
    }

    .hero-title {
        font-size: 30px;
        letter-spacing: 1px;
        white-space: normal;
    }

    .hero-subtitle {
        display: none;
    }

    .hero-bar {
        padding: 0 16px;
    }

    .stats-strip {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 28px 0 36px;
    }

    .stat-cell {
        padding: 16px;
    }

    .stat-cell-value {
        font-size: 34px;
    }

    .section {
        margin-bottom: 40px;
    }

    .section-title {
        font-size: 26px;
    }

    .region-head {
        gap: 10px;
        padding: 14px 16px;
    }

    .region-rank {
        font-size: 22px;
        min-width: 30px;
    }

    .region-logo {
        width: 34px;
        height: 34px;
    }

    .region-name {
        font-size: 17px;
    }

    .region-points {
        font-size: 22px;
    }

    .region-body {
        padding: 16px;
    }

    .cup-nav {
        margin-top: 56px;
    }

    .cup-nav + .stats-strip {
        margin-top: 12px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* ================================================================
   МОБИЛЬНЫЙ: экран уже 500px
   ================================================================ */

@media (max-width: 500px) {
    /* в подписи под очками оставляем «N этапов», «в зачёте» скрываем */
    .rz-inzachet {
        display: none;
    }

    /* названия и подписи этапов в зачёте - перенос до двух строк */
    .cup-stage-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 100%;
    }

    .cup-stage-date {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        font-size: 11px;
        line-height: 100%;
    }

    /* этапы сезона: подпись мельче и компактнее */
    .event-meta {
        font-size: 11px;
        line-height: 100%;
    }
}

/* ================================================================
   ПЛАНШЕТ/МОБИЛЬНЫЙ: этапы сезона - дата из правого блока уходит в подпись
   ================================================================ */

@media (max-width: 720px) {
    .event-date-col {
        display: none;
    }

    .event-meta .em-date,
    .event-meta .em-sep {
        display: inline;
    }
}

