/* Material 3 Tokens, erzeugt mit material-color-utilities aus #2e6b4f (TonalSpot). */
:root {
  color-scheme: light dark;
  --md-sys-color-primary:#236a4c;--md-sys-color-on-primary:#ffffff;--md-sys-color-primary-container:#aaf2cb;--md-sys-color-on-primary-container:#005236;--md-sys-color-secondary:#4d6356;--md-sys-color-on-secondary:#ffffff;--md-sys-color-secondary-container:#d0e8d8;--md-sys-color-on-secondary-container:#364b3f;--md-sys-color-tertiary:#3d6472;--md-sys-color-on-tertiary:#ffffff;--md-sys-color-tertiary-container:#c0e9fa;--md-sys-color-on-tertiary-container:#234c5a;--md-sys-color-error:#ba1a1a;--md-sys-color-on-error:#ffffff;--md-sys-color-error-container:#ffdad6;--md-sys-color-on-error-container:#93000a;--md-sys-color-background:#f5fbf4;--md-sys-color-on-background:#171d19;--md-sys-color-surface:#f5fbf4;--md-sys-color-on-surface:#171d19;--md-sys-color-surface-variant:#dce5dd;--md-sys-color-on-surface-variant:#404943;--md-sys-color-outline:#707973;--md-sys-color-outline-variant:#c0c9c1;--md-sys-color-surface-container-lowest:#ffffff;--md-sys-color-surface-container-low:#f0f5ef;--md-sys-color-surface-container:#eaefe9;--md-sys-color-surface-container-high:#e4eae3;--md-sys-color-surface-container-highest:#dee4de;--md-sys-color-inverse-surface:#2c322e;--md-sys-color-inverse-on-surface:#edf2ec;--md-sys-color-inverse-primary:#8fd5b0;
  /* Keine Google-Fonts-Abrufe: Roboto nur, wenn lokal vorhanden. */
  --md-ref-typeface-plain: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  --md-ref-typeface-brand: var(--md-ref-typeface-plain);
}
@media (prefers-color-scheme: dark) {
  :root {
    --md-sys-color-primary:#8fd5b0;--md-sys-color-on-primary:#003824;--md-sys-color-primary-container:#005236;--md-sys-color-on-primary-container:#aaf2cb;--md-sys-color-secondary:#b4ccbc;--md-sys-color-on-secondary:#20352a;--md-sys-color-secondary-container:#364b3f;--md-sys-color-on-secondary-container:#d0e8d8;--md-sys-color-tertiary:#a4cdde;--md-sys-color-on-tertiary:#063543;--md-sys-color-tertiary-container:#234c5a;--md-sys-color-on-tertiary-container:#c0e9fa;--md-sys-color-error:#ffb4ab;--md-sys-color-on-error:#690005;--md-sys-color-error-container:#93000a;--md-sys-color-on-error-container:#ffdad6;--md-sys-color-background:#0f1511;--md-sys-color-on-background:#dee4de;--md-sys-color-surface:#0f1511;--md-sys-color-on-surface:#dee4de;--md-sys-color-surface-variant:#404943;--md-sys-color-on-surface-variant:#c0c9c1;--md-sys-color-outline:#8a938c;--md-sys-color-outline-variant:#404943;--md-sys-color-surface-container-lowest:#0a0f0c;--md-sys-color-surface-container-low:#171d19;--md-sys-color-surface-container:#1b211d;--md-sys-color-surface-container-high:#262b27;--md-sys-color-surface-container-highest:#303632;--md-sys-color-inverse-surface:#dee4de;--md-sys-color-inverse-on-surface:#2c322e;--md-sys-color-inverse-primary:#236a4c;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 400 16px/24px var(--md-ref-typeface-plain);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
}
a { color: var(--md-sys-color-primary); }
:not(:defined) { visibility: hidden; }

/* Top App Bar + Navigation */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 0 16px;
  background: var(--md-sys-color-surface-container);
}
.brand { font-size: 22px; line-height: 28px; color: inherit; text-decoration: none; }
nav { display: flex; gap: 4px; }
nav form { display: contents; }
nav a, nav button {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 12px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font: 500 14px/20px var(--md-ref-typeface-plain);
  color: var(--md-sys-color-on-surface-variant); text-decoration: none;
}
nav a:hover, nav button:hover { background: var(--md-sys-color-surface-container-highest); }
nav a.active { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
nav :focus-visible, .x:focus-visible, a:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
.ic { display: grid; place-items: center; }
.ic svg { width: 24px; height: 24px; fill: currentColor; }

main { max-width: 960px; margin: 0 auto; padding: 8px 24px 48px; }
main.narrow { max-width: 560px; }

h1 { font: 400 28px/36px var(--md-ref-typeface-plain); margin: 24px 0 12px; }
h2 { font: 400 22px/28px var(--md-ref-typeface-plain); margin: 0 0 8px; }
h3 { font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .1px; color: var(--md-sys-color-on-surface-variant); margin: 20px 0 8px; }
p { margin: 0 0 12px; }
.lead { font-size: 18px; color: var(--md-sys-color-on-surface-variant); }
.muted { color: var(--md-sys-color-on-surface-variant); }
.small { font-size: 14px; line-height: 20px; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }

.card {
  display: block; margin: 0 0 16px; padding: 16px;
  border-radius: 12px; background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
}
.card.link { color: inherit; text-decoration: none; margin: 0; transition: background .15s; }
.card.link:hover { background: var(--md-sys-color-surface-container-high); }
.card.flush { padding: 0; }
.card.flush > h2 { padding: 16px 16px 0; }
.card.hero { margin-top: 12vh; padding: 24px; }
.card.hero h1 { margin-top: 0; }
.card > :last-child, .card form > :last-child { margin-bottom: 0; }
.scroll { overflow-x: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

.stack { display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row > md-outlined-text-field, .row > md-outlined-select { flex: 1 1 180px; min-width: 0; }
.row > .short { flex: 0 1 140px; }
main > .row { margin-bottom: 16px; }
.headrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.playerrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; }
.playerrow > .row { flex: 1 1 320px; }
md-divider { margin: 20px 0 0; }
.danger { --md-text-button-label-text-color: var(--md-sys-color-error); --md-text-button-hover-label-text-color: var(--md-sys-color-error); --md-text-button-focus-label-text-color: var(--md-sys-color-error); --md-text-button-pressed-label-text-color: var(--md-sys-color-error); }

.badges, .names { display: flex; flex-wrap: wrap; gap: 8px; }
.badges { margin-top: 16px; }
.card .badges { margin: 0 0 8px; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 8px;
  font: 500 12px/20px var(--md-ref-typeface-plain); letter-spacing: .3px;
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
}
.badge.plain { background: none; outline: 1px solid var(--md-sys-color-outline-variant); outline-offset: -1px; color: var(--md-sys-color-on-surface-variant); }
.badge.ok { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.badge.warn { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }

.flash {
  margin: 16px 0; padding: 14px 16px; border-radius: 8px;
  background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
}
.flash.warnbox { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
th { font: 500 14px/20px var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface-variant); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num:first-child { width: 1%; }
td.actions { text-align: right; white-space: nowrap; }

.matches { list-style: none; margin: 0; padding: 0; }
.matches li {
  display: grid; grid-template-columns: 1fr auto 1fr 40px; align-items: center; gap: 12px;
  padding: 4px 0; border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.matches li:last-child { border-bottom: 0; }
.matches .p1 { text-align: right; }
.matches .win { font-weight: 700; color: var(--md-sys-color-primary); }
.score { min-width: 56px; padding: 2px 10px; border-radius: 8px; text-align: center; font-variant-numeric: tabular-nums; background: var(--md-sys-color-surface-container-highest); }
.x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; cursor: pointer; font-size: 20px; color: var(--md-sys-color-on-surface-variant); }
.x:hover { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-error); }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.checks label { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; cursor: pointer; }

/* Handy: Navigation Bar unten */
@media (max-width: 640px) {
  .top { justify-content: center; min-height: 56px; }
  nav {
    position: fixed; left: 0; right: 0; bottom: 0; gap: 0;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    background: var(--md-sys-color-surface-container);
  }
  nav a, nav button { flex: 1; flex-direction: column; gap: 4px; padding: 0; border-radius: 0; font-size: 12px; line-height: 16px; }
  nav a:hover, nav button:hover, nav a.active { background: none; }
  nav .ic { width: 64px; height: 32px; border-radius: 16px; }
  nav a.active { color: var(--md-sys-color-on-surface); }
  nav a.active .ic { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
  main { padding: 0 16px 112px; }
  h1 { font-size: 24px; line-height: 32px; }
  th, td { padding: 12px 10px; }
  .wide { display: none; }
  td.actions { white-space: normal; padding-left: 0; }
  .playerrow > .row { display: contents; }
  .playerrow md-outlined-text-field { flex: 1 1 100%; }
  .row > .short { flex: 1 1 110px; }
  .row > md-filled-button, .row > md-filled-tonal-button, .stack md-filled-button { flex: 1 1 100%; }
}

/* Sprungziele nicht unter der fixierten Leiste verstecken */
[id] { scroll-margin-top: 72px; }

/* Meldungen bleiben sichtbar, auch wenn die Seite zu einem Abschnitt springt */
main > .flash[role=status] { position: sticky; top: 72px; z-index: 4; }

/* Teamliste: Name links, Auflösen-Knopf rechts */
.matches.teams li { grid-template-columns: 1fr 40px; min-height: 48px; }
