/* Trainings-Vlog Damen 3. Look nach docs/ui-vorlage.png:
   hellgraues Papier, feine Rasterlinien, oranges Signal, schwarze Blockschrift, Monospace-Text. */

@font-face { font-family: "Tektur"; src: url("../fonts/tektur-latin-900-normal.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Tektur"; src: url("../fonts/tektur-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #e4e4e2;
  --cell: #f4f4f2;
  --line: #b9b9b5;
  --ink: #161616;
  --ink-soft: #55554f;
  --orange: #ff6a1a;
  --yellow: #ffd23f;
  --court: #232321;
  --court-line: #8d8d88;
  --display: "Tektur", "Arial Black", Impact, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --pad: clamp(20px, 2.8vw, 40px);
  --top-h: 79px;
  --cut: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: #9d9d98 var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--mono); font-size: 15px; line-height: 1.65;
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--ink-soft); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
main:focus { outline: none; }

.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; z-index: 50; }
.skip:focus { top: 8px; }

/* oranges Quadrat, das Markenzeichen der Vorlage */
.sq { display: inline-block; width: 11px; height: 11px; background: var(--orange); flex: none; }

/* ---------- Rahmen ---------- */
.frame { max-width: 1600px; margin: 0 auto; border-inline: 1px solid var(--line); min-height: 100vh; display: flex; flex-direction: column; }
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); flex: 1; }
.cell { border-bottom: 1px solid var(--line); padding: var(--pad); }

.top { display: grid; grid-template-columns: 240px minmax(0, 1fr) auto 84px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 20; }
.top > * { border-right: 1px solid var(--line); }
.top > .logo-btn { border-right: 0; grid-column: 4; }
.top > .admin-flag { grid-column: 3; border-right: 0; }
.brand { display: flex; flex-direction: column; justify-content: center; padding: 12px var(--pad); text-decoration: none; line-height: 1.05; }
.brand-small { font-size: 12px; letter-spacing: .04em; }
.brand-big { font-family: var(--display); font-weight: 900; font-size: 27px; text-transform: uppercase; letter-spacing: .01em; }
.top-nav { border-right: 0 !important; display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); padding: 0 var(--pad); }
.top-nav a { text-decoration: none; padding: 6px 0; border-bottom: 3px solid transparent; }
.top-nav a:hover { border-color: var(--line); }
.top-nav a.on { border-color: var(--orange); }
.admin-flag { display: flex; align-items: center; gap: 10px; padding: 0 var(--pad); font-size: 13px; }
.logo-btn { background: none; border: 0; border-left: 1px solid var(--line); padding: 10px; display: grid; place-items: center; }
.logo-btn .logo { width: 58px; height: 58px; display: block; transition: transform .15s; }
.logo-btn:hover .logo { transform: translateY(-2px); }
.is-admin .logo-btn { background: var(--orange); }

/* ---------- Trainingsliste ---------- */
.side { border-right: 1px solid var(--line); }
.side-toggle { display: none; }
.side-title { display: flex; align-items: center; gap: 10px; font: 500 13px var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: 18px var(--pad); border-bottom: 1px solid var(--line); }
.side-body { position: sticky; top: var(--top-h); max-height: calc(100vh - var(--top-h)); overflow: auto; scrollbar-width: none; }
.side-body::-webkit-scrollbar { display: none; }
.side-empty { padding: var(--pad); }
.side-form { padding: 16px var(--pad); border-bottom: 1px solid var(--line); background: var(--cell); display: grid; gap: 8px; }
.side-form label { font-size: 13px; font-weight: 700; }
.side-form-row { display: flex; gap: 8px; }
.side-form-row input { flex: 1; min-width: 0; }
.train-list a { display: grid; gap: 4px; padding: 18px var(--pad); text-decoration: none; border-bottom: 1px solid var(--line); }
.train-list a:hover { background: var(--cell); }
.train-list a.on { background: var(--ink); color: #fff; box-shadow: inset 6px 0 0 var(--orange); }
.train-date { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.1; }
.train-meta { font-size: 12.5px; color: var(--ink-soft); }
.train-list a.on .train-meta { color: #c9c9c4; }

/* ---------- Kopfzelle (Hero) ---------- */
.hero { position: relative; padding: clamp(34px, 5vw, 64px) clamp(34px, 4vw, 56px) clamp(28px, 4vw, 44px); overflow: hidden; }
.hero .sq-tl, .hero .sq-tr, .hero .sq-bl, .hero .sq-br { position: absolute; }
.sq-tl { top: 14px; left: 14px; } .sq-tr { top: 14px; right: 14px; }
.sq-bl { bottom: 14px; left: 14px; } .sq-br { bottom: 14px; right: 14px; }
.hero-title { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: clamp(3.4rem, 12.5vw, 11.5rem); line-height: .82; letter-spacing: -.005em; margin-left: -.04em; white-space: nowrap; }
.hero-training { padding-block: clamp(32px, 4.4vw, 56px) clamp(26px, 3.4vw, 40px); }
.hero-training .hero-title { font-size: clamp(2.45rem, 8.85vw, 8.1rem); }
.hero-sub { display: flex; align-items: center; gap: 14px; margin-top: clamp(16px, 2.4vw, 28px); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.hero-sub span { margin-left: 14px; }
.hero-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-top: 18px; }
.hero-text { max-width: 46ch; font-size: 16px; line-height: 1.55; }
.hero-tile { flex: none; width: clamp(88px, 10vw, 132px); aspect-ratio: 1; background: var(--ink); color: #fff; padding: clamp(12px, 1.6vw, 22px); margin-bottom: 4px; }
.hero-tile .logo { width: 100%; height: 100%; display: block; }
.hero-admin { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hero-admin label { font-size: 13px; font-weight: 700; }

/* ---------- Posts ---------- */
.post { background: var(--cell); padding-block: clamp(26px, 3vw, 40px); }
.post-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; }
.post-date { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.post-title { font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.15; margin: 14px 0 12px; max-width: 30ch; }
.post-body { max-width: 68ch; }
.post-body p + p { margin-top: .9em; }
.post-body a { overflow-wrap: anywhere; }
.post.editing { padding: 0; }
.empty { color: var(--ink-soft); }
.empty-title { font-family: var(--display); font-weight: 700; font-size: 1.8rem; color: var(--ink); margin-bottom: 8px; line-height: 1.15; }
.empty .btn { margin-top: 18px; }

/* ---------- Knöpfe und Formulare ---------- */
.btn {
  display: inline-block; border: 0; background: var(--orange); color: var(--ink); text-decoration: none;
  font: 500 13px var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: 13px 22px; min-height: 44px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.btn:hover { background: #ff8440; }
.btn:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-small { padding: 10px 14px; min-height: 40px; }
.btn-ghost { background: var(--ink); color: #fff; }
.btn-ghost:hover { background: #3a3a37; }
.btn-ghost:focus-visible { box-shadow: inset 0 0 0 3px var(--orange); }
.btn-danger { background: var(--ink); color: #fff; }
.btn-danger:hover { background: #3a3a37; }
.btn-danger:focus-visible { box-shadow: inset 0 0 0 3px var(--orange); }

.icon { display: inline-grid; }
.icon svg, .ctl svg, .side-toggle svg { width: 20px; height: 20px; display: block; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; background: var(--paper); border: 1px solid var(--line); }
.icon-btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.tools { display: inline-flex; gap: 6px; }

.form { display: grid; gap: 8px; background: var(--cell); }
.form-title { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.2; margin-bottom: 6px; }
.form label { font-size: 13px; font-weight: 700; margin-top: 8px; }
input[type="text"], input[type="password"], input[type="date"], textarea, select {
  width: 100%; background: #fff; border: 1px solid var(--ink); border-radius: 0; padding: 10px 12px; font-size: 16px; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.5; display: block; }
textarea.code { font-size: 13px; white-space: pre; overflow: auto; }
input[type="date"] { width: auto; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.label-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 8px 16px; }
.file { font-size: 13px; max-width: 100%; }
.errors { border: 2px solid var(--ink); background: #fff; padding: 12px 14px; margin-top: 8px; }
.errors:empty { display: none; }
.errors-lead { font-weight: 700; margin-bottom: 6px; }
.errors li { padding-left: 20px; position: relative; overflow-wrap: anywhere; }
.errors li::before { content: ""; position: absolute; left: 0; top: .55em; width: 9px; height: 9px; background: var(--orange); }
.errors li + li { margin-top: 4px; }

.dlg { border: 1px solid var(--ink); padding: 0; background: var(--cell); color: var(--ink); width: min(420px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(22, 22, 22, .62); }
.dlg .form { padding: 26px; }
.dlg-logo { width: 76px; height: 76px; background: var(--ink); color: #fff; padding: 9px; margin-bottom: 8px; }
.dlg-logo .logo { width: 100%; height: 100%; display: block; }
.login-error { color: var(--ink); font-weight: 700; min-height: 1.6em; margin-top: 6px; }
.login-error:not(:empty) { border-left: 6px solid var(--orange); padding-left: 10px; }
.confirm-text { font-size: 16px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 12px 18px; max-width: min(560px, calc(100vw - 32px)); z-index: 60; transition: opacity .2s, transform .2s; border-left: 8px solid var(--orange); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--orange); color: var(--ink); border-left-color: var(--ink); font-weight: 500; }

/* ---------- Übung ---------- */
.ex { padding: 0; background: var(--cell); }
.ex-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 30px var(--pad) 26px; border-bottom: 1px solid var(--line); }
.ex-num { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; grid-column: 1; }
.ex-title { font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.12; grid-column: 1; }
.ex-meta { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 13.5px; color: var(--ink-soft); margin-top: 10px; }
.ex-meta:empty { display: none; }
.ex-head .tools { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
.tag { background: var(--ink); color: #fff; padding: 2px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

.drill { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); grid-template-areas: "anim steps" "anim focus"; grid-template-rows: auto 1fr; }
.drill-anim { grid-area: anim; }
.drill-steps { grid-area: steps; }
.drill-focus { grid-area: focus; }
/* Die Animation bleibt stehen, während die Schritte mit der Seite scrollen. Keine eigene Scrollbar. */
.drill-anim { position: sticky; top: var(--top-h); align-self: start; }
.drill-col { min-width: 0; }
.drill-steps, .drill-focus { border-left: 1px solid var(--line); }
.drill-focus { border-top: 1px solid var(--line); }
.col-title { font: 500 13px var(--mono); text-transform: uppercase; letter-spacing: .1em; padding: 26px 28px 16px; }
.col-title::before { content: ""; display: inline-block; width: 11px; height: 11px; background: var(--orange); margin-right: 10px; }

.stage { background: var(--ink); }
.stage svg { display: block; width: 100%; height: auto; max-height: max(240px, calc(100vh - var(--top-h) - 280px)); }
.variants { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.variant { flex: 1 1 auto; background: none; border: 0; border-right: 1px solid var(--line); padding: 14px 20px; font-size: 13px; min-height: 44px; text-align: left; }
.variant:hover { background: var(--paper); }
.variant.on { background: var(--ink); color: #fff; }
.caption { display: grid; grid-template-columns: 34px minmax(0, 1fr); background: var(--ink); color: #fff; padding: 14px 22px 18px; min-height: 5.6em; font-size: 15px; line-height: 1.5; border-top: 1px solid #3a3a37; }
.caption-num { color: var(--orange); font-size: 13px; padding-top: 2px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ctl { width: 54px; height: 54px; display: grid; place-items: center; background: none; border: 0; border-right: 1px solid var(--line); }
.ctl:hover { background: var(--paper); }
.ctl-play { background: var(--orange); width: 72px; }
.ctl-play:hover { background: #ff8440; }
.ctl:focus-visible { outline-offset: -3px; outline-color: var(--ink); }
.counter { padding: 0 20px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; margin-right: auto; }
.speed { display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 13px; border-left: 1px solid var(--line); height: 54px; }
.speed select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 16px 22px 20px; font-size: 12.5px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1.5px solid var(--ink); }
.dot-team1 { background: #fff; } .dot-team2 { background: var(--orange); }
.dot-wait { background: var(--ink-soft); border-style: dashed; border-color: var(--ink-soft); background: transparent; } .dot-ball { background: var(--yellow); }

/* Feld */
.c-court { fill: var(--court); stroke: var(--court-line); stroke-width: 1.5; }
.c-line3 { stroke: var(--court-line); stroke-dasharray: 4 4; }
.c-net { stroke: #f4f4f2; stroke-width: 3; }
.c-label { fill: #c4c4bf; font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.c-label-zone { fill: #ffa46f; text-transform: none; letter-spacing: 0; }
.c-hatch { stroke: var(--orange); stroke-width: 3; opacity: .5; }
.c-basket { fill: none; stroke: var(--yellow); stroke-width: 2; }
.c-basket-ball { fill: var(--yellow); }
.c-box { fill: #3d3d3a; stroke: var(--court-line); }
.c-spot { fill: none; stroke: var(--court-line); stroke-dasharray: 3 3; }
.c-spot-label { fill: #f4f4f2; font: 700 14px var(--mono); }
.actor text { font: 700 13px var(--mono); fill: var(--ink); }
.actor-team1 circle { fill: #f4f4f2; }
.actor-team2 circle { fill: var(--orange); }
.actor-wait circle { fill: var(--ink); stroke: var(--court-line); stroke-width: 1.5; stroke-dasharray: 3 2.5; }
.actor-wait text { fill: #c4c4bf; }
.c-shadow { fill: #000; opacity: .55; }
.c-ball { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.2; }
.trail-ball { stroke: var(--yellow); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .95; }
.trail-ball.past { opacity: .4; }
.trail-run { fill: none; stroke: #f4f4f2; stroke-width: 1.3; stroke-dasharray: 2 4; opacity: .85; }
.trail-run.past { opacity: .35; }

/* Schritte */
.steps { counter-reset: step; border-top: 1px solid var(--line); }
.steps li { counter-increment: step; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 6px; width: 100%; text-align: left; background: none; border: 0; padding: 16px 28px 16px 22px; font-size: 15px; line-height: 1.55; border-left: 6px solid transparent; }
.step::before { content: counter(step, decimal-leading-zero); font-size: 12.5px; color: var(--ink-soft); padding-top: 3px; }
.step:hover { background: var(--paper); }
.steps li.done .step { color: var(--ink-soft); }
.steps li.cur .step { background: var(--ink); color: #fff; border-left-color: var(--orange); }
.steps li.cur .step::before { color: #c9c9c4; }
.step:focus-visible { outline-offset: -3px; }

/* Fokus */
.focus { padding: 4px 28px 32px; display: grid; gap: 16px; max-width: 62ch; }
.focus li { position: relative; padding-left: 24px; font-size: 15px; line-height: 1.55; }
.focus li::before { content: ""; position: absolute; left: 0; top: .5em; width: 9px; height: 9px; background: var(--orange); }
.drill-focus > .muted { padding: 0 28px 28px; }

/* Admin: Übung hinzufügen */
.add-slot { border-bottom: 1px solid var(--line); }
.add-btn { display: grid; place-items: center; width: 100%; height: 76px; background: none; border: 0; }
.add-btn .icon { width: 48px; height: 48px; place-items: center; background: var(--orange); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
.add-btn:hover { background: var(--cell); }
.ex-form { border-bottom: 0; }
.ex.editing .ex-form { border-bottom: 0; }
.preview { margin-top: 16px; border: 1px solid var(--line); background: var(--cell); }
.preview > .muted { padding: 16px; }
.preview-label { background: var(--ink); color: #fff; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; padding: 6px 16px; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding: 18px var(--pad); font-size: 12.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.noscript { padding: 24px; }

/* ---------- Sehr breit: drei Spalten nebeneinander (Animation, Schritte, Fokus) ---------- */
@media (min-width: 1560px) {
  .drill { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) minmax(0, .8fr); grid-template-areas: "anim steps focus"; grid-template-rows: auto; }
  .drill-focus { border-top: 0; }
}

/* ---------- Handy: Trainingsliste als Menü oben, alles untereinander, Animation zuerst ---------- */
@media (max-width: 820px) {
  body { font-size: 15px; }
  .layout { display: block; }
  .top { grid-template-columns: minmax(0, 1fr) 0 auto 68px; position: static; }
  .top-nav { display: none; }
  .brand { border-right: 0; }
  .admin-flag { font-size: 0; gap: 0; padding: 0 14px; }
  .brand-big { font-size: 24px; }
  .logo-btn .logo { width: 46px; height: 46px; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; background: var(--paper); }
  .side-title { display: none; }
  .side-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; background: var(--ink); color: #fff; border: 0; padding: 13px var(--pad); min-height: 48px; font: 500 13px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
  .side-toggle svg { transition: transform .15s; }
  .side.open .side-toggle svg { transform: rotate(180deg); }
  .side-body { display: none; position: static; max-height: 60vh; }
  .side.open .side-body { display: block; }
  .drill { display: block; }
  .drill-anim { position: static; }
  .stage svg { max-height: none; }
  .drill-steps, .drill-focus { border-left: 0; border-top: 1px solid var(--line); }
  .col-title { padding: 22px var(--pad) 14px; }
  .step { padding: 14px var(--pad) 14px calc(var(--pad) - 6px); }
  .focus { padding: 4px var(--pad) 28px; }
  .caption { padding: 12px var(--pad) 16px; }
  .hero-sub span { margin-left: 4px; }
  .counter { padding: 0 10px; font-size: 12px; }
  .speed-label, .counter-word { display: none; }
  .ctl { width: 48px; height: 50px; }
  .ctl-play { width: 60px; }
  .speed { height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
