:root {
  --paper: #FCFBF7; --card: #FFFFFF; --ink: #20211D; --muted: #8A857A;
  --line: #E7E2D7; --plum: #5E3A57; --plum-soft: #F1E9EE;
  --clay: #C0573D; --green: #3E6B39; --green-soft: #E7F0E4;
  --shadow: 0 1px 2px rgba(32,33,29,.05),0 8px 24px rgba(32,33,29,.05);
  --r: 12px;
}
* { box-sizing: border-box; }
body { margin:0; background:var(--paper); color:var(--ink);
  font-family:"Inter",system-ui,-apple-system,sans-serif;
  font-size:16px; line-height:1.5; -webkit-font-smoothing:antialiased; }
.wrap { max-width:1180px; margin:0 auto; padding:28px 20px 80px; }

/* ---- Masthead ---- */
.masthead { margin-bottom:20px; }
.masthead h1 { font-family:"Fraunces",Georgia,serif; font-weight:600;
  font-size:clamp(28px,5vw,44px); line-height:1.04; letter-spacing:-.01em; margin:0 0 6px; }
.masthead p { margin:0; color:var(--muted); max-width:52ch; }

/* ---- Tabs ---- */
.tabs { display:flex; gap:4px; margin-bottom:20px;
  border-bottom:2px solid var(--line); }
.tab-btn { font:inherit; font-weight:600; font-size:15px; cursor:pointer;
  background:none; border:0; padding:10px 16px; color:var(--muted);
  border-bottom:2px solid transparent; margin-bottom:-2px; }
.tab-btn.active { color:var(--plum); border-bottom-color:var(--plum); }
.tab-btn:hover:not(.active) { color:var(--ink); }
.tab-content { display:none; }
.tab-content.active { display:block; }

/* ---- Setup-Karte ---- */
.setup { background:var(--card); border:1px solid var(--line); border-radius:var(--r);
  box-shadow:var(--shadow); padding:22px; margin-bottom:24px; }
.setup-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(148px,1fr)); gap:16px 18px; }
.field { display:flex; flex-direction:column; gap:6px; }
.field>label,.flag-label { font-size:12px; font-weight:600; letter-spacing:.04em;
  text-transform:uppercase; color:var(--muted); }
.flag-label { display:inline-flex; align-items:center; gap:7px; text-transform:none; font-size:14px; }
.field input,.field select { font:inherit; color:var(--ink); padding:9px 11px;
  border:1px solid var(--line); border-radius:8px; background:var(--paper); }
.field input:focus,.field select:focus { outline:2px solid var(--plum); outline-offset:1px; border-color:var(--plum); }

.seg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.seg button { font:inherit; border:0; background:var(--paper); color:var(--ink); padding:9px 13px; cursor:pointer; }
.seg button[aria-pressed="true"] { background:var(--plum); color:#fff; }

.chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip { font:inherit; font-size:14px; cursor:pointer; border:1px solid var(--line);
  background:var(--paper); color:var(--ink); padding:7px 13px; border-radius:999px; }
.chip[aria-pressed="true"] { background:var(--plum-soft); border-color:var(--plum); color:var(--plum); }

.setup-foot { display:flex; align-items:center; gap:14px; margin-top:20px; flex-wrap:wrap; }
.btn { font:inherit; font-weight:600; cursor:pointer; background:var(--plum); color:#fff;
  border:0; padding:11px 20px; border-radius:9px; }
.btn:hover { background:#4d2f47; }
.btn.ghost { background:transparent; color:var(--plum); border:1px solid var(--line); }
.btn.ghost:hover { background:var(--plum-soft); }
.btn:disabled { opacity:.5; cursor:default; }
.err { color:var(--clay); font-size:14px; }
.loading { display:none; color:var(--muted); font-size:14px; }
.loading.show { display:inline; }

/* ---- Import-Bereich ---- */
.import-area { margin-top:16px; padding-top:14px; border-top:1px solid var(--line);
  display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.import-divider { font-size:13px; color:var(--muted); }
.import-label { display:inline-flex; align-items:center; gap:7px; font:inherit;
  font-size:14px; font-weight:600; cursor:pointer; color:var(--plum);
  border:1px dashed var(--plum); padding:8px 14px; border-radius:8px; background:var(--plum-soft); }
.import-label input[type="file"] { display:none; }
.import-icon { font-size:16px; }

/* ---- Ziel-Banner ---- */
.target { display:none; gap:26px; align-items:flex-start; flex-wrap:wrap;
  background:var(--card); border:1px solid var(--line); border-radius:var(--r);
  box-shadow:var(--shadow); padding:22px; margin-bottom:24px; }
.target.show { display:flex; }
.target .big { font-family:"Fraunces",serif; font-weight:600; font-size:44px;
  line-height:1; font-variant-numeric:tabular-nums; }
.target .big small { display:block; font-family:"Inter"; font-size:12px; font-weight:600;
  letter-spacing:.05em; text-transform:uppercase; color:var(--muted); margin-bottom:4px; }
.macros { display:flex; gap:10px; flex-wrap:wrap; }
.macro { background:var(--paper); border:1px solid var(--line); border-radius:8px; padding:8px 12px; }
.macro b { display:block; font-size:18px; }
.macro span { font-size:12px; color:var(--muted); }
.note { flex:1 1 260px; font-size:14px; color:var(--muted); border-left:2px solid var(--line); padding-left:14px; }
.note .flag { color:var(--clay); font-weight:600; }

/* ---- Board ---- */
.board { display:none; }
.board.show { display:block; }
.board-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; flex-wrap:wrap; gap:10px; }
.board-head h2 { font-family:"Fraunces",serif; font-weight:600; font-size:22px; margin:0; }
.board-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.integration-toggle { font-size:13px; font-weight:600; color:var(--plum);
  display:inline-flex; align-items:center; gap:6px; cursor:pointer; }

/* ---- Wochen-Grid ---- */
.week { display:grid; grid-template-columns:repeat(7,1fr); gap:10px; }
.day { background:var(--card); border:1px solid var(--line); border-radius:var(--r);
  overflow:hidden; display:flex; flex-direction:column; }
.day-rest { background:var(--paper); }
.day-name { font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  padding:9px 11px; border-bottom:1px solid var(--line); color:var(--plum); }
.day-rest .day-name { color:var(--muted); }

/* ---- Meal-Slot ---- */
.slot { padding:10px 11px; border-bottom:1px dashed var(--line); }
.slot:last-of-type { border-bottom:0; }
.eyebrow { font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:var(--muted); display:flex; align-items:center; gap:5px; }
.dish { font-size:13px; line-height:1.3; margin:3px 0 3px; }
.kcal { font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; }
.nocook { width:6px; height:6px; border-radius:50%; background:var(--plum); display:inline-block; }
.portion { font-size:10px; font-weight:600; color:var(--plum); background:var(--plum-soft);
  border-radius:4px; padding:1px 4px; vertical-align:middle; }
.slot-actions { display:flex; gap:8px; margin-top:5px; }
.iconbtn { font:inherit; font-size:11px; cursor:pointer; background:none; border:0;
  color:var(--muted); padding:2px 0; }
.iconbtn:hover { color:var(--plum); }
.iconbtn.on { color:var(--plum); font-weight:600; }
.empty { color:var(--muted); font-size:12px; }

/* Zutaten-Klapp */
.ing-details { margin-top:5px; }
.ing-details summary.ing-toggle { font-size:11px; cursor:pointer; color:var(--plum);
  font-weight:600; list-style:none; display:inline-flex; align-items:center; gap:4px; }
.ing-details summary.ing-toggle::before { content:'▸'; }
.ing-details[open] summary.ing-toggle::before { content:'▾'; }
.ing-list { margin:5px 0 0 12px; padding:0; font-size:11px; color:var(--ink);
  list-style:disc; line-height:1.6; }

/* Tages-Konto */
.ledger { padding:9px 11px; border-top:1px solid var(--line); background:var(--paper); }
.ledger .nums { display:flex; justify-content:space-between; font-size:11px;
  font-variant-numeric:tabular-nums; margin-bottom:4px; }
.ledger .nums .lo { color:var(--muted); }
.bar { height:5px; border-radius:3px; background:var(--line); overflow:hidden; }
.bar>span { display:block; height:100%; background:var(--plum); }
.ledger.over .bar>span { background:var(--clay); }
.ledger.over .nums .geplant { color:var(--clay); font-weight:600; }
.workout-bonus { font-size:10px; color:var(--green); margin-bottom:3px; }

/* ---- Workout-Tag ---- */
.rest-label { padding:20px 11px; color:var(--muted); font-size:14px; text-align:center; }
.w-meta { font-size:11px; color:var(--muted); padding:7px 11px 4px; border-bottom:1px dashed var(--line); }
.w-focus { font-weight:700; color:var(--plum); }
.w-block { padding:6px 11px; border-bottom:1px dashed var(--line); }
.w-block:last-of-type { border-bottom:0; }
.w-phase { font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--muted); margin-bottom:4px; }
.w-ex { margin:3px 0; }
.ex-details summary { font-size:12px; cursor:pointer; list-style:none; display:flex;
  justify-content:space-between; align-items:center; }
.ex-details summary::marker,.ex-details summary::-webkit-details-marker { display:none; }
.ex-details summary::before { content:'▸'; font-size:10px; margin-right:4px; color:var(--muted); }
.ex-details[open] summary::before { content:'▾'; }
.ex-detail { font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; }
.ex-desc { margin:5px 0 2px 14px; font-size:11px; color:var(--ink); line-height:1.5; }
.ex-muscles { margin:0 0 2px 14px; font-size:10px; color:var(--muted); }
.btn-done { display:block; width:calc(100% - 22px); margin:8px 11px 11px;
  font:inherit; font-size:12px; font-weight:600; cursor:pointer; padding:7px;
  border-radius:8px; border:1px solid var(--line); background:var(--paper); color:var(--muted); }
.btn-done.done { background:var(--green-soft); color:var(--green); border-color:var(--green); }

/* ---- Misc ---- */
.statusline { font-size:13px; color:var(--muted); }

@media (max-width:900px) {
  .week { grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:no-preference) {
  .day { animation:rise .3s ease both; }
  @keyframes rise { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:none; } }
}

/* ---- Übungs-SVG ---- */
.ex-svg {
  display: block;
  width: 64px;
  height: 80px;
  margin: 8px auto 4px;
  color: var(--plum);
  opacity: .85;
}
.ex-details[open] .ex-svg { opacity: 1; }

/* ---- Tagesform ---- */
.vibe-hint { font-size:12px; color:var(--muted); margin-top:5px; display:block; }

.w-vibe-tag {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px; margin-bottom: 3px;
  background: var(--plum-soft); color: var(--plum);
}
/* Vollgas */
.w-meta .w-vibe-tag[data-v="vollgas"],
.day-vollgas .w-vibe-tag { background:#FFF3E0; color:#E65100; }
/* Ruhig */
.day-ruhig .w-vibe-tag  { background:#E8F5E9; color:#2E7D32; }

/* ---- Fokusmodus ---- */
.focus-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  z-index: 9999;
  overflow: hidden;
}
.focus-overlay.show { display: block; }

.fm-screen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: #0d1117;
  display: flex; flex-direction: column;
  color: #fff;
  font-family: "Inter", system-ui, sans-serif;
  position: relative;
  overflow: hidden;
}

/* Top-Bar */
.fm-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 10px;
  flex-shrink: 0;
}
.fm-vibe-badge {
  font-size: 11px; font-weight: 800; letter-spacing: .1em;
  background: #1a9e6e; color: #fff;
  padding: 4px 10px; border-radius: 6px;
  text-transform: uppercase; flex-shrink: 0;
}
.fm-counter {
  flex: 1; font-size: 15px; font-weight: 600; color: #e0e0e0;
}
.fm-close-btn {
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .05em;
  background: #1e2530; color: #aaa; border: none; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; display: flex; align-items: center; gap: 6px;
}
.fm-close-btn:hover { background: #2a3140; color: #fff; }

/* Progress */
.fm-bar {
  height: 3px; background: #1e2530; flex-shrink: 0; margin: 0 18px;
}
.fm-bar-fill {
  height: 100%; background: #1a9e6e; transition: width .4s ease; width: 0;
}

/* Illustration */
.fm-illus-wrap {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0 16px;
}
.fm-illus-inner {
  background: #161d27;
  border-radius: 22px;
  width: min(260px, 60vw); height: min(220px, 50vw);
  display: flex; align-items: center; justify-content: center;
}
.fm-illus svg {
  width: min(130px, 30vw); height: min(160px, 36vw);
  color: #1a9e6e;
}

/* Body */
.fm-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 0 24px; min-height: 0;
}
.fm-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(28px, 6vw, 44px); font-weight: 700;
  margin: 0 0 10px; line-height: 1.1; color: #fff;
}
.fm-desc {
  font-size: 15px; color: #8a95a3; line-height: 1.55;
  margin: 0 0 10px; max-width: 36ch;
}
.fm-sets {
  font-size: 13px; color: #5a6472; font-weight: 600; margin-bottom: 6px; min-height: 1.4em;
}
.fm-timer {
  font-size: clamp(60px, 14vw, 88px); font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #f5a623; line-height: 1; margin: 4px 0 0;
  transition: color .2s;
}
.fm-timer.fm-timer-warn {
  color: #e05a3a;
  animation: fm-pulse .35s ease infinite alternate;
}
@keyframes fm-pulse { from { transform: scale(1); } to { transform: scale(1.06); } }

.fm-reps {
  font-size: 36px; font-weight: 700; color: #fff; margin-top: 6px;
}

/* Unsichtbare Tap-Fläche (Weiter) */
.fm-tap-area {
  position: absolute; inset: 0;
  background: transparent; border: none; cursor: pointer; z-index: 1;
}

/* Zurück-Button (links unten, über der Next-Bar) */
.fm-prev-btn {
  position: absolute; left: 14px; bottom: 90px; z-index: 2;
  font: inherit; font-size: 22px; background: rgba(255,255,255,.06);
  color: #aaa; border: none; cursor: pointer;
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.fm-prev-btn:disabled { opacity: .2; pointer-events: none; }
.fm-prev-btn:hover:not(:disabled) { background: rgba(255,255,255,.12); color: #fff; }

/* Als Nächstes-Bar */
.fm-next-bar {
  position: relative; z-index: 2;
  flex-shrink: 0;
  background: #161d27; border-top: 1px solid #1e2530;
  padding: 14px 20px 24px;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px;
}
.fm-next-label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em;
  color: #5a6472; text-transform: uppercase; margin-bottom: 4px;
}
.fm-next-name {
  font-size: 15px; font-weight: 600; color: #e0e0e0;
}
.fm-next-right { text-align: right; flex-shrink: 0; }
.fm-total-remaining {
  font-size: 16px; font-weight: 700; color: #e0e0e0;
  font-variant-numeric: tabular-nums;
}

/* Fokus-Button im Tagesplan */
.btn-focus {
  display: block; width: calc(100% - 22px); margin: 0 11px 11px;
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 7px;
  border-radius: 8px; border: 1px solid var(--plum); background: var(--plum-soft);
  color: var(--plum);
}
.btn-focus:hover { background: var(--plum); color: #fff; }
