:root {
    --ink: #10141b;
    --muted: #667085;
    --line: #d9e0ea;
    --paper: #f4f7fb;
    --panel: #ffffff;
    --blue: #062e63;
    --blue-dark: #022756;
    --cyan: #52c9ee;
    --green: #147d4f;
    --red: #b42318;
    --shadow: 0 18px 50px rgba(16, 20, 27, .10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(0, 110, 183, .10), transparent 38%),
        repeating-linear-gradient(90deg, rgba(16, 20, 27, .035) 0 1px, transparent 1px 80px),
        var(--paper);
    font-family: "Segoe UI", Verdana, sans-serif;
    letter-spacing: 0;
}

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

input, select, button {
    font: inherit;
}

input, select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    background: #fff;
    color: var(--ink);
}

textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 11px;
    background: #fff;
    color: var(--ink);
    resize: vertical;
    font: inherit;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(90deg, rgba(244, 247, 251, .98), rgba(244, 247, 251, .80) 45%, rgba(244, 247, 251, .35)),
        url("../images/auth-football.jpg") center right / cover no-repeat,
        var(--paper);
}

.auth-card {
    width: min(440px, 100%);
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(217, 224, 234, .9);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 34px;
}

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

.auth-logo {
    width: min(260px, 100%);
    height: auto;
    display: block;
    margin-bottom: 24px;
}

h1, h2 {
    margin: 0;
    line-height: 1.08;
    letter-spacing: 0;
}

h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 4vw, 56px);
    font-weight: 700;
}

h2 {
    font-size: 20px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    text-transform: uppercase;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .08em;
}

.stack {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

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

.full { grid-column: 1 / -1; }

.button,
button {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 42px;
    padding: 10px 16px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button.primary,
button.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.button.light {
    background: rgba(255, 255, 255, .94);
    border-color: rgba(255, 255, 255, .55);
    color: var(--ink);
}

.button.small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
}

button:disabled,
input:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.auth-switch {
    margin: 18px 0 0;
    color: var(--muted);
}

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

.flash {
    margin: 0 0 18px;
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 700;
}

.flash.success { border-color: rgba(20, 125, 79, .35); color: var(--green); }
.flash.danger { border-color: rgba(180, 35, 24, .35); color: var(--red); }
.flash.info { border-color: rgba(23, 79, 130, .28); color: var(--blue); }

.legal-links {
    position: fixed;
    right: 18px;
    bottom: 14px;
    z-index: 25;
    display: flex;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid rgba(217, 224, 234, .9);
    border-radius: 8px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 10px 28px rgba(16, 20, 27, .10);
    font-size: 12px;
    font-weight: 800;
}

.legal-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    padding: 24px;
}

.legal-modal:target {
    display: grid;
    place-items: center;
}

.legal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 20, 27, .58);
}

.legal-dialog {
    position: relative;
    z-index: 1;
    width: min(820px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(16, 20, 27, .28);
    padding: 28px;
}

.legal-close {
    position: sticky;
    top: 0;
    float: right;
    width: 36px;
    height: 36px;
    margin: -8px -8px 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--ink);
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.legal-copy {
    display: grid;
    gap: 12px;
    color: #27313f;
    font-size: 14px;
    line-height: 1.55;
}

.legal-copy h3 {
    margin: 10px 0 0;
    font-size: 15px;
}

.legal-copy p {
    margin: 0;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.nav-toggle,
.mobile-nav-button,
.nav-backdrop {
    display: none;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px;
    background: rgba(255, 255, 255, .88);
    border-right: 1px solid var(--line);
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 26px;
}

.brand {
    display: grid;
    gap: 6px;
    color: var(--ink);
    font-weight: 900;
}

.brand img {
    width: min(176px, 100%);
}

.sidebar nav {
    display: grid;
    align-content: start;
    gap: 8px;
}

.sidebar nav a {
    color: var(--ink);
    border-radius: 8px;
    padding: 12px 13px;
    font-weight: 800;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: #e9f3fb;
    color: var(--blue-dark);
}

.user-box {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 13px;
}

.user-box strong { color: var(--ink); font-size: 16px; }

.content {
    width: min(1320px, 100%);
    padding: 34px;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.visual-hero,
.stage-visual {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    min-height: 230px;
    margin-bottom: 18px;
    color: #fff;
    background: var(--ink);
    isolation: isolate;
}

.visual-hero::before,
.stage-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: center / cover no-repeat;
}

.visual-hero::after,
.stage-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, rgba(16, 20, 27, .82), rgba(16, 20, 27, .35) 55%, rgba(16, 20, 27, .05));
}

.dashboard-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    padding: 28px;
}

.dashboard-hero::before {
    background-image: url("../images/hero-stadium.jpg");
}

.dashboard-hero h2 {
    max-width: 620px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(28px, 3vw, 46px);
}

.stage-visual {
    min-height: 160px;
    display: flex;
    align-items: end;
    padding: 22px;
}

.stage-visual::before {
    background-image: url("../images/tips-banner.jpg");
}

.stage-visual div {
    display: grid;
    gap: 5px;
}

.stage-visual span {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 12px;
    font-weight: 900;
    color: #d7e9f8;
}

.stage-visual strong {
    font-size: 30px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stat-card,
.panel {
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(16, 20, 27, .07);
}

.stat-card {
    padding: 20px;
    display: grid;
    gap: 8px;
}

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

.stat-card strong {
    font-size: 36px;
    line-height: 1;
}

.primary-stat {
    background: var(--ink);
    color: #fff;
}

.primary-stat span { color: #b9c3d0; }

.dashboard-layout {
    display: flex;
    flex-direction: column;
}

.dashboard-layout > .dashboard-hero {
    order: 1;
}

.dashboard-layout > .stat-grid {
    order: 2;
}

.dashboard-layout > .news-panel {
    order: 3;
}

.dashboard-layout > .dashboard-grid {
    order: 4;
}

.dashboard-grid,
.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

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

.rich-text {
    margin-top: 14px;
    color: #344054;
    line-height: 1.65;
}

.admin-grid {
    grid-template-columns: .85fr 1.15fr;
    margin-bottom: 16px;
}

.panel {
    padding: 20px;
    margin-bottom: 16px;
}

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

.section-head p {
    margin: 6px 0 0;
}

.user-picker {
    display: flex;
    align-items: end;
    gap: 10px;
    min-width: min(420px, 100%);
}

.fixture-highlight {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.fixture-highlight span,
.fixture-highlight em {
    color: var(--muted);
    font-style: normal;
}

.fixture-highlight strong {
    font-size: 24px;
}

.team-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    vertical-align: middle;
}

.flag {
    width: 24px;
    height: 18px;
    flex: 0 0 24px;
    display: inline-block;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(16, 20, 27, .14);
    background: #fff;
}

.flag.placeholder {
    border: 1px dashed var(--line);
    border-radius: 3px;
    background: #f8fafc;
}

.champion {
    font-size: 28px;
    font-weight: 900;
    margin: 18px 0 8px;
}

.rules-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.rules-page {
    max-width: 880px;
}

.rules-page p {
    color: #344054;
    line-height: 1.65;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.rule-card {
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    display: grid;
    gap: 10px;
    box-shadow: 0 12px 34px rgba(16, 20, 27, .07);
}

.rule-card span {
    color: var(--blue);
    font-weight: 900;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .06em;
}

.rule-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.rule-card strong {
    color: var(--ink);
}

.rules-mini span {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px;
}

.segmented {
    display: inline-flex;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.segmented a {
    min-width: 112px;
    text-align: center;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--ink);
    font-weight: 800;
}

.segmented a.active {
    background: var(--blue);
    color: #fff;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 16px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .88);
    width: max-content;
    max-width: 100%;
}

.admin-tabs a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 13px;
    border-radius: 6px;
    color: var(--ink);
    font-weight: 900;
}

.admin-tabs a.active {
    background: var(--blue);
    color: #fff;
}

.champion-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.champion-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 10px;
    width: min(520px, 100%);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.data-table tr.self {
    background: #e9f3fb;
}

.score-form {
    display: inline-grid;
    grid-template-columns: 56px auto 56px auto;
    align-items: center;
    gap: 6px;
}

.prediction-table .score-form {
    grid-template-columns: 56px auto 56px;
}

.prediction-actions {
    display: flex;
    justify-content: flex-end;
    padding: 16px 0 0;
}

.admin-champion-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    align-items: end;
    gap: 10px;
    max-width: 640px;
    margin-bottom: 10px;
}

.inline-delete {
    margin-bottom: 16px;
}

.score-form input {
    min-height: 34px;
    padding: 6px;
    text-align: center;
}

.score-form button {
    min-height: 34px;
    padding: 6px 9px;
}

.admin-result-form {
    display: grid;
    grid-template-columns: 54px 14px 54px;
    align-items: center;
    gap: 6px;
    width: max-content;
}

.admin-result-form input[type="number"] {
    width: 54px;
    min-height: 34px;
    padding: 6px;
    text-align: center;
}

.admin-result-form > span {
    text-align: center;
    color: var(--muted);
    font-weight: 900;
}

.result-release {
    margin-top: 8px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    white-space: nowrap;
}

.vs {
    display: inline-block;
    margin: 0 8px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.venue {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.status {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 900;
}

.status.open {
    color: var(--green);
    background: rgba(20, 125, 79, .10);
}

.status.locked {
    color: var(--muted);
    background: rgba(102, 112, 133, .12);
}

.points {
    display: inline-flex;
    min-width: 44px;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--ink);
    color: #fff;
    font-weight: 900;
}

.admin-table input,
.admin-table select {
    min-width: 110px;
    margin: 2px 0;
}

.admin-add-user {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.admin-match-table {
    min-width: 1180px;
}

.admin-match-table input,
.admin-match-table select {
    margin: 2px 0;
}

.admin-match-table td:nth-child(1) input,
.admin-match-table td:nth-child(1) select,
.admin-match-table td:nth-child(2) input,
.admin-match-table td:nth-child(4) input {
    width: 150px;
}

.admin-match-table td:nth-child(3) input {
    width: 240px;
}

.admin-row-form {
    display: grid;
    align-items: center;
    gap: 10px;
}

.user-row {
    grid-template-columns: 1fr 1fr 1.35fr 1fr .75fr .75fr auto;
}

.row-actions {
    display: flex;
    gap: 8px;
}


.admin-row-form > div {
    display: grid;
    gap: 4px;
}

.admin-prediction-table .score-form {
    grid-template-columns: 56px auto 56px auto;
}

.check {
    display: inline-flex;
    grid-auto-flow: column;
    align-items: center;
    gap: 6px;
    color: var(--ink);
}

.check input {
    width: auto;
    min-width: auto;
    min-height: auto;
}

.empty {
    text-align: center;
    color: var(--muted);
}

.setup-secret {
    display: grid;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    margin: 16px 0;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-shell:has(.nav-toggle:checked) {
        overflow: hidden;
    }

    .mobile-nav-button {
        position: fixed;
        top: 14px;
        right: 14px;
        z-index: 40;
        width: 46px;
        height: 46px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 10px 28px rgba(16, 20, 27, .14);
        display: grid;
        place-content: center;
        gap: 5px;
        cursor: pointer;
    }

    .mobile-nav-button span {
        display: block;
        width: 22px;
        height: 2px;
        border-radius: 999px;
        background: var(--ink);
        transition: transform .18s ease, opacity .18s ease;
    }

    .nav-toggle:checked + .mobile-nav-button span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle:checked + .mobile-nav-button span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle:checked + .mobile-nav-button span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 20;
        background: rgba(16, 20, 27, .42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .18s ease;
    }

    .nav-toggle:checked ~ .nav-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 30;
        width: min(320px, 86vw);
        height: 100dvh;
        grid-template-columns: 1fr;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 18px 0 50px rgba(16, 20, 27, .18);
    }

    .nav-toggle:checked ~ .sidebar {
        transform: translateX(0);
    }

    .sidebar nav {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 76px 22px 22px;
    }

    .stat-grid,
    .dashboard-grid,
    .admin-grid,
    .rules-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 820px) {
    .prediction-panel {
        overflow: visible;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .prediction-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 12px;
    }

    .prediction-table thead {
        display: none;
    }

    .prediction-table,
    .prediction-table tbody,
    .prediction-table tr,
    .prediction-table td {
        display: block;
        width: 100%;
    }

    .prediction-table tr {
        background: rgba(255, 255, 255, .94);
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: 0 10px 26px rgba(16, 20, 27, .07);
        overflow: hidden;
    }

    .prediction-table td {
        border-bottom: 1px solid var(--line);
        padding: 12px 14px;
    }

    .prediction-table td:last-child {
        border-bottom: 0;
    }

    .prediction-table td::before {
        display: block;
        margin-bottom: 5px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 900;
        letter-spacing: .06em;
        text-transform: uppercase;
    }

    .prediction-table td:nth-child(1)::before { content: "Termin"; }
    .prediction-table td:nth-child(2)::before { content: "Runde"; }
    .prediction-table td:nth-child(3)::before { content: "Spiel"; }
    .prediction-table td:nth-child(4)::before { content: "Dein Tipp"; }
    .prediction-table td:nth-child(5)::before { content: "Ergebnis"; }
    .prediction-table td:nth-child(6)::before { content: "Status"; }

    .prediction-table td:nth-child(3) strong {
        display: inline-flex;
        max-width: 100%;
    }

    .prediction-table .vs {
        margin: 6px 0;
        display: block;
    }

    .prediction-table .score-form {
        width: 100%;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    }

    .prediction-table .score-form input {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 680px) {
    .legal-links {
        right: 12px;
        bottom: 10px;
        left: 12px;
        justify-content: center;
    }

    .legal-modal {
        padding: 12px;
    }

    .legal-dialog {
        max-height: calc(100vh - 24px);
        padding: 22px;
    }

    .auth-card {
        padding: 24px;
    }

    .grid-form,
    .stat-grid,
    .dashboard-grid,
    .admin-grid,
    .rules-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-layout > .news-panel {
        grid-column: auto;
        order: 0;
    }

    .page-head,
    .champion-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .champion-form {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 38px;
    }
}
