/* Tennis-Pyramide – "Center Court"
   Layout: Hartplatz-Blau als Bühne, Ballgelb als einziger Akzent, Anzeigetafel-Ziffern.
   Schriften lokal eingebunden (SIL OFL), keine externen Server → DSGVO-freundlich. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }

:root {
  --navy: #07284a; --navy-2: #0b3a68; --blue: #015EA3; --blue-soft: #e2edf7;
  --court: #1b5c9a; --court-line: rgba(255,255,255,.85); --outer: #2c7a4b;
  --ball: #d8f03c; --ball-ink: #1a2507;
  --ink: #0f1d2b; --muted: #5a6a7b; --line: #d5dde6; --bg: #eef2f6; --surface: #ffffff;
  --green: #17803d; --green-soft: #dcf2e3; --orange: #a85d00; --orange-soft: #ffefc7; --red: #b42318;
  --radius: 12px;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --navy: #050f1c; --navy-2: #0a1d33; --blue: #66adeb; --blue-soft: #13263a;
    --court: #123f6b; --court-line: rgba(255,255,255,.55); --outer: #1d5233;
    --ink: #e7eef5; --muted: #98a9ba; --line: #24364a; --bg: #0b1520; --surface: #13202e;
    --green: #5ccf80; --green-soft: #143723; --orange: #f2b450; --orange-soft: #3a2a0d; --red: #ff8f85;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
b, strong { font-weight: 600; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--f-body); }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.05; text-wrap: balance; }
h2 { font-family: var(--f-body); font-size: 1.15rem; font-weight: 600; letter-spacing: 0; margin: 0 0 .9rem; color: var(--blue);
  display: flex; align-items: center; gap: .5rem; }
h3 { font-family: var(--f-body); font-size: 1.05rem; font-weight: 600; margin: 1rem 0 .5rem; }

/* ---------- Kopf: Platz von oben ---------- */
.top { color: #fff; background:
    linear-gradient(var(--court-line), var(--court-line)) center 100% / 100% 2px no-repeat,
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255,255,255,.18) calc(50% - 1px), rgba(255,255,255,.18) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(transparent 62%, rgba(255,255,255,.14) 62%, rgba(255,255,255,.14) calc(62% + 2px), transparent calc(62% + 2px)),
    radial-gradient(120% 140% at 85% -20%, var(--navy-2), var(--navy) 60%);
}
.top-inner { max-width: 1080px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-left)) 0; }
.brand { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; }
.brand h1 { margin: 0; font-size: clamp(1.7rem, 4.5vw, 2.6rem); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.brand .sub { font-size: .95rem; color: #c9d7e6; margin-top: 4px; }
.brand-mark { width: 44px; height: 44px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f1ff8a, var(--ball) 55%, #b3c726);
  position: relative; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 44px; height: 44px; border: 2.5px solid rgba(255,255,255,.95); border-radius: 50%; top: 0; }
.brand-mark::before { left: -30px; } .brand-mark::after { right: -30px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 12px; }
.tabs a { color: #dce7f2; text-decoration: none; padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  font-family: var(--f-body); font-weight: 600; font-size: 1rem; }
.tabs a:hover { background: rgba(255,255,255,.12); color: #fff; }
.tabs a[aria-current="page"] { background: var(--ball); color: var(--ball-ink); }

/* ---------- Grundlayout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-left)) 36px; display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card.narrow { max-width: 460px; width: 100%; margin: 28px auto; }
.card.confirm { background: var(--orange-soft); border-color: var(--orange); }
.card.highlight { background: var(--navy); color: #eaf1f8; border: 0; box-shadow: 0 10px 30px rgba(7,40,74,.25); }
.card.highlight h2 { color: var(--ball); }
.card.highlight .muted, .card.highlight .score-table .h { color: #a9bccf; }
.card.highlight .contact { background: rgba(255,255,255,.08); }
.card.highlight .contact .label { color: #a9bccf; }
.card.highlight .result-form { border-top-color: rgba(255,255,255,.15); }
.card.highlight .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.card.highlight .btn-ghost:hover { background: rgba(255,255,255,.1); }
.card.highlight .btn:not(.btn-ghost) { background: var(--ball); color: var(--ball-ink); }
.card.highlight input { background: #fff; color: #0f1d2b; border-color: transparent; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.muted { color: var(--muted); } .small { font-size: .9rem; } .warn { color: var(--red); }
.card.highlight .warn { color: var(--ball); }
.count { background: var(--ball); color: var(--ball-ink); border-radius: 999px; font-size: .85rem; padding: 0 9px; letter-spacing: 0; }
.more { display: inline-block; margin-top: .8rem; font-weight: 600; text-decoration: none; }
.callout { background: var(--blue-soft); border-radius: var(--radius); padding: 12px 16px; }
.flash { border-radius: var(--radius); padding: 12px 16px; font-weight: 600; }
.flash-ok { background: var(--green-soft); color: var(--green); }
.flash-err { background: #fde8e6; color: var(--red); }
@media (prefers-color-scheme: dark) { .flash-err { background: #3b1a17; } }
.sel { user-select: all; }
.foot { max-width: 1080px; margin: 0 auto; padding: 0 16px 36px; text-align: center; color: var(--muted); font-size: .9rem; }

/* ---------- Formulare & Buttons ---------- */
.stack { display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.nowrap { white-space: nowrap; flex-wrap: nowrap; }
form.inline { display: inline; margin: 0; }
label { font-weight: 600; font-size: .92rem; }
.inline-label { font-weight: 600; }
input, select { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
input:focus, select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.row input[type="date"], .row select { width: auto; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grid label { display: grid; gap: 4px; }
.span-2 { grid-column: 1 / -1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--blue); color: #fff; border: 1px solid transparent;
  border-radius: 999px; padding: 10px 20px; font-family: var(--f-body); font-weight: 600; font-size: 1rem;
  cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--blue); border-color: var(--line); }
.btn-ghost:hover { background: var(--blue-soft); }
.btn-sm { padding: 4px 12px; font-size: .9rem; }
.btn-danger { background: var(--red); } .btn-danger:hover { background: #8f1c13; }
.btn-danger-text { color: var(--red); }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Listen, Anzeigetafel ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.meta { display: block; color: var(--muted); font-size: .88rem; }
.results li { display: grid; grid-template-columns: 6.4em 1fr auto; gap: 4px 14px; align-items: center; }
.results .date { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.results .win { font-weight: 700; }
.results .vs { color: var(--muted); font-size: .88rem; }
.results > li > .tag { grid-column: 2 / -1; justify-self: start; }
.score { display: inline-flex; gap: 4px; }
.set { display: inline-grid; grid-template-columns: auto auto; gap: 3px; align-items: baseline; background: var(--navy); color: #c7d4e2;
  border-radius: 6px; padding: 2px 7px; font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.set b { color: #fff; font-weight: 700; }
.set i { font-style: normal; opacity: .75; }
.set-won b { color: var(--ball); }
@media (max-width: 560px) { .results li { grid-template-columns: 1fr auto; } .results .date { grid-column: 1 / -1; } }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; border-radius: 6px; padding: 1px 8px; background: var(--blue-soft); color: var(--blue); }
.tag-warn { background: var(--orange-soft); color: var(--orange); }
.tag-win { background: var(--ball); color: var(--ball-ink); }
.tag-loss { background: var(--bg); color: var(--muted); }

/* Spitze der Pyramide: kleines Siegertreppchen */
.podium { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.podium li { display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: 12px; padding: 6px 0; }
.podium .place { font-family: var(--f-display); font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--blue); text-align: center; font-variant-numeric: tabular-nums; }
.podium li:first-child .place { color: var(--ball-ink); background: var(--ball); border-radius: 50%; width: 3rem; height: 3rem; display: grid; place-items: center; font-size: 2rem; }
.podium li:first-child .name { font-size: 1.25rem; }
.podium .name { font-weight: 600; } .podium .lk { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

/* Bestenlisten */
table { border-collapse: collapse; width: 100%; }
.board td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.board tr:last-child td { border-bottom: 0; }
.board .pl { width: 2.4em; font-family: var(--f-display); font-weight: 700; color: var(--muted); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.board tr:first-child .pl { color: var(--blue); }
.board .num { text-align: right; font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.board small { font-family: var(--f-body); font-weight: 400; font-size: .82rem; color: var(--muted); }
.board tr.mine td { background: var(--blue-soft); }

/* ---------- Pyramide auf dem Hartplatz ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.key { display: inline-block; font-size: .85rem; font-weight: 600; padding: 2px 10px; border-radius: 6px; }
.key-me { background: var(--ball); color: var(--ball-ink); }
.key-open { background: var(--green); color: #fff; }
.key-blocked { background: var(--orange-soft); color: var(--orange); }
.court-card { padding-bottom: 20px; }
.pyramid.court { display: grid; gap: 0; padding: 18px 12px; border-radius: 10px; overflow-x: auto;
  background:
    linear-gradient(var(--court), var(--court)) padding-box,
    var(--outer);
  border: 10px solid var(--outer);
  box-shadow: inset 0 0 0 2px var(--court-line); }
.pyr-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 10px 0; position: relative; }
.pyr-row + .pyr-row { border-top: 2px solid var(--court-line); }
.pyr-row:first-child { padding-top: 2px; }
.pc { width: 132px; border-radius: 8px; padding: 7px 8px 6px; text-align: center; background: #fff; color: #0f1d2b;
  text-decoration: none; display: grid; gap: 0; font-size: .92rem; line-height: 1.2; box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.pc-rank { font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; color: #015EA3; font-variant-numeric: tabular-nums; }
.pc-name b { font-weight: 600; }
.pc-lk { color: #5a6a7b; font-size: .78rem; margin-top: 2px; }
.pc-me { background: var(--ball); color: var(--ball-ink); box-shadow: 0 0 0 3px #fff, 0 6px 18px rgba(0,0,0,.3); }
.pc-me .pc-rank, .pc-me .pc-lk { color: var(--ball-ink); }
.pc-blocked { background: repeating-linear-gradient(135deg, #ffe7ad 0 8px, #fff4d6 8px 16px); }
.pc-blocked .pc-rank { color: #a85d00; }
.pc-me.pc-blocked { background: repeating-linear-gradient(135deg, var(--ball) 0 8px, #f0fbb0 8px 16px); }
.pc-me.pc-blocked .pc-rank { color: var(--ball-ink); }
.pc-open { background: #1f9d55; color: #fff; cursor: pointer; }
.pc-open .pc-rank, .pc-open .pc-lk { color: #eaffef; }
a.pc-open:hover { background: #fff; color: #17803d; transform: translateY(-2px); }
a.pc-open:hover .pc-rank, a.pc-open:hover .pc-lk { color: #17803d; }
@media (max-width: 560px) {
  .pyramid.court { border-width: 6px; padding: 12px 6px; }
  .pc { width: calc(33.33% - 6px); min-width: 88px; font-size: .82rem; padding: 6px 4px; }
  .pc-rank { font-size: 1.1rem; }
}

/* ---------- Mein Bereich ---------- */
.facts { display: grid; gap: 8px; margin: 0 0 14px; }
.facts div { display: grid; grid-template-columns: 9.5em 1fr; gap: 8px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; }
.contact { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; background: var(--blue-soft); border-radius: 10px; padding: 12px 16px; margin: 12px 0; }
.contact .label { display: block; font-size: .82rem; color: var(--muted); }
.contact .sel { font-weight: 600; font-size: 1.1rem; word-break: break-all; }
.score-table { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(52px, 1fr)); gap: 8px; align-items: center; }
.score-table .h { font-size: .85rem; color: var(--muted); text-align: center; }
.score-table .who { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.score-table input { text-align: center; font-family: var(--f-display); font-weight: 700; font-size: 1.4rem; padding: 6px 4px; font-variant-numeric: tabular-nums; }
.result-form { display: grid; gap: 12px; border-top: 1px solid var(--line); margin-top: 14px; }
.actions-secondary { margin-top: 12px; }

.prose { max-width: 780px; }
.rules { margin: 0; display: grid; gap: 4px; }
.rules dt { font-weight: 600; margin-top: 12px; font-size: 1.05rem; }
.rules dd { margin: 0; }

/* ---------- Verwaltung ---------- */
.table-scroll { overflow-x: auto; }
.admin-table th, .admin-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { font-size: .85rem; font-weight: 600; color: var(--muted); }
.admin-table .num { font-variant-numeric: tabular-nums; }
.w-rank { width: 5.5em !important; }
.log { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; font-size: .92rem; }
.log li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.log .date { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }

@media (max-width: 420px) { .tabs a { padding: 6px 11px; font-size: .98rem; } body { font-size: 16px; } }
@media (prefers-reduced-motion: no-preference) { .btn, .pc, .tabs a { transition: background-color .15s, color .15s, transform .15s; } }
.logout-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
