/* app.css — Trainings-Coach · Look nach Leos Geschmacksprofil (E7/E17):
   dark & cinematic · kompakt (wenig Scroll) · alles in gerahmten Kästchen mit Icons ·
   EIN Akzent (Gold) · Motion sparsam & nativ (150–250 ms). */

/* ——— Fonts (lokal, offline-fähig) ——— */
@font-face {
  font-family: 'Oswald';
  src: url('../fonts/oswald.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

/* ——— Tokens ——— */
:root {
  --bg: #0b0c0f;
  --surface: #14161c;
  --surface-2: #1a1d25;
  --border: #262a35;
  --border-strong: #343947;
  --text: #e9e7e2;
  --muted: #8d919c;
  --faint: #5d616c;
  --accent: #e2b13c;          /* das eine Gold */
  --accent-dim: rgba(226, 177, 60, 0.14);
  --accent-border: rgba(226, 177, 60, 0.45);
  --ok: #58c98a;              /* semantisch: erledigt */
  --ok-dim: rgba(88, 201, 138, 0.12);
  --radius: 14px;
  --radius-s: 10px;
  --pad: 14px;
  --nav-h: 62px;
  --display: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* ——— App-Rahmen ——— */
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 24px);
}

.icon { width: 20px; height: 20px; flex: none; }

/* ——— Header (jede Seite rahmt sich, P4) ——— */
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 2px 14px;
}
.page-head h1 {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}
.page-head h1 .accent { color: var(--accent); }
.page-head .sub {
  color: var(--muted);
  font-size: 12.5px;
  text-align: right;
  line-height: 1.3;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.badge.gold { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); }

/* ——— Sektionen ——— */
.section { margin-bottom: 18px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 2px 8px;
}
.section-title .icon { width: 16px; height: 16px; color: var(--accent); }
.section-title .count { margin-left: auto; font-size: 12px; color: var(--faint); letter-spacing: 0; font-family: var(--body); }

/* ——— Karten (alles in gerahmten Kästchen, P2) ——— */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 10px;
  transition: border-color 200ms var(--ease), background 200ms var(--ease);
}
.card:last-child { margin-bottom: 0; }

.card-head { display: flex; align-items: center; gap: 10px; }
.card-icon {
  width: 36px; height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  color: var(--accent);
  background: var(--surface-2);
  transition: all 200ms var(--ease);
}
.card-icon .icon { width: 19px; height: 19px; }
.card-title { font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.card-detail { color: var(--muted); font-size: 12.5px; margin-top: 9px; line-height: 1.45; }

/* Log-Karten: Technik-Hinweis kompakt (1 Zeile), Tap auf den Kopf expandiert (P1: Kompaktheit) */
.card[data-log] .card-detail {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card[data-log].expanded .card-detail { -webkit-line-clamp: unset; }
.card[data-log] .card-head { cursor: pointer; }

/* erledigt */
.card.done { border-color: rgba(88, 201, 138, 0.35); }
.card.done .card-icon { color: var(--ok); border-color: rgba(88, 201, 138, 0.4); background: var(--ok-dim); }
.card.done .card-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }

/* ——— Check-Karten (Ein-Tap-Abhaken, E15) ——— */
.card.checkable { cursor: pointer; user-select: none; }
.card.checkable:active { background: var(--surface-2); }
.check-dot {
  margin-left: auto;
  width: 26px; height: 26px;
  flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: transparent;
  transition: all 220ms var(--ease);
}
.check-dot .icon { width: 15px; height: 15px; }
.card.done .check-dot,
.done-row .check-dot {
  background: var(--ok);
  border-color: var(--ok);
  color: #0b0c0f;
  animation: check-pop 260ms var(--ease);
}
.checkable-row { user-select: none; }
.checkable-row:active { opacity: 0.75; }
@keyframes check-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ——— Set-Logging (Log-Kern, E15) ——— */
.sets-row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.set-chip {
  min-width: 52px;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--faint);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: all 200ms var(--ease);
}
.set-chip.filled {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent);
  animation: chip-pop 240ms var(--ease);
}
.set-chip.next { border-style: dashed; color: var(--muted); }
@keyframes chip-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.logger {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  overflow: hidden;
}
.stepper button {
  width: 40px; height: 40px;
  border: 0;
  background: none;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.stepper button:active { background: var(--border); color: var(--text); }
.stepper .val {
  min-width: 52px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.stepper .val small { display: block; font-size: 9.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.stepper button .icon { width: 16px; height: 16px; }

.log-set-btn {
  margin-left: auto;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-s);
  background: var(--accent);
  color: #16130a;
  font-weight: 700;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 150ms var(--ease), filter 150ms var(--ease);
}
.log-set-btn:active { transform: scale(0.96); filter: brightness(1.1); }
.log-set-btn .icon { width: 16px; height: 16px; }
.log-set-btn:disabled { background: var(--border); color: var(--faint); }

/* ——— Rest-Timer (sticky über der Nav) ——— */
#rest-timer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 8px 10px 8px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
#rest-timer.on { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
#rest-timer .time {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 58px;
}
#rest-timer .lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
#rest-timer button {
  border: 1px solid var(--border-strong);
  background: none;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ——— Befinden ——— */
.seg-row { display: flex; gap: 6px; margin-top: 8px; }
.seg {
  flex: 1;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 180ms var(--ease);
}
.seg.on {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent);
}
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.field-row .lbl { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.field-row .lbl .icon { width: 16px; height: 16px; color: var(--accent); }
textarea.note {
  width: 100%;
  margin-top: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  color: var(--text);
  font-family: var(--body);
  font-size: 13.5px;
  padding: 10px 12px;
  min-height: 64px;
  resize: vertical;
}
textarea.note:focus { outline: none; border-color: var(--accent-border); }

/* ——— Stats (Fortschritt) ——— */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px var(--pad);
}
.stat .k {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600;
}
.stat .k .icon { width: 14px; height: 14px; color: var(--accent); }
.stat .v {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 4px;
}
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 400; }

/* PR-Liste / Zeilen-Listen */
.rowlist .row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.rowlist .row:last-child { border-bottom: 0; }
.rowlist .row .icon { width: 16px; height: 16px; color: var(--accent); }
.rowlist .row .check-dot .icon { color: inherit; } /* Häkchen erbt vom Dot (transparent/dunkel), nicht Gold */
.rowlist .row .val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.rowlist .row .val small { color: var(--muted); font-weight: 400; }

/* Leiter */
.ladder-item { padding: 11px 0; border-bottom: 1px solid var(--border); }
.ladder-item:last-child { border-bottom: 0; }
.ladder-top { display: flex; align-items: center; gap: 8px; }
.ladder-top .name { font-weight: 600; font-size: 13.5px; }
.ladder-top .rung-badge { margin-left: auto; }
.ladder-rung { color: var(--text); font-size: 12.5px; margin-top: 5px; }
.ladder-trigger { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.ladder-trigger .icon { width: 13px; height: 13px; color: var(--accent); }
.ladder-up {
  margin-top: 8px;
  border: 1px solid var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.ladder-up .icon { width: 13px; height: 13px; }

/* Sparkline */
.spark { width: 100%; height: 64px; margin-top: 8px; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark .area { fill: url(#sparkfill); stroke: none; }

/* ——— Ernährung ——— */
.anchor-macros { display: flex; gap: 8px; margin-left: auto; align-items: center; flex: none; }
.macro-pill {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.macro-pill.p { color: var(--accent); border-color: var(--accent-border); }

/* ——— Plan-Screen ——— */
.day-row { display: flex; gap: 10px; align-items: flex-start; }
.day-dow {
  flex: none;
  width: 38px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  padding-top: 1px;
}
.day-units { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.day-units b { color: var(--text); font-weight: 600; }
.card.today-hl { border-color: var(--accent-border); background: linear-gradient(180deg, var(--accent-dim), var(--surface) 55%); }

table.ramp { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.ramp td { padding: 7px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.ramp tr:last-child td { border-bottom: 0; }
table.ramp .w { font-family: var(--display); font-size: 15px; color: var(--accent); width: 30px; }
table.ramp .i { font-weight: 700; white-space: nowrap; width: 105px; }
table.ramp .n { color: var(--muted); }
table.ramp tr.now td { background: var(--accent-dim); }

/* ——— Ruhetag ——— */
.rest-hero {
  text-align: center;
  padding: 44px 20px;
}
.rest-hero .icon { width: 44px; height: 44px; color: var(--accent); margin-bottom: 12px; }
.rest-hero h2 { font-family: var(--display); font-size: 26px; text-transform: uppercase; letter-spacing: 0.05em; }
.rest-hero p { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ——— PR-Toast (Feier einmalig & dezent, E17) ——— */
#toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  max-width: calc(100vw - 20px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 24px rgba(226, 177, 60, 0.15);
  transition: transform 300ms var(--ease);
}
#toast.on { transform: translateX(-50%) translateY(0); }
#toast .icon { width: 18px; height: 18px; color: var(--accent); }

/* ——— Bottom-Nav ——— */
#nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  background: rgba(13, 14, 18, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#nav .inner {
  max-width: 560px;
  margin: 0 auto;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
#nav button {
  border: 0;
  background: none;
  color: var(--faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 200ms var(--ease);
  position: relative;
}
#nav button .icon { width: 21px; height: 21px; }
#nav button.active { color: var(--accent); }
#nav button.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 26px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
}

/* ——— View Transitions (Screenwechsel, E17) ——— */
::view-transition-old(screen) { animation: vt-out 160ms var(--ease) both; }
::view-transition-new(screen) { animation: vt-in 200ms var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
#screen { view-transition-name: screen; }

@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-old(screen), ::view-transition-new(screen) { animation: none !important; transition: none !important; }
}
