:root { --bg: #17181b; --card: #24252a; --line: #3a3b42; --text: #f1f1f4; --muted: #a2a3ab; --accent: #33b5f5; --good: #6fd08a; --bad: #ff8a8a; }
* { box-sizing: border-box; }
/* Spalte in Fensterhöhe: die Fußzeile steht am unteren Rand, bei viel Inhalt darunter */
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, sans-serif; }
header { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
header h1 { margin: 0; font-size: 22px; }
header h1 small { color: var(--muted); font-weight: 400; font-size: 15px; margin-left: 8px; }
#ver { opacity: .6; }
input.short { width: 70px; }
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 18px 16px 24px; }
footer { width: 100%; max-width: 1200px; margin: 0 auto; padding: 14px 16px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
/* Datenschutz: Lesetext in schmaler Spalte */
main.legal { max-width: 800px; }
main.legal h1 { font-size: 26px; margin: 8px 0 4px; }
main.legal h2 { font-size: 18px; margin: 28px 0 6px; }
main.legal p, main.legal ul { margin: 0 0 10px; }
main.legal a { color: var(--accent); }
a.btn { padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: #2f3037; color: var(--text); text-decoration: none; }
a.btn:hover { background: #3a3b44; }
main.wide { max-width: none; }   /* Runden mit Gruppen: die ganze Fensterbreite nutzen */
button { font: inherit; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: #2f3037; color: var(--text); cursor: pointer; }
button:hover { background: #3a3b44; }
button.primary { background: var(--accent); border-color: var(--accent); color: #06222f; font-weight: 600; }
button.danger { color: var(--bad); }
button.small { padding: 3px 9px; font-size: 14px; }
button:disabled { opacity: .45; cursor: not-allowed; }
input { font: inherit; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--line); background: #111214; color: var(--text); min-width: 0; }
input.score { width: 58px; text-align: center; font-size: 18px; font-weight: 700; }
.card { background: var(--card); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.tabs button { border: none; background: none; border-bottom: 3px solid transparent; border-radius: 0; padding: 9px 16px; color: var(--muted); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { color: var(--muted); display: block; }
/* Zeilen abwechselnd getönt, damit man in der Zeile bleibt */
tbody tr:nth-child(even) td, #matches > .match:nth-child(even), #list > .item:nth-child(even) { background: #2c2d34; }
#matches > .match, #list > .item { padding-left: 10px; padding-right: 10px; }
.compact th, .compact td { padding: 3px 8px; }
.compact table { width: auto; min-width: 520px; }
td .grp { color: var(--muted); font-size: 12px; margin-left: 8px; white-space: nowrap; }
tr.out td { color: var(--muted); text-decoration: line-through; }
.match { display: grid; grid-template-columns: 70px 1fr auto 1fr; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.match .tbl { color: var(--muted); font-weight: 700; }
.match .b { text-align: right; }
.match .win { color: var(--good); font-weight: 700; }
.match .sc { display: flex; gap: 6px; align-items: center; }
.match small { color: var(--muted); display: block; }
/* Runden mit Gruppen: je nach Fensterbreite 1, 2 oder 4 Gruppen nebeneinander, die Zeilen dafür enger */
.groups { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.groups > div { border: 2px solid var(--line); border-radius: 10px; background: #1c1d21; overflow: hidden; }
.groups > div > h3.group { margin: 0; padding: 7px 12px; background: #1d4a63; color: #fff; border-bottom: none; }
.groups > div > .match { padding-left: 12px; padding-right: 12px; }
.groups > div > .match:nth-child(odd) { background: #2a2b32; }
.groups > div > .match:last-child { border-bottom: none; }
@media (min-width: 900px) { .groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1700px) { .groups.many { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.groups .match { grid-template-columns: 54px minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; padding: 6px 0; }
.groups .match > div { overflow-wrap: anywhere; }
.groups input.score { width: 46px; padding: 5px 4px; font-size: 17px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:hover b { color: var(--accent); }
#msg { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #5a2328; color: #fff; padding: 10px 18px; border-radius: 8px; max-width: 90vw; }
#offBar { border: 1px solid #8a6d1f; background: #3a3117; }
#offBar b { color: #ffd166; }
#lock { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; z-index: 10; }
#lockForm { display: flex; flex-direction: column; gap: 12px; width: min(340px, 90vw); margin: 0; box-shadow: 0 10px 40px #000; }
#lockErr { color: var(--bad); min-height: 1.4em; }
[hidden] { display: none !important; }
/* Leseversion: nichts zum Ändern anbieten, Ergebnisse als reine Zahlen */
body.readonly :is(#newForm, #loadBtn, #teamForm, #delTour, #drawBtn, #undoBtn, #nextBtn, #teamRows button) { display: none !important; }
body.readonly :is(input, select):disabled { opacity: 1; color: var(--text); border-color: transparent; background: none; }
body.readonly input[type=number] { appearance: textfield; -moz-appearance: textfield; }   /* ohne die Pfeile zum Hoch- und Runterzählen */
body.readonly input[type=number]::-webkit-inner-spin-button, body.readonly input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; display: none; margin: 0; }
body.readonly #roBtn { background: var(--accent); border-color: var(--accent); color: #06222f; font-weight: 600; }
@media print {
  body { background: #fff; color: #000; }
  header, .tabs, button, form, .noprint, #msg, #lock { display: none !important; }
  .card { background: none; padding: 0; }
  th, td, .match { border-color: #999; }
  th, .muted, td small, td .grp, .match small, .match .tbl, h3.group { color: #333; }
  input.score { border: none; background: none; color: #000; }
  .match .win { color: #000; }
  h2.print { display: block !important; }
  .groups > div, .groups > div > h3.group, .groups > div > .match { background: none !important; border-color: #999; color: #000; }
  tbody tr:nth-child(even) td, #matches > .match:nth-child(even), .groups > div > .match:nth-child(odd) {
    background: #e8e8e8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
h2.print { display: none; }
h3.group { margin: 26px 0 4px; padding-bottom: 5px; font-size: 17px; color: var(--accent); border-bottom: 2px solid var(--accent); }
h3.group:first-child { margin-top: 0; }
select { font: inherit; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--line); background: #111214; color: var(--text); }
