/* ==========================================================================
   Tippspiel 2027 – Stadion-Design
   Nur Systemschriften (keine externen Webfonts, datenschutzfreundlich).
   ========================================================================== */

:root {
    --pitch-dark: #0b3d23;      /* Rasen dunkel: Navigation, Tabellenköpfe */
    --pitch: #14632f;           /* Rasen: Buttons, Akzente */
    --pitch-light: #e8f3ec;     /* Rasen hell: Zebra-Zeilen, Hover */
    --gold: #f2c230;            /* Pokal-Gold: Akzentlinie, Platz 1 */
    --silver: #c0c6cc;
    --bronze: #cd8a4f;
    --ink: #1c2421;             /* Text */
    --muted: #66706b;
    --line: #d5ddd8;            /* Rahmen */
    --page-bg: #eef1ef;
    --link: #14632f;

    /* Trefferfarben (Rangliste, Legende, Anleitung) */
    --col-tendenz: #7b8794;
    --col-exact: #f0a020;
    --col-joker-exact: #d62d2d;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Arial Narrow", "Roboto Condensed", "Helvetica Neue Condensed", "Segoe UI", system-ui, sans-serif;
}

/* Grundlayout ------------------------------------------------------------- */
* { box-sizing: border-box; }

/* Basis-Schriftgröße: kompakt auf Mobilgeräten, größer auf großen Bildschirmen */
html { font-size: 100%; }
@media (min-width: 900px) { html { font-size: 125%; } }
@media (min-width: 1400px) { html { font-size: 150%; } }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        repeating-linear-gradient(90deg, rgba(20, 99, 47, 0.025) 0 80px, transparent 80px 160px),
        var(--page-bg);
    line-height: 1.45;
}

.page {
    max-width: 1400px;
    margin: 1.5em auto;
    padding: 1.5em 2em 2em;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(11, 61, 35, 0.08);
}

/* Rangliste: Seite so breit wie die Tabelle, damit Kopfzeile und Legende die
   volle Breite nutzen und Pinch-to-Zoom über den ganzen Schirm verläuft. */
body.ranking-page {
    width: max-content;
    min-width: 100%;
}
body.ranking-page .page {
    max-width: none;
    width: max-content;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--pitch-dark);
}
h1 {
    text-transform: uppercase;
    margin-top: 0.2em;
    padding-bottom: 0.25em;
    border-bottom: 4px solid var(--gold);
    display: inline-block;
}
h2 { margin-top: 1.4em; }

a { color: var(--link); }

/* Aktuelle Mitteilung auf der Startseite (große Schrift) */
.announcement {
    font-family: var(--font-display);
    font-size: 1.6em;
    font-weight: 700;
    color: var(--pitch-dark);
    background: #fffbe6;
    border: 2px solid var(--gold);
    border-left: 8px solid var(--gold);
    border-radius: 8px;
    padding: 0.8em 1em;
    margin: 0 0 1.5em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Startseite: alle Inhalte zentriert (Willkommensüberschrift, Runden, Gewinne) */
body.home-page .page {
    text-align: center;
}

/* Startseite: Hinweis auf anstehende Rundenschließung.
   Das Legacy-Projekt ließ den Text im Sekundentakt hart an/aus blinken.
   Stattdessen pulsiert die Warnung in einem ruhigen 4-Sekunden-Takt: kurze
   Ein-/Ausblendphasen, dazwischen gut lesbare Haltephasen. Der farbige
   Rahmen hält sie auch in der gedimmten Phase präsent. */
@keyframes lock-pulse {
    0%, 20%, 80%, 100% {
        opacity: 1;
    }
    35%, 65% {
        opacity: 0.78;
    }
}
.lock-warning {
    max-width: 56rem;
    margin: 0.8em auto 1.6em;
    padding: 0.7em 1.1em;
    text-align: center;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2rem);
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: 0.01em;
    overflow-wrap: break-word;
    color: var(--col-joker-exact);
    background: #fff5f5;
    border: 2px solid rgba(214, 45, 45, 0.35);
    border-left: 8px solid var(--col-joker-exact);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(214, 45, 45, 0.12);
    animation: lock-pulse 4s ease-in-out infinite;
}
.lock-warning p {
    margin: 0.25em 0;
    text-align: center;
}
/* Dauerhafte Profil-Warnungen (fehlende Zahlungsmöglichkeit/Handynummer):
   gleiche Optik wie der Lock-Hinweis, aber ohne Pulsieren und etwas kleiner. */
.lock-warning.profile-warning {
    animation: none;
    font-size: clamp(1.1rem, 2.6vw, 1.4rem);
}
/* Direkter Weg zur Tippabgabe der gefährdeten Runde */
.lock-warning .lock-warning-link {
    display: inline-block;
    margin-top: 0.35em;
    padding: 0.45em 1.2em;
    font-family: var(--font-display);
    font-size: 0.7em;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    color: #fff;
    background: var(--col-joker-exact);
    border-radius: 999px;
    box-shadow: 0 2px 0 rgba(150, 25, 25, 0.9);
}
.lock-warning .lock-warning-link:hover {
    background: #b51f1f;
}
.lock-warning .lock-warning-link:focus-visible {
    outline: 3px solid var(--pitch);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .lock-warning {
        animation: none;
        opacity: 1;
    }
}

/* Automatisch ermittelte Gewinne je abgeschlossener Runde (Startseite) */
.round-winnings-title {
    margin: 0 0 0.1em;
}
.round-winnings {
    list-style: none;
    margin: 0 0 0.8em;
    padding: 0;
}
.round-winnings li {
    padding: 0.1em 0;
}
.round-winnings .win-type {
    color: var(--muted);
    font-size: 0.9em;
}
.round-note {
    margin: 0 0 0.6em;
    color: var(--muted);
    font-style: italic;
}

/* Sprungziele (#round-…, #playerid_…) nicht unter der fixierten Navigation verstecken */
[id] { scroll-margin-top: 90px; }
a:hover { color: var(--pitch-dark); }

/* Navigation ("Stadionbanner") -------------------------------------------- */
.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2em 0.4em;
    padding: 0.55em 1.5em;
    background: linear-gradient(180deg, #145a32 0%, var(--pitch-dark) 100%);
    border-bottom: 4px solid var(--gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
    z-index: 20;
}
.site-nav a {
    color: #fff;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.35em 0.7em;
    border-radius: 6px;
}
.site-nav > a:hover,
.site-nav .nav-dropdown > a:hover,
.site-nav .nav-dropdown:focus-within > a { background: rgba(255, 255, 255, 0.12); color: var(--gold); }

.site-nav .brand {
    font-size: 1.15em;
    font-weight: 900;
    letter-spacing: 0.06em;
    margin-right: 0.8em;
    padding-left: 0;
}
.site-nav .brand:hover { background: none; }
.brand-ball { display: inline-block; transition: transform 0.4s; }
.site-nav .brand:hover .brand-ball { transform: rotate(180deg); }
.brand-accent { color: var(--gold); }

.nav-user { margin-left: auto; }

/* Menüpunkt "Fragen": animiertes Leuchten bei neuen Fragen/Antworten */
@keyframes nav-glow {
    0%, 100% {
        box-shadow: 0 0 0 rgba(242, 194, 48, 0);
        background-color: rgba(255, 255, 255, 0.12);
        color: #fff;
    }
    50% {
        box-shadow: 0 0 12px 3px rgba(242, 194, 48, 0.9);
        background-color: rgba(242, 194, 48, 0.45);
        color: #3d2d00;
    }
}
.site-nav a.is-glowing {
    animation: nav-glow 1.5s ease-in-out infinite;
}

/* Dropdowns in der Navigation (Administration, Info, Spielermenü) */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 30;
    min-width: 13em;
    padding: 0.4em 0;
    background: #fff;
    border-top: 3px solid var(--gold);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}
.nav-user .nav-dropdown-content { left: auto; right: 0; }
.site-nav .nav-dropdown-content a {
    display: block;
    margin: 0;
    padding: 0.45em 1.1em;
    border-radius: 0;
    color: var(--ink);
    font-family: var(--font);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}
.site-nav .nav-dropdown-content a:hover { background: var(--pitch-light); color: var(--pitch-dark); }
.nav-dropdown-form { margin: 0.3em 0 0; padding-top: 0.3em; border-top: 1px solid var(--line); }
.nav-dropdown-form button {
    display: block;
    width: 100%;
    padding: 0.45em 1.1em;
    border: none;
    border-radius: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
}
.nav-dropdown-form button:hover { background: var(--pitch-light); }
.nav-dropdown-form small { color: var(--muted); }
.nav-season-form { padding: 0.45em 1.1em; }
.nav-season-form label {
    display: block;
    margin-bottom: 0.25em;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.nav-season-form select { width: 100%; }
.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content { display: block; }

/* Fußzeile */
.site-footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.75em;
    padding: 0 0 2em;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Tabellen ("Anzeigetafel") ------------------------------------------------ */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    max-width: 800px;
    margin-top: 1em;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
th, td {
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    text-align: left;
}
tbody tr:last-child td { border-bottom: none; }
th {
    background: var(--pitch-dark);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.85em;
}
th a { color: var(--gold); }
tbody tr:nth-child(even) td { background-color: #f6faf7; }
tbody tr:hover td { background-color: var(--pitch-light); }
tfoot th, tfoot td { background: #f0f4f1; color: var(--ink); border-top: 2px solid var(--pitch-dark); }

/* Formulare --------------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="datetime-local"], select, textarea {
    font: inherit;
    padding: 0.35em 0.55em;
    border: 1px solid #b9c4bd;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--pitch);
    box-shadow: 0 0 0 3px rgba(20, 99, 47, 0.18);
}
input[readonly] { background: #f2f4f3; color: var(--muted); }
input[type="checkbox"] { accent-color: var(--pitch); width: 1.1em; height: 1.1em; vertical-align: middle; }

button {
    font: inherit;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4em 1.2em;
    color: #fff;
    background: linear-gradient(180deg, #1b7a3b, var(--pitch));
    border: none;
    border-radius: 999px;
    box-shadow: 0 2px 0 var(--pitch-dark);
    cursor: pointer;
}
button:hover { background: var(--pitch-dark); }
button:active { transform: translateY(1px); box-shadow: none; }
button:disabled { background: #b8c2bc; box-shadow: none; cursor: not-allowed; }
/* Link-artige Buttons (z.B. "Löschen", "Als aktiv setzen") bleiben schlicht */
button.link-button {
    background: none;
    box-shadow: none;
    color: var(--link);
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font);
    font-weight: normal;
    padding: 0;
    border-radius: 0;
}

/* Utility-Klassen ---------------------------------------------------------- */
.text-center { text-align: center !important; }

/* Container für breite, scrollbare Tabellen (Rangliste, Rundenansicht) */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
}
.table-container table {
    width: auto;
    min-width: 100%;
}

/* Rangliste --------------------------------------------------------------- */
td.tipp-cell { text-align: center !important; position: relative; font-weight: 700; }
td.tipp-cell.col_exact { background-color: var(--col-exact) !important; color: #fff; }        /* Exaktes Ergebnis */
td.tipp-cell.col_tendenz { background-color: var(--col-tendenz) !important; color: #fff; }    /* Richtige Tendenz */
td.tipp-cell.col_joker_exact { background-color: var(--col-joker-exact) !important; color: #fff; } /* Exakt mit Joker */

/* Platz-Plakette, Gold/Silber/Bronze für die Top 3 */
.rank-badge {
    display: inline-block;
    min-width: 2em;
    padding: 0.1em 0.4em;
    border-radius: 999px;
    font-weight: 800;
    text-align: center;
}
/* Top 10: dezente grüne Hervorhebung; Gold/Silber/Bronze bleibt für 1–3 */
tr.rank-top10 td:not(.tipp-cell) { background-color: #e7f2ea; }
tbody tr.rank-top10:hover td:not(.tipp-cell) { background-color: var(--pitch-light); }
/* Sichtbarer Einschnitt zwischen Platz 10 und dem Rest der Rangliste:
   Abschlusslinie unter Platz 10, Abstand, Rahmenlinie über Platz 11. */
.ranking-table tr.rank-gap td {
    height: 0.9em;
    padding: 0;
    border: none;
    line-height: 0;
    background: transparent !important;
}
.ranking-table tr.rank-top10-last td {
    border-bottom: 2px solid var(--pitch-dark);
}
.ranking-table tr.rank-rest-first td {
    border-top: 2px solid var(--pitch-dark);
}
tr.rank-top10:not(.rank-1):not(.rank-2):not(.rank-3) .rank-badge {
    background: #dbeadf;
    color: var(--pitch-dark);
}
tr.rank-1 .rank-badge { background: var(--gold); color: #3d2d00; }
tr.rank-2 .rank-badge { background: var(--silver); color: #23292e; }
tr.rank-3 .rank-badge { background: var(--bronze); color: #fff; }
tr.me td:not(.tipp-cell) { background-color: #fff6d6 !important; font-weight: 700; }

.round-filter { margin-bottom: 20px; }
.joker-icon {
    width: 1.1em;
    height: 1.1em;
    vertical-align: text-bottom;
    margin-left: 4px;
}
th.game-header { white-space: normal; }
.team-logo {
    height: 1.1em;
    width: auto;
    vertical-align: middle;
    margin-right: 0.25em;
}
/* Logo + Name nebeneinander, vertikal zentriert (für Inline-Wrapper) */
.team-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
}
.team-cell .team-logo {
    margin-right: 0;
}

/* Legende */
.legend {
    margin: 20px 0;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--pitch);
    border-radius: 8px;
    background-color: #f7faf8;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Kleine Bildschirme ------------------------------------------------------- */
@media (max-width: 700px) {
    .page { margin: 0.3em; padding: 0.8em; border-radius: 6px; }
    .site-nav { padding: 0.4em 0.5em; position: static; font-size: 0.85em; }
    .nav-user { margin-left: 0; }

    /* Formulare: Label über dem Feld statt daneben */
    .form-group label {
        display: block;
        width: auto;
        text-align: left;
        margin: 0 0 0.2em;
    }
    .form-group button:first-of-type {
        margin-left: 0;
    }
    .form-actions {
        margin-left: 0;
        justify-content: center;
    }

    /* Tabellen: kompaktere Zellen, volle Breite */
    th, td { padding: 5px 6px; }

    h1 { font-size: 1.3em; }
    h2 { font-size: 1.1em; }
}
