:root {
  --bg: #0f1115; --bg2: #171a21; --card: #1c2029; --line: #2a303c;
  --tx: #f2f4f7; --mu: #9aa3b2; --acc: #c8f53c; --acc2: #ff8a3d; --bad: #ff5d5d;
  --r: 18px; --nav: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tx); }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body.locked { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1, h2, h3 { margin: 0 0 .35em; line-height: 1.2; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: .4em 0; }
.muted { color: var(--mu); } .small { font-size: .85rem; } .warn { color: var(--acc2); }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100%; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: rgba(15,17,21,.92); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; letter-spacing: .3px; }
.lang { padding: 6px 12px; border-radius: 999px; background: var(--card); font-weight: 700; font-size: .85rem; }
.view { padding: 6px 16px calc(var(--nav) + var(--safe-b) + 24px); display: flex; flex-direction: column; gap: 14px; }
.pagetitle { margin-top: 4px; }

.bottomnav { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: rgba(23,26,33,.97); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); backdrop-filter: blur(10px); }
.bottomnav button { flex: 1; max-width: 112px; height: var(--nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .7rem; color: var(--mu); }
.bottomnav .ic { font-size: 1.3rem; filter: grayscale(1) opacity(.7); }
.bottomnav .on { color: var(--acc); } .bottomnav .on .ic { filter: none; }

.card { background: var(--card); border-radius: var(--r); padding: 16px; border: 1px solid var(--line); text-align: left; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 12px 0; }
.grid3 b { display: block; font-size: 1.35rem; } .grid3 small { color: var(--mu); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; }
.btn.big { min-height: 56px; font-size: 1.05rem; width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn.primary { background: var(--acc); color: #111; }
.btn.primary:active { transform: scale(.98); }
.btn.ghost { background: var(--bg2); border: 1px solid var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips span { background: var(--bg2); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; font-size: .8rem; color: var(--mu); }

/* figure */
.fig { width: 100%; height: auto; display: block; }
.fig .limb { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 7; }
.fig .near { stroke: var(--acc); } .fig .far { stroke: #6f8a2a; }
.fig .head { fill: var(--acc); }
.fig .ground { stroke: var(--line); stroke-width: 2; stroke-linecap: round; }
.fig .prop { fill: #3a4252; } .fig .prop-line { stroke: #56607a; stroke-width: 5; fill: none; stroke-linecap: round; }
.fig.big { max-width: 340px; margin: 0 auto; }

/* danas */
.hero h1 { font-size: 1.6rem; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -4px 6px; scroll-snap-type: x mandatory; }
.mini { flex: 0 0 112px; scroll-snap-align: start; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 8px; text-align: center; }
.mini b { display: block; font-size: .78rem; line-height: 1.2; margin-top: 2px; }
.mini small { color: var(--acc); font-weight: 700; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat small { color: var(--mu); font-size: .78rem; } .stat b { font-size: 1.6rem; line-height: 1.1; } .stat span { color: var(--mu); font-size: .8rem; }
.note { background: linear-gradient(135deg, #1e2414, var(--card)); }
.note p { color: var(--mu); font-size: .9rem; }

/* vežbe */
.filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.filter button { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .9rem; }
.filter .on { background: var(--acc); color: #111; border-color: var(--acc); font-weight: 700; }
.exgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.excard { padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.excard b { font-size: .92rem; } .excard small { color: var(--mu); font-size: .75rem; }
.excard.hard { opacity: .6; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet-body { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--bg2);
  border-radius: 24px 24px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.x { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 50%; background: var(--card); font-size: 1.1rem; z-index: 2; }
.cues { padding-left: 1.2em; margin: 12px 0; } .cues li { margin: 6px 0; }

/* forma */
.intro { margin-top: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .85rem; color: var(--mu); font-weight: 600; }
input[type=number], input[type=text], input:not([type]), input[type=time], select {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 1rem; }
input:focus, select:focus { outline: 2px solid var(--acc); outline-offset: 1px; }
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 11px 6px; border-radius: 10px; font-weight: 600; }
.seg input:checked + span { background: var(--acc); color: #111; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); }
.opt small { color: var(--mu); }
.opt input:checked + span { border-color: var(--acc); background: #222a14; }
.switch, .check { display: flex; align-items: center; gap: 12px; }
.switch input { appearance: none; flex: 0 0 52px; width: 52px; height: 30px; border-radius: 999px; background: var(--line); position: relative; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--acc); } .switch input:checked::after { left: 25px; background: #111; }
.switch span { display: flex; flex-direction: column; } .switch small { color: var(--mu); font-size: .85rem; }
.check { align-items: flex-start; font-size: .88rem; color: var(--mu); }
.check input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--acc); margin-top: 2px; }
.err { color: var(--bad); background: #2a1515; padding: 10px 14px; border-radius: 12px; margin: 0; }
.inline { display: flex; gap: 8px; margin-top: 10px; } .inline input { flex: 1; }

/* statistika */
.big { font-size: 1.6rem; }
.bmibar { position: relative; height: 12px; border-radius: 999px; margin: 10px 0 4px;
  background: linear-gradient(90deg, #4ea8ff 0 14%, #5fd35f 14% 40%, #ffc23d 40% 60%, #ff5d5d 60%); }
.bmibar i { position: absolute; top: -5px; width: 6px; height: 22px; margin-left: -3px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 2px var(--bg); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.kv:last-child { border-bottom: 0; } .kv span { color: var(--mu); }
.kv.hl b { color: var(--acc); font-size: 1.1rem; }
.macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; text-align: center; }
.macros div { background: var(--bg2); border-radius: 12px; padding: 8px 2px; } .macros b { display: block; } .macros small { color: var(--mu); font-size: .72rem; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; margin: 12px 0 0; }
.bars div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.bars i { width: 100%; min-height: 3px; border-radius: 6px 6px 2px 2px; background: linear-gradient(var(--acc), #7ea21f); }
.bars small { font-size: .68rem; color: var(--mu); order: -1; } .bars span { font-size: .75rem; color: var(--mu); }
.zone b { padding: 2px 10px; border-radius: 8px; }
.z1 b { background: #23324a; } .z2 b { background: #1f3a24; } .z3 b { background: #44391a; } .z4 b { background: #4a1f1f; }
.wchart { width: 100%; height: 110px; } .wchart polyline { fill: none; stroke: var(--acc); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }

/* podsetnik */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.days button { padding: 10px 0; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: .8rem; font-weight: 600; }
.days .on { background: var(--acc); color: #111; border-color: var(--acc); }
.switch.big b { font-size: 1.05rem; }
.next { background: var(--bg2); padding: 10px 12px; border-radius: 12px; margin: 12px 0 0; }

/* profil */
.prow { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.prow button:first-child { flex: 1; text-align: left; padding: 12px 0; }
.prow.on button:first-child { font-weight: 700; }
.del { padding: 10px; }
.disclaimer { text-align: center; padding: 0 8px; }

/* plejer */
.fullscreen { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column;
  padding: calc(12px + var(--safe-t)) 16px calc(16px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.pl-top { display: flex; justify-content: space-between; align-items: center; min-height: 44px; color: var(--mu); font-weight: 600; }
.pl-top .x { position: static; }
.prog { height: 6px; background: var(--card); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.prog i { display: block; height: 100%; background: var(--acc); transition: width .3s; }
.pl-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; overflow: hidden; }
.pl-center .fig.big { max-height: 38vh; width: auto; max-width: 100%; }
.pl-center.rest .fig { max-width: 200px; }
.reps { font-size: 4.5rem; font-weight: 900; line-height: 1; color: var(--acc); }
.reps small { display: block; font-size: 1rem; color: var(--mu); font-weight: 600; }
.cue { color: var(--mu); font-size: .95rem; max-width: 340px; }
.ring-wrap { position: relative; width: 150px; height: 150px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--card); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--acc); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 0; transition: stroke-dashoffset .2s linear; }
.ring-txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; font-weight: 800; }
.pl-actions { display: flex; gap: 10px; } .pl-actions .btn { flex: 1; min-height: 58px; } .pl-actions .btn.big { flex: 2.4; }
.done .trophy { font-size: 4.5rem; } .done .grid3 { width: 100%; }

/* alarm */
.alarm { background: radial-gradient(circle at 50% 20%, #2b3612, var(--bg) 70%); justify-content: center; }
.alarm-inner { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.alarm-inner .strip { justify-content: center; }
.pulse { font-size: 4rem; animation: shake .5s infinite alternate; }
@keyframes shake { from { transform: rotate(-12deg) scale(1); } to { transform: rotate(12deg) scale(1.1); } }

.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--nav) + var(--safe-b) + 16px); transform: translateX(-50%);
  background: var(--tx); color: #111; padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.4); }

@media (max-width: 360px) { .row3 { grid-template-columns: 1fr 1fr; } .macros { grid-template-columns: 1fr 1fr; } }
@media (min-width: 600px) { .exgrid { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---- načini prikaza vežbi ---- */
.modes button { font-size: .82rem; padding: 7px 12px; }
.fig.v-solid .limb { stroke-width: 14; }
.fig.v-solid .near { stroke: #d9ff6b; } .fig.v-solid .far { stroke: #58701f; }
.fig.v-solid .head { r: 11px; fill: #d9ff6b; }
.fig .joint { fill: #0f1115; stroke: #d9ff6b; stroke-width: 1.5; }
.fig.v-muscle .limb { stroke: #5c6678; } .fig.v-muscle .far { stroke: #3c4452; }
.fig.v-muscle .head { fill: #5c6678; }
.fig.v-muscle .hot { stroke: var(--acc2); animation: glow 1.2s ease-in-out infinite alternate; }
.fig.v-muscle .far.hot { stroke: #b85a22; }
@keyframes glow { from { filter: drop-shadow(0 0 1px var(--acc2)); } to { filter: drop-shadow(0 0 6px var(--acc2)); } }
.fig.v-ghost .ghosts .limb { stroke: #3d4a24; stroke-width: 5; }
.fig.v-ghost .ghosts .head { fill: #3d4a24; }
.steps { display: flex; align-items: center; gap: 2px; width: 100%; }
.steps .fig { flex: 1; min-width: 0; background: var(--bg2); border-radius: 10px; }
.steps .arrow { color: var(--acc); font-weight: 900; font-size: 1.2rem; }
.fig .stepno { fill: var(--acc); font: 800 18px system-ui, sans-serif; }
.steps.small { margin: 4px 0 8px; }
.steps-lbl { margin: 10px 0 0; }
.excard .steps .arrow { font-size: .9rem; }
.brand b { color: var(--acc2); }
