/* ASV Happing Tennis – Rot-Weiß-Lila, mobile-first, moderner Look */
:root {
  --rot: #c8102e;
  --rot-dunkel: #9c0c24;
  --lila: #4b2e83;
  --lila-dunkel: #37215f;
  --lila-hell: #ede8f5;
  --gelb: #d7f542;            /* Tennisball-Akzent */
  --bg: #f6f5f9;
  --text: #1d1d24;
  --muted: #6d6c7a;
  --rand: #e7e5ee;
  --karte: #ffffff;
  --schatten: 0 4px 20px rgba(75, 46, 131, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(120deg, var(--lila-dunkel) 0%, var(--lila) 60%, var(--rot-dunkel) 130%);
  color: #fff;
  padding: 0.55rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.4rem 1rem;
  box-shadow: 0 2px 14px rgba(29, 29, 36, 0.25);
}
.brand { display: flex; align-items: center; gap: 0.65rem; color: #fff; text-decoration: none; }
.brand img {
  height: 42px; width: 42px; object-fit: contain;
  background: #fff; border-radius: 50%; padding: 2px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-club { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }
.brand-title { font-size: 1.02rem; font-weight: 700; }
.topbar nav { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.topbar nav a {
  color: #fff; text-decoration: none; font-weight: 600; font-size: 0.92rem;
  padding: 0.3rem 0.85rem; border-radius: 999px;
  transition: background 0.15s;
}
.topbar nav a:hover { background: rgba(255, 255, 255, 0.16); }
.topbar nav a.muted { opacity: 0.7; font-weight: 400; }

main { max-width: 960px; margin: 0 auto; padding: 1.1rem 1rem 2rem; }
footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1rem 1rem 2.2rem; }

h1 { font-size: 1.55rem; margin: 0.6rem 0 1rem; color: var(--lila); letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
h3.sub { font-size: 0.85rem; margin: 1.3rem 0 0.3rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.section-title { margin: 1.6rem 0 0.7rem; color: var(--lila); }

.card {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--schatten);
}

/* Startseite */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 85% -20%, rgba(215, 245, 66, 0.28), transparent 45%),
    linear-gradient(120deg, var(--lila-dunkel) 0%, var(--lila) 55%, var(--rot) 130%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.6rem 1.3rem;
  margin-bottom: 1rem;
  box-shadow: var(--schatten);
}
.hero h1 { color: #fff; margin: 0 0 0.35rem; font-size: 1.65rem; }
.hero p { margin: 0; opacity: 0.9; font-size: 0.95rem; max-width: 34rem; }
.comp-cards { display: grid; grid-template-columns: 1fr; gap: 0.9rem; }
@media (min-width: 560px) { .comp-cards { grid-template-columns: 1fr 1fr; } }
.comp-card {
  text-decoration: none; color: inherit; display: block;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.comp-card h2 { color: var(--rot); font-size: 1.25rem; }
.comp-card:hover {
  transform: translateY(-2px);
  border-color: var(--lila);
  box-shadow: 0 8px 26px rgba(75, 46, 131, 0.16);
}
.progress { height: 8px; background: var(--lila-hell); border-radius: 999px; overflow: hidden; margin: 0.6rem 0 0.35rem; }
.progress div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--rot), var(--lila)); }

/* Tabellen */
table.standings { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.standings th, .standings td { padding: 0.45rem 0.35rem; text-align: center; }
.standings tbody tr { border-bottom: 1px solid var(--rand); }
.standings tbody tr:last-child { border-bottom: none; }
.standings th {
  color: var(--muted); font-weight: 600; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 2px solid var(--rand);
}
.standings .left { text-align: left; }
.standings tr.quali td { background: var(--lila-hell); }
.standings tr.quali td:first-child { border-left: 3px solid var(--lila); border-radius: 4px 0 0 4px; }

/* Ergebniszeilen */
.result-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.7rem;
  padding: 0.55rem 0; border-bottom: 1px solid var(--rand);
}
.result-row:last-child { border-bottom: none; }
.result-row .names { font-weight: 600; flex: 1 1 200px; }
.result-row .score { font-size: 0.92rem; }
.tag {
  background: var(--lila-hell); color: var(--lila);
  border-radius: 999px; padding: 0.08rem 0.6rem; font-size: 0.74rem; font-weight: 700;
  white-space: nowrap; letter-spacing: 0.02em;
}

/* Turnierbaum */
.bracket { display: flex; gap: 0.9rem; overflow-x: auto; padding: 0.2rem 0.1rem 0.8rem; }
.bracket-round { min-width: 210px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.bracket-round h3 {
  font-size: 0.78rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.07em; margin: 0 0 0.6rem; text-align: center;
}
.bracket-match {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 12px;
  margin: 0 0 0.8rem; overflow: hidden; box-shadow: var(--schatten);
}
.bracket-match.done { border-color: var(--lila); }
.bm-head {
  padding: 0.2rem 0.75rem; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--lila); background: var(--lila-hell);
}
.bm-row { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rand); font-size: 0.95rem; font-weight: 500; }
.bm-row.winner { font-weight: 700; color: var(--rot); }
.bm-row.winner::after { content: " ✓"; font-size: 0.8em; }
.bm-row.placeholder { color: var(--muted); font-style: italic; font-weight: 400; }
.bm-score { padding: 0.4rem 0.75rem; font-size: 0.85rem; color: var(--muted); background: var(--bg); }
.champion {
  background:
    radial-gradient(circle at 85% -30%, rgba(215, 245, 66, 0.35), transparent 50%),
    linear-gradient(120deg, var(--rot), var(--lila));
  color: #fff;
  border-radius: 12px; padding: 0.9rem; text-align: center; font-size: 1.05rem;
  box-shadow: var(--schatten);
}

/* Formulare */
form { margin: 0.5rem 0 0; }
label { display: block; margin: 0.6rem 0 0.2rem; font-weight: 600; font-size: 0.9rem; }
label.check { font-weight: 400; }
input[type=password], input[type=number], input[type=datetime-local], select {
  padding: 0.6rem 0.7rem; border: 1px solid var(--rand); border-radius: 10px;
  font-size: 1rem; width: 100%; max-width: 320px; background: #fff;
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--lila); outline-offset: 1px; }
table.score-input { border-collapse: collapse; margin: 0.5rem 0; width: 100%; }
.score-input th, .score-input td { padding: 0.3rem; text-align: center; }
.score-input th { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.score-input td.left { text-align: left; font-weight: 600; font-size: 0.92rem; }
.score-input input { width: 3.8rem; max-width: none; text-align: center; }
fieldset { border: 1px solid var(--rand); border-radius: 10px; margin: 0.8rem 0; padding: 0.6rem 0.8rem; }
legend { font-size: 0.85rem; color: var(--muted); padding: 0 0.3rem; }
fieldset label { font-weight: 400; margin: 0.3rem 0; }
details { margin: 0.8rem 0; }
summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.pairing { margin: 0.3rem 0 0.8rem; }

.btn {
  display: inline-block;
  background: linear-gradient(120deg, var(--rot), var(--rot-dunkel));
  color: #fff; border: none;
  border-radius: 999px; padding: 0.6rem 1.35rem; font-size: 1rem; font-weight: 600;
  cursor: pointer; text-decoration: none; margin: 0.6rem 0.4rem 0 0;
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: #fff; color: var(--lila); border: 1.5px solid var(--lila); }
.btn.danger { background: #fff; color: var(--rot); border: 1.5px solid var(--rot); }
.btn.small { padding: 0.28rem 0.85rem; font-size: 0.85rem; margin: 0; }

.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.admin-actions form { margin: 0; }
.draw-table select { max-width: 90px; }

.flash {
  background: var(--lila-hell); border: 1px solid var(--lila); color: var(--lila);
  border-radius: 10px; padding: 0.65rem 0.95rem; margin-bottom: 0.9rem; font-size: 0.95rem;
}
.error {
  background: #fdecec; border: 1px solid var(--rot); color: var(--rot-dunkel);
  border-radius: 10px; padding: 0.65rem 0.95rem; margin: 0.6rem 0; font-size: 0.95rem;
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.login-card, .form-card { max-width: 480px; margin: 2rem auto; }

/* Termin */
.termin-tag {
  background: #fff8e1; color: #8a6d00; border: 1px solid #eed9a0;
  border-radius: 999px; padding: 0.08rem 0.6rem; font-size: 0.78rem; font-weight: 600;
  white-space: nowrap;
}
.termin-tag.gespielt {
  background: var(--bg); color: var(--muted); border-color: var(--rand); font-weight: 500;
}
.termin-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.termin-row input { max-width: 230px; }
.termin-row .btn { margin: 0; }
hr.trenner { border: none; border-top: 1px solid var(--rand); margin: 1.1rem 0; }

/* Protokoll */
.log-row {
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: baseline;
  padding: 0.5rem 0; border-bottom: 1px solid var(--rand); font-size: 0.9rem;
}
.log-row:last-child { border-bottom: none; }
.log-ts { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-details { flex: 1 1 260px; }
