:root {
  --bg: #f1f4f9;
  --surface: #ffffff;
  --surface-2: #eaeef5;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #3b82f6;
  --navy: #0f172a;
  --primary-dark: #1d4ed8;
  --primary-ink: #ffffff;
  --primary-soft: #e0ecff;
  --accent: #3b82f6;
  --accent-soft: #e0ecff;
  --good: #15803d;
  --good-soft: #dcfce7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --gold: #ca8a04;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .06);
  --nav-h: 64px;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.4; overflow-x: clip; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; margin: 22px 0 10px; }
h3 { font-size: 1rem; }
a { color: var(--primary); }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.pad { padding: 24px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }

/* Layout */
#app { min-height: 100vh; }
.main-col { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 1.2rem; }
.view { padding: 4px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600;
}
.nav a .ico { font-size: 1.35rem; line-height: 1; }
.nav a.active { color: var(--primary); }
.nav .brand { display: none; }

@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: 220px 1fr; }
  .nav {
    position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--line); padding: 18px 10px; gap: 4px;
  }
  .nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; padding: 6px 10px 18px; color: var(--text); }
  .nav .brand img { width: 32px; height: 32px; }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: .95rem; }
  .nav a.active { background: var(--primary-soft); }
  .view { padding: 8px 28px 40px; }
  .topbar { padding: 16px 28px 12px; }
}

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 12px; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.99); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title h3 { font-size: .95rem; }
.grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
.grid > .card + .card { margin-top: 0; }
@media (min-width: 700px) { .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 1.1rem; border-radius: 14px; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: .85rem; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; font-size: 1.3rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); }
.icon-btn:active { background: var(--surface-2); }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Forms */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
textarea.input { min-height: 70px; resize: vertical; }
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.search { margin-bottom: 10px; }

/* Studio list */
.gym-row { display: flex; align-items: center; gap: 14px; }
.gym-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex: 0 0 auto; overflow: hidden; }
.gym-ico img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.gym-banner { height: 120px; border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; background: #fff; box-shadow: var(--shadow); }
.gym-banner img { width: 100%; height: 100%; object-fit: contain; }

/* Exercise tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.tile:active { transform: scale(.98); }
.tile .ph { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 2.2rem; overflow: hidden; position: relative; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; }
.tile .ph .order { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: .75rem; font-weight: 700; border-radius: 8px; padding: 1px 7px; }
.tile .body { padding: 9px 11px 11px; }
.tile .name { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .last { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* Exercise screen */
.hero { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.hero .ph { width: 96px; height: 96px; border-radius: 14px; background: var(--surface-2); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; }
.hero .ph img { width: 100%; height: 100%; object-fit: cover; }
.settings-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { background: var(--primary-soft); color: var(--primary); border-radius: 10px; padding: 4px 10px; font-weight: 700; font-size: .95rem; }
.pill.neutral { background: var(--surface-2); color: var(--text); font-weight: 600; }

.entry { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stepper label { display: block; text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.stepper .ctl { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; background: var(--surface-2); border-radius: 10px; overflow: hidden; }
.stepper button { height: 58px; border: 0; background: transparent; font-size: 1.6rem; font-weight: 700; cursor: pointer; color: var(--primary); }
.stepper button:active { background: var(--line); }
.stepper input { width: 100%; min-width: 0; padding: 0; height: 58px; border: 0; background: transparent; text-align: center; font-size: clamp(1.25rem, 5.6vw, 1.6rem); font-weight: 800; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; font-size: .9rem; }
.seg button.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 600; }
.toggle input { width: 22px; height: 22px; accent-color: var(--primary); }

.notice { border-radius: 12px; padding: 10px 12px; font-size: .9rem; margin-bottom: 12px; }
.notice.info { background: var(--primary-soft); color: var(--primary-dark); }
.notice.warn { background: #fff4e5; color: #8a4b08; }

.sets { list-style: none; margin: 0; padding: 0; }
.sets li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sets li:last-child { border-bottom: 0; }
.sets .n { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; }
.sets .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.sets .warm { opacity: .5; }
.sets .ghost { font-size: .8rem; }
.feel { font-size: .8rem; color: var(--muted); }
.rec-badge { display: inline-block; background: #fef3c7; color: #92400e; font-size: .72rem; font-weight: 800; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }

.history-day { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-day:last-child { border-bottom: 0; }
.history-day .d { font-weight: 700; font-size: .9rem; }
.history-day .s { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

.next-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--primary); color: #fff; text-decoration: none; font-weight: 700; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.kpi .l { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .d { font-size: .8rem; font-weight: 700; }

.body-hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.body-hero .muted { color: rgba(255,255,255,.75); }
.body-hero .big { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.body-hero .trend { font-weight: 700; font-size: .9rem; }
.body-hero .trend.good { color: #bbf7d0; }
.body-hero .trend.bad { color: #fecaca; }

.level { display: flex; align-items: center; gap: 14px; }
.level .badge-lvl { width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; flex: 0 0 auto; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.teal > i { background: var(--primary); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .emoji { font-size: 1.3rem; width: 30px; text-align: center; flex: 0 0 auto; }

.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .badges { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.badge { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 8px; text-align: center; }
.badge .e { font-size: 2rem; }
.badge .t { font-weight: 700; font-size: .8rem; margin-top: 4px; }
.badge .s { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.badge.locked { opacity: .38; filter: grayscale(1); }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: 380px; margin: 0 auto; }
.cal .h { font-size: .7rem; color: var(--muted); text-align: center; font-weight: 700; }
.cal .c { aspect-ratio: 1; min-width: 0; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: .78rem; font-variant-numeric: tabular-nums; }
.cal .c.on { background: var(--primary); color: #fff; font-weight: 700; }
.cal .c.empty { background: transparent; padding: 0; }
.cal .c.today { outline: 2px solid var(--accent); }

.chart-box { position: relative; height: 220px; }
.chart-box.tall { height: 260px; }

.hbar { display: grid; grid-template-columns: 110px 1fr 54px; gap: 8px; align-items: center; font-size: .88rem; margin: 6px 0; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Status / Sync */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); }

/* Toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { background: #16202a; color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-weight: 600; animation: pop .25s ease-out; }
.toast.record { background: var(--primary-dark); font-size: 1.05rem; }
.toast.level { background: var(--primary); font-size: 1.05rem; }
.toast.badge-t { background: var(--primary); }
@keyframes pop { from { transform: translateY(12px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@media (min-width: 700px) { .modal-back { align-items: center; } }
.modal { background: var(--surface); width: min(100%, 520px); max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@media (min-width: 700px) { .modal { border-radius: 20px; } }
.modal h2 { margin: 0 0 14px; }
.modal .actions { display: flex; gap: 10px; margin-top: 16px; }
.modal .actions .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }

.energy { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.energy button { aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 1.8rem; cursor: pointer; }
.energy button span { display: block; font-size: .7rem; font-weight: 700; color: var(--muted); }

.kv-row { display: grid; grid-template-columns: 1fr 90px 40px; gap: 8px; margin-bottom: 8px; }

/* Welcome */
.welcome { max-width: 460px; margin: 6vh auto 0; text-align: center; }
.welcome img { width: 88px; height: 88px; margin: 0 auto 16px; border-radius: 22px; }
.welcome h1 { font-size: 1.7rem; margin-bottom: 8px; }
.welcome .stack { margin-top: 26px; text-align: left; }

/* Story (year review) */
.story { position: fixed; inset: 0; z-index: 80; color: #fff; display: flex; flex-direction: column; user-select: none; }
.story .progress { display: flex; gap: 4px; padding: calc(12px + env(safe-area-inset-top)) 12px 0; }
.story .progress i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
.story .progress i.done { background: #fff; }
.story .close { position: absolute; top: calc(22px + env(safe-area-inset-top)); right: 10px; color: #fff; font-size: 1.6rem; }
.story .slide { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 30px 28px; animation: pop .35s ease-out; }
.story .slide .k { font-size: 1rem; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .08em; }
.story .slide .big { font-size: clamp(3rem, 16vw, 6rem); font-weight: 900; line-height: 1; margin: 14px 0; font-variant-numeric: tabular-nums; }
.story .slide .mid { font-size: clamp(1.6rem, 7vw, 2.6rem); font-weight: 800; margin: 12px 0; }
.story .slide .sub { font-size: 1.1rem; opacity: .9; max-width: 420px; }
.story .slide .e { font-size: 4rem; }
.story .hint { text-align: center; font-size: .8rem; opacity: .7; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .8; } }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .e { font-size: 2.4rem; margin-bottom: 6px; }

/* Linien-Icons */
.ic { display: inline-block; vertical-align: -0.2em; flex: 0 0 auto; }
.btn .ic { vertical-align: middle; }
.nav a .ico { display: flex; }
.list .emoji { color: var(--primary); display: flex; justify-content: center; }
.gym-ico { color: var(--primary); }
.tile .ph { color: #94a3b8; }
.hero .ph { color: #94a3b8; }
.empty .e { color: #94a3b8; }
.badge .e { width: 48px; height: 48px; margin: 0 auto; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.badge.locked .e { background: var(--surface-2); color: var(--muted); }
.badge.locked { opacity: .55; filter: none; }
.story .slide .e { color: #fff; opacity: .9; }
.toast .ic { vertical-align: -0.25em; margin-right: 4px; }
.energy button { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.energy button span { font-size: .68rem; margin-top: 2px; }
.seg button .ic { margin-bottom: 2px; }
.notice .ic { vertical-align: -0.2em; }
.ghost .ic { vertical-align: -0.15em; }
.energy { gap: 6px; }
.energy button { min-width: 0; aspect-ratio: auto; padding: 12px 2px; }
.energy button span { white-space: normal; line-height: 1.1; }

/* Design B: Modern-sachlich (blaue Kopfzeile, IBM Plex Sans, feine Rahmen) */
.topbar { background: var(--primary); color: #fff; padding-bottom: 14px; }
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:active { background: rgba(255,255,255,.15); }
.topbar.scrolled { border-bottom-color: transparent; }
.view { padding-top: 14px; }
.card, .tile, .kpi, .badge { border: 1px solid var(--line); }
h2 { font-size: 1rem; font-weight: 600; }
.btn { border-radius: 8px; }
.chip, .seg button { border-radius: 8px; }
.level .badge-lvl { background: var(--primary); border-radius: 10px; }
.bar > i { background: var(--primary); }
.gym-ico { border-radius: 8px; }
.pill { border-radius: 6px; }
.kpi .v { font-weight: 700; }
.cal .c.today { outline-color: #f59e0b; }
@media (min-width: 900px) { .topbar { background: var(--bg); color: var(--text); } .topbar .icon-btn { color: var(--text); } }

/* App-Symbol in der Kopfzeile (nur auf Hauptseiten, auf dem PC steht es in der Seitenleiste) */
.top-logo { width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto; box-shadow: 0 0 0 1.5px rgba(255,255,255,.55); }
@media (max-width: 330px) { .top-logo { display: none; } }
@media (min-width: 900px) { .top-logo { display: none; } }

/* Farbwelt "Modern": Nachtblau für Kopfzeile, Navigation und Akzentflächen, leuchtendes Blau für Aktionen */
.topbar { background: var(--navy); color: #fff; }
.body-hero { background: linear-gradient(135deg, var(--navy), #1e3a8a); }
.body-hero .trend.good { color: #86efac; }
.level .badge-lvl { background: var(--navy); border-radius: 12px; }
.bar > i { background: linear-gradient(90deg, #3b82f6, #22d3ee); }
.bar.teal > i { background: var(--primary); }
.chip.on { background: var(--navy); border-color: var(--navy); }
.next-link { background: var(--navy); }
.nav { background: var(--navy); border-top-color: var(--navy); }
.nav a { color: #94a3b8; }
.nav a.active { color: #fff; }
.toast.record { background: var(--navy); }
@media (min-width: 900px) {
  .nav .brand { color: #fff; }
  .nav a.active { background: rgba(255,255,255,.1); }
  .topbar { background: var(--bg); color: var(--text); }
}

/* Hinweis auf neue Version */
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); z-index: 65;
  display: flex; align-items: center; gap: 12px; width: min(94vw, 460px); padding: 10px 12px 10px 16px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(15,23,42,.18); font-weight: 600; font-size: .92rem; }
.update-bar span { flex: 1; }

/* Schritte-Karte auf der Startseite: Ring bis zum Ziel, Serie, Woche */
.steps-ring { flex: 0 0 auto; }
.steps-ring circle { fill: none; stroke-width: 9; }
.steps-ring .track { stroke: var(--surface-2); }
.steps-ring .fill { stroke: var(--primary); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.steps-ring .fill.done { stroke: var(--good); }
.steps-ring text { text-anchor: middle; fill: var(--text, #0f172a); font-family: inherit; }
.steps-ring .num { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.steps-ring .sub { font-size: 10px; fill: var(--muted); }
.streak { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); }
.streak > .ic { margin-top: 1px; }
.streak b { color: var(--text, #0f172a); }
.streak.on > .ic { color: #f59e0b; }
.week-dots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.week-dots .wd { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .7rem; color: var(--muted); }
.week-dots .wd i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); }
.week-dots .wd.done i { background: var(--good); border-color: var(--good); }
.week-dots .wd.missed i { background: var(--surface-2); border-color: #cbd5e1; }
.week-dots .wd.open i { border-color: var(--primary); border-style: dashed; }
.week-dots .wd.open span { color: var(--primary); font-weight: 700; }

/* Startseite: Aktivität und Erfolge */
.act-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.act-grid .big-n { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.latest-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.latest-badges:empty { display: none; }
.latest-badges .lb { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: .8rem; font-weight: 600; max-width: 100%; }
.latest-badges .lb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.near { display: flex; gap: 6px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.near > .ic { color: #f59e0b; }

/* Erfolge: Rang-Stufen und aufklappbare Abzeichen */
.rank-stages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 4px; color: var(--muted); }
.rank-stages i { width: 18px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.rank-stages i.on { background: var(--primary); }
.rank-stages span { margin-left: 4px; }
.rank-list li.cur b { color: var(--primary); }
.rank-list li.past { opacity: .6; }
.badge-group { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.badge-group summary { cursor: pointer; padding: 4px 0; }
.badge-cat { margin: 14px 0 8px; font-size: .9rem; }

/* Level-Plakette: beschriftet, blau, als Blickfang */
.level .badge-lvl { width: 62px; height: 66px; flex-direction: column; gap: 0; border-radius: 14px;
  background: linear-gradient(160deg, #60a5fa 0%, var(--primary) 45%, var(--primary-dark) 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .35), inset 0 1px 0 rgba(255, 255, 255, .35); }
.level .badge-lvl small { font-size: .58rem; font-weight: 800; letter-spacing: .12em; opacity: .9; line-height: 1; }
.level .badge-lvl span { font-size: 1.6rem; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.level .badge-lvl.lg { width: 76px; height: 82px; }
.level .badge-lvl.lg small { font-size: .66rem; }
.level .badge-lvl.lg span { font-size: 2rem; }
