@import url("/static/fonts/fonts.css");

/*
 * Dart-Turniere – Farben der Dartscheibe, jede mit fester Bedeutung:
 *   Schiefer  Hintergrund (Kreidetafel)     Kreide  Schrift
 *   Sisal     Nebenschrift, Linien          Draht   inaktiv, Linien im Baum
 *   Rot       läuft gerade                  Grün    gewonnen / weiter
 * Rot und Grün stehen nie allein – immer mit Wort oder Form daneben.
 * Schrift: Barlow Condensed für Zahlen, Namen, Überschriften (Anzeigetafel), Barlow für Text.
 */
:root {
  --schiefer: #233029;
  --schiefer-hell: #2b3a32;
  --schiefer-tief: #1c2722;
  --kreide: #edeae0;
  --sisal: #cdbb94;
  --rot: #d2393b;
  --gruen: #2e9b5e;
  --gruen-hell: #4cc283;
  --draht: #8e9aa0;
  --linie: rgba(205, 187, 148, .22);
  --zahl: "Barlow Condensed", "Arial Narrow", sans-serif;
  --text: "Barlow", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--schiefer); color: var(--kreide); font-family: var(--text); line-height: 1.4; }
a { color: var(--kreide); }
:focus-visible { outline: 2px solid var(--sisal); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }   /* gilt auch für Elemente mit eigenem display */

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 16px; }
main { max-width: 64rem; margin: 0 auto; padding: 6px 16px 60px; }

/* ── Kopf ─────────────────────────────────────────────────────────────── */
header { max-width: 64rem; margin: 0 auto; padding: 18px 16px 6px; position: relative; }
.kopf { display: flex; align-items: flex-start; gap: 12px; }
h1 { flex: 1; margin: 0; font-family: var(--zahl); font-weight: 700; font-size: 2.1rem; line-height: 1.05; letter-spacing: .01em; }
.lage { margin: 6px 0 0; color: var(--sisal); font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.lage .punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--draht); flex: none; }
.lage .punkt.laeuft { background: var(--rot); }
.lage .punkt.fertig { background: var(--gruen); }
.format { margin: 2px 0 0 16px; color: var(--draht); font-size: .85rem; }
.info { color: var(--draht); font-size: .85rem; }
.back { display: inline-block; color: var(--sisal); text-decoration: none; font-size: .85rem; margin-bottom: 6px; }
.back:hover { color: var(--kreide); }
.stamp { color: var(--rot); font-size: .85rem; }   /* erscheint nur bei Verbindungsproblemen */

.werkzeug { display: flex; align-items: center; gap: 2px; padding-top: 4px; }
.werkzeug button, #auth button, #auth a { display: inline-flex; align-items: center; gap: 6px; color: var(--sisal);
  padding: 6px 8px; border-radius: 6px; font-size: .9rem; background: none; border: 0; text-decoration: none; }
.werkzeug button:hover, #auth button:hover, #auth a:hover { color: var(--kreide); background: var(--schiefer-hell); }
.werkzeug svg { width: 18px; height: 18px; }
#auth { position: absolute; right: 16px; top: 16px; display: flex; gap: 2px; align-items: center; }
#auth .info { padding: 0 6px; }
@media (max-width: 600px) { #auth { position: static; margin: 6px 0 0 -8px; flex-wrap: wrap; } }

/* Menü */
.menue { position: absolute; right: 16px; top: 58px; background: var(--schiefer-hell); border: 1px solid var(--linie);
  border-radius: 8px; padding: 6px; min-width: 15rem; z-index: 20; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.menue button, .menue a { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 5px;
  color: var(--kreide); text-decoration: none; background: none; border: 0; font-size: .95rem; }
.menue button:hover, .menue a:hover { background: var(--schiefer); }
.menue hr { border: 0; border-top: 1px solid var(--linie); margin: 6px 0; }
.menue .wer { padding: 6px 12px 8px; color: var(--draht); font-size: .85rem; }

/* ── Reiter ───────────────────────────────────────────────────────────── */
nav { display: flex; gap: 22px; border-bottom: 1px solid var(--linie); margin: 14px auto 0; max-width: calc(64rem - 32px);
  overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
@media (max-width: 64rem) { nav { margin-left: 16px; margin-right: 16px; } }
nav button { padding: 10px 0; color: var(--draht); font-weight: 500; white-space: nowrap; background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font: inherit; }
nav button:hover { color: var(--sisal); }
nav button.on { color: var(--kreide); border-bottom-color: var(--kreide); }

/* ── Überschriften, Leerstellen ───────────────────────────────────────── */
h2 { font-family: var(--zahl); font-weight: 600; font-size: 1.35rem; margin: 26px 0 6px; color: var(--kreide); letter-spacing: .01em; }
h2:first-child { margin-top: 10px; }
.empty { color: var(--sisal); padding: 30px 0; text-align: center; }

/* ── Knöpfe, Formulare ────────────────────────────────────────────────── */
button, .btn { font: inherit; font-size: .9rem; cursor: pointer; border-radius: 6px; padding: 8px 14px;
  background: transparent; color: var(--kreide); border: 1px solid var(--linie); }
button:hover { border-color: var(--sisal); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--kreide); color: var(--schiefer); border-color: var(--kreide); font-weight: 600; }
button.primary:hover { background: #fff; border-color: #fff; }
button.danger { color: #f08c8d; border-color: rgba(210,57,59,.5); }
button.danger:hover { border-color: var(--rot); }
button.small { padding: 4px 10px; font-size: .82rem; }
button.ghost { border-color: transparent; color: var(--sisal); }
button.link { border: 0; padding: 4px 0; color: var(--sisal); text-decoration: underline; text-underline-offset: 3px; font-size: .88rem; white-space: nowrap; }
button.link:hover { color: var(--kreide); }
button.link.danger { color: #f08c8d; }
input, select, textarea { font: inherit; font-size: .95rem; background: var(--schiefer-tief); color: var(--kreide);
  border: 1px solid var(--linie); border-radius: 5px; padding: 8px 10px; width: 100%; }
input:focus, select:focus { border-color: var(--sisal); outline: none; }
label { display: block; font-size: .85rem; color: var(--sisal); margin: 12px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: .95rem; color: var(--kreide); margin: 8px 0; }
label.check input { width: auto; accent-color: var(--gruen); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
body:not(.admin) .adm { display: none !important; }

dialog { background: var(--schiefer-hell); color: var(--kreide); border: 1px solid var(--linie); border-radius: 10px;
  padding: 20px 22px; width: min(30rem, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; }
dialog::backdrop { background: rgba(10, 15, 12, .7); }
dialog h3 { margin: 0 0 6px; font-family: var(--zahl); font-weight: 600; font-size: 1.5rem; }
dialog p { color: var(--sisal); font-size: .9rem; margin: 0 0 10px; }
dialog input, dialog select { background: var(--schiefer); }
.dlgbtns { display: flex; gap: 8px; margin-top: 20px; }
.dlgbtns button { flex: 1; padding: 10px; }
.warn { color: var(--sisal); font-size: .85rem; margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--sisal); }
.err { color: #f08c8d; font-size: .88rem; margin-top: 8px; min-height: 1.2em; }
#toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--kreide);
  color: var(--schiefer); padding: 10px 16px; border-radius: 6px; font-weight: 500; font-size: .95rem;
  max-width: calc(100vw - 24px); z-index: 50; display: none; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
#toast.bad { background: var(--rot); color: var(--kreide); }

/* ── Hinweis-Streifen (z. B. K.-o.-Phase einrichten) ─────────────────── */
.banner { border-left: 3px solid var(--sisal); padding: 10px 14px; margin: 14px 0; background: var(--schiefer-hell);
  border-radius: 0 6px 6px 0; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ── Jetzt: Anzeigetafel-Streifen je Scheibe ─────────────────────────── */
.tafeln { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); column-gap: 32px; }
.scheibe { display: grid; grid-template-columns: 3.2rem 1fr; padding: 16px 0 12px; border-bottom: 1px solid var(--linie); position: relative; }
.scheibe .nr { font-family: var(--zahl); font-weight: 600; font-size: 2.6rem; line-height: 1; color: var(--kreide); padding-top: 4px; }
.scheibe::before { content: ""; position: absolute; left: -16px; top: 18px; bottom: 16px; width: 3px; background: var(--rot); border-radius: 2px; }
.spieler { display: grid; grid-template-columns: 1fr auto 2.6rem; align-items: center; gap: 12px; width: 100%;
  text-align: left; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; border: 0; background: none; cursor: default; }
.admin .spieler { cursor: pointer; }
@media (hover: hover) { .admin .spieler:hover { background: var(--schiefer-hell); } }
.admin .spieler:active { background: var(--schiefer-hell); }
.spieler .name { font-family: var(--zahl); font-weight: 500; font-size: 1.55rem; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--kreide); }
.spieler .legs { font-family: var(--zahl); font-weight: 700; font-size: 2.4rem; line-height: 1; text-align: right;
  font-variant-numeric: tabular-nums; border-radius: 4px; color: var(--kreide); padding: 0 2px; }
.pips { display: flex; gap: 5px; }
.pips i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--draht); }
.pips i.voll { background: var(--kreide); border-color: var(--kreide); }
.unter { display: flex; justify-content: space-between; align-items: center; gap: 6px 14px; margin-top: 6px;
  color: var(--sisal); font-size: .88rem; flex-wrap: wrap; }
.unter .aktionen { display: flex; gap: 14px; align-items: center; }
details.mehr { position: relative; }
details.mehr summary { list-style: none; cursor: pointer; color: var(--sisal); text-decoration: underline; text-underline-offset: 3px; font-size: .88rem; }
details.mehr summary::-webkit-details-marker { display: none; }
details.mehr[open] .mehr-liste { position: absolute; right: 0; top: 1.6rem; z-index: 10; background: var(--schiefer-hell);
  border: 1px solid var(--linie); border-radius: 8px; padding: 6px; min-width: 14rem; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.mehr-liste button { display: block; width: 100%; text-align: left; border: 0; padding: 8px 10px; }
.mehr-liste button:hover { background: var(--schiefer); }

/* Neues Leg: Zahl leuchtet kurz auf – die einzige Bewegung, auch für Zuschauer */
@keyframes leg { 0% { background: var(--rot); } 100% { background: transparent; } }
.legs.neu { animation: leg 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) { .legs.neu { animation: none; text-decoration: underline; } }

.frei { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 0; border-bottom: 1px solid var(--linie); color: var(--sisal); }
.frei b { color: var(--kreide); font-weight: 500; }

/* Als Nächstes */
.naechste { list-style: none; margin: 0; padding: 0; }
.naechste li { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: 0 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--linie); }
.naechste .sp { font-family: var(--zahl); color: var(--draht); font-size: 1.05rem; }
.naechste .paar { font-family: var(--zahl); font-size: 1.3rem; font-weight: 500; }
.naechste .rechts { display: flex; gap: 12px; align-items: center; justify-content: flex-end; color: var(--sisal); font-size: .88rem; text-align: right; }
.naechste .hinweis { grid-column: 2 / 4; color: var(--draht); font-size: .85rem; }
.gegen { color: var(--draht); font-weight: 500; padding: 0 6px; }
.offen { color: var(--draht); font-style: italic; }

/* ── Tabelle ──────────────────────────────────────────────────────────── */
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 8px 32px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { color: var(--draht); font-weight: 500; font-size: .8rem; text-align: right; padding: 6px 6px; }
td { padding: 7px 6px; text-align: right; border-top: 1px solid var(--linie); font-variant-numeric: tabular-nums; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
td:first-child, th:first-child { text-align: left; width: 2em; color: var(--draht); }
td:nth-child(2) { font-family: var(--zahl); font-size: 1.2rem; font-weight: 500; }
tr.q td:first-child { color: var(--gruen-hell); }
tr.cut td { border-bottom: 2px solid var(--gruen); }       /* Linie unter dem letzten Weiter-Platz */
tr.dq td { color: var(--draht); text-decoration: line-through; }
.pts { font-family: var(--zahl); font-weight: 700; font-size: 1.2rem; }
td.x { width: 2em; text-decoration: none !important; }
/* „abwesend“ erst nach „Spieler abwesend melden“ zeigen – sonst stünde es in jeder Zeile */
.tables:not(.abwesend-modus) td.x, .tables:not(.abwesend-modus) th.x { display: none; }
button.link.leise { color: var(--draht); }
.ad { font-family: var(--text); font-size: .7rem; color: var(--draht); border: 1px solid var(--linie); border-radius: 3px;
  padding: 0 4px; margin-left: 6px; vertical-align: 2px; font-weight: 500; }
.legende { color: var(--draht); font-size: .82rem; margin-top: 10px; }
.legende i { display: inline-block; width: 18px; border-bottom: 2px solid var(--gruen); vertical-align: middle; margin-right: 6px; }

/* ── Spielplan ────────────────────────────────────────────────────────── */
.runde { margin-bottom: 8px; }
.m { display: grid; grid-template-columns: 3.2rem 1fr auto 1fr 8.5rem; gap: 10px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--linie); position: relative; }
.m .no { font-family: var(--zahl); color: var(--draht); font-size: 1.05rem; }
.m .p1, .m .p2 { font-family: var(--zahl); font-size: 1.25rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m .p2 { text-align: right; }
.m .sc { font-family: var(--zahl); font-weight: 700; font-size: 1.25rem; min-width: 3.2em; text-align: center; color: var(--kreide); font-variant-numeric: tabular-nums; }
.m .sc.vs { color: var(--draht); font-weight: 500; font-size: 1rem; }
.m .st { text-align: right; font-size: .82rem; color: var(--sisal); white-space: nowrap; }
.m.run::before { content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px; background: var(--rot); border-radius: 2px; }
.m.run .st { color: var(--kreide); }
.m.done .p1, .m.done .p2 { color: var(--sisal); }
.m.done .w { color: var(--kreide); font-weight: 600; }
.m.done .l { color: var(--draht); }
body.admin .can { cursor: pointer; }
@media (hover: hover) { body.admin .can:hover { background: var(--schiefer-hell); } }
@media (max-width: 560px) {
  .m { grid-template-columns: 2.4rem 1fr auto 1fr; }
  .m .st { grid-column: 2 / 5; text-align: left; margin-top: -4px; }
}

/* ── Turnierbaum ──────────────────────────────────────────────────────── */
.bracket { position: relative; overflow-x: auto; padding-bottom: 10px; }
.bsec { margin-bottom: 26px; }
.bcols { position: relative; display: flex; gap: 3rem; align-items: stretch; }
.bcol { display: flex; flex-direction: column; min-width: 13rem; flex: 0 0 auto; }
.bcol .rt { min-height: 1.4em; color: var(--sisal); font-size: .85rem; margin-bottom: 4px; }
.bms { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.bm { background: var(--schiefer-tief); border: 1px solid var(--linie); border-left: 3px solid var(--linie);
  border-radius: 5px; margin: 5px 0; overflow: hidden; }
.bm.run { border-left-color: var(--rot); }
.bm.done { border-left-color: var(--draht); }
.bm .r { display: flex; justify-content: space-between; padding: 4px 8px; font-family: var(--zahl); font-size: 1.1rem; }
.bm .r + .r { border-top: 1px solid var(--linie); }
.bm .r span:last-child { font-weight: 700; margin-left: 10px; font-variant-numeric: tabular-nums; }
.bm .r.w span { color: var(--kreide); font-weight: 600; }
.bm .r.l span { color: var(--draht); }
.bm .slot { color: var(--draht); font-style: italic; font-weight: 400; }
.bm .no { font-size: .72rem; color: var(--draht); padding: 3px 8px 0; font-family: var(--text); }
svg.lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
svg.lines path { fill: none; stroke: var(--draht); stroke-opacity: .55; stroke-width: 1.5; }

/* ── Statistik ────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 0 32px; align-items: start; }
.stats .sr { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--linie); font-size: .95rem; }
.stats .sr span:first-child { color: var(--sisal); }
.stats .sr span:last-child { text-align: right; font-weight: 500; }
.stats .note { color: var(--sisal); font-size: .82rem; margin-top: 8px; }

/* ── Ergebnis ─────────────────────────────────────────────────────────── */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 14px 0 24px; align-items: end; }
.podium div { border-top: 3px solid var(--linie); padding-top: 10px; }
.podium .p1 { border-top-color: var(--gruen); }
.podium .platz { font-family: var(--zahl); font-weight: 700; font-size: 3.4rem; line-height: 1; color: var(--sisal); }
.podium .p1 .platz { color: var(--kreide); font-size: 4.4rem; }
.podium .wer { font-family: var(--zahl); font-weight: 600; font-size: 1.6rem; line-height: 1.1; }
.rank { max-width: 34rem; }
.rank .e { display: grid; grid-template-columns: 5rem 1fr; padding: 8px 0; border-top: 1px solid var(--linie); }
.rank .pl { color: var(--sisal); font-family: var(--zahl); font-size: 1.15rem; }
.rank .n { font-family: var(--zahl); font-size: 1.25rem; font-weight: 500; }
@media (max-width: 520px) {
  .podium .platz { font-size: 2.6rem; } .podium .p1 .platz { font-size: 3.2rem; } .podium .wer { font-size: 1.25rem; }
}

/* ── Startseite / Verwaltung ──────────────────────────────────────────── */
a.t { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; text-decoration: none; color: inherit;
  padding: 14px 0; border-bottom: 1px solid var(--linie); position: relative; }
a.t.run::before { content: ""; position: absolute; left: -16px; top: 16px; bottom: 16px; width: 3px; background: var(--rot); border-radius: 2px; }
@media (hover: hover) { a.t:hover .n { text-decoration: underline; text-underline-offset: 4px; } }
a.t .n { font-family: var(--zahl); font-weight: 600; font-size: 1.5rem; line-height: 1.15; }
a.t .s { font-size: .9rem; color: var(--sisal); }
a.t .del { grid-row: 1 / 4; grid-column: 2; align-self: center; display: flex; gap: 14px; }
@media (max-width: 600px) { a.t { grid-template-columns: 1fr; } a.t .del { grid-row: auto; grid-column: 1; margin-top: 4px; } }
.panel { padding: 12px 0; border-top: 1px solid var(--linie); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 4px; margin: 0 6px 6px 0; font-size: .85rem;
  border: 1px solid var(--linie); color: var(--kreide); }
.plist div { display: flex; justify-content: space-between; align-items: center; padding: 4px 0;
  border-bottom: 1px solid var(--linie); font-size: .95rem; }
.results button { display: block; width: 100%; text-align: left; margin-bottom: 4px; border: 2px solid var(--linie);
  font-family: var(--zahl); font-size: 1.15rem; }
@media (hover: hover) { .results button:hover { border-color: var(--sisal); } }
.results button.sel, .results button.sel:hover { border-color: var(--gruen); background: rgba(46,155,94,.14); }
.results button.sel::after { content: "dabei"; float: right; font-family: var(--text); font-size: .78rem; color: var(--gruen-hell); padding-top: 3px; }

footer { max-width: 64rem; margin: 0 auto; padding: 0 16px 24px; color: var(--draht); font-size: .75rem; }
footer a { color: inherit; }
