:root {
  --bg: #0a0e1a; --card: #0f1a33; --card2: #142447; --line: #1e3c64;
  --text: #dae1f2; --dim: #7890b4; --green: #00d4aa; --red: #e94560;
  --gold: #ffd700; --silver: #d2d2d2; --bronze: #cd7f32; --amber: #f39c12;
  font-size: clamp(14px, 0.3vw + 11px, 17px);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font-family: "Segoe UI", system-ui, -apple-system, sans-serif; }
header { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); position: relative; }
h1 { margin: 0; font-size: 1.5rem; }
.info { color: var(--dim); font-size: .85rem; margin-top: 2px; }
.back { display: inline-block; color: var(--dim); text-decoration: none; font-size: .8rem; margin-bottom: 6px; }
.back:hover { color: var(--green); }
#auth { position: absolute; right: 16px; top: 12px; }
.status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: .8rem; }
.badge { padding: 3px 10px; border-radius: 5px; font-weight: 700; color: #0f1928; }
.badge.run { background: var(--green); } .badge.fin { background: #64788c; }
.stamp { color: var(--dim); }
main { padding: 14px 16px 60px; }
.empty { color: var(--dim); padding: 30px 0; text-align: center; }
h2 { font-size: .8rem; letter-spacing: .05em; color: var(--green); margin: 18px 0 8px; }
h2:first-child { margin-top: 0; }

/* Knöpfe + Formulare */
button, .btn { font: inherit; font-size: .85rem; cursor: pointer; border-radius: 6px; padding: 7px 12px;
               background: var(--card2); color: var(--text); border: 1px solid var(--line); }
button:hover { border-color: var(--green); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--green); color: #0f1928; border-color: var(--green); font-weight: 700; }
button.danger { color: var(--red); border-color: #6b2333; background: transparent; }
button.small { padding: 3px 8px; font-size: .75rem; }
button.ghost { background: transparent; color: var(--dim); }
input, select, textarea { font: inherit; font-size: .9rem; background: #0c1832; color: #fff;
       border: 1px solid #0064c8; border-radius: 5px; padding: 7px 8px; width: 100%; }
label { display: block; font-size: .75rem; color: var(--dim); margin: 10px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--text); margin: 8px 0; }
label.check input { width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
body:not(.admin) .adm { display: none !important; }

dialog { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
         padding: 20px 22px; width: min(30rem, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin: 0 0 4px; color: var(--green); font-size: 1rem; }
dialog p { color: var(--dim); font-size: .8rem; margin: 0 0 10px; }
.dlgbtns { display: flex; gap: 8px; margin-top: 18px; }
.dlgbtns button { flex: 1; padding: 10px; }
.warn { color: var(--amber); font-size: .8rem; margin-top: 8px; }
.err { color: var(--red); font-size: .85rem; margin-top: 8px; min-height: 1.2em; }
#toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #14284f;
         border: 1px solid var(--green); color: var(--text); padding: 10px 16px; border-radius: 8px;
         font-size: .9rem; max-width: calc(100vw - 24px); z-index: 50; display: none; }
#toast.bad { border-color: var(--red); }

/* Turnierliste */
a.t { display: block; text-decoration: none; color: inherit; background: var(--card);
      border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; position: relative; }
a.t:hover { border-color: var(--green); }
a.t.run { border-left: 4px solid var(--green); }
a.t .n { font-size: 1.15rem; font-weight: 700; padding-right: 5rem; }
a.t .s { font-size: .8rem; margin-top: 6px; color: var(--green); } a.t .s.fin { color: var(--dim); }
a.t .del { position: absolute; right: 10px; top: 10px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 4px; margin: 0 6px 6px 0; font-size: .8rem;
        background: rgba(0,212,170,.12); border: 1px solid rgba(0,212,170,.3); }
.plist div { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px;
             background: #0c1832; border-radius: 4px; margin-bottom: 3px; font-size: .9rem; }
.results button { display: block; width: 100%; text-align: left; margin-bottom: 3px; }

/* Reiter */
nav { display: flex; gap: 6px; padding: 10px 16px 0; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav button { background: transparent; color: var(--dim); border: 0; border-radius: 6px 6px 0 0;
             padding: 8px 14px; font-size: .9rem; white-space: nowrap; }
nav button.on { background: #1a4a8a; color: #fff; font-weight: 700; }
.banner { background: rgba(243,156,18,.1); border: 1px solid rgba(243,156,18,.4); border-radius: 8px;
          padding: 10px 14px; margin: 0 0 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Scheiben */
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 10px; }
.board { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.board.busy { background: #071e12; border-color: #00825a; }
.board .bt { font-size: .75rem; font-weight: 700; color: var(--dim); }
.board.busy .bt { color: var(--green); }
.board .free { color: #3d5a8a; font-weight: 700; font-size: 1.1rem; padding: 8px 0 4px; text-align: center; }
.board .row { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; padding: 4px 0; }
.board .row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .row b { color: var(--green); min-width: 1.5em; text-align: right; font-size: 1.3rem; }
.board .row button { font-weight: 700; padding: 6px 12px; }
.board .sub { color: var(--dim); font-size: .75rem; margin-top: 4px; }
.board .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* Tabellen */
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 14px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { color: var(--dim); font-weight: 600; font-size: .75rem; text-align: right; padding: 4px 6px; }
td { padding: 5px 6px; text-align: right; border-top: 1px solid #142747; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
td:first-child, th:first-child { text-align: left; width: 2em; color: var(--dim); }
tr.q td:nth-child(2) { color: var(--green); font-weight: 600; }
tr.dq td { color: #6e5a5a; text-decoration: line-through; }
.pts { font-weight: 700; }
td.x { width: 2em; text-decoration: none !important; }

/* Spielplan */
.rounds { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 6px; }
.round { min-width: 17rem; flex: 0 0 auto; }
.rt { font-size: .75rem; font-weight: 700; color: var(--dim); margin: 0 0 6px 2px; }
.m { display: grid; grid-template-columns: 2.6em 1fr auto 1fr auto; gap: 6px; align-items: center;
     background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
     margin-bottom: 5px; font-size: .9rem; }
.m .no { color: var(--dim); font-size: .75rem; }
.m .p2 { text-align: right; }
.m .sc { color: var(--dim); font-weight: 700; min-width: 3em; text-align: center; }
.m.run { border-color: #00825a; background: #0a2a1c; }
.m.run .sc { color: var(--green); }
.m.done .sc { color: var(--text); }
.w { font-weight: 700; color: #fff; } .l { color: #5a6a8a; }
body.admin .can { cursor: pointer; }
body.admin .can:hover { border-color: var(--green); }
@media (max-width: 700px) {
  .rounds { flex-direction: column; }
  .round { min-width: 0; width: 100%; }
}

/* 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.3em; }
.bms { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.bm { background: #242832; border: 1px solid #343c4e; border-radius: 5px; margin: 5px 0;
      overflow: hidden; font-size: .85rem; }
.bm.run { border-color: #00825a; }
.bm .r { display: flex; justify-content: space-between; padding: 4px 8px; }
.bm .r + .r { border-top: 1px solid #343c4e; }
.bm .r span:last-child { color: var(--dim); font-weight: 700; margin-left: 10px; }
.bm .r.w span { color: #fff; font-weight: 700; } .bm .r.w span:last-child { color: var(--green); }
.bm .r.l span:first-child { color: #586480; text-decoration: line-through; }
.bm .slot { color: #6a7aa0; font-style: italic; }
.bm .no { font-size: .65rem; color: var(--dim); padding: 2px 8px 0; }
svg.lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
svg.lines path { fill: none; stroke: #485876; stroke-width: 1.5; }

/* Platzierung */
.rank { max-width: 34rem; }
.rank .e { display: flex; gap: 14px; padding: 8px 12px; border-radius: 7px; margin-bottom: 6px;
           background: var(--card); align-items: center; }
.rank .pl { min-width: 5em; color: var(--dim); font-weight: 700; }
.rank .p1 { background: rgba(255,215,0,.12); } .rank .p1 .pl { color: var(--gold); }
.rank .p2 { background: rgba(210,210,210,.10); } .rank .p2 .pl { color: var(--silver); }
.rank .p3 { background: rgba(205,127,50,.12); } .rank .p3 .pl { color: var(--bronze); }
.rank .p1, .rank .p2, .rank .p3 { font-size: 1.15rem; font-weight: 700; }
