:root {
    --bg: #07130f;
    --panel: rgba(15, 38, 30, 0.78);
    --panel-strong: rgba(20, 55, 42, 0.95);
    --text: #f2fff7;
    --muted: #a9c8b8;
    --line: rgba(221, 255, 231, 0.14);
    --green: #2ee66b;
    --green-dark: #128a45;
    --yellow: #ffcf55;
    --danger: #ff6b6b;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    background:
        linear-gradient(135deg, rgba(46, 230, 107, 0.14), transparent 34%),
        radial-gradient(circle at top right, rgba(255, 207, 85, 0.10), transparent 34%),
        linear-gradient(180deg, #07130f 0%, #0a1c15 48%, #07130f 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: space-between;
    padding: 14px clamp(16px, 4vw, 48px);
    background: rgba(7, 19, 15, 0.86);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 800;
}

.brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-mark {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    color: #04210f;
    background: var(--green);
    font-size: 13px;
}

.desktop-nav {
    display: none;
    align-items: center;
    gap: 8px;
}

.desktop-nav a {
    padding: 10px 12px;
    color: var(--muted);
    border-radius: var(--radius);
}

.desktop-nav a.active,
.desktop-nav a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

.header-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-menu-button {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.mobile-menu-button span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
}

.mobile-menu {
    position: absolute;
    right: 16px;
    top: calc(100% + 8px);
    z-index: 40;
    display: grid;
    width: min(260px, calc(100vw - 32px));
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(7, 19, 15, 0.98);
    box-shadow: var(--shadow);
}

.mobile-menu[hidden] {
    display: none;
}

.mobile-menu a {
    padding: 13px 12px;
    border-radius: var(--radius);
    color: var(--muted);
    font-weight: 800;
}

.mobile-menu a.active,
.mobile-menu a:hover {
    color: #07130f;
    background: var(--green);
}

.profile-chip {
    display: none;
    align-items: center;
    gap: 8px;
    max-width: 180px;
    color: var(--muted);
    font-size: 14px;
}

.profile-chip img,
.leader-row img,
.user-cell img,
.tie-list img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 96px;
}

.hero {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 20px;
    min-height: 520px;
    align-items: center;
    padding: 34px clamp(16px, 4vw, 42px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(90deg, rgba(7, 19, 15, 0.92), rgba(7, 19, 15, 0.68), rgba(7, 19, 15, 0.42)),
        url("../images/worldcup-hero_desktop.webp") center / cover no-repeat;
    box-shadow: var(--shadow);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 19, 15, 0.12), rgba(7, 19, 15, 0.66));
    pointer-events: none;
}

.hero-content,
.hero-panel {
    position: relative;
    z-index: 1;
}

.hero-content h1,
.page-heading h1 {
    margin: 8px 0 14px;
    max-width: 760px;
    font-size: clamp(38px, 8vw, 78px);
    line-height: 0.98;
}

.hero-subtitle,
.page-heading p,
.section-title p {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.55;
}

.eyebrow {
    color: var(--yellow);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 12px;
}

.hero-actions,
.admin-actions,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    font-weight: 800;
    cursor: pointer;
}

.btn-primary {
    color: #04180c;
    background: var(--green);
    border-color: var(--green);
}

.btn-ghost {
    background: transparent;
}

.btn-small {
    min-height: 36px;
    padding: 0 12px;
    font-size: 14px;
}

.btn-full {
    width: 100%;
}

.hero-panel,
.match-card,
.content-card,
.table-card,
.winner-card,
.auth-card,
.stat-card,
.steps article,
.prize-band {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.hero-panel {
    position: relative;
    overflow: hidden;
    min-height: 240px;
    padding: 28px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.10) 1px, transparent 1px),
        linear-gradient(145deg, rgba(20, 122, 59, 0.92), rgba(8, 39, 24, 0.92));
    background-size: 42px 42px, 42px 42px, auto;
}

.hero-panel strong {
    display: block;
    max-width: 360px;
    font-size: 32px;
    line-height: 1.1;
}

.hero-panel small {
    display: block;
    max-width: 320px;
    margin-top: 12px;
    color: #ddffe8;
    line-height: 1.5;
}

.pitch-line {
    position: absolute;
    right: -80px;
    top: 40px;
    width: 230px;
    height: 230px;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
}

.grid-two {
    display: grid;
    gap: 22px;
    margin: 24px 0;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0;
}

.section-title h1,
.section-title h2,
.steps h2,
.prize-band h2 {
    margin: 0;
}

.section-title a {
    color: var(--green);
    font-weight: 800;
}

.card-list,
.match-list,
.admin-list {
    display: grid;
    gap: 14px;
}

.match-card {
    padding: 18px;
}

.match-tools {
    margin: 0 0 18px;
}

.search-box {
    display: grid;
    gap: 8px;
    max-width: 520px;
    color: var(--muted);
    font-weight: 800;
}

.match-card h2,
.match-card h3 {
    margin: 12px 0 8px;
}

.match-card p,
.compact time,
.muted,
.prose p {
    color: var(--muted);
}

.match-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.status-pill {
    display: inline-flex;
    width: max-content;
    padding: 6px 9px;
    border-radius: 999px;
    color: #061c0e;
    background: var(--yellow);
    font-size: 12px;
    font-weight: 800;
}

.status-open {
    color: #03130b;
    background: #2ee66b;
    box-shadow: 0 0 0 3px rgba(46, 230, 107, 0.16);
}

.status-soon {
    color: #061c0e;
    background: var(--yellow);
}

.status-closed {
    color: #2a1700;
    background: #ffb057;
}

.status-completed {
    color: #ffffff;
    background: #5b6ee1;
}

.teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    margin: 18px 0;
    text-align: center;
}

.teams strong {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 14px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.07);
    overflow-wrap: anywhere;
}

.teams strong em {
    color: var(--green);
    font-size: 32px;
    font-style: normal;
    line-height: 1;
}

.prediction-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.prediction-form button {
    min-height: 52px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.10);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.prediction-form button:hover {
    color: #04180c;
    background: var(--green);
}

.locked-choice {
    padding: 14px;
    border-radius: var(--radius);
    color: #dfffe6;
    background: rgba(46, 230, 107, 0.14);
}

.result-box {
    display: grid;
    gap: 4px;
    margin: 12px 0;
    padding: 14px;
    border: 1px solid rgba(46, 230, 107, 0.28);
    border-radius: var(--radius);
    color: #eaffef;
    background: rgba(46, 230, 107, 0.12);
    text-align: center;
}

.result-box strong {
    font-size: 18px;
}

.result-box span {
    color: #eaffef;
    font-weight: 900;
}

.score-inputs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.leader-list,
.rule-list,
.stack-form {
    display: grid;
    gap: 10px;
}

.leader-row {
    display: grid;
    grid-template-columns: 34px 32px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
}

.rank {
    color: var(--yellow);
    font-weight: 800;
}

.steps,
.prize-band,
.content-card,
.winner-card,
.auth-card,
.table-card {
    margin-top: 24px;
    padding: 20px;
}

.step-grid,
.stat-grid {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.steps article,
.stat-card {
    padding: 18px;
}

.steps article span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #04180c;
    background: var(--green);
    font-weight: 900;
}

.steps article p {
    color: var(--muted);
}

.ad-slot {
    display: grid;
    place-items: center;
    margin: 18px 0;
    border: 1px dashed rgba(255, 255, 255, 0.28);
    border-radius: var(--radius);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
}

.ad-slot span,
.ad-slot ins,
.ad-slot iframe {
    max-width: 100%;
}

.ad-slot iframe {
    border: 0;
}

.ad-slot-banner {
    width: 100%;
    height: 90px;
    min-height: 90px;
    max-height: 90px;
    margin: 0 auto 22px;
}

.ad-slot-rectangle {
    width: min(100%, 336px);
    height: 280px;
    min-height: 280px;
    max-height: 280px;
    margin-left: auto;
    margin-right: auto;
}

.ad-slot-wide {
    width: 100%;
    height: 250px;
    min-height: 250px;
    max-height: 250px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 767px) {
    .hero {
        min-height: 620px;
        padding: 28px 18px;
        background:
            linear-gradient(180deg, rgba(7, 19, 15, 0.80), rgba(7, 19, 15, 0.66), rgba(7, 19, 15, 0.88)),
            url("../images/worldcup-hero_mobile.webp") center / cover no-repeat;
    }

    .ad-slot-banner {
        width: 100%;
        height: 100px;
        min-height: 100px;
        max-height: 100px;
    }

    .ad-slot-rectangle {
        width: min(100%, 300px);
        height: 250px;
        min-height: 250px;
        max-height: 250px;
    }

    .ad-slot-wide {
        width: 100%;
        height: 250px;
        min-height: 250px;
        max-height: 250px;
    }
}

.page-heading {
    margin: 22px 0;
}

.table-card {
    overflow-x: auto;
}

.leaderboard-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.groups-grid {
    display: grid;
    gap: 16px;
}

.groups-scroll {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(260px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
}

.group-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    scroll-snap-align: start;
}

.group-card h2,
.group-card h3 {
    margin: 0 0 12px;
}

.group-table {
    width: 100%;
    border-collapse: collapse;
}

.group-table th,
.group-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
}

.group-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.group-table td:not(:first-child),
.group-table th:not(:first-child) {
    text-align: center;
}

.group-card.mini {
    min-width: 260px;
}

.group-card.mini .group-table td {
    padding: 8px 6px;
}

.group-card.mini .group-table th {
    padding: 0 6px 8px;
    font-size: 11px;
}

.tournament-grid {
    display: grid;
    gap: 16px;
}

.tournament-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.tournament-card h2,
.tournament-card p {
    margin: 0;
}

.tournament-card p,
.tournament-meta {
    color: var(--muted);
}

.tournament-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-weight: 800;
}

.leaderboard-table th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-user {
    background: rgba(46, 230, 107, 0.12);
}

.demo-notice {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 207, 85, 0.35);
    border-radius: var(--radius);
    color: #fff2bc;
    background: rgba(255, 207, 85, 0.10);
    font-weight: 800;
}

.demo-badge,
.demo-inline {
    display: inline-flex;
    margin-left: 6px;
    padding: 3px 7px;
    border-radius: 999px;
    color: #07130f;
    background: var(--yellow);
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
    vertical-align: middle;
}

.winner-card {
    text-align: center;
}

.winner-avatar {
    width: 86px;
    height: 86px;
    margin-top: 16px;
    border-radius: 50%;
    object-fit: cover;
}

.tie-list {
    display: grid;
    gap: 10px;
    max-width: 420px;
    margin: 18px auto 0;
}

.tie-list div {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.07);
}

.rule-list {
    margin: 0;
    padding-left: 20px;
    color: #dfffe6;
    line-height: 1.55;
}

.auth-card {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}

.auth-card.wide {
    max-width: 620px;
}

.stack-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

.interest-box {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.interest-box legend {
    color: var(--muted);
    font-weight: 800;
}

.interest-box label,
.consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.interest-box input,
.consent-row input {
    width: auto;
    min-height: auto;
    margin-top: 3px;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

select option {
    color: #07130f;
}

.inline-form input {
    max-width: 280px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--muted);
    font-weight: 800;
}

.stat-card span {
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 34px;
}

.flash {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-weight: 800;
}

.flash-success {
    color: #04180c;
    background: var(--green);
}

.flash-error {
    color: #230505;
    background: var(--danger);
}

.site-footer {
    display: none;
}

.mobile-nav {
    position: fixed;
    left: 50%;
    bottom: 12px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: min(440px, calc(100% - 24px));
    padding: 9px;
    transform: translateX(-50%);
    border: 1px solid rgba(46, 230, 107, 0.36);
    border-radius: var(--radius);
    background: rgba(13, 39, 28, 0.98);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    backdrop-filter: blur(18px);
}

.mobile-nav a {
    display: grid;
    min-height: 50px;
    place-items: center;
    border-radius: var(--radius);
    color: #eaffef;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.mobile-nav a.active {
    color: #04180c;
    background: var(--green);
    box-shadow: 0 8px 20px rgba(46, 230, 107, 0.28);
}

.exit-ad-open {
    overflow: hidden;
}

.exit-ad-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(8px);
}

.exit-ad-overlay[hidden] {
    display: none;
}

.exit-ad-dialog {
    position: relative;
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
}

.exit-ad-close {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 2;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: var(--radius);
    color: #07130f;
    background: var(--green);
    font-weight: 900;
    cursor: pointer;
}

.exit-ad-video {
    display: grid;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 40px);
    place-items: center;
    overflow: hidden;
    border: 1px dashed rgba(255, 255, 255, 0.35);
    border-radius: var(--radius);
    color: var(--muted);
    background: rgba(7, 19, 15, 0.96);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

@media (max-width: 767px) {
    .exit-ad-dialog {
        width: min(360px, 82vw);
    }

    .exit-ad-video {
        aspect-ratio: 9 / 16;
        max-height: 72vh;
    }
}

@media (max-width: 919px) {
    .site-header {
        padding: 10px 14px;
    }

    .brand {
        flex: 0 0 auto;
    }

    .brand-name {
        display: none;
    }

    .brand-mark {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
    }

    .header-action {
        margin-left: auto;
    }

    .header-action .profile-chip {
        display: none;
    }

    .header-action .btn-small {
        min-height: 42px;
        padding: 0 14px;
    }

    .header-action .btn-ghost {
        display: none;
    }
}

@media (min-width: 680px) {
    .prediction-form {
        grid-template-columns: repeat(3, 1fr);
    }

    .step-grid,
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-chip {
        display: inline-flex;
    }
}

@media (min-width: 920px) {
    .mobile-menu-button,
    .mobile-menu {
        display: none;
    }

    .desktop-nav {
        display: flex;
    }

    .mobile-nav {
        display: none;
    }

    .site-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        padding: 22px clamp(24px, 4vw, 56px);
        color: #d8f7e3;
        background: rgba(12, 34, 25, 0.96);
        border-top: 1px solid rgba(46, 230, 107, 0.22);
    }

    .site-footer nav {
        display: flex;
        gap: 18px;
    }

    .site-footer a {
        color: #8ff0b1;
        font-weight: 800;
    }

    .page {
        padding-bottom: 48px;
    }

    .hero,
    .grid-two {
        grid-template-columns: 1.15fr 0.85fr;
    }

    .step-grid,
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .match-list,
    .admin-list,
    .groups-grid,
    .tournament-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1180px) {
    .groups-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
