:root {
    --navy: #0B1120;
    --lime: #D4FF00;
    --yellow: #EEFF00;
    --pink: #E91E8C;
    --text: #F8FAFC;
    --muted: #94A3B8;
    --glass: rgba(30, 41, 59, 0.62);
    --glass-border: rgba(148, 163, 184, 0.15);

    --clay: #FF8A3D;
    --grass: #22C55E;
    --hard: #38BDF8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    min-height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--navy);
    color: var(--text);
    overflow-x: hidden;
}

#bgCanvas { position: fixed; inset: 0; z-index: 0; }

.gradient-mask {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(ellipse 80% 60% at 50% 30%, transparent 30%, var(--navy) 82%);
}

.page {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem 4rem;
}

/* ==================== ШАПКА ==================== */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--lime); }

.btn {
    padding: 0.7rem 1.4rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: inherit;
}
.btn-lime {
    background: var(--lime);
    color: #0B1120;
    box-shadow: 0 4px 16px rgba(212,255,0,0.3);
}
.btn-lime:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(212,255,0,0.45); }
.btn-small { padding: 0.6rem 1.2rem; font-size: 0.85rem; }
.btn-large { padding: 1.1rem 2.2rem; font-size: 1.05rem; }

/* ==================== HERO ==================== */
.hero-titles {
    text-align: center;
    margin-bottom: 3rem;
}

.grand-number {
    width: 130px;
    height: 130px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--lime), var(--yellow), var(--pink));
    box-shadow: 0 0 50px rgba(212,255,0,0.4), 0 0 90px rgba(233,30,140,0.2);
    animation: numberPulse 3s ease-in-out infinite;
}

@keyframes numberPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.gn-value {
    font-family: 'Outfit', sans-serif;
    font-size: 3.4rem;
    font-weight: 900;
    color: #0B1120;
    line-height: 1;
}

.gn-label {
    font-size: 0.6rem;
    font-weight: 800;
    color: #0B1120;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.titles-heading {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: 1rem;
}

.gradient-text {
    background: linear-gradient(135deg, var(--lime), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.gradient-text-reverse {
    background: linear-gradient(135deg, var(--pink), var(--lime));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.titles-sub {
    max-width: 560px;
    margin: 0 auto 2rem;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.6;
}
.titles-sub strong { color: var(--text); }
.hl-lime { color: var(--lime); font-weight: 700; }

.quick-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.qs-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.8rem 1.2rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    min-width: 90px;
}

.qs-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--lime);
}

.qs-item.qs-total .qs-num { color: var(--pink); font-size: 2.1rem; }

.qs-label {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 2px;
}

.qs-plus, .qs-eq {
    font-size: 1.6rem;
    color: var(--muted);
    font-weight: 300;
}

/* ==================== ФИЛЬТРЫ ==================== */
.filter-row {
    display: flex;
    justify-content: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
}

.filter-tab {
    padding: 0.65rem 1.3rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.filter-tab:hover {
    color: var(--text);
    border-color: rgba(212,255,0,0.3);
}

.filter-tab.active {
    background: var(--lime);
    color: #0B1120;
    border-color: var(--lime);
    box-shadow: 0 4px 16px rgba(212,255,0,0.3);
}

.dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    display: inline-block;
}
.dot-clay { background: var(--clay); }
.dot-grass { background: var(--grass); }
.dot-hard { background: var(--hard); }

/* ==================== ЗОНЫ КОРТОВ ==================== */
.courts-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.court-zone {
    padding: 1.8rem;
    border-radius: 22px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.zone-clay { border-left: 4px solid var(--clay); }
.zone-grass { border-left: 4px solid var(--grass); }
.zone-hard { border-left: 4px solid var(--hard); }

.zone-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}
.zone-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}
.zone-icon { font-size: 1.2rem; }
.zone-count {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
}

.balls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: flex-start;
    padding: 0.5rem 0;
}

/* Скрытие зон по фильтру */
.courts-wrapper[data-filter="clay"] .court-zone:not(.zone-clay) { display: none; }
.courts-wrapper[data-filter="grass"] .court-zone:not(.zone-grass) { display: none; }
.courts-wrapper[data-filter="hard"] .court-zone:not(.zone-hard) { display: none; }

/* ==================== ТЕННИСНЫЙ МЯЧ ==================== */
.ball {
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, #F5FF7A 0%, #D4FF00 45%, #9FCE00 100%);
    box-shadow:
        inset -8px -10px 18px rgba(0,0,0,0.28),
        inset 6px 6px 14px rgba(255,255,255,0.4),
        0 8px 20px rgba(0,0,0,0.35);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
    animation: ballFloat 4.5s ease-in-out infinite;
    opacity: 0;
    animation-fill-mode: forwards;
}

.ball.appear {
    animation: ballAppear 0.6s cubic-bezier(0.16,1,0.3,1) forwards, ballFloat 4.5s ease-in-out infinite 0.6s;
}

@keyframes ballAppear {
    from { opacity: 0; transform: scale(0.3) rotate(-90deg); }
    to { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes ballFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(3deg); }
}

.ball::after {
    content: '';
    position: absolute;
    inset: 8%;
    border-top: 2.5px solid rgba(255,255,255,0.6);
    border-bottom: 2.5px solid rgba(255,255,255,0.6);
    border-left: none;
    border-right: none;
    border-radius: 50%;
    transform: rotate(18deg);
    pointer-events: none;
}

.ball:hover {
    transform: scale(1.15) !important;
    animation-play-state: paused;
}

.ball[data-surface="clay"] {
    outline: 3px solid var(--clay);
    outline-offset: 5px;
}
.ball[data-surface="clay"]:hover { box-shadow: 0 0 30px rgba(255,138,61,0.6), inset -8px -10px 18px rgba(0,0,0,0.28); }

.ball[data-surface="grass"] {
    outline: 3px solid var(--grass);
    outline-offset: 5px;
}
.ball[data-surface="grass"]:hover { box-shadow: 0 0 30px rgba(34,197,94,0.6), inset -8px -10px 18px rgba(0,0,0,0.28); }

.ball[data-surface="hard"] {
    outline: 3px solid var(--hard);
    outline-offset: 5px;
}
.ball[data-surface="hard"]:hover { box-shadow: 0 0 30px rgba(56,189,248,0.6), inset -8px -10px 18px rgba(0,0,0,0.28); }

.ball-year {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.05rem;
    color: #0B1120;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

.ball-tag {
    font-size: 0.55rem;
    font-weight: 700;
    color: #0B1120;
    opacity: 0.75;
    position: relative;
    z-index: 2;
    text-align: center;
    line-height: 1;
    margin-top: 2px;
}

/* ==================== НИЖНИЙ CTA ==================== */
.bottom-cta {
    text-align: center;
    margin-top: 4rem;
    padding: 3rem 2rem;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(212,255,0,0.06), rgba(233,30,140,0.06));
    border: 1px solid var(--glass-border);
}

.bottom-cta h2 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    font-weight: 900;
    margin-bottom: 0.8rem;
}

.bottom-cta p {
    color: var(--muted);
    margin-bottom: 1.8rem;
}

/* ==================== OVERLAY С ДЕТАЛЯМИ ==================== */
.title-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(11,17,32,0.86);
    backdrop-filter: blur(18px);
    cursor: pointer;
}
.title-overlay.active { display: flex; }

.title-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 2.4rem 2rem 2rem;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(30,41,59,0.98), rgba(11,17,32,0.96));
    border: 1px solid var(--glass-border);
    box-shadow: 0 18px 60px rgba(0,0,0,0.55);
    text-align: center;
    cursor: default;
    animation: cardPop 0.4s cubic-bezier(0.16,1,0.3,1);
}

@keyframes cardPop {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.title-close {
    position: absolute;
    top: 0.7rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.9rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}
.title-close:hover { color: var(--pink); transform: rotate(90deg); }

.title-surface-badge {
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.2rem;
}
.title-surface-badge.clay { background: rgba(255,138,61,0.15); color: var(--clay); border: 1px solid rgba(255,138,61,0.4); }
.title-surface-badge.grass { background: rgba(34,197,94,0.15); color: var(--grass); border: 1px solid rgba(34,197,94,0.4); }
.title-surface-badge.hard { background: rgba(56,189,248,0.15); color: var(--hard); border: 1px solid rgba(56,189,248,0.4); }

.title-year {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    color: var(--lime);
    line-height: 1;
    margin-bottom: 0.3rem;
}

.title-tournament {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.title-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
}
.title-detail-row:last-of-type { border-bottom: none; }

.detail-label {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
}
.detail-value {
    font-weight: 700;
    text-align: right;
}
.detail-value.score {
    font-family: monospace;
    color: var(--lime);
}

.title-note {
    margin-top: 1.2rem;
    padding: 0.8rem;
    background: rgba(212,255,0,0.08);
    border: 1px solid rgba(212,255,0,0.25);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--lime);
    font-weight: 600;
}

/* ==================== АДАПТИВ ==================== */
@media (max-width: 768px) {
    .page { padding: 1.2rem 1rem 3rem; }
    .top-nav { margin-bottom: 1.8rem; }
    .grand-number { width: 100px; height: 100px; }
    .gn-value { font-size: 2.6rem; }
    .titles-heading { font-size: 1.7rem; }
    .quick-stats { gap: 0.6rem; }
    .qs-item { padding: 0.6rem 0.9rem; min-width: 70px; }
    .qs-num { font-size: 1.4rem; }
    .qs-item.qs-total .qs-num { font-size: 1.6rem; }
    .filter-tab { padding: 0.55rem 1rem; font-size: 0.8rem; }
    .court-zone { padding: 1.2rem; border-radius: 16px; }
    .ball { width: 68px; height: 68px; }
    .ball-year { font-size: 0.9rem; }
    .balls-container { gap: 1rem; justify-content: center; }
    .bottom-cta { padding: 2rem 1.2rem; margin-top: 2.5rem; }
}