/* Biomechanika – štýl „Zápisník“: papier, atrament, žiadne farby okrem guličky závažnosti. */

:root {
  --paper: #EFECE2;
  --ink: #141414;
  --muted: #6A665D;
  --fab: #B9B4A8;
  --s1: #A9C5EC; /* bolí trochu */
  --s2: #E8A23A; /* bolí stredne */
  --s3: #E5372B; /* bolí veľmi */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: 'Pangolin', 'Patrick Hand', 'Comic Sans MS', cursive;
  font-size: 18px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; } /* nič v appke nie je podčiarknuté */

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

.page {
  position: relative;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 28px calc(env(safe-area-inset-bottom) + 124px);
}

/* ---------- spoločné ---------- */

.muted { color: var(--muted); }
.small { font-size: 16px; }
.center { text-align: center; }

.label {
  margin: 18px 0 2px;
  font-size: 17px;
  color: var(--muted);
}

/* Textové tlačidlá: nikdy nepodčiarknuté. Že sa dajú ťuknúť, ukazuje pohyb (časť „pohyb“ na konci). */
.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  text-decoration: none;
}
.link.plain { gap: 10px; padding-left: 0; }
.link.quiet { color: var(--muted); }

.dot {
  flex: none;
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--muted);
}
.dot.s1 { background: var(--s1); }
.dot.s2 { background: var(--s2); }
.dot.s3 { background: var(--s3); }

.squiggle { display: block; margin: 16px auto 0; }
.avatar { flex: none; display: block; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  margin: -10px -10px 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

/* ---------- domov ---------- */

/* Logo: Tomášov znak z biomechanika.sk, len v čiernej. */
.logo { display: flex; justify-content: center; }
.logo img { display: block; width: 64px; height: auto; }

/* Pole na meno: len rovná čiara a blikajúci kurzor, žiadny text. */
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  border-bottom: 1.5px solid var(--ink);
}
.search input {
  flex: 1;
  min-width: 0;
  height: 60px;
  padding: 0;
  border: 0;
  outline: 0;
  border-radius: 0;
  background: none;
  font: inherit;
  font-size: 40px;
  line-height: 60px;
  color: var(--ink);
  caret-color: var(--ink);
}
.search .caret {
  position: absolute;
  left: 0;
  top: 10px;
  width: 2px;
  height: 40px;
  background: var(--ink);
  animation: blink 1.1s steps(1, end) infinite;
  pointer-events: none;
}
.search:focus-within .caret, .has-text .caret { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.search .cancel { display: none; flex: none; }
.is-searching .search .cancel { display: inline-flex; }

#list { margin-top: 14px; }
.none { margin: 6px 0; color: var(--muted); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  text-decoration: none;
}
.row .name {
  min-width: 0;
  font-size: 24px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .ago { flex: none; margin-left: auto; font-size: 16px; color: var(--muted); }

.home-foot { display: flex; flex-direction: column; align-items: flex-start; margin-top: 10px; }
.home-foot .link { font-size: 20px; }
.home-foot .reset { margin-top: 18px; font-size: 15px; color: var(--muted); }

/* ---------- profil ---------- */

.who { display: flex; flex-direction: column; align-items: center; margin-top: 2px; text-align: center; }
.who h1 { margin-top: 4px; font-size: 38px; font-weight: 400; line-height: 1.2; }
.who .meta { font-size: 18px; color: var(--muted); }

/* krátky úvod o klientovi, s dostatkom vzduchu */
.brief { margin-top: 24px; font-size: 20px; line-height: 1.55; }

/* rozbaľovacie časti: nadpis je tlačidlo, obsah sa otvorí pod ním */
.folds { margin-top: 20px; }
.fold-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 16px 0;
  text-align: left;
}
.fold-icon { flex: none; display: flex; justify-content: center; width: 30px; margin-top: 3px; }
.fold-icon .figure { margin-top: -8px; }
.spot { fill: var(--muted); stroke: var(--paper); stroke-width: 1.2; }
.spot.s1 { fill: var(--s1); }
.spot.s2 { fill: var(--s2); }
.spot.s3 { fill: var(--s3); }
.fold-title { flex: 1; min-width: 0; font-size: 23px; line-height: 1.3; }
.chev { flex: none; display: flex; margin-top: 5px; color: var(--muted); }
.fold-body { display: grid; grid-template-rows: 0fr; }
.fold.open .fold-body { grid-template-rows: 1fr; }
.fold-clip { overflow: hidden; min-height: 0; }
.fold-inner { padding: 4px 0 26px; opacity: 0; }
.fold.open .fold-inner { opacity: 1; }

/* obsah časti: malá menovka, pod ňou text, medzi položkami výrazná medzera */
/* ikonka stojí v ľavom stĺpci pod ikonkou časti, text je zarovnaný s nadpisom */
.item { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; }
.item + .item { margin-top: 20px; }
.item .i { grid-column: 1; grid-row: 1 / span 2; display: flex; justify-content: center; padding-top: 1px; color: var(--muted); }
.item .bullet { width: 7px; height: 7px; margin-top: 8px; border-radius: 50%; background: var(--muted); }
.item .k { grid-column: 2; margin-bottom: 2px; font-size: 16px; color: var(--muted); }
.item .v, .item .plan { grid-column: 2; font-size: 20px; line-height: 1.5; }
.plan { font-size: 20px; line-height: 1.5; }
.plan li { display: flex; gap: 12px; }
.plan li + li { margin-top: 12px; }
.plan li::before { content: '•'; flex: none; }
.fold-inner .add { margin: 22px 0 0 42px; }
.fold-inner #notes { padding-left: 42px; }

/* pravý okraj nechávame voľný, aby riadok neskončil pod tlačidlom mikrofónu */
.add { display: flex; align-items: flex-end; gap: 10px; margin-top: 6px; padding-right: 76px; }
.add input {
  flex: 1;
  min-width: 0;
  padding: 6px 0 4px;
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 19px;
  color: var(--ink);
}
.add input::placeholder { color: var(--muted); opacity: 1; }
.add input:focus { border-bottom-width: 3px; padding-bottom: 2.5px; }

.note { display: flex; align-items: center; gap: 10px; min-height: 52px; padding-right: 76px; font-size: 19px; line-height: 1.2; }
.note .info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.note .play {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -8px;
}
.note .state { font-size: 15px; color: var(--muted); }
.note .icon-btn { flex: none; color: var(--muted); }

.fab {
  position: fixed;
  right: max(26px, calc(50vw - 215px + 26px));
  bottom: calc(34px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--fab);
}

/* ---------- naposledy, návštevy, tréning ---------- */

/* to, čo si Tomáš číta pred klientom: čo bolo naposledy, čo má na doma a čo skontrolovať */
.last { margin-top: 30px; }
.item .more, .item .said, .item .exs { grid-column: 2; }
.more { margin-top: 10px; font-size: 17px; line-height: 1.45; }
.more dt { margin-top: 10px; font-size: 15px; color: var(--muted); }
.said { margin-top: 12px; font-size: 16px; line-height: 1.5; color: var(--muted); }
.said summary { display: inline-flex; align-items: center; min-height: 36px; list-style: none; cursor: pointer; }
.said summary::-webkit-details-marker { display: none; }
.said summary::after { content: '›'; margin-left: 8px; }
.said[open] summary::after { content: '⌄'; }
.exs { margin-top: 6px; padding-left: 26px; font-size: 19px; line-height: 1.45; list-style: decimal; }
.exs li + li { margin-top: 22px; }
.exs p + p { margin-top: 4px; }
.ex-name { font-size: 21px; }
.fold-inner .pad { margin: 18px 0 0 42px; }
.fold-inner > .pad:first-child { margin-top: 0; }
button:disabled { opacity: 0.55; }

/* ---------- prepis a výber osoby ---------- */

.home { padding-bottom: 96px; }
.home.is-searching .fab { display: none; }
#inbox .link { margin-top: 8px; font-size: 18px; color: var(--muted); }

.proc { margin-top: 10px; }
.proc .lead { margin-top: 22vh; font-size: 26px; line-height: 1.3; text-align: center; }
.proc .lead + .wave { margin-top: 22px; }
.proc .lead ~ .muted { margin-top: 18px; }
.proc .brief { margin-top: 14px; }
.proc-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 36px; }
.picks { margin-top: 18px; }
.picks li { display: flex; align-items: center; gap: 4px; }
.picks li + li { margin-top: 16px; }
.pickrow { flex: 1; min-width: 0; text-align: left; }
.who2 { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.who2 .sub { font-size: 16px; line-height: 1.3; color: var(--muted); }
.picks .icon-btn { flex: none; color: var(--muted); }
.proc-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 22px; }
.proc-foot .label { margin-top: 10px; }
.proc-foot .picks { align-self: stretch; margin-top: 0; }

/* ---------- nahrávanie ---------- */

.rec {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100dvh - 160px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding-top: 28px;
  text-align: center;
}
.rec .lead { font-size: 26px; }
.timer { margin: 22px 0 12px; font-size: 84px; line-height: 1; font-variant-numeric: tabular-nums; }
.rec .saving { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--muted); }
.hints { margin-top: 28px; text-align: left; font-size: 22px; line-height: 1.9; }
.hints li::before { content: '•'; margin-right: 16px; }
.rec .controls { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: auto; padding-top: 28px; }
.stop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--ink);
}
.stop span { width: 26px; height: 26px; border-radius: 5px; background: var(--paper); }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ---------- formulár ---------- */
/* Navrchu len to, čo treba hneď: kto to je a čo ho trápi. Ostatné sa otvára ťuknutím. Medzi poľami je vzduch. */

.form-title { margin-top: 6px; font-size: 32px; font-weight: 400; line-height: 1.2; }

/* postava: ťuknutím sa mení účes, vedľa nej žena / muž */
.look { display: flex; align-items: center; gap: 22px; margin-top: 26px; }
.face-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 64px; color: var(--muted); }
.face-btn > span { display: flex; }

.field { display: flex; flex-direction: column; margin-top: 34px; }
.field.short { width: 96px; }
.field > span, fieldset legend { padding: 0; font-size: 16px; color: var(--muted); }
.field input, .prob input[type='text'] {
  width: 100%;
  padding: 10px 0 6px;
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 22px;
  color: var(--ink);
}
.field input::placeholder, .prob input::placeholder { color: var(--muted); opacity: 0.75; font-size: 18px; }
.field input:focus, .prob input[type='text']:focus { border-bottom-width: 3px; padding-bottom: 4.5px; }

/* dlhší text: pole rastie s obsahom */
.field textarea, .prob textarea {
  display: block;
  width: 100%;
  min-height: 1lh;
  padding: 10px 0 6px;
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 20px;
  line-height: 1.4;
  color: var(--ink);
  resize: none;
  field-sizing: content;
}
.field textarea::placeholder, .prob textarea::placeholder { color: var(--muted); opacity: 0.75; font-size: 17px; }
.field textarea:focus, .prob textarea:focus { border-bottom-width: 3px; padding-bottom: 4.5px; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

.pick { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.pick label { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--muted); cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick input:checked ~ .t { color: var(--ink); }
.pick input:checked + .dot { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ink); }
.pick label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

/* čo klienta trápi: jeden problém hneď, ďalšie sa pridávajú */
.probs { margin-top: 46px; }
.prob { margin-top: 6px; }
.prob + .prob { margin-top: 40px; }
.prob input[type='text'] + input[type='text'] { margin-top: 18px; }
.prob .pick { margin-top: 18px; }
.prob textarea { min-height: 3lh; }
.add-prob { margin-top: 20px; }

/* rozbaľovacie časti vo formulári; „podrobnosti“ sú menšie a bez ikonky */
form .folds { margin-top: 30px; }
form .fold-inner .field { margin: 0 0 0 42px; }
form .fold-inner .field + .field { margin-top: 28px; }
.fold.plain .fold-head { align-items: center; min-height: 44px; margin-top: 6px; padding: 0; color: var(--muted); }
.fold.plain .fold-title { flex: none; font-size: 18px; }
.fold.plain .chev { margin-top: 0; }
.fold.plain .fold-inner { padding: 6px 0 4px; }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 40px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 32px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 22px;
}
.danger { margin-top: 36px; font-size: 16px; color: var(--muted); }

/* ---------- oznam ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(118px + env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 40px));
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 17px;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.14s var(--ease-in), transform 0.14s var(--ease-in);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out); }

/* ---------- pohyb ---------- */
/*
  Zásady: čo spustí ťuknutie, trvá do 300 ms. Hýbe sa len transform a opacity.
  Stlačenie prvok stlačí (0.95), pustenie ho vráti pružinou s malým prekmitom.
  Pri myši sa prvok zväčší, aby bolo vidno, že sa dá ťuknúť. Nič sa nepodčiarkuje.
*/
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --press: 90ms;
  --release: 280ms;
}
/* skutočná pružina (tlmenie 0.6, prekmit asi 9 %), kde ju prehliadač vie */
@supports (transition-timing-function: linear(0, 1)) {
  :root { --spring: linear(0, 0.108 5%, 0.34 10%, 0.594 15%, 0.81 20%, 0.963 25%, 1.052 30%, 1.09 35%, 1.093 40%, 1.076 45%, 1.052 50%, 1.011 60%, 0.993 70%, 0.992 80%, 0.996 90%, 1); }
}

/* všetko stlačiteľné má rovnaký čas a rovnakú pružinu */
.link, .icon-btn, .fab, .stop, .btn, .play, .face-btn, .pick label, .row {
  transition: transform var(--release) var(--spring);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.link.plain, .pick label { transform-origin: left center; }
.link.plain svg, .row .avatar, .row .name, .row .dot, .pick .t, .pick .dot {
  transition: transform var(--release) var(--spring), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.row .name, .pick .t { transform-origin: left center; }
.row .dot { transition-delay: 40ms; } /* gulička dobehne o chvíľu neskôr */

/* myš: zväčšenie a malý náznak, čo tlačidlo spraví */
@media (hover: hover) and (pointer: fine) {
  .link:hover, .btn:hover { transform: scale(1.06); }
  .icon-btn:hover, .play:hover, .face-btn:hover { transform: scale(1.14); }
  .fab:hover, .stop:hover { transform: scale(1.08); }
  .icon-btn.back:hover { transform: translateX(-4px) scale(1.1); }
  .icon-btn.edit:hover { transform: rotate(-12deg) scale(1.14); }
  .icon-btn.close:hover { transform: rotate(90deg) scale(1.14); }
  .link.plain:hover svg { transform: rotate(90deg); }
  .row:hover .avatar { transform: scale(1.14) rotate(-5deg); }
  .row:hover .name { transform: translateX(4px); }
  .row:hover .dot { transform: scale(1.5); }
}

/* stlačenie: rýchle a krátke, pustenie sa vráti pružinou */
.link:active, .icon-btn:active, .fab:active, .stop:active, .btn:active, .play:active, .face-btn:active, .pick label:active {
  transform: scale(0.95);
  transition-duration: var(--press);
  transition-timing-function: var(--ease-out);
}
.row:active {
  transform: scale(0.98);
  transition-duration: var(--press);
  transition-timing-function: var(--ease-out);
}
.row:active .avatar { transform: scale(0.94); }

/* vybraná možnosť vo formulári: tmavšia a väčšia, bez podčiarknutia */
.pick input:checked ~ .t { transform: scale(1.14); }
.pick input:checked + .dot { transform: scale(1.2); margin-right: 5px; }

/* pole na meno: pri ťuknutí sa čiara dokreslí zľava a zhrubne */
.search::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1.5px;
  height: 1.5px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 200ms var(--ease-out);
}
.search:focus-within::after { transform: scaleX(1); }
.is-searching .search .cancel { animation: pop var(--release) var(--spring) backwards; }

/* príchod obrazovky: obsah vystúpi, zoznam po riadkoch, drobnosti dobehnú */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes wave { to { transform: translateX(-16px); } }

.page.enter > :not(.fab):not(.home) { animation: rise 220ms var(--ease-out) backwards; }
.page.enter .stagger > li { animation: rise 240ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 28ms); }
.page.enter .logo, .page.enter .rec .timer { animation: pop var(--release) var(--spring) backwards; }
.page.enter .who .avatar { animation: pop var(--release) var(--spring) 60ms backwards; }
.page.enter .fab, .page.enter .stop { animation: pop var(--release) var(--spring) 120ms backwards; }
.page.enter .squiggle path { stroke-dasharray: 1; animation: draw 300ms var(--ease-out) 120ms backwards; }
#face .avatar { animation: pop var(--release) var(--spring); }
.prob.added { animation: rise 220ms var(--ease-out); }

/* počas nahrávania vlnka plynie */
.wave { display: block; margin: 16px auto 0; overflow: hidden; }
.wave path { animation: wave 1.1s linear infinite; }

/* rozbaľovanie: obsah sa vysunie, šípka sa pootočí pružinou */
.fold-body { transition: grid-template-rows 240ms var(--ease-out); }
.fold-inner { transition: opacity 200ms var(--ease-out); }
.chev, .fold-head .fold-title, .fold-icon { transition: transform var(--release) var(--spring); }
.fold.open .chev { transform: rotate(90deg); }
button.fold-head { transition: transform var(--release) var(--spring); transform-origin: left center; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
@media (hover: hover) and (pointer: fine) {
  button.fold-head:hover .fold-title { transform: translateX(4px); }
  button.fold-head:hover .fold-icon { transform: scale(1.18) rotate(-6deg); }
  button.fold-head:hover .chev { transform: scale(1.3); }
  .fold.open button.fold-head:hover .chev { transform: rotate(90deg) scale(1.3); }
}
button.fold-head:active { transform: scale(0.98); transition-duration: var(--press); transition-timing-function: var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
