:root {
  --bg: #0b1120; --s1: #131c2e; --s2: #1a2540; --line: #24314d;
  --txt: #e8ecf4; --mut: #8a96ad; --acc: #22c55e; --acc-ink: #04220f; --red: #ef4444;
  --r: 16px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--txt); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { padding: 4px 16px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
h1 { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 13px; font-weight: 650; color: var(--mut); text-transform: uppercase; letter-spacing: .08em; margin: 26px 0 10px; }
b { font-weight: 650; }

/* Kopfzeile */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px; max-width: 640px; margin: 0 auto;
  background: linear-gradient(var(--bg) 75%, transparent); }
.bar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { background: var(--s1); color: var(--txt); width: 38px; height: 38px; border-radius: 12px; padding: 0; font-size: 22px; line-height: 1; }

/* Formularelemente */
input, select, button { font: inherit; color: var(--txt); }
input, select { background: var(--s2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
input[type=number] { width: 84px; text-align: center; }
button { border: 0; border-radius: 12px; padding: 12px 18px; background: var(--acc); color: var(--acc-ink); font-weight: 650; cursor: pointer; }
button:active { transform: scale(.97); }
button:disabled { opacity: .4; }
button.ghost { background: var(--s2); color: var(--txt); }
button.danger { background: transparent; color: var(--red); border: 1px solid #4a1d24; }
button.sm { padding: 8px 12px; font-size: 14px; }
.full { width: 100%; margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mut { color: var(--mut); font-size: 14px; }
.empty { color: var(--mut); text-align: center; padding: 28px 12px; border: 1px dashed var(--line); border-radius: var(--r); }

/* Karten */
.card { background: var(--s1); border-radius: var(--r); padding: 14px; margin-bottom: 10px; }
.tap { cursor: pointer; transition: background .15s; }
.tap:active { background: var(--s2); }
.chev { color: var(--mut); font-size: 22px; }
.title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico { flex: none; display: grid; place-items: center; border-radius: 14px; overflow: hidden;
  color: var(--m); background: color-mix(in srgb, var(--m) 16%, var(--s2)); }
.ico img { width: 100%; height: 100%; object-fit: cover; }
.pill { font-size: 13px; font-weight: 650; color: var(--acc); }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 10px -16px; padding: 0 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--s2); color: var(--txt); font-size: 14px; font-weight: 550; border: 1px solid transparent; }
.chip[style*="--m"] { color: var(--m); background: color-mix(in srgb, var(--m) 14%, transparent); }
.chip.f { cursor: pointer; }
.chip.f.on { background: var(--m); color: #0b1120; }
.chip.sm { padding: 3px 10px; font-size: 12px; color: var(--mut); }

/* Übungsdetail */
.hero { height: 190px; border-radius: 20px; display: grid; place-items: center; overflow: hidden; color: var(--m);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--m) 30%, var(--s1)), var(--s1) 70%); }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.tip { background: var(--s1); border-left: 3px solid var(--acc); border-radius: 4px 12px 12px 4px; padding: 10px 14px; margin: 12px 0; color: #cdd5e3; font-size: 15px; }
.photo-row { display: flex; gap: 8px; }
.photo-row label { display: inline-flex; align-items: center; gap: 6px; background: var(--s2); border-radius: 12px; padding: 8px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.stepper .lbl { flex: 1; color: var(--mut); font-size: 14px; }
.stepper input { width: 92px; font-size: 20px; font-weight: 700; padding: 10px; }
.stepper button { width: 46px; height: 46px; padding: 0; font-size: 22px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.stats div { background: var(--s1); border-radius: var(--r); padding: 12px; text-align: center; }
.stats b { display: block; font-size: 22px; }
.stats span { color: var(--mut); font-size: 12px; }
.hist-day { display: flex; justify-content: space-between; color: var(--mut); font-size: 13px; margin-bottom: 6px; }
.set { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); }
.set button { background: none; color: var(--mut); padding: 4px 8px; }
.chart svg { display: block; }
.chart text { fill: var(--mut); font-size: 11px; }

/* Kalender */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head button { width: 38px; height: 38px; padding: 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal .wd { color: var(--mut); font-size: 11px; font-weight: 600; padding-bottom: 2px; }
.cal .d { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; font-size: 14px; color: var(--mut); }
.cal .d.on { background: var(--acc); color: var(--acc-ink); font-weight: 700; }
.cal .d.today { outline: 2px solid var(--acc); outline-offset: -2px; color: var(--txt); }
.cal .d.on.today { outline-color: #bbf7d0; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.kpis div { background: var(--s2); border-radius: 12px; padding: 10px 12px; }
.kpis b { display: block; font-size: 20px; }
.kpis span { color: var(--mut); font-size: 12px; }
.streak { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-weight: 650;
  background: linear-gradient(90deg, #7c2d12, #9a3412); color: #ffedd5; }

/* Rangliste */
.rank { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.rank + .rank { border-top: 1px solid var(--line); }
.card .chips.scroll { margin: 8px -14px 10px; padding: 0 14px; }
.rank .pos { width: 28px; text-align: center; font-weight: 700; color: var(--mut); }
.rank .val { font-weight: 700; white-space: nowrap; }
.rank.me .who { color: var(--acc); font-weight: 700; }
.board-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 4px; }
.board-title span { font-size: 20px; }
.board-sub { color: var(--mut); font-size: 13px; margin-bottom: 6px; }

/* Anmeldung */
.auth { max-width: 420px; margin: 0 auto; padding: calc(48px + env(safe-area-inset-top, 0px)) 20px 40px; text-align: center; }
.auth .logo { width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 24px; display: grid; place-items: center;
  background: radial-gradient(circle, #14532d, var(--s1)); color: var(--acc); }
.auth h1 { font-size: 30px; }
.auth .card { text-align: left; margin-top: 24px; }
.links { display: flex; justify-content: space-between; margin-top: 8px; }
.link { background: none; color: var(--acc); padding: 8px 0; font-weight: 600; }

/* Tab-Leiste */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b)); }
.tabs button { flex: 1; max-width: 140px; background: none; color: var(--mut); display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; }
.tabs button.on { color: var(--acc); }
.tabs button { position: relative; }
.tabs .dot { position: absolute; top: 5px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%;
  background: var(--acc); box-shadow: 0 0 0 2px var(--bg); }
#update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + var(--safe-b)); z-index: 25;
  width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; font-weight: 700;
  background: var(--acc); color: #0b1120; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); }
.chip.sm.new { color: #0b1120; background: var(--acc); font-weight: 700; }
.release ul { margin: 10px 0 2px; padding-left: 20px; line-height: 1.5; }
.release li + li { margin-top: 4px; }

#toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); z-index: 20;
  background: #e8ecf4; color: #0b1120; font-weight: 600; padding: 10px 18px; border-radius: 999px; display: none;
  box-shadow: 0 8px 30px #0008; white-space: nowrap; }

/* Level & Abzeichen */
.lvl { background: linear-gradient(135deg, #14532d 0%, var(--s1) 70%); }
.lvl-badge { flex: none; width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; align-content: center;
  background: linear-gradient(160deg, #4ade80, #16a34a); color: var(--acc-ink); font-size: 24px; font-weight: 800; line-height: 1;
  box-shadow: 0 6px 20px #16a34a55; }
.lvl-badge small { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .75; margin-bottom: 2px; }
.bar { height: 8px; border-radius: 99px; background: #0b1120aa; margin-top: 12px; overflow: hidden; }
.bar div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #22c55e, #a3e635); }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge { background: var(--s1); border-radius: 14px; padding: 12px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.badge .i { font-size: 28px; line-height: 1.2; }
.badge b { font-size: 12px; }
.badge span { font-size: 11px; color: var(--mut); line-height: 1.25; }
.badge.off { opacity: .35; filter: grayscale(1); }
.xp-info { margin: 10px 0 0; color: var(--mut); font-size: 13px; }
.xp-info summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
#toast.big { background: linear-gradient(135deg, #4ade80, #16a34a); color: var(--acc-ink); font-size: 17px; padding: 14px 22px; }

/* Videos */
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; margin: 12px 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vlink { display: inline-flex; align-items: center; gap: 6px; background: #3f1d1d; color: #fecaca; border-radius: 12px; padding: 8px 12px;
  font-size: 14px; font-weight: 600; text-decoration: none; }
.photo-row { flex-wrap: wrap; margin-bottom: 4px; }
