:root {
  --bg: #0e1116;
  --card: #171b22;
  --card2: #1e2530;
  --text: #eaf0f7;
  --muted: #8b96a5;
  --accent: #37c26b;      /* STÁHNI / plné */
  --accent2: #3b82f6;     /* POVOL / info */
  --warn: #f5a623;
  --danger: #ef4444;
  --ring: #2a323d;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100%;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bot));
  display: flex;
  flex-direction: column;
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; }

/* ---------- Hlavička ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.top h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .2px; }
.top .week { color: var(--muted); font-size: 13px; }
.icon-btn {
  background: var(--card); border: none; color: var(--text);
  width: 40px; height: 40px; border-radius: 12px; font-size: 18px; cursor: pointer;
}

/* ---------- Karty ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }

/* Dnešní stav */
.today-status { display: flex; align-items: center; gap: 16px; }
.dots { display: flex; gap: 8px; }
.dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--ring); background: transparent;
}
.dot.done { background: var(--accent); border-color: var(--accent); }
.today-text { font-size: 17px; font-weight: 600; }
.today-text small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; margin-top: 2px; }

/* Streak + statistiky */
.stats { display: flex; gap: 12px; }
.stat {
  flex: 1; background: var(--card2); border-radius: 14px; padding: 14px; text-align: center;
}
.stat .num { font-size: 28px; font-weight: 800; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .fire { color: var(--warn); }

/* Tlačítka */
.btn {
  display: block; width: 100%; border: none; border-radius: 14px;
  padding: 18px; font-size: 18px; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #06210f;
}
.btn:active { transform: scale(.99); }
.btn.secondary { background: var(--card2); color: var(--text); font-size: 15px; padding: 14px; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 600; }
.btn:disabled { opacity: .5; }

.safety {
  margin-top: auto;
  color: var(--muted); font-size: 12.5px; line-height: 1.5;
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  border-left: 3px solid var(--warn);
}

/* ---------- Vedená session ---------- */
#screen-session { justify-content: space-between; }
.session-head { text-align: center; color: var(--muted); font-size: 14px; }
.session-head b { color: var(--text); }

.stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
}
.phase-label { font-size: 34px; font-weight: 800; letter-spacing: 1px; min-height: 42px; }
.phase-label.hold { color: var(--accent); }
.phase-label.release { color: var(--accent2); }
.phase-label.rest { color: var(--warn); }

.orb-wrap { position: relative; width: 240px; height: 240px; display: flex; align-items: center; justify-content: center; }
.orb-track {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--ring);
}
.orb {
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--accent), #1c7a41);
  transform: scale(.30);
  box-shadow: 0 0 40px rgba(55,194,107,.25);
  will-change: transform;
}
.orb.release { background: radial-gradient(circle at 50% 40%, var(--accent2), #1e40af); box-shadow: 0 0 40px rgba(59,130,246,.25); }
.orb-timer {
  position: absolute; font-size: 52px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.rep-counter { color: var(--muted); font-size: 16px; }
.rep-counter b { color: var(--text); font-size: 20px; }

.session-foot { display: flex; gap: 10px; }
.session-foot .btn { padding: 14px; font-size: 15px; }

.big-count { font-size: 90px; font-weight: 800; color: var(--accent); }

/* ---------- Nastavení ---------- */
.row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--ring); }
.row:last-child { border-bottom: none; }
.row label { font-size: 15px; }
.row input[type="time"] {
  background: var(--card2); border: none; color: var(--text); font-size: 15px;
  padding: 8px 10px; border-radius: 10px;
}
.switch { display: inline-block; position: relative; width: 48px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--ring); border-radius: 28px; transition: .2s; }
.slider:before { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* EHS */
.ehs-options { display: grid; gap: 10px; }
.ehs-opt {
  text-align: left; background: var(--card2); border: 2px solid transparent; color: var(--text);
  border-radius: 12px; padding: 14px; font-size: 15px; cursor: pointer;
}
.ehs-opt b { display: inline-block; width: 26px; color: var(--accent); }
.ehs-opt.sel { border-color: var(--accent); }

/* Mini graf */
.trend { display: flex; align-items: flex-end; gap: 6px; height: 90px; margin-top: 8px; }
.trend .bar { flex: 1; background: var(--accent2); border-radius: 5px 5px 0 0; min-height: 4px; position: relative; }
.trend .bar span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }

.hint { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 10px 0 0; }
.check-row {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 0;
  border-bottom: 1px solid var(--ring); font-size: 15px; line-height: 1.4; cursor: pointer;
}
.check-row:last-child { border-bottom: none; }
.check-row input { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; accent-color: var(--accent); }
.rep-counter small { color: var(--muted); font-size: 13px; }

.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 14px; }

/* ---------- Přepínač programů ---------- */
.tabs { display: flex; gap: 8px; background: var(--card); padding: 5px; border-radius: 14px; margin-bottom: 14px; }
.tabs .tab {
  flex: 1; border: none; background: transparent; color: var(--muted);
  padding: 10px 8px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.tabs .tab.active { background: var(--card2); color: var(--text); }

.start-buttons { display: grid; gap: 10px; }
.start-buttons .btn small { font-weight: 500; opacity: .75; font-size: 13px; }

/* ---------- Obrázek cviku ---------- */
.ex-figure { width: 100%; max-width: 330px; color: var(--text); }
.ex-figure svg { width: 100%; height: auto; display: block; }

/* V režimu cviků je hlavní obrázek, kruh se zmenší na odpočet */
#screen-session.mode-exercise .orb-wrap { width: 118px; height: 118px; }
#screen-session.mode-exercise .orb { width: 108px; height: 108px; }
#screen-session.mode-exercise .orb-timer { font-size: 34px; }
#screen-session.mode-exercise .stage { gap: 14px; }
.phase-label.small { font-size: 22px; line-height: 1.2; text-align: center; }

/* ---------- Náhled cviků ---------- */
.sub-head { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; margin: 16px 0 8px; }
.guide-item {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 10px;
}
.guide-fig { width: 104px; flex-shrink: 0; color: var(--text); }
.guide-fig svg { width: 100%; height: auto; display: block; }
.guide-item b { font-size: 15px; }
.dose { color: var(--accent); font-size: 13px; font-weight: 600; }

/* ---------- Týden +/- ---------- */
.week-ctl { display: flex; align-items: center; gap: 12px; }
.week-ctl b { min-width: 18px; text-align: center; font-size: 16px; }
.mini {
  width: 34px; height: 34px; border: none; border-radius: 10px;
  background: var(--card2); color: var(--text); font-size: 18px; cursor: pointer;
}
