:root {
  --bg: #000000; --card: #1C1C1E; --fill: #2C2C2E; --fill2: #3A3A3C; --sep: #38383A;
  --text: #FFFFFF; --sec: #98989F; --chev: #5A5A5F;
  --glass: rgba(58,58,60,0.6); --glass-b: rgba(255,255,255,0.16);
  --tab: rgba(44,44,46,0.62); --tab-sel: rgba(255,255,255,0.12); --tab-sh: 0 8px 24px rgba(0,0,0,0.5);
  --seg-sel: #636366; --seg-sh: none;
  --time: #FFD60A; --ring: #2C2C2E; --missed: #48484A; --tbtn: #333336; --tgap: #000000;
  --acc: #30D158; --acc-t: #30D158; --acc-track: rgba(48,209,88,0.2); --acc-dim: rgba(48,209,88,0.25);
  --calm: #64D2FF; --calm-t: #64D2FF; --calm-track: #1F2A30; --calm-dim: rgba(100,210,255,0.25);
  --e1: #30D158; --e2: #FFD60A; --e3: #FF9F0A; --e4: #FF453A;
  --e1t: #30D158; --e2t: #FFD60A; --e3t: #FF9F0A; --e4t: #FF453A;
  --danger: #FF453A;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #F2F2F7; --card: #FFFFFF; --fill: #E5E5EA; --fill2: #D1D1D6; --sep: #C6C6C8;
  --text: #000000; --sec: #6C6C70; --chev: #C4C4C7;
  --glass: rgba(255,255,255,0.72); --glass-b: rgba(0,0,0,0.08);
  --tab: rgba(255,255,255,0.72); --tab-sel: rgba(0,0,0,0.06); --tab-sh: 0 8px 24px rgba(0,0,0,0.12);
  --seg-sel: #FFFFFF; --seg-sh: 0 1px 4px rgba(0,0,0,0.15);
  --time: #C93400; --ring: #E5E5EA; --missed: #C7C7CC; --tbtn: #E5E5EA; --tgap: #F2F2F7;
  --acc-t: #1A7330;
  --calm: #32ADE6; --calm-t: #0071A4; --calm-track: #D6EEF8; --calm-dim: rgba(50,173,230,0.25);
  --e1t: #248A3D; --e2t: #8A6D00; --e3t: #C93400; --e4t: #D70015;
  --danger: #D70015;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acc-t); text-decoration: none; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--round); font-variant-numeric: tabular-nums; }
.sec { color: var(--sec); }

#app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; }

/* ---------- Stránky s lištou ---------- */
.page { padding: calc(var(--safe-top) + 20px) 16px calc(var(--safe-bottom) + 112px); display: flex; flex-direction: column; gap: 14px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 4px; gap: 12px; }
.head .eyebrow { font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--sec); }
h1.large { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: 0.4px; }
h2.title2 { margin: 0; font-size: 22px; font-weight: 700; }
.section-label { margin: 6px 0 -6px; padding: 0 16px; font-size: 13px; font-weight: 400; text-transform: uppercase; color: var(--sec); }
.footnote { margin: -6px 0 0; padding: 0 16px; font-size: 13px; color: var(--sec); }
.card { background: var(--card); border-radius: 26px; padding: 18px; }
.list { background: var(--card); border-radius: 26px; padding: 0 16px; margin: 0; list-style: none; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; border-bottom: 0.5px solid var(--sep); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; padding: 0; text-align: left; }
.list > :last-child .row, .list > .row:last-child { border-bottom: 0; }
.grow { flex: 1; min-width: 0; }
.row .val { color: var(--sec); font-variant-numeric: tabular-nums; }
.chev { flex-shrink: 0; }
.tile { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--round); font-size: 15px; font-weight: 700; }
.ex-row { display: flex; align-items: center; gap: 14px; min-height: 50px; width: 100%; background: none; border: 0; padding: 0; text-align: left; }
.ex-row .inner { flex: 1; align-self: stretch; display: flex; align-items: center; gap: 8px; border-bottom: 0.5px solid var(--sep); }
.list > li:last-child .ex-row .inner { border-bottom: 0; }

.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border-radius: 26px; border: 0; background: var(--acc); color: #000; font-size: 17px; font-weight: 600; width: 100%; }
.btn-secondary { height: 44px; border-radius: 22px; border: 0; background: var(--fill); color: var(--text); font-size: 15px; font-weight: 600; padding: 0 18px; }
.btn-tinted { height: 44px; border-radius: 22px; border: 0; background: var(--acc-track); color: var(--acc-t); font-size: 15px; font-weight: 600; padding: 0 18px; }
.btn-glass { height: 38px; padding: 0 16px; border-radius: 19px; border: 0.5px solid var(--glass-b); background: var(--glass); color: var(--text); font-size: 17px; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.btn-danger-text { background: none; border: 0; color: var(--danger); font-size: 17px; padding: 0; min-height: 44px; }

.stepper { display: flex; align-items: center; height: 34px; border-radius: 17px; background: var(--fill); flex-shrink: 0; }
.stepper button { width: 48px; height: 34px; border: 0; background: transparent; font-size: 22px; line-height: 1; }
.stepper button:disabled { opacity: 0.3; }
.stepper span { width: 1px; height: 18px; background: var(--sep); }

.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; justify-items: center; padding: 14px 12px; }
.day-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--fill); color: var(--text); font-size: 15px; font-weight: 600; }
.day-btn[aria-pressed="true"] { background: var(--acc); color: #000; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: 34px; padding: 2px; border-radius: 17px; background: var(--fill); }
.segmented button { border: 0; border-radius: 15px; background: transparent; font-size: 14px; font-weight: 500; }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--seg-sel); box-shadow: var(--seg-sh); font-weight: 600; }

.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; border-radius: 16px; border: 0; background: var(--fill2); transition: background .2s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--acc); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* Tab bar – plovoucí sklo */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 40px)); bottom: calc(var(--safe-bottom) + 12px); height: 64px; padding: 4px; border-radius: 32px; background: var(--tab); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border: 0.5px solid var(--glass-b); box-shadow: var(--tab-sh); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 28px; color: var(--text); font-size: 10px; font-weight: 500; }
.tabbar a[aria-current="page"] { background: var(--tab-sel); color: var(--acc-t); font-weight: 600; }

/* Přehled */
.goal { display: flex; align-items: center; gap: 18px; }
.ring-wrap { position: relative; flex-shrink: 0; }
.ring-wrap svg { display: block; transform: rotate(-90deg); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 16px; }
.week > div { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--sec); }
.week .today { color: var(--text); }
.mini-ring { width: 26px; height: 26px; border-radius: 50%; border: 5px solid var(--ring); }
.mini-ring.done { border-color: var(--acc); }
.mini-ring.plan { border-color: var(--acc-track); }
.icon-circle { width: 48px; height: 48px; border-radius: 50%; background: var(--acc-track); color: var(--acc-t); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Postup – kalendář */
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-head button { width: 44px; height: 36px; border: 0; background: none; color: var(--acc-t); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 4px; text-align: center; }
.cal .wd { font-size: 12px; font-weight: 600; color: var(--sec); padding-bottom: 4px; }
.cal .cell { height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.cal .d { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-variant-numeric: tabular-nums; border: 3px solid transparent; }
.cal .done .d { border-color: var(--acc); }
.cal .missed .d { border-color: var(--missed); color: var(--sec); }
.cal .today .d { background: var(--acc); color: #000; font-weight: 700; border-color: var(--acc); }
.cal .future .d { color: var(--sec); }
.cal .dot { width: 4px; height: 4px; border-radius: 50%; }
.cal .planned .dot { background: var(--sec); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--sec); margin-top: 10px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.bars { height: 90px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; align-items: end; border-bottom: 0.5px solid var(--sep); }
.bars span { border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--acc) 45%, transparent); min-height: 4px; }
.bars span:last-child { background: var(--acc); }

/* ---------- Trénink ---------- */
.player { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 24px); }
.player.rest { --acc: var(--calm); --acc-t: var(--calm-t); --acc-dim: var(--calm-dim); --ring-track: var(--calm-track); }
.p-top { display: flex; justify-content: space-between; align-items: center; }
.glass-circle { width: 44px; height: 44px; border-radius: 50%; background: var(--glass); border: 0.5px solid var(--glass-b); color: var(--text); display: flex; align-items: center; justify-content: center; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); flex-shrink: 0; }
.glass-circle.lg { width: 64px; height: 64px; }
.segs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.segs span { height: 4px; border-radius: 2px; background: var(--ring); }
.segs span.done { background: var(--text); }
.segs span.cur { background: var(--acc); }
.p-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.p-main.center { align-items: center; text-align: center; gap: 18px; }
.p-eyebrow { font-size: 15px; font-weight: 600; text-transform: uppercase; color: var(--sec); }
.p-name { margin: 0; font-size: 40px; font-weight: 700; letter-spacing: 0.3px; }
.p-reps { display: flex; align-items: baseline; gap: 10px; color: var(--acc-t); }
.p-reps .big { font-family: var(--round); font-size: min(200px, 48vw); font-weight: 700; line-height: 0.95; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.p-reps .unit { font-family: var(--round); font-size: 34px; font-weight: 600; }
.p-tip { margin: 6px 0 0; font-size: 17px; color: var(--sec); }
.p-elapsed { font-family: var(--round); font-size: 40px; font-weight: 600; color: var(--time); font-variant-numeric: tabular-nums; }
.timer { position: relative; width: min(320px, 78vw); aspect-ratio: 1; }
.timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.timer .inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.timer .t { font-size: min(96px, 24vw); font-weight: 200; line-height: 1; font-variant-numeric: tabular-nums; }
.next { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 22px; background: var(--card); }
.next .lbl { font-size: 15px; color: var(--sec); }
.next .nm { flex: 1; font-size: 17px; font-weight: 600; }
.p-actions { display: flex; align-items: center; gap: 12px; }
.btn-done { flex: 1; height: 80px; border-radius: 40px; border: 0; background: var(--acc); color: #000; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 24px; font-weight: 700; }
.timer-btns { display: flex; justify-content: space-between; align-items: center; padding: 0 6px; }
.tbtn { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--tbtn); box-shadow: 0 0 0 3px var(--tgap), 0 0 0 5px var(--tbtn); color: var(--text); font-size: 16px; font-weight: 500; }
.tbtn.acc { background: var(--acc-dim); box-shadow: 0 0 0 3px var(--tgap), 0 0 0 5px var(--acc-dim); color: var(--acc-t); font-weight: 600; }
.tbtn-mid { display: flex; gap: 16px; }
.paused-banner { text-align: center; font-size: 15px; font-weight: 600; color: var(--time); }

/* Dokončení */
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.metric { background: var(--card); border-radius: 22px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.metric .lbl { font-size: 13px; color: var(--sec); }
.metric .v { font-family: var(--round); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.effort { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.effort button { height: 44px; border: 0; border-radius: 4px; background: var(--fill); padding: 0; }
.effort button:first-child { border-radius: 10px 4px 4px 10px; }
.effort button:last-child { border-radius: 4px 10px 10px 4px; }
.effort-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--sec); }
.input-card { background: var(--card); border-radius: 22px; padding: 0 16px; display: flex; align-items: center; min-height: 52px; }
.input-card input { flex: 1; height: 44px; border: 0; background: transparent; font-size: 17px; outline: none; }

/* Sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; background: var(--bg); border-radius: 30px 30px 0 0; padding: 10px 16px calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; gap: 14px; }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--fill2); margin: 0 auto 4px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 12px); background: var(--card); color: var(--text); padding: 10px 16px; border-radius: 20px; font-size: 15px; box-shadow: var(--tab-sh); z-index: 30; max-width: calc(100% - 32px); }
.empty { padding: 18px; text-align: center; color: var(--sec); font-size: 15px; }
