:root {
  /* Volley Coach – Markenfarben (Quelle: tools/brand.py, README → Design) */
  --ink: #0E1B3D;          /* Navy: Kopfzeile, Sperrbildschirm, Nähte */
  --court: #1F4FD8;        /* Court-Blau: Aktionen, Links */
  --ball: #FFC629;         /* Ball-Gelb: Akzent, Logo */
  --on-ball: #1A1400;

  --bg: #F4F6FB;
  --card: #FFFFFF;
  --text: #0E1B3D;
  --muted: #5B6784;
  --line: #E3E8F2;
  --primary: var(--court);
  --primary-2: #4C78F0;
  --on-primary: #FFFFFF;
  --accent: var(--ball);
  --ok: #138A52;
  --warn: #C9741C;
  --bad: #D13F3F;
  --chip: #EAF0FC;
  --input: #F7F9FD;
  --bar: var(--ink);
  --shadow: 0 1px 2px rgba(14, 27, 61, .06), 0 6px 18px rgba(14, 27, 61, .07);
  --r: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1020;
    --card: #121A30;
    --text: #E9EEF9;
    --muted: #9AA7C2;
    --line: #243052;
    --primary: #7AA2FF;
    --primary-2: #9DBBFF;
    --on-primary: #0A1020;
    --chip: #1B2644;
    --input: #0E152A;
    --bar: #0B1430;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45;
  min-height: 100vh; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.splash { display: grid; place-items: center; height: 100vh; font-family: var(--font-display); font-weight: 800; color: #fff; background: var(--ink); }
h1, h2, h3, .card h2, .section-title, .stat b, .wordmark { font-family: var(--font-display); }
.ico { width: 24px; height: 24px; display: block; flex: none; }

/* App shell */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bar); color: #fff;
  padding: calc(var(--safe-top) + 10px) 12px 10px;
  display: flex; align-items: center; gap: 8px; min-height: 52px;
}
.topbar h1 { font-size: 19px; font-weight: 800; letter-spacing: -.2px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand { width: 28px; height: 28px; flex: none; margin-left: 2px; }
.topbar #backBtn:not([hidden]) + .brand { display: none; }
.topbar .icon-btn { color: #fff; }
.icon-btn { background: none; border: 0; padding: 7px; font-size: 20px; line-height: 1; cursor: pointer; border-radius: 12px; text-decoration: none; color: inherit; display: inline-grid; place-items: center; }
.icon-btn:active { background: rgba(255,255,255,.15); }
main#view { padding: 14px 14px calc(90px + var(--safe-bottom)); max-width: 760px; margin: 0 auto; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: var(--safe-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.tabbar a .ico { padding: 3px 14px; box-sizing: content-box; border-radius: 999px; transition: background .15s; }
.tabbar a.active { color: var(--primary); }
.tabbar a.active .ico { background: var(--chip); }

/* Cards & lists */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h2, .section-title { font-size: 16px; font-weight: 800; margin: 0 0 10px; letter-spacing: 0; }
.section-title { margin: 20px 4px 8px; color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: .6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li, .list > a {
  display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
.list > :last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev::after { content: "›"; color: var(--muted); font-size: 22px; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: #fff; font-weight: 700; font-size: 15px;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.stat { text-align: center; padding: 10px 4px; background: var(--chip); border-radius: 12px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }

.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--text); white-space: nowrap; }
.badge.ok { background: rgba(26,154,90,.15); color: var(--ok); }
.badge.warn { background: rgba(217,130,43,.15); color: var(--warn); }
.badge.bad { background: rgba(209,63,63,.15); color: var(--bad); }
.badge.pri { background: var(--chip); color: var(--primary); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer;
  background: var(--primary); color: var(--on-primary); text-decoration: none; min-height: 44px;
}
.btn.block { width: 100%; }
.btn.sec { background: var(--chip); color: var(--text); }
.btn.ghost { background: transparent; color: var(--primary); padding: 8px 10px; min-height: 36px; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.accent { background: var(--ball); color: var(--on-ball); }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: 14px; border-radius: 10px; }
.btn:active { transform: scale(.98); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-row .btn { flex: 1; }
.fab {
  position: fixed; right: 16px; bottom: calc(76px + var(--safe-bottom)); z-index: 9;
  width: 56px; height: 56px; border-radius: 50%; border: 0; font-size: 28px;
  background: var(--ball); color: var(--on-ball); box-shadow: 0 8px 22px rgba(14,27,61,.3); cursor: pointer; font-weight: 700;
  display: grid; place-items: center; text-decoration: none;
}

/* Forms */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=password], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--input); border-radius: 10px;
  padding: 10px 12px; font-size: 16px; min-height: 44px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-2); outline-offset: 0; border-color: transparent; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px;
  font-size: 14px; cursor: pointer; user-select: none;
}
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* Rating */
.rate-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rate-row:last-child { border-bottom: 0; }
.rate-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 8px; }
.rate { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.rate input { position: absolute; opacity: 0; pointer-events: none; }
.rate label {
  display: grid; place-items: center; min-height: 40px; border-radius: 10px; background: var(--chip);
  font-weight: 700; cursor: pointer; font-size: 15px;
}
.rate input:checked + label { background: var(--primary); color: var(--on-primary); }
.rate input:focus-visible + label { outline: 2px solid var(--accent); }
.rate .none { font-weight: 400; color: var(--muted); }

.stars { display: flex; gap: 4px; }
.stars button { background: none; border: 0; font-size: 30px; cursor: pointer; padding: 0 2px; color: var(--line); }
.stars button.on { color: var(--accent); }

/* Skill bars */
.skillbar { margin: 8px 0; }
.skillbar .lbl { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 3px; gap: 8px; }
.bar { height: 9px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--court), var(--ball)); border-radius: 99px; }
.trend-up { color: var(--ok); font-weight: 700; }
.trend-down { color: var(--bad); font-weight: 700; }

/* Segmented tabs */
.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; margin-bottom: 12px; overflow-x: auto; }
.seg a { flex: 1; text-align: center; padding: 8px 6px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.seg a.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* Blocks (training plan) */
.tblock { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--card); }
.tblock .bh { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.phase-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.timeline { border-left: 3px solid var(--line); margin-left: 6px; padding-left: 14px; }
.timeline .t-item { position: relative; padding-bottom: 14px; }
.timeline .t-item::before { content: ""; position: absolute; left: -21px; top: 5px; width: 11px; height: 11px; border-radius: 50%; background: var(--dot, var(--primary)); border: 2px solid var(--card); }
.pre { white-space: pre-wrap; }

/* Attendance */
.att { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.att:last-child { border-bottom: 0; }
.att-btn { border: 0; border-radius: 10px; padding: 8px 10px; min-width: 104px; font-weight: 600; cursor: pointer; font-size: 14px; }
.att-btn.present { background: rgba(26,154,90,.16); color: var(--ok); }
.att-btn.absent { background: rgba(209,63,63,.14); color: var(--bad); }
.att-btn.excused { background: rgba(217,130,43,.16); color: var(--warn); }

details.card > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
details[open].card > summary::after { content: "▴"; }

/* Lock screen */
.lock {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 24px);
  background: radial-gradient(120% 70% at 0% 0%, rgba(31,79,216,.85) 0%, rgba(31,79,216,0) 60%), var(--ink);
  color: #fff; text-align: center; position: relative; isolation: isolate; overflow: hidden;
}
/* Ball als dezentes Wasserzeichen unten rechts */
.lock::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 380px; height: 380px; right: -130px; bottom: -110px;
  background: url("icons/ball-line.svg") no-repeat center / contain; opacity: .06;
}
.lock .logo { width: min(92px, 11vh); height: min(92px, 11vh); margin-bottom: 10px; filter: drop-shadow(0 10px 24px rgba(0,0,0,.35)); }
.lock h1 { margin: 0 0 4px; font-size: 30px; }
.wordmark { font-weight: 800; letter-spacing: -.5px; }
.wordmark b { color: var(--ball); font-weight: 800; margin-left: .18em; }
.lock .lead { font-family: var(--font-display); font-weight: 700; font-size: 18px; opacity: 1; margin-bottom: 2px; }
.lock p { margin: 0 0 18px; opacity: .85; }
.dots { display: flex; gap: 12px; justify-content: center; margin: 10px 0 18px; min-height: 16px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.dots i.f { background: var(--ball); border-color: var(--ball); }
.pad { display: grid; grid-template-columns: repeat(3, min(76px, 10vh)); gap: min(14px, 1.8vh) 16px; justify-content: center; }
.pad button {
  height: min(76px, 10vh); border-radius: 50%; border: 0; font-size: 26px; font-weight: 500; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.14);
}
.pad button:active { background: var(--ball); color: var(--on-ball); }
.pad button.txt { font-size: 13px; background: transparent; padding: 0; }
.lock .err { color: #ffd2d2; min-height: 22px; font-weight: 600; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.onb { width: 100%; max-width: 420px; text-align: left; background: var(--card); color: var(--text); border-radius: 18px; padding: 18px; }
.onb h2 { margin-top: 0; }

/* Sheet / modal */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(5, 10, 25, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-body {
  background: var(--bg); width: 100%; max-width: 760px; max-height: 85vh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 16px 14px calc(16px + var(--safe-bottom));
}
.sheet-body h3 { margin: 0 0 10px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(88px + var(--safe-bottom)); z-index: 60;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(14,27,61,.3); border-left: 4px solid var(--ball);
  max-width: calc(100vw - 32px);
}
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .big { font-size: 40px; }

svg text { fill: var(--muted); font-size: 10px; }
.chart-wrap { width: 100%; overflow: hidden; }
.mom-q { font-weight: 700; font-size: 14px; color: var(--primary); margin: 0 0 4px; }
.mom-a { margin: 0 0 14px; white-space: pre-wrap; }
.goal-done .title { text-decoration: line-through; color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

@media (min-width: 700px) {
  .tabbar { max-width: 760px; margin: 0 auto; border-radius: 16px 16px 0 0; border: 1px solid var(--line); }
}
