/* ===== MAIN BET — переменные темы ===== */
:root {
    --accent: #ffd700;
    --accent-2: #ffb300;
    --bg: #141414;
    --bg-2: #1c1c1c;
    --card: #202020;
    --card-hover: #262626;
    --text: #f2f2f2;
    --muted: #9a9a9a;
    --line: #2c2c2c;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    --shadow-accent: 0 10px 30px rgba(255, 215, 0, .18);
    --radius: 14px;
    --header-bg: url('../img/mainbetshapka.jpg');
    --header-bg-mobile: url('../img/shapkaphone.jpg');
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Montserrat', sans-serif; font-weight: 700; }

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

/* ===== Шапка ===== */
.header { background: var(--bg); }

.header-top {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 10px 24px;
    /* aspect-ratio держит кроп баннера одинаковым на любой ширине экрана:
       окно = 36% высоты картинки, надпись MAIN BET + подзаголовок всегда внутри. */
    aspect-ratio: 13.25;
    min-height: 90px;
    background: var(--header-bg) center 85% / cover no-repeat;
    border-bottom: 1px solid var(--line);
}

.header-top::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
}

.header-top > * { position: relative; z-index: 2; }

.social-media { display: flex; gap: 16px; }
.social-link img { width: 22px; height: 22px; opacity: .85; transition: opacity .3s, transform .3s; }
.social-link:hover img { opacity: 1; transform: translateY(-2px); }

.contact-info { justify-self: end; color: #fff; font-size: 14px; }
.ad-text { color: rgba(255, 255, 255, .85); white-space: nowrap; }

.header-main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo h1 {
    margin: 0;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    white-space: nowrap;   /* логотип не ломается на строки, сколько бы ни было категорий */
}
.logo h1::first-letter { color: var(--accent); }
.logo a { color: inherit; text-decoration: none; display: inline-block; }

.menu-toggle {
    width: 26px; height: 18px;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}
.menu-toggle span { height: 2px; background: #fff; border-radius: 2px; transition: .3s; }

.main-nav { margin-left: auto; min-width: 0; }
/* Категорий может быть много - переносим ряды аккуратно, прижимая вправо */
.nav-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.nav-link, .mobile-link {
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .14);
    transition: all .25s ease;
}
.nav-link:hover, .mobile-link:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.nav-link.active, .mobile-link.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* ===== Мобильное меню ===== */
.mobile-menu {
    position: fixed;
    top: 0; left: -320px;
    width: 300px; height: 100vh;
    background: var(--bg-2);
    z-index: 1000;
    box-shadow: 2px 0 18px rgba(0, 0, 0, .5);
    opacity: 0; pointer-events: none;
    overflow-y: auto;
    transition: left .35s cubic-bezier(.4, 0, .2, 1), opacity .35s;
}
.mobile-menu.active { left: 0; opacity: 1; pointer-events: auto; }
.mobile-menu-header { padding: 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: flex-end; }
.close-menu {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 20px; cursor: pointer;
    border-radius: 50%; background: rgba(255, 255, 255, .08);
    transition: .3s;
}
.close-menu:hover { color: var(--accent); transform: rotate(90deg); }
.mobile-nav { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.mobile-link { text-align: center; }

.menu-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 999;
    opacity: 0; pointer-events: none;
    transition: opacity .3s;
}
.menu-overlay.active { opacity: 1; pointer-events: auto; }

/* ===== Контент ===== */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 24px 60px;
    min-height: 60vh;
}

.sport-section { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.sport-section h2 {
    text-align: center;
    font-size: clamp(24px, 4vw, 34px);
    color: var(--accent);
    margin: 0 0 10px;
}

.divider {
    height: 3px;
    width: 110px;
    margin: 0 auto 30px;
    background: linear-gradient(90deg, var(--accent), transparent);
    border-radius: 3px;
}

.grid-loader, .grid-empty {
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
    font-size: 15px;
}

/* ===== Сетка карточек ===== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}

.news-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform .3s ease, box-shadow .3s ease, background .3s;
}
.news-card:hover {
    transform: translateY(-6px);
    background: var(--card-hover);
    border-color: var(--accent);
    box-shadow: var(--shadow-accent);
}

.card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #0d0d0d;
    overflow: hidden;
}
.card-media img, .card-media video {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.news-card:hover .card-media img,
.news-card:hover .card-media video { transform: scale(1.05); }
.card-media--empty {
    background: linear-gradient(135deg, #1a1a1a, #262626);
}
.play-badge {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 54px; height: 54px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .55);
    color: #fff; font-size: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .8);
    pointer-events: none;
}

.news-category {
    position: absolute;
    top: 12px; right: 12px;
    background: var(--accent);
    color: #000;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    z-index: 2;
}

.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.news-card h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
    color: var(--accent);
    font-weight: 600;
}
.news-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Модалка ===== */
.modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .85);
    z-index: 2000;
    padding: 24px;
    overflow-y: auto;
}
.modal.active { display: flex; }

.modal-content {
    position: relative;
    width: 100%;
    max-width: 820px;
    margin: auto;
    background: linear-gradient(150deg, #232323, #161616);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 34px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    animation: modalPop .3s ease;
}
@keyframes modalPop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-close {
    position: absolute;
    top: 16px; right: 18px;
    background: none; border: none;
    color: #fff; font-size: 30px;
    cursor: pointer; line-height: 1;
    transition: transform .3s, color .3s;
}
.modal-close:hover { color: var(--accent); transform: rotate(90deg); }

.modal-title {
    margin: 0 40px 6px 0;
    font-size: clamp(20px, 3vw, 30px);
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.modal-meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.modal-media { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.modal-media img, .modal-media video {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #000;
    border-radius: 12px;
}
.yt-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}
.yt-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.modal-description {
    color: #e2e2e2;
    line-height: 1.75;
    font-size: 15px;
    padding: 18px;
    background: rgba(255, 255, 255, .04);
    border-radius: 12px;
}
.modal-description p { margin: 0; }

/* ===== Страница новости ===== */
.article-wrap { max-width: 820px; margin: 0 auto; padding: 36px 24px 70px; }

.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted); text-decoration: none;
    font-size: 14px; font-weight: 600; margin-bottom: 26px;
    transition: color .2s, gap .2s;
}
.back-link:hover { color: var(--accent); gap: 10px; }

.article-cat {
    display: inline-block;
    background: var(--accent); color: #000;
    font-family: 'Montserrat', sans-serif; font-weight: 700;
    font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
    padding: 6px 13px; border-radius: 7px; text-decoration: none;
    transition: filter .2s;
}
.article-cat:hover { filter: brightness(1.08); }

.article-title {
    font-size: clamp(28px, 4.6vw, 46px);
    line-height: 1.15;
    margin: 18px 0 16px;
    color: var(--text);
    letter-spacing: -.3px;
}
.article-meta {
    display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
    color: var(--muted); font-size: 14px;
    padding-bottom: 24px; margin-bottom: 30px;
    border-bottom: 1px solid var(--line);
}

.article-lead {
    font-size: clamp(17px, 2.2vw, 20px);
    line-height: 1.6; color: #cfcfcf; font-weight: 500;
    margin: 0 0 28px;
    border-left: 3px solid var(--accent);
    padding-left: 18px;
}

/* Карусель медиа */
.media-carousel {
    position: relative;
    margin-bottom: 34px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow);
}
.mc-track { display: flex; transition: transform .4s cubic-bezier(.4, 0, .2, 1); }
.mc-slide {
    min-width: 100%;
    aspect-ratio: 16 / 9;
    display: flex; align-items: center; justify-content: center;
    background: #000;
}
.mc-slide img, .mc-slide video, .mc-slide iframe {
    width: 100%; height: 100%; object-fit: contain; border: 0; display: block;
}
.mc-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 46px; height: 46px; border-radius: 50%;
    border: none; background: rgba(0, 0, 0, .55); color: #fff;
    font-size: 28px; line-height: 1; cursor: pointer; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s, color .2s;
}
.mc-btn:hover { background: var(--accent); color: #000; }
.mc-prev { left: 12px; }
.mc-next { right: 12px; }
.mc-counter {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    background: rgba(0, 0, 0, .6); color: #fff;
    font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 20px;
}
.mc-dots {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px; z-index: 2;
}
.mc-dot {
    width: 9px; height: 9px; border-radius: 50%; padding: 0;
    background: rgba(255, 255, 255, .45); border: none; cursor: pointer;
    transition: background .2s, transform .2s;
}
.mc-dot.active { background: var(--accent); transform: scale(1.25); }

.article-body { font-size: 18px; line-height: 1.85; color: #dcdcdc; }
.article-body p { margin: 0 0 22px; }
.article-body p:last-child { margin-bottom: 0; }

.article-notfound { text-align: center; padding: 60px 0; }
.article-notfound h1 { color: var(--accent); margin-bottom: 12px; }
.article-notfound a { color: var(--accent); }

@media (max-width: 600px) {
    .article-wrap { padding: 22px 16px 50px; }
    .article-body { font-size: 16px; line-height: 1.75; }
}

/* ===== Футер ===== */
.footer { background: var(--bg-2); padding: 46px 0 22px; margin-top: 40px; border-top: 1px solid var(--line); }
.footer-content {
    max-width: 1200px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 30px; padding: 0 24px;
}
.footer-section h4 { color: var(--accent); margin: 0 0 14px; font-size: 18px; }
.footer-section p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 8px; }
.certificate {
    font-size: 12px; line-height: 1.5; color: #888;
    margin-top: 16px; padding: 14px;
    border: 1px solid rgba(255, 215, 0, .18);
    border-radius: 10px;
    background: rgba(255, 255, 255, .03);
}
.footer-social { display: flex; gap: 14px; }
.footer-social img { width: 24px; height: 24px; transition: opacity .3s; }
.footer-social a:hover img { opacity: .7; }
.footer-bottom {
    max-width: 1200px; margin: 28px auto 0;
    padding: 18px 24px 0;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--muted); font-size: 13px;
}

/* ===== Адаптив ===== */
@media (max-width: 900px) {
    .nav-buttons { display: none; }
    .menu-toggle { display: flex; }
    .main-nav { margin-left: 0; }
    .header-main { gap: 16px; }
}

@media (max-width: 768px) {
    .header-top {
        grid-template-columns: 1fr;
        justify-items: center;
        background: var(--header-bg-mobile) center / cover no-repeat;
        aspect-ratio: auto;   /* на телефоне высота как была */
        min-height: 72px;
    }
    .social-media, .contact-info, .logo-center { display: none; }
    .footer-content { grid-template-columns: 1fr; text-align: center; }
    .footer-social { justify-content: center; }
    .modal-content { padding: 22px 18px; }
    .main-container { padding: 24px 16px 50px; }
}

@media (max-width: 480px) {
    .news-grid { grid-template-columns: 1fr; }
    .logo h1 { font-size: 20px; }
}
