:root {
    --green: #376631;
    --lime: #c1d849;
    --dark: #112015;
    --muted: #66736a;
    --line: #dfe8dc;
    --soft: #f5f8ef;
    --white: #ffffff;
    --danger: #b42318;
    --shadow: 0 22px 60px rgba(17, 32, 21, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--soft);
    color: var(--dark);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--green);
    text-decoration: none;
}

input,
select,
button {
    font: inherit;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--white);
}

label {
    display: grid;
    gap: 7px;
    color: var(--dark);
    font-weight: 700;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0;
}

.page-narrow {
    width: min(900px, calc(100% - 32px));
}

.muted {
    color: var(--muted);
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    font-weight: 800;
    cursor: pointer;
}

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

.button-primary {
    background: var(--green);
    color: var(--white);
}

.button-secondary {
    background: var(--white);
    color: var(--green);
    border: 1px solid var(--line);
}

.button-danger {
    background: #fff1f0;
    color: var(--danger);
    border: 1px solid #ffd5d2;
}

.button-xl {
    min-width: 240px;
    padding: 18px 30px;
    font-size: 1.2rem;
}

.site-hero {
    min-height: 360px;
    color: var(--white);
    background:
        radial-gradient(circle at 85% 20%, rgba(193, 216, 73, 0.45), transparent 26%),
        linear-gradient(135deg, #112015 0%, #376631 100%);
}

.top-nav,
.admin-header {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 0;
}

.brand {
    color: var(--white);
    font-size: 1.15rem;
    font-weight: 900;
}

.nav-link {
    color: var(--white);
    font-weight: 700;
}

.hero-content {
    width: min(780px, calc(100% - 32px));
    margin: 0 auto;
    padding: 44px 0 72px;
    text-align: center;
}

.hero-content h1,
.result-hero h1,
.live-header h1,
.admin-header h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.05;
}

.section-card,
.result-hero,
.auth-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.section-heading h2,
.match-card h3,
.empty-state h3 {
    margin: 0;
}

.match-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.match-card,
.stat-card {
    background: #fbfcf7;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
}

.match-teams,
.winner-line {
    color: var(--green);
    font-weight: 800;
}

.status-pill,
.count-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    background: #edf5d5;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 900;
}

.status-draft {
    background: #eef2f7;
    color: #526070;
}

.status-ready {
    background: #fff7d6;
    color: #8a5a00;
}

.status-revealed {
    background: #e4f6dc;
    color: var(--green);
}

.status-archived {
    background: #f4e8e8;
    color: var(--danger);
}

.empty-state {
    text-align: center;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    font-weight: 800;
}

.result-hero {
    margin-bottom: 22px;
    text-align: center;
}

.winner-card {
    width: min(420px, 100%);
    margin: 26px auto 0;
    display: grid;
    gap: 6px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--green), #193f21);
    color: var(--white);
    padding: 24px;
}

.winner-card strong {
    font-size: clamp(2rem, 6vw, 3.4rem);
    line-height: 1;
}

.participant-list {
    display: grid;
    gap: 10px;
}

.participant-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: #fbfcf7;
}

.participant-row span {
    display: block;
    color: var(--muted);
}

.winner-row {
    border-color: var(--lime);
    background: #f6fbdc;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #112015, #376631);
}

.auth-card {
    width: min(440px, 100%);
}

.brand-mark {
    display: inline-flex;
    border-radius: 999px;
    background: var(--lime);
    color: var(--dark);
    padding: 7px 12px;
    font-weight: 900;
}

.stacked-form,
.form-grid,
.admin-form {
    display: grid;
    gap: 18px;
}

.auth-link {
    margin-bottom: 0;
    text-align: center;
}

.alert {
    border-radius: 16px;
    margin-bottom: 18px;
    padding: 14px 16px;
    font-weight: 700;
}

.alert-error {
    background: #fff1f0;
    color: var(--danger);
}

.alert-success {
    background: #edf8df;
    color: var(--green);
}

.admin-page {
    background: #f7f8f3;
}

.admin-header {
    width: min(1180px, calc(100% - 32px));
}

.admin-actions,
.form-actions,
.compact-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

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

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

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

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

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

.admin-table th {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-table td span {
    display: block;
    color: var(--muted);
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell a {
    margin-right: 10px;
    font-weight: 800;
}

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

.span-2 {
    grid-column: span 2;
}

.clear-winner {
    display: inline-flex;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-weight: 800;
}

.clear-winner input,
.winner-radio input {
    width: auto;
}

.participant-editor {
    display: grid;
    gap: 12px;
}

.participant-edit-row {
    display: grid;
    grid-template-columns: 90px repeat(4, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    background: #fbfcf7;
}

.winner-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 47px;
}

.live-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(193, 216, 73, 0.22), transparent 25%),
        linear-gradient(135deg, #0c180f, #214c29 60%, #376631);
    color: var(--white);
}

.live-stage {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0;
}

.live-header {
    text-align: center;
    padding: 28px 0 34px;
}

.live-header .eyebrow {
    color: var(--lime);
}

.live-board {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 24px;
    align-items: stretch;
}

.participants-panel,
.draw-panel {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 22px 80px rgba(0, 0, 0, 0.2);
    padding: 26px;
    backdrop-filter: blur(12px);
}

.live-participants {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.live-participant {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    padding: 14px 16px;
    font-size: 1.12rem;
    font-weight: 900;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.live-participant.is-active {
    transform: scale(1.04);
    background: var(--lime);
    color: var(--dark);
}

.live-participant.is-winner {
    box-shadow: 0 0 0 4px rgba(193, 216, 73, 0.35);
}

.draw-panel {
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
}

.spinner-orb {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin-bottom: 20px;
    background:
        radial-gradient(circle, var(--lime) 0 28%, transparent 29%),
        conic-gradient(from 0deg, var(--lime), #ffffff, var(--green), var(--lime));
    animation: spin 2.4s linear infinite;
}

.draw-label {
    font-size: 1.25rem;
    font-weight: 900;
}

.winner-reveal {
    width: min(360px, 100%);
    margin-top: 24px;
    border-radius: 28px;
    background: var(--white);
    color: var(--dark);
    padding: 24px;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
}

.winner-reveal.is-visible {
    animation: revealPop 0.65s ease forwards;
}

.winner-reveal span {
    color: var(--green);
    font-weight: 900;
    text-transform: uppercase;
}

.winner-reveal strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1;
}

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

@keyframes revealPop {
    60% {
        transform: translateY(-4px) scale(1.03);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@media (max-width: 900px) {
    .live-board,
    .form-grid,
    .participant-edit-row {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .top-nav,
    .admin-header,
    .section-heading,
    .participant-row {
        align-items: flex-start;
        flex-direction: column;
    }
}
