*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #1a7a3c;
  --green-dark: #145c2d;
  --green-light: #e8f5ed;
  --gold: #f0b429;
  --red: #e53935;
  --grey-bg: #f4f6f8;
  --grey-border: #dde1e7;
  --text: #1a1f2e;
  --text-muted: #6b7280;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.13);
  --radius: 12px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--grey-bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---- NAME OVERLAY ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.name-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.trophy { font-size: 48px; margin-bottom: 8px; }

.name-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 8px;
}

.name-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.name-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.name-card input {
  padding: 12px 14px;
  border: 1.5px solid var(--grey-border);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
}

.name-card input:focus { border-color: var(--green); }

.btn-primary {
  padding: 12px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--green-dark); }

.name-error {
  color: var(--red);
  font-size: 0.85rem;
  min-height: 18px;
}

/* ---- HEADER ---- */
header {
  background: var(--green-dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
}

nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }

.nav-btn {
  padding: 7px 16px;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.nav-btn:hover, .nav-btn.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* Burger-Button: nur auf Mobile sichtbar (per Media-Query) */
.nav-toggle {
  display: none;
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle:hover { background: rgba(255,255,255,0.28); }

.sync-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
  flex-shrink: 0;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf50;
  flex-shrink: 0;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.header-user {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}

/* ---- PAGES ---- */
.page { display: none; }
.page.active { display: block; }

.page-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  min-height: 36px;
  background: white;
  border: 1.5px solid var(--grey-border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

#group-filter {
  padding: 8px 12px;
  min-height: 36px;
  border: 1.5px solid var(--grey-border);
  border-radius: 20px;
  font-size: 0.85rem;
  background: white;
  cursor: pointer;
  outline: none;
  margin-left: auto;
}

/* ---- GROUP HEADER ---- */
.group-header {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 20px 0 8px;
  border-bottom: 1px solid var(--grey-border);
  margin-bottom: 10px;
}

/* ---- MATCH CARD ---- */
.match-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.match-card.played { border-left: 4px solid var(--green); }
.match-card.locked { border-left: 4px solid var(--gold); }

.match-flag {
  width: 36px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
  margin-bottom: 4px;
}

.team-name {
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-word;
  hyphens: auto;
}

.team.home {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.team.home .match-flag {
  margin-bottom: 0;
  flex-shrink: 0;
}

.team.home .team-info {
  text-align: left;
}

.team.away {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
}

.team.away .match-flag {
  margin-bottom: 0;
  flex-shrink: 0;
}

.team.away .team-info {
  text-align: right;
}

.tip-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

.match-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 110px;
}

.match-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.result-display {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: 2px;
}

.vs-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
}

.played-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.played-hint span {
  font-size: 0.72rem;
  color: var(--green);
  font-weight: 700;
}

.played-hint.pending {
  color: var(--gold-dark, #b07800);
  font-style: italic;
}

/* ---- FAVORITEN ---- */
.fav-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
  align-items: start;
}

.fav-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.fav-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--green-dark);
  color: white;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.fav-toggle:hover { background: var(--green); }

.fav-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.fav-body.open {
  max-height: none;
  overflow-y: visible;
}

.fav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--grey-border);
  font-size: 0.85rem;
}

.fav-item:last-child { border-bottom: none; }

.fav-rank {
  width: 26px;
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.fav-rank.top3 { color: var(--gold-dark, #c88f00); font-size: 0.9rem; }

.fav-flag { width: 30px; height: 20px; object-fit: cover; border-radius: 2px; flex-shrink: 0; }

.fav-name { font-weight: 600; flex: 1; }

.fav-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}


/* ---- TIP INPUT ---- */
.tip-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tip-input-single {
  width: 68px;
  height: 34px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  border: 1.5px solid var(--grey-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.tip-input-single:focus { border-color: var(--green); }

.tip-submit {
  padding: 6px 12px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.tip-submit:hover { background: var(--green-dark); }

/* ---- HIGHLIGHTS BUTTON ---- */
.highlights-btn {
  grid-column: 1 / -1;
  display: block;
  text-align: center;
  padding: 8px 12px;
  margin-top: 4px;
  background: #ff0000;
  color: white;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: background 0.15s, transform 0.1s;
}

.highlights-btn:hover {
  background: #cc0000;
  transform: translateY(-1px);
}

/* ---- POINTS BADGE ---- */
.points-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pts-3 { background: var(--green-light); color: var(--green-dark); }
.pts-1 { background: #fff8e1; color: #7a5c00; }
.pts-0 { background: #fce8e8; color: var(--red); }
.pts-pending { background: var(--grey-border); color: var(--text-muted); }

/* ---- LEADERBOARD ---- */
h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; }

.leaderboard-table {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  background: var(--green-dark);
  color: white;
  padding: 11px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leaderboard-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--grey-border);
  font-size: 0.93rem;
}

.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover td { background: var(--grey-bg); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}
@media (max-width: 500px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 16px;
  text-align: center;
}
.stat-card.stat-gold { border-top: 4px solid #c8900a; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--green-dark); line-height: 1; }
.stat-card.stat-gold .stat-value { color: #c8900a; }
.stat-label { font-size: 0.78rem; color: #666; margin-top: 6px; }

/* ---- GRUPPENSTAND ---- */
#standings-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 720px) { #standings-container { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { #standings-container { grid-template-columns: 1fr; } }

.standing-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.standing-header {
  background: var(--green-dark);
  color: white;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.standing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.standing-table th {
  padding: 5px 6px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  border-bottom: 1px solid var(--grey-border);
  background: var(--grey-bg);
}

.standing-table th:nth-child(2) { text-align: left; }

.standing-table td {
  padding: 6px 6px;
  text-align: center;
  border-bottom: 1px solid var(--grey-border);
}

.standing-table tr:last-child td { border-bottom: none; }

.standing-table td:nth-child(2) { text-align: left; }

.st-pos { font-weight: 700; color: var(--text-muted); width: 18px; }
.st-team { font-weight: 600; min-width: 80px; display: flex; align-items: center; gap: 6px; }
.st-flag { width: 22px; height: 15px; object-fit: cover; border-radius: 2px; flex-shrink: 0; }
.st-pts { font-weight: 800; color: var(--green-dark); }

.standing-qualify td { background: #edf7f1; }
.standing-qualify .st-pts { color: var(--green); }

/* ---- EMPTY ---- */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---- BESTÄTIGUNGS-DIALOG ---- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-box {
  background: white;
  border-radius: 16px;
  padding: 28px 28px 22px;
  width: min(340px, 90vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  text-align: center;
}

.confirm-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 10px;
}

.confirm-match {
  font-size: 0.9rem;
  color: #555;
  margin: 0 0 6px;
}

.confirm-score {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--green-dark);
  margin: 0 0 22px;
}

.confirm-btns {
  display: flex;
  gap: 10px;
}

.confirm-btn-cancel {
  flex: 1;
  padding: 11px;
  border: 1.5px solid var(--grey-border);
  border-radius: 10px;
  background: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: #444;
  transition: background 0.15s;
}
.confirm-btn-cancel:hover { background: var(--grey-bg); }

.confirm-btn-ok {
  flex: 1;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.confirm-btn-ok:hover { background: var(--green-dark); }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--green-dark);
  color: white;
  padding: 11px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  z-index: 999;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

/* ---- QUIZ ---- */
.quiz-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.quiz-q {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.quiz-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  background: var(--green-dark);
  color: white;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 1px;
}

.quiz-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--grey-border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.quiz-input:focus { border-color: var(--green); }

.quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
}

.quiz-option input[type="radio"] { display: none; }

.quiz-option span, .quiz-option {
  padding: 7px 14px;
  border: 1.5px solid var(--grey-border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  background: white;
  color: var(--text);
  transition: all 0.15s;
  user-select: none;
}

.quiz-option:has(input:checked) {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.quiz-save-btn {
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.quiz-save-btn:hover { background: var(--green-dark); }

/* ---- KO-KARTE ---- */
.ko-map-outer { padding-bottom: 40px; }

.map-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

.map-leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.map-leg-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.dot-wm   { background: #90caf9; }
.dot-in   { background: #66bb6a; }
.dot-out  { background: #ef5350; }
.dot-none { background: #dde1e7; border: 1px solid #c0c7d0; }

#ko-map {
  width: 100%;
  height: 520px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--grey-bg);
}

.map-note {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* jsvectormap tooltip override */
.jsvectormap-tip {
  background: var(--text) !important;
  color: white !important;
  font-family: 'Segoe UI', system-ui, sans-serif !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 5px 10px !important;
  border-radius: 6px !important;
  border: none !important;
}

@media (max-width: 560px) {
  #ko-map { height: 260px; }
}

/* ---- TRIVIA QUIZ ---- */
.trivia-wrap { margin-bottom: 8px; }

.trivia-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.trivia-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trivia-badge.leicht { background: #e8f5e9; color: #2e7d32; }
.trivia-badge.mittel { background: #fff8e1; color: #e65100; }

.trivia-counter {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.trivia-bar {
  height: 5px;
  background: var(--grey-border);
  border-radius: 3px;
  margin-bottom: 12px;
  overflow: hidden;
}

.trivia-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.trivia-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 22px 20px 18px;
}

.trivia-question {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 18px;
  color: var(--text);
}

.trivia-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 14px;
}

.trivia-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--grey-border);
  border-radius: 10px;
  background: white;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.trivia-opt:hover:not(.answered) {
  border-color: var(--green);
  background: var(--green-light);
}

.trivia-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--grey-bg);
  font-size: 0.78rem;
  font-weight: 800;
  transition: background 0.15s, color 0.15s;
}

.trivia-opt.answered { cursor: default; }

.trivia-opt.t-correct {
  border-color: #43a047;
  background: #e8f5e9;
  color: #1b5e20;
}

.trivia-opt.t-correct .trivia-letter {
  background: #43a047;
  color: white;
}

.trivia-opt.t-wrong {
  border-color: var(--red);
  background: #fce8e8;
  color: var(--red);
}

.trivia-opt.t-wrong .trivia-letter {
  background: var(--red);
  color: white;
}

.trivia-opt.answered:not(.t-correct):not(.t-wrong) {
  opacity: 0.45;
}

.trivia-fb {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.fb-ok   { background: #e8f5e9; color: #1b5e20; }
.fb-fail { background: #fce8e8; color: var(--red); }

.trivia-next-btn {
  width: 100%;
  padding: 13px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.trivia-next-btn:hover { background: var(--green-dark); }

.trivia-result {
  text-align: center;
  padding: 36px 24px;
}

.res-emoji { font-size: 3rem; margin-bottom: 10px; }

.res-score {
  font-size: 3rem;
  font-weight: 900;
  color: var(--green-dark);
  line-height: 1;
  margin-bottom: 6px;
}

.res-msg {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.res-pct {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* ---- AUTOCOMPLETE ---- */
.ac-wrap { position: relative; }

.ac-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: white;
  border: 1.5px solid var(--grey-border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 200;
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
}

.ac-item {
  padding: 10px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--grey-border);
  transition: background 0.1s;
}

.ac-item:last-child { border-bottom: none; }

.ac-item:hover, .ac-item.ac-active {
  background: var(--green-light);
}

.ac-item mark {
  background: none;
  color: var(--green-dark);
  font-weight: 700;
}

/* ---- TABLET (≤ 768px) ---- */
@media (max-width: 768px) {
  .page-inner { padding: 20px 16px 52px; }
  .match-center { min-width: 95px; }
  #standings-container { grid-template-columns: repeat(2, 1fr); }

  /* ---- Burger-Navigation ---- */
  /* Kopfzeile (eingeklappt): Logo links · Name · Burger ganz rechts */
  .nav-toggle { display: block; order: 2; margin-left: 0; }

  .user-greet {
    order: 1;
    margin-left: auto;          /* schiebt Name + Burger nach rechts */
    max-width: 50vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-inner {
    height: auto;
    min-height: 50px;
    padding-top: 9px;
    padding-bottom: 9px;
    gap: 10px;
  }

  /* Sync-Badge auf dem Handy ausblenden (spart Platz) */
  .sync-badge { display: none; }

  /* Menü zugeklappt → nav + Benutzerbox versteckt, klappen unter den Header */
  nav {
    display: none;
    order: 5;
    flex: 1 0 100%;
    flex-direction: column;
    overflow: visible;
    gap: 3px;
    margin-top: 6px;
    padding-bottom: 2px;
  }

  /* "header" davor → höhere Spezifität als die Basis-Regel weiter unten,
     sonst bliebe die Benutzerbox auf dem Handy sichtbar. */
  header .user-box {
    display: none;
    order: 6;
    flex: 1 0 100%;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.15);
  }

  header.menu-open nav { display: flex; }
  header.menu-open .user-box { display: flex; }

  /* Aufgeklapptes Menü: Header darf wachsen (sonst läuft das Menü über Weiß)
     und ist durchgehend grün – von Rand zu Rand. */
  header.menu-open .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
    row-gap: 0;
  }
  header.menu-open .header-inner,
  header.menu-open nav,
  header.menu-open .user-box {
    background: var(--green-dark);
  }

  nav .nav-btn {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    font-size: 0.95rem;
    border-radius: 8px;
    color: rgba(255,255,255,0.92);
  }

  .user-greet { font-size: 0.9rem; }
  .logout-btn { padding: 10px 14px; font-size: 0.9rem; width: 100%; text-align: center; }
}

/* ---- MOBILE (≤ 560px) ---- */
@media (max-width: 560px) {

  /* Header */
  .header-inner { padding: 0 12px; height: 50px; gap: 10px; }
  .header-logo { font-size: 0.88rem; }
  .nav-btn { padding: 6px 10px; font-size: 0.82rem; }

  /* Page */
  .page-inner { padding: 14px 10px 48px; }

  /* Filter bar */
  .filter-bar { gap: 6px; }
  #group-filter { margin-left: 0; }

  /* Match card: Team A oben links, Team B oben rechts, Rest darunter */
  .match-card {
    grid-template-columns: 1fr 1fr;
    padding: 12px 12px 14px;
    column-gap: 8px;
    row-gap: 10px;
  }

  .team.home { grid-column: 1; grid-row: 1; padding-right: 6px; }
  .team.away { grid-column: 2; grid-row: 1; padding-left: 6px; }

  .match-center {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--grey-border);
    padding-top: 10px;
    min-width: 0;
    gap: 6px;
  }

  .highlights-btn { grid-column: 1 / -1; }
  .all-tips { grid-column: 1 / -1; }

  /* Team names */
  .team-name { font-size: 0.88rem; }
  .match-flag { width: 30px; height: 20px; }

  /* Stats cards */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 16px 10px; }
  .stat-value { font-size: 1.6rem; }

  /* Standings */
  #standings-container { grid-template-columns: 1fr; }
}

/* ---- SMALL PHONE (≤ 380px) ---- */
@media (max-width: 380px) {
  .nav-btn { padding: 5px 8px; font-size: 0.78rem; }
  .header-logo { font-size: 0.8rem; }
  .team-name { font-size: 0.8rem; }
  .match-card { padding: 10px 10px 12px; }
  .page-inner { padding: 12px 8px 44px; }
}

/* ---- ENDRUNDE / KO-BRACKET ---- */
.ko-bracket-page { padding-bottom: 40px; }

.bracket-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.bracket-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
  padding: 20px 16px 20px;
}

.bracket-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  min-width: max-content;
  padding: 4px 0;
}

.bracket-half {
  display: flex;
  flex-direction: row;
  gap: 0;
}

.bracket-half.right {
  flex-direction: row-reverse;
}

.bracket-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.br-col {
  display: flex;
  flex-direction: column;
}

.br-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: white;
  background: var(--green-dark);
  text-align: center;
  padding: 4px 4px;
  border-radius: 4px;
  margin-bottom: 10px;
  white-space: nowrap;
}

.br-slots {
  position: relative;
  flex-shrink: 0;
}

/* Match card in bracket */
.bm-card {
  position: absolute;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--grey-border);
}

.bm-card.played {
  border-left: 3px solid var(--green);
}

.bm-team {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 5px;
  flex: 1;
  min-height: 0;
}

.bm-team + .bm-team {
  border-top: 1px solid var(--grey-border);
}

.bm-team.bm-winner {
  background: var(--green-light);
}

.bm-flag {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 1px;
  flex-shrink: 0;
}

.bm-name {
  flex: 1;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.bm-score {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--green-dark);
  min-width: 12px;
  text-align: right;
  flex-shrink: 0;
}

/* TBD placeholder slot */
.bm-tbd {
  position: absolute;
  background: var(--grey-bg);
  border: 1.5px dashed var(--grey-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bm-tbd-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Connector lines */
.br-cv {
  position: absolute;
  width: 2px;
  background: var(--green);
  opacity: 0.35;
}

.br-ch {
  position: absolute;
  height: 2px;
  background: var(--green);
  opacity: 0.35;
}

/* 3rd place match */
.bracket-third-wrap {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.bracket-third {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
}

.bracket-third .br-label {
  margin-bottom: 10px;
}

/* ==================== LOGIN / REGISTRIERUNG ==================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}

.login-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-logo { font-size: 1.4rem; font-weight: 800; color: var(--green-dark); margin-bottom: 6px; }
.login-hint { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

.auth-tabs {
  display: flex;
  background: var(--grey-bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.active { background: var(--white); color: var(--green-dark); box-shadow: var(--shadow); }

#auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
.login-label input {
  padding: 12px 14px;
  border: 1.5px solid var(--grey-border);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.login-label input:focus { border-color: var(--green); }

.login-error { color: var(--red); font-size: 0.82rem; min-height: 1em; font-weight: 600; }

.login-submit {
  padding: 13px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.login-submit:hover { background: var(--green-dark); }
.login-foot { margin-top: 16px; font-size: 0.74rem; color: var(--text-muted); line-height: 1.5; }

/* ---- USER-BOX im Header ---- */
.user-box { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.user-greet { color: rgba(255,255,255,0.9); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.logout-btn {
  padding: 5px 10px;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.28); }

/* ---- RANGLISTE ---- */
.rl-intro { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 16px; }
.rl-table td:nth-child(2) { text-align: left; }
.rl-pos { font-weight: 700; color: var(--text-muted); width: 28px; }
.rl-name { font-weight: 600; }
.rl-you { color: var(--green); font-weight: 700; font-size: 0.78rem; }
.rl-pts { font-weight: 800; color: var(--green-dark); font-size: 0.95rem; }
.rl-table tr.rl-me td { background: var(--green-light); }
.rl-note { margin-top: 14px; font-size: 0.76rem; color: var(--text-muted); line-height: 1.5; }

/* ---- TIPPS DER FAMILIE (ab Anpfiff) ---- */
.all-tips {
  grid-column: 1 / -1;
  margin-top: 10px;
  border-top: 1px solid var(--grey-border);
  padding-top: 8px;
}
.all-tips summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-dark);
  list-style: none;
  user-select: none;
}
.all-tips summary::-webkit-details-marker { display: none; }
.all-tips summary::before { content: '▸ '; }
.all-tips[open] summary::before { content: '▾ '; }

.at-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.at-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  padding: 4px 6px;
  border-radius: 6px;
}
.at-row.at-me { background: var(--green-light); }
.at-name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-tip { font-weight: 700; font-variant-numeric: tabular-nums; }
.at-pts {
  min-width: 30px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}
