:root {
    --bg: #f4f7f2;
    --surface: #ffffff;
    --surface-strong: #eef6ea;
    --ink: #13251d;
    --muted: #65746c;
    --line: #dce5dc;
    --primary: #0f7b46;
    --primary-dark: #0a5b34;
    --accent: #c9342f;
    --gold: #f1b83b;
    --blue: #145c9e;
    --shadow: 0 18px 45px rgba(19, 37, 29, 0.1);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(15, 123, 70, 0.06) 1px, transparent 1px),
        linear-gradient(0deg, rgba(15, 123, 70, 0.05) 1px, transparent 1px),
        var(--bg);
    background-size: 42px 42px;
}

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

button,
input,
select {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(244, 247, 242, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.nav,
.page,
.site-footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 72px;
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #fff;
    background: var(--primary);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    padding: 10px 12px;
    color: var(--muted);
    border-radius: var(--radius);
    font-weight: 700;
}

.nav-links a:hover {
    color: var(--ink);
    background: var(--surface-strong);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 4px auto;
    background: var(--ink);
}

.page {
    padding: 34px 0 48px;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 0 36px;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

.flash-list {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.flash-success {
    border-color: rgba(15, 123, 70, 0.28);
    background: #edf8f1;
}

.flash-error {
    border-color: rgba(201, 52, 47, 0.32);
    background: #fff1f0;
}

.flash button {
    width: 32px;
    height: 32px;
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.home-hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: stretch;
    gap: 24px;
    min-height: 410px;
}

.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 42px;
    color: #fff;
    background: #18392b;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 16px;
    font-size: 3rem;
    line-height: 1.05;
}

.hero-text {
    max-width: 590px;
    margin-bottom: 26px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.08rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.button-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 20px rgba(15, 123, 70, 0.22);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--line);
}

.full-width {
    width: 100%;
}

.pitch-panel {
    position: relative;
    overflow: hidden;
    min-height: 330px;
    background:
        repeating-linear-gradient(
            90deg,
            #11804c 0 44px,
            #0d7142 44px 88px
        );
    border: 8px solid #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.pitch-panel::before {
    position: absolute;
    inset: 18px;
    content: "";
    border: 3px solid rgba(255, 255, 255, 0.8);
}

.pitch-line.center {
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 50%;
    width: 3px;
    background: rgba(255, 255, 255, 0.8);
}

.pitch-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 118px;
    height: 118px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.pitch-box {
    position: absolute;
    top: 50%;
    width: 82px;
    height: 170px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    transform: translateY(-50%);
}

.pitch-box.left {
    left: 18px;
    border-left: 0;
}

.pitch-box.right {
    right: 18px;
    border-right: 0;
}

.stats-grid,
.match-grid,
.admin-grid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 24px;
}

.stat-card,
.match-card,
.panel-form,
.empty-state,
.table-wrap,
.result-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card {
    display: grid;
    gap: 4px;
    padding: 22px;
}

.stat-value {
    color: var(--primary);
    font-size: 2.25rem;
    font-weight: 900;
}

.stat-label,
.muted {
    color: var(--muted);
}

.page-heading {
    margin-bottom: 24px;
}

.page-heading h1 {
    margin-bottom: 0;
    color: var(--ink);
}

.tipster-panel,
.tournament-panel,
.player-summary,
.admin-users,
.rules-panel {
    margin-bottom: 22px;
}

.rules-panel {
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.rules-panel h2 {
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.rules-grid span {
    padding: 9px 10px;
    color: var(--muted);
    background: var(--surface-strong);
    border-radius: var(--radius);
    line-height: 1.35;
}

.rules-grid strong {
    color: var(--ink);
}

.tipster-current,
.player-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tipster-current strong,
.player-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 1.2rem;
}

.tipster-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.tipster-actions form {
    margin: 0;
}

.panel-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.prediction-badge {
    padding: 9px 11px;
    color: var(--primary-dark);
    background: var(--surface-strong);
    border-radius: var(--radius);
    font-weight: 900;
    white-space: nowrap;
}

.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.prediction-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.prediction-summary > div {
    display: grid;
    gap: 4px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.prediction-summary strong {
    font-size: 1.15rem;
}

.match-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.match-card {
    padding: 22px;
}

.match-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.92rem;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.status-open {
    color: #075d36;
    background: #dff4e8;
}

.status-closed {
    color: #71340a;
    background: #fff0d4;
}

.status-locked {
    color: #6d1820;
    background: #ffe2e5;
}

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

.teams strong {
    font-size: 1.22rem;
}

.teams span {
    color: var(--accent);
    font-weight: 900;
}

.tip-form,
.panel-form {
    display: grid;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.form-note {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.5;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 123, 70, 0.14);
}

input:disabled,
select:disabled {
    color: var(--muted);
    background: #f2f4f1;
}

.score-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 12px;
}

.score-inputs input {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 900;
}

.score-separator {
    padding-bottom: 10px;
    color: var(--accent);
    font-size: 1.45rem;
    font-weight: 900;
}

.compact {
    align-items: end;
}

.results-list {
    display: grid;
    gap: 14px;
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
}

.result-row h2 {
    margin: 4px 0 0;
    font-size: 1.18rem;
}

.result-score {
    min-width: 110px;
    padding: 12px 16px;
    color: #fff;
    background: var(--blue);
    border-radius: var(--radius);
    text-align: center;
    font-size: 1.45rem;
    font-weight: 900;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

th,
td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    color: var(--muted);
    background: var(--surface-strong);
    font-size: 0.82rem;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

code {
    display: inline-block;
    max-width: 240px;
    overflow: hidden;
    color: var(--primary-dark);
    font-size: 0.86rem;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.table-link {
    color: var(--primary-dark);
    font-weight: 800;
}

.table-link:hover {
    text-decoration: underline;
}

.empty-state {
    padding: 32px;
    text-align: center;
}

.empty-state h2,
.empty-state h3 {
    margin-bottom: 8px;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.admin-login {
    width: min(430px, 100%);
}

.admin-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.import-panel {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.import-panel p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.55;
}

.import-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.import-stats span {
    padding: 8px 10px;
    color: var(--ink);
    background: var(--surface-strong);
    border-radius: var(--radius);
    font-weight: 800;
}

.inline-form {
    margin: 0;
}

.admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 28px;
}

.panel-form {
    padding: 22px;
}

.panel-form h2 {
    margin-bottom: 4px;
}

.admin-users h2,
.admin-matches h2 {
    margin-bottom: 14px;
}

.team-filter {
    margin-bottom: 18px;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

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

.team-card:hover {
    border-color: rgba(15, 123, 70, 0.35);
    transform: translateY(-1px);
}

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

@media (max-width: 820px) {
    .nav {
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: inline-block;
    }

    .nav-links {
        display: none;
        width: 100%;
        padding-bottom: 14px;
    }

    .nav-links.is-open {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .home-hero,
    .match-grid,
    .admin-grid,
    .stats-grid,
    .three-columns,
    .prediction-summary {
        grid-template-columns: 1fr;
    }

    .hero-content {
        padding: 30px 24px;
    }

    h1 {
        font-size: 2.35rem;
    }

    .pitch-panel {
        min-height: 260px;
    }
}

@media (max-width: 560px) {
    .nav,
    .page,
    .site-footer {
        width: min(100% - 22px, 1120px);
    }

    .site-footer,
    .result-row,
    .tipster-current,
    .player-summary,
    .panel-heading-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .tipster-actions,
    .tipster-actions .button,
    .tipster-actions form {
        width: 100%;
    }

    .hero-actions,
    .hero-actions .button {
        width: 100%;
    }

    .form-grid,
    .score-inputs {
        grid-template-columns: 1fr;
    }

    .score-separator {
        display: none;
    }

    .teams {
        grid-template-columns: 1fr;
    }

    .nav-links.is-open {
        grid-template-columns: 1fr;
    }

    .result-score {
        width: 100%;
    }
}
