:root {
    color-scheme: light dark;
    --fg: #1c2418;
    --muted: #6a7560;
    --bg: #fafaf6;
    --card: #ffffff;
    --border: #e5e3d8;
    --green: #1e6b3a;
    --green-dark: #134d28;
    --gold: #d4a73a;
    --pos: #1e6b3a;
    --neg: #b03a3a;
    --me: #fff8df;
    --link: #1e6b3a;
    --nav-bg: #ffffff;
    --status-done-bg: #d6ead9;
    --status-done-fg: #134d28;
    --status-soon-bg: #fcedc1;
    --status-soon-fg: #7a5a10;
    --status-partial-bg: #f0e9d2;
    --status-partial-fg: #6a5a10;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg: #e8e8df;
        --muted: #9a9a8e;
        --bg: #1a1d18;
        --card: #232620;
        --border: #34372f;
        --green: #66c08a;
        --green-dark: #4ea970;
        --gold: #e2b955;
        --pos: #7fd29c;
        --neg: #e87a7a;
        --me: #2c2e1c;
        --link: #9bd9b4;
        --nav-bg: #1f221c;
        --status-done-bg: #1f3a26;
        --status-done-fg: #8fd2a2;
        --status-soon-bg: #3a2f1a;
        --status-soon-fg: #e8c878;
        --status-partial-bg: #322d1f;
        --status-partial-fg: #c4b073;
    }
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--fg);
    margin: 0;
    line-height: 1.55;
    font-size: 16px;
}

.container {
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: #fff;
    padding: 3rem 0 2.5rem;
    border-bottom: 4px solid var(--gold);
}
header .kicker {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.85);
    margin: 0 0 0.5rem;
    font-weight: 500;
}
header h1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    margin: 0 0 0.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
header h1 a {
    color: inherit;
    text-decoration: none;
}
header h1 a:hover { opacity: 0.9; }
header .lead {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

/* Top nav */
.topnav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.topnav .container {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.topnav a {
    display: inline-block;
    padding: 0.85rem 1rem;
    color: var(--fg);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s, color 0.15s;
}
.topnav a:hover { color: var(--green); border-bottom-color: var(--gold); }
.topnav a.active { color: var(--green); border-bottom-color: var(--green); }

/* Sections */
main { padding: 2rem 0 4rem; }
section { margin-bottom: 3rem; scroll-margin-top: 4rem; }
h2 {
    font-size: 1.5rem;
    color: var(--green);
    margin: 0 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--gold);
    font-weight: 600;
}
h3 {
    font-size: 1.05rem;
    margin: 1.75rem 0 0.6rem;
    color: var(--fg);
    font-weight: 600;
}
h3 .muted { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
.updated { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; }
.muted { color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    overflow: hidden;
}
th, td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
thead th {
    background: var(--green);
    color: #fff;
    font-weight: 500;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    border-bottom: none;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(212, 167, 58, 0.06); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); font-weight: 500; }
.neg { color: var(--neg); }

/* Game tables */
.games td { vertical-align: middle; }
.games .dash { color: var(--muted); text-align: center; padding: 0 0.25rem; }
.games .vs { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 0 0.5rem; }
.winA td:nth-child(1), .winA td:nth-child(2) { font-weight: 600; }
.winB td:nth-child(4), .winB td:nth-child(5) { font-weight: 600; }
.pending td { color: var(--muted); font-style: italic; }

/* Round details (collapsible) */
details {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    margin-bottom: 1rem;
    overflow: hidden;
}
details summary {
    padding: 0.85rem 1rem;
    cursor: pointer;
    font-weight: 500;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
    content: "▸";
    color: var(--gold);
    transition: transform 0.15s;
    display: inline-block;
}
details[open] summary::before { transform: rotate(90deg); }
details summary .r {
    color: var(--green);
    font-weight: 600;
    min-width: 4.5rem;
}
details[open] summary { border-bottom: 1px solid var(--border); }
details .table-wrap { padding: 0; }
details table { border: none; border-radius: 0; }

/* Status pills */
.status {
    margin-left: auto;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-weight: 500;
}
.status.done { background: var(--status-done-bg); color: var(--status-done-fg); }
.status.soon { background: var(--status-soon-bg); color: var(--status-soon-fg); }
.status.partial { background: var(--status-partial-bg); color: var(--status-partial-fg); }

/* Round list (calendar) */
.rounds { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.rounds li {
    padding: 0.45rem 0;
    border-bottom: 1px dashed var(--border);
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
}
.rounds li:last-child { border-bottom: none; }
.rounds .r {
    flex: 0 0 auto;
    min-width: 5rem;
    color: var(--green);
    font-weight: 600;
}
.rounds li.break {
    color: var(--muted);
    justify-content: center;
    padding: 0.75rem 0;
}

/* Regulamento prose */
#regulamento p { margin: 0 0 0.75rem; max-width: 50rem; }
#regulamento u { text-decoration-color: var(--gold); text-underline-offset: 2px; }
#regulamento h3 {
    font-size: 1.05rem;
    margin: 2rem 0 0.75rem;
    color: var(--green);
}
#regulamento hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0 1rem;
}
.reg-meta {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 1rem 1.25rem;
    margin: 0 0 2rem;
}
.reg-meta p { margin: 0.25rem 0; }
.reg-meta a {
    color: var(--green);
    text-decoration: none;
    font-weight: 500;
}
.reg-meta a:hover { text-decoration: underline; }
.reg-meta code {
    font-family: ui-monospace, SF Mono, Menlo, monospace;
    font-size: 0.88em;
    background: rgba(212, 167, 58, 0.12);
    padding: 0.05rem 0.35rem;
    border-radius: 0.2rem;
}
ol.reg {
    max-width: 50rem;
    padding-left: 1.5rem;
    margin: 0 0 1rem;
}
ol.reg > li { margin: 0.5rem 0; line-height: 1.55; }
ol.reg-sub {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}
ol.reg-sub > li { margin: 0.3rem 0; }

.tiebreak {
    margin: 0;
    padding-left: 1.4rem;
}
.tiebreak li { margin: 0.25rem 0; }

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    color: var(--muted);
    font-size: 0.88rem;
    text-align: center;
}
footer a { color: var(--link); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.footnote {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0.75rem 0 0;
}

/* Smooth scroll */
html { scroll-behavior: smooth; }
