/*
 * Stammtisch-Kasse — Styles
 *
 * Mobile-first: Default-Layout ist für Smartphones gedacht,
 * die Media Query unten passt für Desktop nach oben an.
 *
 * Farb-Tokens hängen alle an :root, damit später Dark-Mode oder
 * Theme-Anpassungen an einer einzigen Stelle möglich sind.
 *
 * Datei-Struktur (von oben nach unten):
 *   Fonts → Reset → Root-Variablen → Basis-Layout → Header → Stat-Boxen →
 *   Tabs → Cards & Tabellen → Beiträge-Tabelle → Formulare → Buttons →
 *   Biere → Einstellungen → Ankündigungen → Regelwerk → Turnier → Utilities →
 *   Mobile-Anpassungen → Toast-System → Offline-Banner
 */

/* ---------- Fonts ---------- */

/* dm-sans-regular - latin_latin-ext */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  src: url('/fonts/dm-sans-v17-latin_latin-ext-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* dm-sans-500 - latin_latin-ext */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  src: url('/fonts/dm-sans-v17-latin_latin-ext-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* dm-sans-600 - latin_latin-ext */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 600;
  src: url('/fonts/dm-sans-v17-latin_latin-ext-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* ---------- Reset ---------- */

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

/* ---------- Root-Variablen ---------- */

:root {
  --bg: #f5f4f0;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #a3a3a3;
  --border: #e5e4e0;
  --accent: #1d9e75;
  --accent-bg: #e1f5ee;
  --danger: #e24b4a;
  --danger-bg: #fcebeb;
  --blue: #0070ba;
  --battle-gold: #d4af37;
  --battle-silver: #a8b0b8;
  --battle-bronze: #b06a35;
  --battle-red: #7a1f1f;
  --battle-dark: #1c1712;
}

/* ---------- Basis-Layout ---------- */

body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Header ---------- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: 22px;
  font-weight: 600;
}

header .sub {
  font-size: 13px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.paypal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.admin-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Stat-Boxen oben ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat {
  background: var(--card);
  border-radius: 10px;
  padding: 14px 16px;
  border: 0.5px solid var(--border);
}

.stat .label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat .value {
  font-size: 22px;
  font-weight: 600;
}

.stat .value.danger {
  color: var(--danger);
}

.stat .value.accent {
  color: var(--accent);
}

/* ---------- Kategorie-Tabs ---------- */

.tab-categories {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
}

.tab-category {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: var(--bg);
  border-radius: 20px;
  white-space: nowrap;
}

.tab-category.active {
  background: var(--text);
  color: var(--card);
}

/* ---------- Sub-Tabs ---------- */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.tab.category-hidden {
  display: none;
}

/* ---------- Cards & Tabellen ---------- */

.card {
  background: var(--card);
  border-radius: 10px;
  border: 0.5px solid var(--border);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

td {
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--border);
}

.sticky-col {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
}

th.sticky-col {
  z-index: 3;
}

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

.amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.penalty-total,
.expense-total {
  padding: 10px 12px;
  font-weight: 600;
  text-align: right;
  border-top: 2px solid var(--border);
}

/* ---------- Beiträge-Tabelle (Zahlungsmatrix) ---------- */

.pay-cell {
  text-align: center;
  min-width: 52px;
  padding: 6px 4px;
}

.pay-btn {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.pay-btn.paid {
  background: var(--accent);
  color: #fff;
}

.pay-btn.unpaid {
  background: #f0efeb;
  color: var(--faint);
}

.pay-btn.readonly {
  cursor: default;
}

.month-header {
  font-size: 11px;
}

.month-header.current {
  color: var(--accent);
}

.member-name {
  font-weight: 500;
  white-space: nowrap;
}

.paid-date {
  font-size: 10px;
  color: var(--accent);
  display: block;
  margin-top: 1px;
}

/* ---------- Formulare ---------- */

.form-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  flex-wrap: wrap;
}

.form-row input,
.form-row select,
.settings-row input,
.news-form input,
.news-form textarea {
  padding: 8px 12px;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
}

.form-row input,
.form-row select,
.settings-row input {
  font-size: 13px;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--muted);
}

.form-row input[type="text"],
.form-row input[type="number"] {
  flex: 1;
  min-width: 100px;
}

.form-row .form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 100px;
}

.form-row .form-field.compact {
  flex: 0 0 auto;
}

.form-row .form-field label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.form-row .form-field input,
.form-row .form-field select {
  width: 100%;
}

.amount-input-sm {
  max-width: 100px;
}

.amount-input-xs {
  max-width: 80px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Buttons ---------- */

.btn {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg);
}

.btn.primary {
  background: var(--text);
  color: var(--card);
  border-color: var(--text);
}

.btn.primary:hover {
  opacity: 0.85;
}

.btn.sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn.danger {
  color: var(--danger);
  border-color: var(--danger-bg);
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.remove-btn,
.share-btn,
.edit-btn {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  /* Klickbereich für Mobile auf 44x44px erweitern, unabhängig von der
     visuellen Icon-Größe (Font-Size bzw. SVG-Dimension) */
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.remove-btn {
  font-size: 16px;
}

.remove-btn:hover {
  color: var(--danger);
}

.share-btn,
.edit-btn {
  border-radius: 6px;
  transition: color 0.15s;
}

.share-btn:hover {
  color: var(--accent);
  background: rgba(0, 0, 0, 0.04);
}

.edit-btn:hover {
  color: var(--blue);
  background: rgba(0, 0, 0, 0.04);
}

/* ---------- Biere ---------- */

.beer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.beer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.beer-info {
  flex: 1;
  text-align: center;
}

.beer-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.beer-count {
  font-size: 30px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.beer-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 20px;
  font-weight: 600;
}

.beer-btn.plus {
  background: var(--accent);
  color: #fff;
}

.beer-btn.minus {
  background: #f0efeb;
  color: var(--text);
}

/* Dauerhafte, dezente Hervorhebung für den aktuellen Spitzenreiter */
.beer-card-leader {
  border-color: #f0c419;
  background: linear-gradient(90deg, rgba(240, 196, 25, 0.1), rgba(240, 196, 25, 0));
}

.beer-crown {
  display: inline-block;
  font-size: 14px;
  animation: crown-bounce 2.4s ease-in-out infinite;
}

/* Flashy Animation, wenn jemand NEU auf Platz 1 kommt */
.beer-card-crowned {
  animation: crown-glow 1.1s ease-out;
}

.beer-card-crowned .beer-count {
  animation: crown-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes crown-glow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(240, 196, 25, 0.7);
  }
  30% {
    transform: scale(1.04);
    box-shadow: 0 0 0 10px rgba(240, 196, 25, 0);
  }
  60% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(240, 196, 25, 0);
  }
}

@keyframes crown-pop {
  0% {
    transform: scale(1);
    color: inherit;
  }
  50% {
    transform: scale(1.35);
    color: #f0c419;
  }
  100% {
    transform: scale(1);
    color: inherit;
  }
}

@keyframes crown-bounce {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-2px) rotate(-6deg);
  }
}

/* ---------- Rekorde (Promille-Leaderboard, Battle-Style) ---------- */

.rekorde-header-card {
  margin-bottom: 12px;
  padding: 20px 16px;
  text-align: center;
  background: linear-gradient(160deg, var(--battle-red), #3a0d0d);
  border-color: var(--battle-red);
}

.rekorde-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--battle-gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.rekorde-subtitle {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

#panel-rekorde .empty-state {
  margin-bottom: 12px;
}

/* Podium: 2. links, 1. Mitte (erhöht), 3. rechts */
.podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}

.podium-place {
  position: relative;
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.podium-empty {
  box-shadow: none;
}

.podium-rank1 {
  padding-top: 24px;
  padding-bottom: 20px;
  background: linear-gradient(160deg, var(--battle-gold), #9c7a1f);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.5);
}

.podium-rank2 {
  background: linear-gradient(160deg, var(--battle-silver), #737b82);
}

.podium-rank3 {
  background: linear-gradient(160deg, var(--battle-bronze), #7a4a24);
}

.podium-rank-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  padding: 1px 7px;
}

.podium-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  word-break: break-word;
}

.podium-rank1 .podium-name {
  font-size: 15px;
}

.rekorde-crown {
  font-size: 14px;
}

.podium-value {
  font-weight: 800;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.podium-rank1 .podium-value {
  font-size: 30px;
}

.podium-date {
  margin-top: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
}

.podium-place .rekorde-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  color: rgba(255, 255, 255, 0.7);
  min-width: 32px;
  min-height: 32px;
}

.podium-place .rekorde-remove:hover {
  color: #fff;
}

/* Rekorde ab Platz 4: normale Card-Reihe mit prominenter Rang-Nummer */
.rekorde-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.rekorde-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.rekorde-rank {
  flex-shrink: 0;
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--muted);
}

.rekorde-info {
  flex: 1;
  min-width: 0;
}

.rekorde-name {
  font-weight: 600;
  font-size: 14px;
}

.rekorde-date {
  margin-top: 2px;
  font-size: 11px;
  color: var(--faint);
}

.rekorde-value {
  flex-shrink: 0;
  font-weight: 800;
  font-size: 22px;
  color: var(--battle-red);
  font-variant-numeric: tabular-nums;
}

/* ---------- Einstellungen ---------- */

.settings-card {
  padding: 16px;
}

.settings-card .form-actions {
  margin-top: 12px;
}

.settings-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.settings-row label {
  font-size: 13px;
  color: var(--muted);
  min-width: 100px;
}

.settings-row input {
  flex: 1;
  min-width: 200px;
}

.settings-input-narrow {
  max-width: 100px;
}

/* ---------- Ankündigungen ---------- */

.news-form {
  padding: 16px;
  margin-bottom: 16px;
}

.news-form label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.news-form input,
.news-form textarea {
  width: 100%;
  margin-bottom: 8px;
}

.news-form input {
  font-size: 14px;
}

.news-form textarea {
  font-size: 13px;
  resize: vertical;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.announcement-card {
  padding: 16px;
  margin-bottom: 10px;
}

.announcement-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}

.announcement-title-block {
  flex: 1;
  min-width: 0;
}

.announcement-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.announcement-date {
  font-size: 12px;
  color: var(--faint);
  margin-bottom: 8px;
}

.announcement-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.announcement-text {
  font-size: 14px;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ---------- Regelwerk ---------- */

.rules-card {
  padding: 24px;
  line-height: 1.8;
  font-size: 14px;
  color: var(--text);
}

.rules-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.rules-card p {
  margin-bottom: 14px;
}

.rules-card p.rules-card-last {
  margin-bottom: 0;
}

/* ---------- Turnier ---------- */

.tournament-form {
  padding: 16px;
}

.tournament-form h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
}

.tournament-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.tournament-form .form-field label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.tournament-form input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.radio-row {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 13px;
}

.radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.member-checklist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding: 4px;
  border: 0.5px solid var(--border);
  border-radius: 8px;
}

.member-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.member-checklist label:hover {
  background: var(--bg);
}

#trn-team-list {
  margin-bottom: 14px;
}

.team-slot {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.team-slot .team-name,
.team-slot select {
  flex: 1;
  min-width: 110px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}

.tournament-preview {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 14px;
}

/* ---------- Turnier: Bracket-Anzeige ---------- */

.tournament-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.tournament-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.tournament-mode {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.champion-card {
  text-align: center;
  padding: 24px 16px;
  margin-bottom: 16px;
  background: linear-gradient(160deg, var(--battle-gold), #9c7a1f);
  border-color: var(--battle-gold);
  color: #fff;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.4);
}

.champion-crown {
  font-size: 36px;
  animation: crown-bounce 2.4s ease-in-out infinite;
}

.champion-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.85;
  margin-top: 4px;
}

.champion-name {
  font-size: 24px;
  font-weight: 800;
  margin-top: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.champion-members {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.9;
}

.bracket {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.bracket-round {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.round-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.match-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, background 0.15s;
}

.match-card.match-ready:not(.match-bye):hover,
.match-card.match-waiting:not(.match-bye):hover {
  border-color: var(--muted);
  background: var(--bg);
}

.match-side {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.match-side.winner {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 700;
}

.match-side.loser {
  color: var(--faint);
  text-decoration: line-through;
}

.match-side-members {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.match-side.winner .match-side-members {
  color: var(--accent);
  opacity: 0.8;
}

.participant-placeholder {
  color: var(--faint);
  font-style: italic;
  font-size: 12px;
}

.match-vs {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  padding: 3px 0;
}

.match-vs::before,
.match-vs::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--border);
}

.match-vs::before {
  margin-right: 6px;
}

.match-vs::after {
  margin-left: 6px;
}

.check {
  color: var(--accent);
}

.match-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.match-actions .btn {
  flex: 1;
  padding: 4px 5px;
  font-size: 10px;
  line-height: 1.3;
  white-space: normal;
  text-align: center;
}

.match-bye {
  opacity: 0.6;
  background: var(--bg);
}

.match-bye .match-vs {
  font-style: italic;
}

/* ---------- Schicksalstafel (Finger-Zufallswähler) ---------- */

.finger-zone {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 360px;
  overflow: hidden;
  border-radius: 10px;
  border: 0.5px solid var(--border);
  background: radial-gradient(circle at 50% 40%, #2a221a, var(--battle-dark));
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.finger-instructions {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 15px;
  font-weight: 500;
  pointer-events: none;
}

.finger-icon {
  position: absolute;
  width: 150px;
  height: 150px;
  transform: translate(-50%, -50%);
  color: var(--battle-gold);
  pointer-events: none;
}

.finger-icon svg {
  width: 100%;
  height: 100%;
}

.finger-icon.cycling {
  animation: finger-color-cycle 1.5s linear infinite, finger-pulse 0.6s ease-in-out infinite;
}

@keyframes finger-color-cycle {
  0% {
    color: var(--battle-red);
  }
  20% {
    color: var(--battle-gold);
  }
  40% {
    color: var(--blue);
  }
  60% {
    color: var(--accent);
  }
  80% {
    color: #9b59d0;
  }
  100% {
    color: var(--battle-red);
  }
}

@keyframes finger-pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
  }
}

.finger-icon.exploding {
  transition: transform 0.3s ease-out;
  transform: translate(calc(-50% + var(--explode-x, 0px)), calc(-50% + var(--explode-y, 0px))) scale(1.3);
}

.finger-icon.fading {
  transition: opacity 0.4s ease-out;
  opacity: 0;
}

.finger-icon.winner {
  color: #2fbf71;
  transition: transform 0.3s ease-out, color 0.3s ease-out;
  animation: finger-pulse-winner 1s ease-in-out infinite;
}

@keyframes finger-pulse-winner {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1.5);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.7);
  }
}

.countdown-overlay,
.winner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.countdown-number {
  font-size: 120px;
  font-weight: 800;
  color: var(--battle-gold);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.countdown-number.countdown-number--pop {
  animation: countdown-pop 0.5s ease-out;
}

@keyframes countdown-pop {
  from {
    opacity: 0;
    transform: scale(1.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.winner-text {
  padding: 0 24px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  animation: winner-text-fade-in 0.5s ease-out;
}

@keyframes winner-text-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Utilities ---------- */

.hidden {
  display: none;
}

/* ---------- Mobile-Anpassungen ---------- */

@media (max-width: 600px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .stat:last-child {
    grid-column: span 2;
  }
  header h1 {
    font-size: 18px;
  }
  .tab {
    padding: 7px 10px;
    font-size: 12px;
  }
  .tab-category {
    padding: 5px 12px;
    font-size: 11px;
  }
  .bracket-round {
    flex: 0 0 180px;
  }
  .radio-row {
    gap: 10px;
    flex-wrap: wrap;
  }
  .countdown-number {
    font-size: 80px;
  }
  .finger-icon {
    width: 110px;
    height: 110px;
  }
}

/* ---------- Toast-System ---------- */

#toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
}

.toast.success {
  background: var(--accent);
  color: #fff;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

.toast.info {
  background: var(--text);
  color: var(--bg);
}

.toast.leaving {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Mobile: Toasts unten zentriert statt rechts */
@media (max-width: 600px) {
  #toast-container {
    right: 16px;
    left: 16px;
  }

  .toast {
    max-width: none;
  }
}

/* ---------- Offline-Banner ---------- */

#offline-banner {
  background: var(--danger);
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 100;
  animation: banner-slide-in 0.25s ease-out;
}

#offline-banner[hidden] {
  display: none;
}

#snapshot-age-banner {
  background: #fef3c7;
  color: #92400e;
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  position: sticky;
  top: 38px; /* unter dem Offline-Banner */
  z-index: 99;
}

#snapshot-age-banner[hidden] {
  display: none;
}

@keyframes banner-slide-in {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

/* ---------- Login-Overlay ---------- */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(26, 26, 26, 0.55);
}

.login-overlay[hidden] {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 28px;
  text-align: center;
}

.login-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-text {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

#login-key-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  text-align: center;
}

#login-key-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

#login-key-input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

.login-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 16px;
}

.login-actions .btn {
  flex: 1;
}

.guest-admin-link {
  text-align: center;
  padding: 12px;
}

.link-btn {
  border: none;
  background: none;
  padding: 4px;
  font-size: 12px;
  color: var(--faint);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}

.link-btn:hover {
  color: var(--muted);
}

@media (max-width: 600px) {
  .login-actions {
    flex-direction: column;
  }
}
