/* Farbwelt angelehnt an einen Ozean-/Wasser-Look: tiefes Marineblau, Ozeanblau, Aqua, helles Weiß */
:root {
    --navy: #0a2540;
    --ocean: #0b6fb8;
    --aqua: #2bb7d9;
    --bg: #eef6fb;
    --card: #ffffff;
    --ink: #0a2540;
    --muted: #5b7186;
    --line: #d6e6f1;
    --accent: #0b6fb8;
    --accent-2: #2bb7d9;
    --accent-ink: #ffffff;
    --soft: #e3f1fa;
    --danger: #c0392b;
    --ok-bg: #dcf3f1;
    --err-bg: #fde7e4;
    --header-bg: linear-gradient(135deg, #0a2540 0%, #0b4f86 100%);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #07182a;
        --card: #0d2740;
        --ink: #e6f1f9;
        --muted: #8fa9bf;
        --line: #1b3a57;
        --accent: #3aa8ea;
        --accent-2: #46d0ec;
        --accent-ink: #04192b;
        --soft: #123350;
        --danger: #ff8b7d;
        --ok-bg: #0f3a3c;
        --err-bg: #4a2220;
        --header-bg: linear-gradient(135deg, #051524 0%, #0a3558 100%);
    }
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}
.top {
    display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between;
    padding: 14px 24px; background: var(--header-bg); color: #fff;
    border-bottom: 4px solid var(--aqua);
}
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: .06em; text-transform: uppercase; color: #fff; text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
nav a { color: #cfe7f7; text-decoration: none; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; }
nav a:hover { color: #fff; }
main { max-width: 920px; margin: 0 auto; padding: 22px 16px 60px; }
h1 { font-size: 1.35rem; margin: 0 0 14px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: 18px;
    padding: 22px; margin-bottom: 20px; box-shadow: 0 4px 18px rgba(10, 37, 64, .06);
}
.card.narrow { max-width: 420px; margin: 40px auto; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
input[type=text], input[type=password], input[type=number], input[type=date] {
    display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
    font: inherit; color: var(--ink); background: var(--bg);
    border: 1px solid var(--line); border-radius: 10px;
}
input:focus { outline: 2px solid var(--aqua); outline-offset: 1px; }
button {
    font: inherit; font-size: .85rem; cursor: pointer; padding: 11px 24px; border: 0; border-radius: 999px;
    background: linear-gradient(135deg, var(--ocean), var(--accent-2)); color: #fff;
    font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
button.link {
    background: none; color: var(--accent); padding: 4px 6px; font-weight: 600;
    text-transform: none; letter-spacing: 0; font-size: .9rem;
}
button.link.danger { color: var(--danger); }
.game-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: end; }
.game-form .wide { grid-column: 1 / -1; }
.game-form button { grid-column: 1 / -1; margin-top: 4px; }
.game-form input[type=number] { font-size: 1.4rem; text-align: center; }
.sumbar {
    margin: 0 0 14px; padding: 8px 14px; border-radius: 10px; background: var(--soft);
    color: var(--muted); text-align: center; font-size: .9rem;
}
.sumbar.over { background: var(--err-bg); color: var(--danger); font-weight: 600; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-end; }
.inline-form label { flex: 1 1 180px; }
.inline-form button { margin-bottom: 12px; }
.inline-form.compact { gap: 8px; flex-wrap: nowrap; align-items: center; }
.inline-form.compact input { margin: 0; padding: 6px 10px; min-width: 130px; }
.inline-form.compact button { margin: 0; padding: 7px 14px; }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.flash.ok { background: var(--ok-bg); }
.flash.err { background: var(--err-bg); }

/* Gesamtstand */
.totals { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; text-align: center; }
.totals .team {
    position: relative; display: flex; flex-direction: column; padding: 14px 6px;
    border-radius: 14px; background: var(--soft); border: 2px solid transparent;
}
.totals .team.leader {
    background: linear-gradient(145deg, var(--ocean), var(--aqua));
    color: #fff; border-color: var(--aqua);
    box-shadow: 0 8px 24px rgba(11, 111, 184, .35); transform: scale(1.04);
}
.totals .team.leader .name, .totals .team.leader .small { color: #eaf8ff; }
.totals .crown { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 1.5rem; }
.totals .name { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.totals .big { font-size: 2.4rem; font-weight: 800; line-height: 1.2; }
.totals .small { color: var(--muted); font-size: .85rem; }

/* Aufklappbare Gliederung */
details { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: var(--card); }
details.month { margin: 8px 10px; background: var(--bg); }
details > summary {
    list-style: none; cursor: pointer; padding: 12px 16px; display: flex; flex-wrap: wrap;
    gap: 6px 14px; align-items: center;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
    content: "▸"; color: var(--accent); transition: transform .15s; display: inline-block; width: 1em;
}
details[open] > summary::before { transform: rotate(90deg); }
details.year > summary { font-weight: 800; font-size: 1.1rem; }
details.month > summary { font-weight: 600; }
summary .label { min-width: 8.5em; }
summary .sum { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; font-weight: 400; font-size: .85rem; }
summary .pill { background: var(--soft); padding: 2px 10px; border-radius: 999px; color: var(--muted); }
summary .pill.lead { background: linear-gradient(135deg, var(--ocean), var(--aqua)); color: #fff; font-weight: 700; }
summary .pill b { font-size: .95rem; margin-left: 4px; }
summary .cnt { color: var(--muted); }
details .table-wrap { padding: 0 12px 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.win { font-weight: 800; color: var(--accent); }
td form { display: inline; }
td.actions { white-space: nowrap; }
@media (max-width: 560px) {
    .totals .big { font-size: 1.8rem; }
    .totals .team.leader { transform: none; }
    .inline-form.compact { flex-wrap: wrap; }
    summary .sum { margin-left: 0; }
}

/* PWA: Safe-Areas (iPhone-Notch / Home-Indicator) und App-Verhalten */
.top { padding-top: calc(14px + env(safe-area-inset-top)); padding-left: calc(24px + env(safe-area-inset-left)); padding-right: calc(24px + env(safe-area-inset-right)); }
main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
html { -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
button, summary { touch-action: manipulation; }
input[type=text], input[type=password], input[type=number], input[type=date] { font-size: max(16px, 1rem); } /* verhindert Auto-Zoom auf iOS */
