body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #111;
  color: #f3f3f3;
}

header {
  background: #1e3a2f;
  padding: 20px;
  border-bottom: 3px solid #c9a84c;
}

header h1 {
  margin: 0 0 10px 0;
  color: #c9a84c;
}

nav a {
  color: #fff;
  margin-right: 15px;
  text-decoration: none;
}

main {
  padding: 20px;
}

a {
  color: #c9a84c;
}

form {
  max-width: 500px;
  background: #1c1c1c;
  padding: 20px;
  border: 1px solid #333;
  margin-bottom: 20px;
}

label {
  display: block;
  margin-top: 12px;
}

input,
select,
button {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  box-sizing: border-box;
}

button,
.button {
  background: #c9a84c;
  color: #111;
  border: 0;
  font-weight: bold;
  cursor: pointer;
  display: inline-block;
  padding: 10px 15px;
  text-decoration: none;
}

table {
  border-collapse: collapse;
  width: 100%;
  background: #1c1c1c;
}

th,
td {
  border: 1px solid #333;
  padding: 10px;
  text-align: left;
}

th {
  background: #1e3a2f;
  color: #c9a84c;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 15px;
}

.card,
.match {
  background: #1c1c1c;
  border: 1px solid #333;
  padding: 15px;
}

.bracket {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 15px;
}

.match-title {
  color: #c9a84c;
  font-weight: bold;
  margin-bottom: 10px;
}

.status {
  margin-top: 10px;
  color: #aaa;
}

.winner {
  margin-top: 10px;
  color: #c9a84c;
  font-weight: bold;
}

.error {
  color: #ff7777;
  font-weight: bold;
}

.checkbox-label {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 15px;
}

.checkbox-label input {
  width: auto;
}
.brand-header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  width: 95px;
  height: auto;
  object-fit: contain;
}

.brand-header h1 {
  margin: 0;
}

@media (max-width: 700px) {
  .brand-header {
    align-items: flex-start;
    gap: 12px;
  }

  .brand-logo {
    width: 70px;
  }

  .brand-header h1 {
    font-size: 24px;
  }
}

/* Header Layout Update */
.app-header {
  display: grid;
  grid-template-columns: 95px 1fr;
  grid-template-rows: auto auto;
  column-gap: 18px;
  row-gap: 4px;
  align-items: center;
}

.app-header .brand-logo {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 78px;
  height: auto;
  object-fit: contain;
  align-self: start;
}

.app-header .brand-title {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  color: #c9a84c;
}

.app-header .main-nav {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.app-header .nav-left,
.app-header .nav-right {
  display: flex;
  gap: 22px;
  align-items: center;
}

.app-header .main-nav a {
  color: #fff;
  margin-right: 0;
  text-decoration: none;
}

/* alte Header-Regeln neutralisieren */
.brand-header {
  display: contents;
}

@media (max-width: 700px) {
  .app-header {
    grid-template-columns: 72px 1fr;
    column-gap: 12px;
  }

  .app-header .brand-logo {
    width: 65px;
  }

  .app-header .brand-title {
    font-size: 23px;
  }

  .app-header .main-nav {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* Full Bracket Layout */
.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 15px;
  margin-bottom: 30px;
}

.bracket-board {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  min-width: max-content;
}

.bracket-round {
  min-width: 245px;
}

.bracket-round h4 {
  color: #c9a84c;
  margin: 0 0 12px 0;
}

.player-line {
  background: #111;
  border: 1px solid #333;
  padding: 7px;
  margin-bottom: 5px;
}

.status-pending {
  background: #3a3a3a;
  color: #ddd;
}

.status-skipped {
  background: #222;
  color: #777;
}

.match-status-pending {
  opacity: 0.82;
}

.match-status-skipped {
  opacity: 0.45;
}

.match-status-completed {
  opacity: 0.75;
}

/* Spielplan wie Tabellenblatt */
.schedule-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  background: #1c1c1c;
  border: 1px solid #333;
  padding: 10px;
  margin: 10px 0 18px 0;
  color: #ddd;
}

.schedule-table {
  font-size: 15px;
}

.schedule-table th {
  text-align: center;
}

.schedule-table td {
  vertical-align: middle;
}

.match-number {
  color: #6fb7ff;
  font-weight: bold;
  text-align: center;
}

.machine-cell {
  text-align: center;
  font-weight: bold;
}

.score-cell {
  width: 42px;
  text-align: center;
  font-weight: bold;
}

.winner-cell {
  font-weight: bold;
  color: #c9a84c;
}

.score-form {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.score-form input {
  width: 48px;
  padding: 6px;
  margin: 0;
  text-align: center;
}

.score-form button {
  width: auto;
  padding: 6px 10px;
  margin: 0;
}

.status-open {
  background: #c9a84c;
  color: #111;
}

.status-completed {
  background: #444;
  color: #ddd;
}

.status-waiting {
  background: #333;
  color: #fff;
}

.status-pending {
  background: #222;
  color: #aaa;
}

.status-bye {
  background: #1e3a2f;
  color: #fff;
}

.status-skipped {
  background: #111;
  color: #777;
}

/* Einheitliche Zeilenhöhe im Spielplan */
.schedule-table tr {
  height: 52px;
}

.schedule-table th,
.schedule-table td {
  height: 52px;
  padding: 6px 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.schedule-table td:nth-child(4),
.schedule-table td:nth-child(5) {
  min-width: 160px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-form {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.score-form input {
  height: 32px;
  width: 46px;
  padding: 4px;
  margin: 0;
}

.score-form button {
  height: 32px;
  width: auto;
  padding: 4px 10px;
  margin: 0;
  line-height: 1;
}

.status-badge {
  white-space: nowrap;
}

/* =========================
   Mobile Optimierung
   ========================= */

html {
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  max-width: 100%;
  overflow-x: hidden;
}

main {
  max-width: 100%;
  overflow-x: hidden;
}

/* Buttons allgemein fingertauglich */
button,
.button,
input,
select {
  min-height: 44px;
  font-size: 16px;
}

/* Tabellen auf kleineren Geräten scrollbar machen */
table {
  max-width: 100%;
}

.schedule-table,
table {
  overflow-x: auto;
}

/* Spielplan darf horizontal scrollen */
.schedule-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

/* Normale Tabellen ebenfalls scrollbar */
main > table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

/* Turnierkarten */
.cards {
  width: 100%;
}

/* Bracket mobil scrollbar */
.bracket-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bracket-board {
  min-width: max-content;
}

/* Forms mobil sauber */
form {
  width: 100%;
  max-width: 560px;
}

/* Mobile Header */
@media (max-width: 800px) {
  header,
  .app-header {
    padding: 12px;
  }

  .app-header {
    display: grid;
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 8px;
    align-items: center;
  }

  .app-header .brand-logo {
    grid-column: 1;
    grid-row: 1;
    width: 68px;
    height: auto;
  }

  .app-header .brand-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 24px;
    line-height: 1.15;
    margin: 0;
  }

  .app-header .main-nav {
    grid-column: 1 / span 2;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding-top: 6px;
  }

  .app-header .nav-left,
  .app-header .nav-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }

  .app-header .main-nav a {
    display: inline-block;
    padding: 8px 0;
    font-size: 16px;
  }

  main {
    padding: 12px;
  }

  h2 {
    font-size: 22px;
    line-height: 1.25;
  }

  h3 {
    font-size: 19px;
  }

  .cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card {
    width: 100%;
  }

  form {
    max-width: none;
    padding: 14px;
  }

  input,
  select,
  button {
    width: 100%;
  }

  .admin-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .admin-actions a,
  .admin-actions button {
    width: 100%;
  }

  .inline-delete-form {
    width: 100%;
  }

  .danger-button {
    width: 100%;
  }

  .schedule-legend {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    font-size: 14px;
  }

  .schedule-table {
    font-size: 14px;
  }

  .schedule-table th,
  .schedule-table td {
    height: 48px;
    padding: 5px 7px;
  }

  .score-form {
    min-width: 170px;
  }

  .score-form input {
    width: 46px;
    min-height: 34px;
  }

  .score-form button {
    min-height: 34px;
    padding: 5px 9px;
  }

  .bracket-round {
    min-width: 230px;
  }

  .match {
    padding: 12px;
  }
}

/* Sehr kleine Handys */
@media (max-width: 430px) {
  .app-header {
    grid-template-columns: 62px 1fr;
    column-gap: 10px;
  }

  .app-header .brand-logo {
    width: 58px;
  }

  .app-header .brand-title {
    font-size: 20px;
  }

  .app-header .main-nav {
    align-items: flex-start;
  }

  .app-header .nav-left,
  .app-header .nav-right {
    gap: 8px;
  }

  .app-header .main-nav a {
    font-size: 15px;
  }

  main {
    padding: 10px;
  }

  h2 {
    font-size: 20px;
  }

  .schedule-table {
    font-size: 13px;
  }

  .status-badge {
    font-size: 12px;
    padding: 3px 7px;
  }

  .score-form {
    min-width: 160px;
  }
}

/* =========================
   Turnierbaum grafisch aufwerten
   ========================= */

.bracket-section {
  margin-bottom: 34px;
}

.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 14px;
  margin-bottom: 10px;
}

.bracket-board {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  min-width: max-content;
}

.bracket-round {
  min-width: 255px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.bracket-round-title {
  margin: 0 0 14px 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
}

.round-matches {
  display: flex;
  flex-direction: column;
  gap: 14px; /* vertikaler Abstand zwischen Spielen */
}

.match {
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.match-title {
  color: #f0d27a;
  font-weight: bold;
  margin-bottom: 10px;
}

.player-line {
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 9px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: rgba(0,0,0,0.18);
}

.winner-line {
  font-weight: bold;
  color: #f0d27a;
  border-color: rgba(201,168,76,0.45);
}

.match-tone-light {
  background: rgba(255,255,255,0.06);
}

.match-tone-dark {
  background: rgba(0,0,0,0.16);
}

.match .status {
  margin-top: 8px;
  color: #d0d0d0;
  font-size: 14px;
}

.match .winner {
  margin-top: 8px;
  color: #f0d27a;
  font-weight: bold;
}

/* Rundenfarben */
.round-tone-1 {
  background: linear-gradient(180deg, #3a3a3a 0%, #2c2c2c 100%);
}
.round-tone-1 .bracket-round-title {
  background: #555;
  color: #fff;
}

.round-tone-2 {
  background: linear-gradient(180deg, #23354d 0%, #1b2b40 100%);
}
.round-tone-2 .bracket-round-title {
  background: #345b86;
  color: #fff;
}

.round-tone-3 {
  background: linear-gradient(180deg, #244236 0%, #1c352b 100%);
}
.round-tone-3 .bracket-round-title {
  background: #35624f;
  color: #fff;
}

.round-tone-4 {
  background: linear-gradient(180deg, #4d4024 0%, #3b311b 100%);
}
.round-tone-4 .bracket-round-title {
  background: #8a6d2f;
  color: #fff;
}

.round-tone-5 {
  background: linear-gradient(180deg, #4b2847 0%, #391f36 100%);
}
.round-tone-5 .bracket-round-title {
  background: #74416d;
  color: #fff;
}

.round-tone-6 {
  background: linear-gradient(180deg, #3f2f22 0%, #2e2218 100%);
}
.round-tone-6 .bracket-round-title {
  background: #6a4b31;
  color: #fff;
}

/* Status etwas sichtbar halten */
.match-status-open {
  outline: 1px solid rgba(201,168,76,0.55);
}

.match-status-completed {
  opacity: 0.88;
}

.match-status-pending {
  opacity: 0.86;
}

.match-status-skipped {
  opacity: 0.5;
}

/* Mobil */
@media (max-width: 800px) {
  .bracket-board {
    gap: 16px;
  }

  .bracket-round {
    min-width: 230px;
    padding: 8px;
  }

  .round-matches {
    gap: 12px;
  }

  .match {
    padding: 10px;
  }

  .player-line {
    padding: 7px 8px;
  }
}

/* Turnierbaum kompakter: Spieltitel + Status kleiner */
.bracket-round .match-title {
  font-size: 13px;
  line-height: 1.2;
  padding: 0;
  margin-bottom: 8px;
}

.bracket-round .match .status {
  font-size: 12px;
  line-height: 1.2;
  margin-top: 6px;
}

.bracket-round .match .winner {
  font-size: 12px;
  line-height: 1.2;
  margin-top: 6px;
}

/* optional etwas kompaktere Match-Box */
.bracket-round .match {
  padding: 10px;
}

/* auf sehr kleinen Displays noch etwas kompakter */
@media (max-width: 430px) {
  .bracket-round .match-title {
    font-size: 12px;
  }

  .bracket-round .match .status,
  .bracket-round .match .winner {
    font-size: 11px;
  }

  .bracket-round .match {
    padding: 9px;
  }
}

/* =========================
   Neues Grundlayout / Theme
   Logo-orientiert: Dark / Magenta / Orange / Gold
   ========================= */

:root {
  --bg-main: #09090d;
  --bg-panel: #15151c;
  --bg-panel-soft: #1d1d26;
  --bg-header: #101018;

  --border-soft: rgba(255,255,255,0.10);

  --text-main: #f4f4f7;
  --text-muted: #b9b9c4;

  --accent-gold: #f2b84b;
  --accent-orange: #f47b20;
  --accent-magenta: #d9237f;
  --accent-red: #b8192f;
}

/* Grundfläche */
body {
  background:
    radial-gradient(circle at top left, rgba(217,35,127,0.12), transparent 32%),
    radial-gradient(circle at top right, rgba(244,123,32,0.10), transparent 34%),
    var(--bg-main) !important;
  color: var(--text-main) !important;
}

/* Header komplett neu */
header,
.app-header {
  background:
    linear-gradient(135deg, #101018 0%, #171722 52%, #24111e 100%) !important;
  border-bottom: 3px solid var(--accent-gold) !important;
  box-shadow: 0 4px 18px rgba(0,0,0,0.45);
}

/* Logo größer */
.app-header {
  grid-template-columns: 145px 1fr !important;
  column-gap: 22px !important;
  padding: 18px 24px !important;
}

.app-header .brand-logo {
  width: 125px !important;
  max-width: 125px !important;
  height: auto !important;
  align-self: center !important;
}

/* Titel */
.app-header .brand-title,
header h1 {
  color: var(--accent-gold) !important;
  text-shadow: 0 2px 8px rgba(0,0,0,0.55);
  letter-spacing: 0.3px;
}

/* Navigation */
.app-header .main-nav a,
nav a {
  color: #ffffff !important;
  font-weight: 600;
  padding: 6px 0;
}

.app-header .main-nav a:hover,
nav a:hover {
  color: var(--accent-gold) !important;
}

/* Hauptbereich */
main {
  background: transparent !important;
}

/* Karten, Formulare, Tabellen */
.card,
.match,
form,
table,
.schedule-legend {
  background: linear-gradient(180deg, var(--bg-panel-soft), var(--bg-panel)) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
}

/* Tabellenkopf */
th {
  background: linear-gradient(135deg, #2a1824, #332016) !important;
  color: var(--accent-gold) !important;
  border-color: var(--border-soft) !important;
}

td {
  border-color: rgba(255,255,255,0.08) !important;
}

/* Links */
a {
  color: var(--accent-gold) !important;
}

a:hover {
  color: #ffd777 !important;
}

/* Buttons */
button,
.button {
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-magenta)) !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.30);
}

button:hover,
.button:hover {
  filter: brightness(1.12);
}

/* Gefahr/Löschen Button separat */
.danger-button {
  background: linear-gradient(135deg, #8b1e1e, #c12636) !important;
  color: #fff !important;
}

/* Inputs */
input,
select {
  background: #101016 !important;
  color: var(--text-main) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  border-radius: 6px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(242,184,75,0.45);
  border-color: var(--accent-gold) !important;
}

/* Überschriften */
h2,
h3,
h4 {
  color: #ffffff;
}

h2 {
  border-left: 4px solid var(--accent-magenta);
  padding-left: 10px;
}

/* Statusfarben im Spielplan */
.status-open {
  background: var(--accent-gold) !important;
  color: #111 !important;
}

.status-waiting {
  background: #31313b !important;
  color: #fff !important;
}

.status-pending {
  background: #22222b !important;
  color: var(--text-muted) !important;
}

.status-completed {
  background: #3c3c46 !important;
  color: #ddd !important;
}

.status-bye {
  background: #271729 !important;
  color: var(--accent-gold) !important;
}

/* Turnierbaum-Farben etwas harmonischer */
.round-tone-1 {
  background: linear-gradient(180deg, #25252d 0%, #1a1a22 100%) !important;
}

.round-tone-1 .bracket-round-title {
  background: #3a3a45 !important;
  color: #fff !important;
}

.round-tone-2 {
  background: linear-gradient(180deg, #25172a 0%, #1b1220 100%) !important;
}

.round-tone-2 .bracket-round-title {
  background: #64245b !important;
  color: #fff !important;
}

.round-tone-3 {
  background: linear-gradient(180deg, #2b1b14 0%, #1d130f 100%) !important;
}

.round-tone-3 .bracket-round-title {
  background: #9a4c1c !important;
  color: #fff !important;
}

.round-tone-4 {
  background: linear-gradient(180deg, #302811 0%, #211b0d 100%) !important;
}

.round-tone-4 .bracket-round-title {
  background: #9b7626 !important;
  color: #fff !important;
}

.round-tone-5 {
  background: linear-gradient(180deg, #301923 0%, #211018 100%) !important;
}

.round-tone-5 .bracket-round-title {
  background: #9b1d5c !important;
  color: #fff !important;
}

.round-tone-6 {
  background: linear-gradient(180deg, #292936 0%, #1c1c25 100%) !important;
}

.round-tone-6 .bracket-round-title {
  background: #45455f !important;
  color: #fff !important;
}

/* Spielerzeilen im Bracket */
.player-line {
  background: rgba(0,0,0,0.22) !important;
  border-color: rgba(255,255,255,0.10) !important;
}

.winner-line,
.winner-cell,
.winner {
  color: var(--accent-gold) !important;
}

/* Handy */
@media (max-width: 800px) {
  .app-header {
    grid-template-columns: 95px 1fr !important;
    padding: 14px !important;
  }

  .app-header .brand-logo {
    width: 88px !important;
    max-width: 88px !important;
  }

  .app-header .brand-title {
    font-size: 24px !important;
  }
}

@media (max-width: 430px) {
  .app-header {
    grid-template-columns: 82px 1fr !important;
  }

  .app-header .brand-logo {
    width: 76px !important;
    max-width: 76px !important;
  }

  .app-header .brand-title {
    font-size: 20px !important;
  }
}

/* Löschen-Button Adminbereich */
.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-delete-form {
  display: inline-block;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.danger-button {
  width: auto !important;
  margin: 0 !important;
  padding: 7px 12px !important;
  background: linear-gradient(135deg, #8b1e1e, #c12636) !important;
  color: #fff !important;
  border: 1px solid #c44 !important;
}

/* =========================
   Turnierbaum - Partien als Karten
   ========================= */

.bracket-section {
  margin-bottom: 34px;
}

.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 14px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

.bracket-board {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  min-width: max-content;
}

.bracket-round {
  min-width: 275px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
}

.bracket-round-title {
  margin: 0 0 14px 0;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 17px;
  font-weight: bold;
}

.round-matches {
  display: flex;
  flex-direction: column;
  gap: 16px; /* kleiner vertikaler Abstand zwischen den Spielen */
}

/* Match-Karte */
.tree-match-card {
  border-radius: 18px;
  border: 2px solid rgba(0,0,0,0.45);
  padding: 14px 16px 12px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.22);
  background: linear-gradient(180deg, #52afdd 0%, #4aa3d1 100%);
}

.tree-match-light {
  background: linear-gradient(180deg, #58b6e5 0%, #4ea9d8 100%);
}

.tree-match-dark {
  background: linear-gradient(180deg, #4ca8d5 0%, #459dc9 100%);
}

.tree-match-title {
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  color: #ffbf17;
  margin-bottom: 12px;
}

.tree-player-row {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(0,0,0,0.35);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 15px;
  color: #111;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.tree-player-winner {
  background: #ffffff !important;
  color: #000 !important;
  font-weight: 800;
  border: 1px solid rgba(0,0,0,0.45);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}

.tree-status {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.35;
  color: #111;
}

.tree-status span {
  font-weight: 500;
}

/* Vorhandene Round-Farben etwas weicher lassen */
.round-tone-1 {
  background: linear-gradient(180deg, #2c2f34 0%, #1f2226 100%) !important;
}
.round-tone-1 .bracket-round-title {
  background: #555b63 !important;
  color: #fff !important;
}

.round-tone-2 {
  background: linear-gradient(180deg, #21384f 0%, #172a3d 100%) !important;
}
.round-tone-2 .bracket-round-title {
  background: #315d8b !important;
  color: #fff !important;
}

.round-tone-3 {
  background: linear-gradient(180deg, #20443c 0%, #17332d 100%) !important;
}
.round-tone-3 .bracket-round-title {
  background: #357465 !important;
  color: #fff !important;
}

.round-tone-4 {
  background: linear-gradient(180deg, #4a3c1e 0%, #352a16 100%) !important;
}
.round-tone-4 .bracket-round-title {
  background: #9b7a2d !important;
  color: #fff !important;
}

.round-tone-5 {
  background: linear-gradient(180deg, #4a2342 0%, #34192f 100%) !important;
}
.round-tone-5 .bracket-round-title {
  background: #864175 !important;
  color: #fff !important;
}

.round-tone-6 {
  background: linear-gradient(180deg, #3b2f24 0%, #2a2119 100%) !important;
}
.round-tone-6 .bracket-round-title {
  background: #735237 !important;
  color: #fff !important;
}

/* Mobile */
@media (max-width: 800px) {
  .bracket-board {
    gap: 16px;
  }

  .bracket-round {
    min-width: 245px;
    padding: 10px;
  }

  .round-matches {
    gap: 13px;
  }

  .tree-match-card {
    padding: 12px 13px 10px 13px;
  }

  .tree-player-row {
    min-height: 40px;
    font-size: 14px;
    padding: 9px 10px;
  }

  .tree-match-title {
    font-size: 15px;
  }

  .tree-status {
    font-size: 13px;
  }
}

@media (max-width: 430px) {
  .bracket-round {
    min-width: 228px;
  }

  .tree-match-title {
    font-size: 14px;
  }

  .tree-player-row {
    font-size: 13px;
  }

  .tree-status {
    font-size: 12px;
  }
}

/* =========================
   Fix: Match-Karten nicht alle blau
   Rundenfarben bleiben erhalten
   ========================= */

/* Matchkarten neutral, damit die jeweilige Rundenfarbe sichtbar bleibt */
.tree-match-card {
  background: rgba(255,255,255,0.055) !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
}

/* abwechselnd hell/dunkel innerhalb der Runde */
.tree-match-light {
  background: rgba(255,255,255,0.075) !important;
}

.tree-match-dark {
  background: rgba(0,0,0,0.16) !important;
}

/* Textfarben wieder passend zum dunklen Layout */
.tree-player-row {
  background: rgba(0,0,0,0.24) !important;
  color: #f4f4f7 !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
}

.tree-player-winner {
  background: #ffffff !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border: 1px solid rgba(0,0,0,0.55) !important;
}

.tree-status {
  color: #e2e2e8 !important;
}

.tree-status span {
  color: #f2b84b !important;
}

.tree-match-title {
  color: #f2b84b !important;
}

/* Die Rundenfarben selbst wieder bewusst unterschiedlich */
.round-tone-1 {
  background: linear-gradient(180deg, #25252d 0%, #1a1a22 100%) !important;
}

.round-tone-1 .bracket-round-title {
  background: #3a3a45 !important;
  color: #fff !important;
}

.round-tone-2 {
  background: linear-gradient(180deg, #25172a 0%, #1b1220 100%) !important;
}

.round-tone-2 .bracket-round-title {
  background: #64245b !important;
  color: #fff !important;
}

.round-tone-3 {
  background: linear-gradient(180deg, #2b1b14 0%, #1d130f 100%) !important;
}

.round-tone-3 .bracket-round-title {
  background: #9a4c1c !important;
  color: #fff !important;
}

.round-tone-4 {
  background: linear-gradient(180deg, #302811 0%, #211b0d 100%) !important;
}

.round-tone-4 .bracket-round-title {
  background: #9b7626 !important;
  color: #fff !important;
}

.round-tone-5 {
  background: linear-gradient(180deg, #301923 0%, #211018 100%) !important;
}

.round-tone-5 .bracket-round-title {
  background: #9b1d5c !important;
  color: #fff !important;
}

.round-tone-6 {
  background: linear-gradient(180deg, #292936 0%, #1c1c25 100%) !important;
}

.round-tone-6 .bracket-round-title {
  background: #45455f !important;
  color: #fff !important;
}

/* Turnierbaum: gleiche Rundenbreite + kleinere Statusschrift */
.bracket-round {
  width: 275px !important;
  min-width: 275px !important;
  max-width: 275px !important;
  flex: 0 0 275px !important;
}

.tree-status {
  font-size: 11px !important;
  line-height: 1.25 !important;
  margin-top: 6px !important;
  word-break: normal;
  overflow-wrap: break-word;
}

.tree-status span {
  font-size: 11px !important;
  line-height: 1.25 !important;
}

/* Spielerzeilen bleiben gut lesbar */
.tree-player-row {
  font-size: 14px !important;
}

/* Spielnummer etwas kompakter */
.tree-match-title {
  font-size: 13px !important;
  line-height: 1.2 !important;
  margin-bottom: 9px !important;
}

/* Mobile etwas schmaler, aber weiterhin einheitlich */
@media (max-width: 800px) {
  .bracket-round {
    width: 245px !important;
    min-width: 245px !important;
    max-width: 245px !important;
    flex: 0 0 245px !important;
  }

  .tree-status,
  .tree-status span {
    font-size: 10.5px !important;
  }

  .tree-player-row {
    font-size: 13px !important;
  }
}

@media (max-width: 430px) {
  .bracket-round {
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
    flex: 0 0 230px !important;
  }

  .tree-status,
  .tree-status span {
    font-size: 10px !important;
  }
}

/* =========================
   Turnierbaum Seitenkopf
   ========================= */

.bracket-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0 18px 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(21,21,28,0.92), rgba(36,17,30,0.82));
  border: 1px solid rgba(255,255,255,0.10);
  border-left: 4px solid var(--accent-magenta);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.bracket-page-header h2 {
  margin: 0;
  padding-left: 0;
  border-left: 0;
  font-size: 24px;
  line-height: 1.2;
}

.bracket-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.bracket-nav-button {
  width: auto !important;
  white-space: nowrap;
  padding: 9px 16px !important;
  font-size: 15px;
}

/* Gewinnerseite / Verliererseite etwas näher an den Seitenkopf */
.bracket-section h3 {
  margin-top: 8px;
  margin-bottom: 14px;
}

/* Turnierbaum etwas kompakter an den Seitenkopf ziehen */
.bracket-section {
  margin-top: 0;
}

/* Mobile */
@media (max-width: 800px) {
  .bracket-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin: 12px 0 16px 0;
    padding: 12px;
  }

  .bracket-page-header h2 {
    font-size: 21px;
  }

  .bracket-page-actions,
  .bracket-nav-button {
    width: 100% !important;
  }

  .bracket-nav-button {
    text-align: center;
  }
}

/* Header auf Turnierbaumseite generell kompakter */
.app-header {
  min-height: auto !important;
}

.app-header .brand-title {
  line-height: 1.1 !important;
}

.app-header .main-nav {
  margin-top: 4px !important;
}

/* Ergebnisanzeige im Turnierbaum */
.tree-score {
  margin-top: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  line-height: 1.2;
  color: #f4f4f7;
}

.tree-score strong {
  color: #f2b84b;
  font-size: 13px;
}

/* =========================
   Turnierbaum: Spielerfeld + Ergebnisfeld
   ========================= */

.tree-match-card {
  border-radius: 18px !important;
  padding: 14px 16px 12px 16px !important;
}

.tree-match-title {
  text-align: center !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #f2b84b !important;
  margin-bottom: 12px !important;
}

.tree-player-score-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
}

.tree-player-name {
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  background: rgba(0,0,0,0.22);
  color: #f4f4f7;
  border: 1px solid rgba(255,255,255,0.16);
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
}

.tree-player-score {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.18);
  color: #f4f4f7;
  border: 1px solid rgba(255,255,255,0.20);
  font-size: 17px;
  font-weight: 700;
  min-width: 44px;
}

/* Gewinner hervorheben */
.tree-player-winner-row .tree-player-name {
  background: #ffffff !important;
  color: #000000 !important;
  font-weight: 900 !important;
  border-color: rgba(0,0,0,0.65) !important;
}

.tree-player-winner-row .tree-player-score {
  background: #ffffff !important;
  color: #000000 !important;
  font-weight: 900 !important;
  border-color: rgba(0,0,0,0.65) !important;
}

/* Status unten kleiner und einheitlich */
.tree-status {
  margin-top: 8px !important;
  font-size: 10.5px !important;
  line-height: 1.25 !important;
  color: #e8e8ef !important;
}

.tree-status span {
  font-size: 10.5px !important;
  color: #f2b84b !important;
}

/* Alte Spielerzeilen aus vorherigem Layout deaktivieren, falls noch vorhanden */
.tree-player-row {
  display: none !important;
}

/* Mobile */
@media (max-width: 800px) {
  .tree-player-score-row {
    grid-template-columns: 1fr 38px;
    gap: 8px;
  }

  .tree-player-name {
    height: 36px;
    font-size: 13px;
    padding: 0 9px;
  }

  .tree-player-score {
    height: 36px;
    min-width: 38px;
    font-size: 15px;
  }

  .tree-status,
  .tree-status span {
    font-size: 10px !important;
  }
}

/* =========================
   Spielplan: Runden farblich unterscheiden
   ========================= */

.schedule-table tbody tr.schedule-round-1 td {
  background: rgba(60, 60, 70, 0.62) !important;
}

.schedule-table tbody tr.schedule-round-2 td {
  background: rgba(80, 35, 75, 0.55) !important;
}

.schedule-table tbody tr.schedule-round-3 td {
  background: rgba(92, 48, 22, 0.55) !important;
}

.schedule-table tbody tr.schedule-round-4 td {
  background: rgba(92, 72, 24, 0.55) !important;
}

.schedule-table tbody tr.schedule-round-5 td {
  background: rgba(80, 30, 48, 0.55) !important;
}

.schedule-table tbody tr.schedule-round-6 td {
  background: rgba(45, 50, 72, 0.55) !important;
}

/* leichte Hover-Hervorhebung */
.schedule-table tbody tr:hover td {
  filter: brightness(1.14);
}

/* Gewinnerzelle bleibt sichtbar */
.schedule-table .winner-cell {
  color: #f2b84b !important;
  font-weight: 900 !important;
}

/* Ergebniszellen etwas klarer absetzen */
.schedule-table .score-cell {
  background-color: rgba(0,0,0,0.18) !important;
}

/* Automat-Spalte etwas stärker */
.schedule-table .machine-cell {
  color: #ffffff !important;
  font-weight: 900 !important;
}

/* Status-Badges sollen ihre eigene Farbe behalten */
.schedule-table .status-badge {
  filter: none !important;
}

/* =========================
   Spielplan: sichtbare Rahmenlinien
   ========================= */

.schedule-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 1px solid rgba(255,255,255,0.32) !important;
}

/* Alle Zellen klar trennen */
.schedule-table th,
.schedule-table td {
  border-right: 1px solid rgba(255,255,255,0.22) !important;
  border-bottom: 1px solid rgba(255,255,255,0.18) !important;
}

/* Linke Außenkante */
.schedule-table th:first-child,
.schedule-table td:first-child {
  border-left: 1px solid rgba(255,255,255,0.22) !important;
}

/* Obere Außenkante */
.schedule-table thead th {
  border-top: 1px solid rgba(255,255,255,0.28) !important;
}

/* Tabellenkopf stärker */
.schedule-table thead th {
  background: linear-gradient(135deg, #332016, #4a2638) !important;
  color: #f2b84b !important;
  border-color: rgba(255,255,255,0.30) !important;
}

/* Spalten optisch sauberer */
.schedule-table td:nth-child(1),
.schedule-table td:nth-child(2),
.schedule-table td:nth-child(3),
.schedule-table td:nth-child(6),
.schedule-table td:nth-child(8),
.schedule-table td:nth-child(9) {
  text-align: center !important;
}

/* Zelllinien auch bei farbigen Runden sichtbar halten */
.schedule-table tbody tr td {
  box-shadow: inset -1px 0 rgba(255,255,255,0.08), inset 0 -1px rgba(255,255,255,0.08);
}

/* Statusspalte leicht absetzen */
.schedule-table td:nth-child(7) {
  border-left: 1px solid rgba(255,255,255,0.28) !important;
  border-right: 1px solid rgba(255,255,255,0.28) !important;
}

/* Ergebnisbereich leicht absetzen */
.schedule-table td:nth-child(8),
.schedule-table td:nth-child(9) {
  background-color: rgba(0,0,0,0.20) !important;
}

/* Letzte Spalte klar trennen */
.schedule-table td:last-child,
.schedule-table th:last-child {
  border-right: 1px solid rgba(255,255,255,0.32) !important;
}

/* =========================
   Spielplan: ruhigere Schriftfarben
   ========================= */

/* Grundschrift im Spielplan vereinheitlichen */
.schedule-table td,
.schedule-table th {
  color: #f2f2f4 !important;
}

/* Tabellenkopf bleibt etwas akzentuiert, aber ruhiger */
.schedule-table thead th {
  color: #f2b84b !important;
}

/* Spieler 1 / Spieler 2 immer weiß */
.schedule-table td:nth-child(4),
.schedule-table td:nth-child(5) {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Gewinner nicht mehr gelb/orange, nur noch fett */
.schedule-table .winner-cell {
  color: #ffffff !important;
  font-weight: 900 !important;
}

/* Spielnummer dezent, nicht knallig */
.schedule-table .match-number {
  color: #8fc7ff !important;
  font-weight: 700 !important;
}

/* Seite, Runde, Automat, Ergebnis einheitlich */
.schedule-table td:nth-child(2),
.schedule-table td:nth-child(3),
.schedule-table td:nth-child(6),
.schedule-table td:nth-child(8),
.schedule-table td:nth-child(9) {
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Ergebnisfelder neutral halten */
.schedule-table .score-cell {
  color: #ffffff !important;
  background-color: rgba(0,0,0,0.14) !important;
}

/* Status-Badges: keine bunten Schriftfarben mehr */
.schedule-table .status-badge,
.schedule-table .status-badge.status-open,
.schedule-table .status-badge.status-waiting,
.schedule-table .status-badge.status-pending,
.schedule-table .status-badge.status-completed,
.schedule-table .status-badge.status-bye,
.schedule-table .status-badge.status-skipped {
  color: #f4f4f7 !important;
  background: rgba(0,0,0,0.22) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  font-weight: 700 !important;
}

/* Laufende Spiele nur mit dezenter Umrandung statt gelber Schrift */
.schedule-table .match-status-open td {
  box-shadow:
    inset 0 1px rgba(242,184,75,0.25),
    inset 0 -1px rgba(242,184,75,0.25) !important;
}

/* Freilos nicht mehr orange markieren */
.schedule-table .status-bye {
  color: #f4f4f7 !important;
}

/* Eingabe-Spalte ruhiger */
.schedule-table td:last-child {
  color: #ffffff !important;
}

/* Platzhalter / offene Spiele etwas dezenter */
.schedule-table .match-status-pending td,
.schedule-table .match-status-skipped td {
  color: #c9c9cf !important;
}

/* Links / automatisch / wartet im Spielplan nicht farbig schreien lassen */
.schedule-table td a,
.schedule-table td strong,
.schedule-table td span {
  color: inherit;
}

/* OK-Button bleibt als einziger kräftiger Akzent */
.schedule-table .score-form button {
  background: linear-gradient(135deg, #f47b20, #d9237f) !important;
  color: #ffffff !important;
}

/* =========================
   Spielplan: Rahmenlinien weiß
   Ausnahme: laufende Spiele
   ========================= */

/* Grundrahmen komplett weiß */
.schedule-table {
  border: 1px solid #ffffff !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

/* Jede Zelle mit weißer Linie */
.schedule-table th,
.schedule-table td {
  border-right: 1px solid #ffffff !important;
  border-bottom: 1px solid #ffffff !important;
}

/* Außenkanten */
.schedule-table th:first-child,
.schedule-table td:first-child {
  border-left: 1px solid #ffffff !important;
}

.schedule-table thead th {
  border-top: 1px solid #ffffff !important;
}

/* Letzte Spalte */
.schedule-table th:last-child,
.schedule-table td:last-child {
  border-right: 1px solid #ffffff !important;
}

/* Letzte Zeile */
.schedule-table tbody tr:last-child td {
  border-bottom: 1px solid #ffffff !important;
}

/* Schattenlinien aus vorherigen Patches neutralisieren */
.schedule-table tbody tr td {
  box-shadow: none !important;
}

/* Ausnahme: laufende Spiele bekommen goldene/orange Hervorhebung */
.schedule-table tbody tr.match-status-open td {
  border-top: 2px solid #f2b84b !important;
  border-bottom: 2px solid #f2b84b !important;
}

/* linke und rechte Kante laufender Spiele ebenfalls hervorheben */
.schedule-table tbody tr.match-status-open td:first-child {
  border-left: 2px solid #f2b84b !important;
}

.schedule-table tbody tr.match-status-open td:last-child {
  border-right: 2px solid #f2b84b !important;
}

/* Zwischenzellen laufender Spiele bleiben weiß getrennt */
.schedule-table tbody tr.match-status-open td:not(:first-child):not(:last-child) {
  border-right: 1px solid #ffffff !important;
}

/* Header bleibt sauber weiß umrandet */
.schedule-table thead th {
  border-color: #ffffff !important;
}

/* =========================
   Spielplan: dünne, einheitliche Rahmenlinien
   ========================= */

.schedule-table {
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  border: 1px solid rgba(255,255,255,0.70) !important;
}

/* Alle Zellen gleich dünn */
.schedule-table th,
.schedule-table td {
  border: 1px solid rgba(255,255,255,0.70) !important;
}

/* Header ebenfalls gleiche Linien */
.schedule-table thead th {
  border: 1px solid rgba(255,255,255,0.70) !important;
}

/* Laufende Spiele: keine dickeren Rahmen mehr */
.schedule-table tbody tr.match-status-open td,
.schedule-table tbody tr.match-status-open td:first-child,
.schedule-table tbody tr.match-status-open td:last-child,
.schedule-table tbody tr.match-status-open td:not(:first-child):not(:last-child) {
  border: 1px solid rgba(255,255,255,0.70) !important;
}

/* Laufende Spiele nur noch dezent über Hintergrund/Innenakzent markieren */
.schedule-table tbody tr.match-status-open td {
  box-shadow: inset 0 0 0 9999px rgba(242,184,75,0.08) !important;
}

/* alte Sonderlinien endgültig neutralisieren */
.schedule-table tbody tr td {
  outline: none !important;
}

/* =========================
   Spielerdatenbank
   ========================= */

.admin-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 18px 0;
}

.compact-form {
  max-width: 720px;
}

.player-db-table th,
.player-db-table td {
  white-space: nowrap;
}

@media (max-width: 800px) {
  .admin-toolbar {
    flex-direction: column;
  }

  .admin-toolbar .button {
    width: 100%;
    text-align: center;
  }
}

/* Teamrechte */
.teamrights-table td,
.teamrights-table th {
  white-space: nowrap;
}

.role-form {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.role-form select {
  min-width: 170px;
}

.role-form button {
  width: auto;
  margin: 0;
}

.muted {
  color: #c9c9cf;
}

/* =========================
   Spielerverwaltung / Aktionen
   ========================= */

.action-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-delete-form,
.action-cell form {
  display: inline-flex !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  width: auto !important;
  max-width: none !important;
}

.small-button,
button.small-button,
a.small-button {
  padding: 7px 10px !important;
  font-size: 13px !important;
  line-height: 1.1 !important;
  width: auto !important;
  min-width: 0 !important;
}

.danger-button {
  background: linear-gradient(135deg, #8b1e1e, #d92323) !important;
  color: #ffffff !important;
}

.tournament-info-box {
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.18);
  padding: 14px 16px;
  margin: 14px 0 18px 0;
  border-radius: 10px;
}

.tournament-info-box p {
  margin: 5px 0;
}

code {
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 3px 7px;
  border-radius: 6px;
  color: #ffffff;
}
