/* iOS: hover-ефекти обгорнуто в (hover: hover), щоб не «залипали» після дотику */
/* ============ XFIT — сторінка «Тренування»: таймер і щоденник ============ */
:root{
  --work: #39ff6a;
  --rest: #ffb020;
  --prep: #f4f6f4;
  --chart-line: #22b04a; /* перевірено валідатором: смуга світлоти та контраст на темному тлі */
}

.train-page{ min-height: 100vh; padding-bottom: max(32px, env(safe-area-inset-bottom, 0px)); }

/* ---------- Шапка ---------- */
.train-bar{
  position: sticky; top: 0; z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(6,7,6,0.85); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.train-bar__inner{ display:flex; align-items:center; justify-content:space-between; gap: 16px; height: 64px; }
.train-bar__back{ display:flex; align-items:center; gap: 6px; }
.train-bar__back .logo__svg{ height: 28px; }
.train-bar__arrow{ width:20px; height:20px; fill:none; stroke: var(--muted); stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; transition: stroke .2s, transform .2s; }
@media (hover: hover) and (pointer: fine){ .train-bar__back:hover .train-bar__arrow{ stroke: var(--green); transform: translateX(-2px); } }
.train-tabs{ display:flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); }
.train-tab{
  font: 600 .88rem var(--font-body); color: var(--muted); background: transparent; border: 0;
  padding: 9px 18px; border-radius: 999px; cursor: pointer; transition: color .2s, background .2s;
}
.train-tab[aria-selected="true"]{ background: var(--green); color: #04140a; }
.train-tab:focus-visible{ outline: 2px solid var(--green); outline-offset: 2px; }

.train-main{ max-width: 720px; padding-top: 28px; }
.train-panel[hidden]{ display:none; }

/* ---------- Режими ---------- */
.modes{ display:flex; gap: 8px; overflow-x:auto; padding-bottom: 4px; scrollbar-width: none; }
.modes::-webkit-scrollbar{ display:none; }
.mode, .ranges button, .presets button{
  flex-shrink: 0; font: 600 .84rem var(--font-body); color: var(--white); cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px;
  transition: border-color .2s, color .2s, background .2s;
}
@media (hover: hover) and (pointer: fine){ .mode:hover, .ranges button:hover, .presets button:hover{ border-color: rgba(57,255,106,0.5); } }
.mode[aria-checked="true"], .ranges button[aria-checked="true"], .presets button.is-active{
  border-color: var(--green); color: var(--green); background: rgba(57,255,106,0.08);
}
.mode:focus-visible, .ranges button:focus-visible, .presets button:focus-visible{ outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- Циферблат ---------- */
.timer{ --phase-color: var(--prep); display:flex; flex-direction:column; align-items:center; margin: 28px 0 8px; }
.timer[data-phase="work"]{ --phase-color: var(--work); }
.timer[data-phase="rest"]{ --phase-color: var(--rest); }
.timer[data-phase="done"]{ --phase-color: var(--work); }
.timer__dial{ position:relative; width: min(78vw, 320px); aspect-ratio: 1; }
.timer__ring{ width:100%; height:100%; transform: rotate(-90deg); }
.timer__track{ fill:none; stroke: rgba(255,255,255,0.07); stroke-width: 10; }
.timer__progress{
  fill:none; stroke: var(--phase-color); stroke-width: 10; stroke-linecap: round;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--phase-color) 35%, transparent));
  transition: stroke .3s;
}
.timer__center{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap: 6px; text-align:center; }
.timer__phase{
  font-size: .78rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--phase-color);
  transition: color .3s;
}
.timer__time{
  font-family: var(--font-display); font-weight: 700; font-size: clamp(3.2rem, 17vw, 4.6rem);
  line-height: 1; color: var(--white); font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.timer__round{ font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.timer__total{ min-height: 1.4em; margin: 10px 0 0; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.timer[data-phase="work"] .timer__dial{ animation: none; }
.timer.is-flash .timer__dial{ animation: phaseFlash .5s ease-out; }
@keyframes phaseFlash{ 0%{ transform: scale(1.04); } 100%{ transform: none; } }

.timer__controls{ display:flex; align-items:center; gap: 22px; margin-top: 18px; }
.ctl{
  display:inline-flex; align-items:center; justify-content:center; border-radius:50%; cursor:pointer; padding:0;
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
}
.ctl:active{ transform: scale(.94); }
.ctl:focus-visible{ outline: 2px solid var(--green); outline-offset: 3px; }
.ctl svg{ width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ctl--ghost{ width: 56px; height: 56px; color: var(--white); background: var(--panel); border: 1px solid var(--border); }
@media (hover: hover) and (pointer: fine){ .ctl--ghost:hover{ border-color: rgba(57,255,106,0.5); } }
.ctl--main{
  width: 84px; height: 84px; color: #04140a; background: var(--green); border: 0;
  box-shadow: 0 12px 34px -10px var(--green-glow);
}
.ctl--main svg{ width: 32px; height: 32px; fill: currentColor; stroke: none; }
.ctl--main .ico-pause{ display:none; }
.timer.is-running .ctl--main .ico-play{ display:none; }
.timer.is-running .ctl--main .ico-pause{ display:block; }

.laps{ list-style:none; margin: 18px 0 0; padding:0; width: min(100%, 320px); display:flex; flex-direction:column; gap: 6px; max-height: 220px; overflow-y:auto; }
.laps[hidden]{ display:none; }
.laps li{ display:flex; justify-content:space-between; padding: 8px 14px; border-radius: 10px; background: var(--panel); font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--muted); }
.laps li b{ color: var(--white); font-weight: 600; }

/* ---------- Налаштування ---------- */
.settings{
  margin-top: 26px; display:flex; flex-direction:column; gap: 2px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 18px;
  transition: opacity .25s;
}
.timer.is-running ~ .settings, .settings.is-locked{ opacity: .45; pointer-events: none; }
.setting{ display:flex; align-items:center; justify-content:space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.setting:last-of-type{ border-bottom: 0; }
.setting[hidden]{ display:none; }
.setting__label{ font-weight: 600; color: var(--white); }
.stepper{ display:flex; align-items:center; gap: 6px; }
.stepper button{
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg);
  color: var(--white); font: 600 1.2rem var(--font-body); cursor: pointer; transition: border-color .2s, color .2s;
}
@media (hover: hover) and (pointer: fine){ .stepper button:hover{ border-color: var(--green); color: var(--green); } }
.stepper button:focus-visible{ outline: 2px solid var(--green); outline-offset: 2px; }
.stepper output{ min-width: 64px; text-align:center; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.setting--presets{ flex-wrap: wrap; }
.presets{ display:flex; gap: 6px; flex-wrap: wrap; justify-content:flex-end; }
.presets button{ padding: 7px 12px; font-size: .8rem; }
.toggles{ display:flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 0 8px; }
.toggle{ display:inline-flex; align-items:center; gap: 8px; cursor:pointer; color: var(--muted); font-size: .9rem; }
.toggle input{ width: 18px; height: 18px; accent-color: var(--green); }

/* ---------- Щоденник ---------- */
.log-h{ font-size: 1rem; margin: 0 0 14px; }
.stats__caption{ margin: 0 0 10px; font-size:.72rem; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color: var(--muted); }
.stats{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 22px; }
.stat-tile{ background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 12px 12px; min-width:0; }
.stat-tile b{ display:block; font-family: var(--font-display); font-size: clamp(1rem, 4.6vw, 1.35rem); line-height:1.15; color: var(--white); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-tile span{ display:block; font-size: clamp(.68rem, 3.3vw, .8rem); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.log-form, .log-section{
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  display:flex; flex-direction:column; gap: 14px; margin-bottom: 18px;
}
.log-form .log-h, .log-section .log-h{ margin: 0; }
.log-form__row{ display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.log-form__row:first-of-type{ grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.field{ display:flex; flex-direction:column; gap: 6px; min-width:0; }
.field > span{ font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.field input, .field select{
  width:100%; min-width:0; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; color: var(--white);
  font: 500 1rem var(--font-body); padding: 12px 14px; color-scheme: dark;
}
.field input:focus, .field select:focus{ outline:none; border-color: var(--green); }
.stepper--input{ gap: 6px; }
.stepper--input input{ text-align:center; font-family: var(--font-display); font-weight: 700; padding: 10px 4px; -moz-appearance: textfield; }
.stepper--input input::-webkit-inner-spin-button, .stepper--input input::-webkit-outer-spin-button{ -webkit-appearance: none; margin: 0; }
.stepper--input button{ flex-shrink: 0; height: 46px; }

.log-section__head{ display:flex; align-items:center; justify-content:space-between; gap: 12px; flex-wrap: wrap; }
.ranges{ display:flex; gap: 6px; }
.ranges button{ padding: 7px 12px; font-size: .8rem; }

.chart{ position:relative; min-height: 200px; }
.chart svg{ display:block; width:100%; height: 220px; overflow: visible; }
.chart .grid line{ stroke: rgba(255,255,255,0.06); }
.chart .axis text{ fill: var(--muted); font: 500 11px var(--font-body); }
.chart .line{ fill:none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area{ fill: url(#chartFill); }
.chart .dot{ fill: var(--chart-line); stroke: var(--panel); stroke-width: 2; }
.chart .dot--last{ r: 5; }
.chart .cross{ stroke: rgba(255,255,255,0.25); stroke-dasharray: 3 3; }
.chart .hit{ fill: transparent; cursor: crosshair; }
.chart-tip{
  position:absolute; pointer-events:none; transform: translate(-50%, -110%);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px;
  font-size: .8rem; color: var(--white); white-space: nowrap; box-shadow: 0 10px 30px -10px rgba(0,0,0,.8);
}
.chart-tip span{ display:block; color: var(--muted); font-size: .72rem; }
.chart-empty{ display:flex; align-items:center; justify-content:center; min-height: 160px; text-align:center; color: var(--muted); font-size: .9rem; border: 1px dashed var(--border); border-radius: 14px; padding: 16px; }
.chart-stats{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.chart-stats div{ background: var(--bg); border-radius: 12px; padding: 10px 12px; min-width:0; }
.chart-stats b{ display:block; font-family: var(--font-display); font-size: clamp(.85rem, 3.8vw, 1rem); line-height:1.2; color: var(--white); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart-stats span{ font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.history{ display:flex; flex-direction:column; gap: 16px; }
.day__head{ display:flex; justify-content:space-between; align-items:baseline; gap: 10px; margin-bottom: 8px; }
.day__date{ font-weight: 700; color: var(--white); }
.day__meta{ font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ex{ padding: 10px 0; border-top: 1px solid var(--border); }
.ex__name{ font-weight: 600; margin-bottom: 8px; display:flex; justify-content:space-between; gap: 8px; }
.ex__name small{ color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.sets{ display:flex; flex-wrap: wrap; gap: 6px; }
.set-chip{
  display:inline-flex; align-items:center; gap: 4px; padding: 5px 6px 5px 11px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); font-size: .84rem; font-variant-numeric: tabular-nums;
}
.set-chip button{
  width: 22px; height: 22px; border-radius: 50%; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; font-size: .9rem; line-height: 1;
}
@media (hover: hover) and (pointer: fine){ .set-chip button:hover{ color: #ff8080; background: rgba(255,92,92,0.12); } }
.history-empty{ color: var(--muted); font-size: .9rem; text-align:center; padding: 18px; border: 1px dashed var(--border); border-radius: 14px; }
.history-more{ align-self: center; }

.log-backup p{ margin: 0; font-size: .9rem; }
.backup-actions{ display:flex; gap: 10px; flex-wrap: wrap; }
.backup-actions .btn{ padding: 11px 20px; font-size: .88rem; cursor: pointer; }
.backup-note{ min-height: 1.2em; color: var(--green); }

.train-toast{
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; visibility: hidden; pointer-events: none;
  background: var(--panel); border: 1px solid rgba(57,255,106,0.5); color: var(--green);
  padding: 11px 20px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  transition: transform .3s, opacity .3s, visibility .3s;
}
.train-toast.show{ transform: translate(-50%, 0); opacity: 1; visibility: visible; }

@media (max-width: 520px){
  .train-tab{ padding: 8px 14px; font-size: .84rem; }
  .train-bar__back .logo__svg{ height: 24px; }
  .log-form__row:first-of-type{ grid-template-columns: minmax(0,1fr); }
  .settings{ padding: 6px 14px; }
  .stepper output{ min-width: 54px; }
}

/* ---------- Доступ лише з активною картою ---------- */
.train-lock{ padding-top: 40px; padding-bottom: 40px; max-width: 520px; }
.train-lock[hidden]{ display:none; }
.train-lock__box{
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 24px;
  display:flex; flex-direction:column; gap: 16px; text-align:center; align-items:center;
}
.train-lock__icon{ width: 64px; height: 64px; border-radius: 20px; display:flex; align-items:center; justify-content:center; background: rgba(57,255,106,0.1); border:1px solid rgba(57,255,106,0.35); }
.train-lock__icon svg{ width: 30px; height: 30px; fill:none; stroke: var(--green); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.train-lock__title{ font-size: 1.3rem; line-height: 1.2; text-wrap: balance; }
.train-lock__text{ margin: 0; max-width: 40ch; }
.train-lock__steps{ list-style:none; counter-reset: s; margin: 4px 0 8px; padding: 0; display:flex; flex-direction:column; gap: 10px; text-align:left; width:100%; }
.train-lock__steps li{ counter-increment: s; position:relative; padding-left: 38px; color: var(--muted); font-size:.92rem; line-height:1.45; }
.train-lock__steps li::before{
  content: counter(s); position:absolute; left:0; top:-1px; width: 26px; height: 26px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:.8rem;
  background: rgba(57,255,106,0.12); color: var(--green); border: 1px solid rgba(57,255,106,0.4);
}
.train-lock__steps li.is-done{ color: var(--white); }
.train-lock__steps li.is-done::before{ content: "✓"; background: var(--green); color: #04140a; }
body.is-locked .train-tabs{ visibility: hidden; }

/* ============ «Мої тренування»: запис підходів ============ */
.workout{
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  display:flex; flex-direction:column; gap: 14px; margin-bottom: 18px;
}
.workout__head{ display:flex; align-items:center; justify-content:space-between; gap: 10px; }
.workout__head .log-h{ margin:0; font-size: 1.1rem; }
.date-chip{
  position:relative; display:inline-flex; align-items:center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg); color: var(--white); font-size: .84rem; font-weight: 600; cursor: pointer;
}
.date-chip svg{ width: 16px; height: 16px; fill:none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; }
.date-chip input{ position:absolute; inset:0; opacity:0; width:100%; height:100%; cursor:pointer; color-scheme: dark; }

.howto{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.howto[hidden]{ display:none; }
.howto li{ display:flex; flex-direction:column; align-items:center; gap: 6px; text-align:center; padding: 12px 8px; border-radius: 14px; background: var(--bg); font-size: .8rem; color: var(--muted); line-height:1.3; }
.howto b{ width: 30px; height: 30px; border-radius: 50%; display:grid; place-items:center; background: rgba(57,255,106,0.12); border: 1px solid rgba(57,255,106,0.45); color: var(--green); font-family: var(--font-display); }

.pick-btn{
  display:flex; align-items:center; gap: 14px; width:100%; text-align:left; cursor:pointer;
  padding: 16px 18px; border-radius: 18px; border: 1.5px dashed rgba(57,255,106,0.55); background: rgba(57,255,106,0.06);
  color: var(--white); font: inherit; transition: background .2s, border-color .2s, transform .15s;
}
.pick-btn[hidden]{ display:none; }
@media (hover: hover) and (pointer: fine){ .pick-btn:hover{ background: rgba(57,255,106,0.1); border-style: solid; } }
.pick-btn:active{ transform: scale(.985); }
.pick-btn__plus{ flex:none; width: 46px; height: 46px; border-radius: 14px; display:grid; place-items:center; background: var(--green); color:#04140a; font-size: 1.8rem; font-weight: 700; line-height: 1; }
.pick-btn b{ display:block; font-size: 1.05rem; }
.pick-btn small{ display:block; color: var(--muted); font-size: .8rem; margin-top: 2px; }

.today{ display:flex; flex-direction:column; gap: 10px; }
.today:empty{ display:none; }
.today-ex{ border-radius: 16px; background: var(--bg); border: 1px solid var(--border); padding: 10px 12px 12px; }
.today-ex.is-current{ border-color: rgba(57,255,106,0.55); }
.today-ex__head{ display:flex; align-items:center; gap: 10px; width:100%; background:none; border:0; padding: 2px 0 8px; color: var(--white); font: inherit; text-align:left; cursor:pointer; }
.today-ex__head b{ flex:1; min-width:0; font-size: .95rem; }
.today-ex__icon{ font-size: 1.15rem; }
.today-ex__more{ flex:none; font-size: .78rem; font-weight: 700; color: var(--green); padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(57,255,106,0.4); }
.set-chip i{ font-style: normal; font-size: .7rem; color: var(--green); font-weight: 700; margin-right: 2px; }

.current{
  border-radius: 20px; padding: 16px; display:flex; flex-direction:column; gap: 14px;
  background: linear-gradient(160deg, rgba(57,255,106,0.12), rgba(57,255,106,0.02) 60%), var(--bg);
  border: 1px solid rgba(57,255,106,0.45);
}
.current[hidden]{ display:none; }
.current.is-pop{ animation: curPop .35s ease-out; }
@keyframes curPop{ 0%{ transform: scale(.97); opacity: .4; } 100%{ transform:none; opacity:1; } }
.current__top{ display:flex; align-items:center; gap: 12px; }
.current__icon{ flex:none; width: 46px; height: 46px; border-radius: 14px; display:grid; place-items:center; font-size: 1.5rem; background: rgba(57,255,106,0.12); }
.current__title{ flex:1; min-width:0; }
.current__title b{ display:block; font-size: 1.08rem; line-height: 1.25; }
.current__title small{ display:block; color: var(--muted); font-size: .82rem; margin-top: 3px; }
.link-btn{ flex:none; background:none; border:0; color: var(--green); font: 600 .85rem var(--font-body); cursor:pointer; padding: 6px; }

.big-field{ display:flex; flex-direction:column; gap: 8px; }
.big-field__label{ display:flex; align-items:center; justify-content:space-between; }
.big-field__label > span{ font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.chip-toggle{ font: 600 .78rem var(--font-body); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor:pointer; }
.chip-toggle[aria-pressed="true"]{ border-color: var(--green); color: var(--green); background: rgba(57,255,106,0.1); }
.big-stepper{ display:grid; grid-template-columns: 64px minmax(0,1fr) 64px; gap: 10px; align-items:center; }
.big-stepper[hidden]{ display:none; }
.big-stepper > button{
  height: 64px; border-radius: 18px; border: 1px solid var(--border); background: var(--panel); color: var(--white);
  font: 600 1.8rem var(--font-body); cursor:pointer; transition: border-color .15s, transform .1s, color .15s; touch-action: manipulation;
}
.big-stepper > button:active{ transform: scale(.94); border-color: var(--green); color: var(--green); }
.big-stepper__val{ display:flex; align-items:baseline; justify-content:center; gap: 6px; height: 64px; border-radius: 18px; background: var(--panel); border: 1px solid var(--border); cursor:text; }
.big-stepper__val.is-bump{ animation: bump .25s ease-out; }
@keyframes bump{ 50%{ transform: scale(1.06); } }
.big-stepper__val input{
  width: 4.2ch; background: transparent; border: 0; color: var(--white); text-align: right; padding: 0;
  font: 700 2rem var(--font-display); line-height: 64px; height: 64px; -moz-appearance: textfield;
}
.big-stepper__val input:focus{ outline: none; }
.big-stepper__val input::-webkit-inner-spin-button, .big-stepper__val input::-webkit-outer-spin-button{ -webkit-appearance: none; margin: 0; }
.big-stepper__val span{ color: var(--muted); font-size: .9rem; }

.add-set{ font-size: 1.05rem; }
.add-set.is-done{ animation: setDone .5s ease-out; }
.add-set.is-record{ animation: setRecord .9s ease-out; }
@keyframes setDone{ 0%{ transform: scale(.96); } 40%{ box-shadow: 0 0 0 10px rgba(57,255,106,0.25); } 100%{ transform:none; box-shadow: none; } }
@keyframes setRecord{ 0%{ transform: scale(.95); } 30%{ transform: scale(1.04); box-shadow: 0 0 0 14px rgba(255,176,32,0.35); background: #ffb020; } 100%{ transform:none; } }
.current__actions{ display:grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.soft-btn{
  padding: 13px 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); color: var(--white);
  font: 600 .88rem var(--font-body); cursor:pointer; transition: border-color .2s;
}
@media (hover: hover) and (pointer: fine){ .soft-btn:hover{ border-color: rgba(57,255,106,0.5); } }
.soft-btn b{ color: var(--rest); }

/* ---------- Вікно вибору вправи ---------- */
.sheet{ position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0); display:flex; align-items:flex-end; justify-content:center; transition: background .22s; }
.sheet[hidden]{ display:none; }
.sheet.is-open{ background: rgba(0,0,0,0.6); }
.sheet__box{
  width: min(100%, 640px); max-height: 88vh; display:flex; flex-direction:column; gap: 12px;
  background: var(--panel); border: 1px solid var(--border); border-bottom: 0; border-radius: 26px 26px 0 0;
  padding: 18px 16px max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateY(100%); transition: transform .22s ease-out;
}
.sheet.is-open .sheet__box{ transform: none; }
.sheet__head{ display:flex; align-items:center; justify-content:space-between; }
.sheet__head h3{ font-size: 1.1rem; margin:0; }
.sheet__close{ width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); color: var(--white); font-size: 1.4rem; line-height: 1; cursor:pointer; }
.sheet__search{
  width:100%; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; color: var(--white);
  font: 500 1rem var(--font-body); padding: 13px 14px; color-scheme: dark;
}
.sheet__search:focus{ outline:none; border-color: var(--green); }
.cats{ display:flex; gap: 8px; overflow-x:auto; scrollbar-width:none; padding-bottom: 2px; flex:none; }
.cats::-webkit-scrollbar{ display:none; }
.cats[hidden]{ display:none; }
.cat{ flex:none; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--white); font: 600 .84rem var(--font-body); cursor:pointer; white-space: nowrap; }
.cat.is-active{ border-color: var(--green); color: #04140a; background: var(--green); }
.ex-list{ overflow-y:auto; display:flex; flex-direction:column; gap: 6px; min-height: 200px; overscroll-behavior: contain; }
.ex-item{
  display:flex; align-items:center; gap: 12px; width:100%; text-align:left; padding: 13px 14px; border-radius: 14px;
  background: var(--bg); border: 1px solid transparent; color: var(--white); font: 500 .98rem var(--font-body); cursor:pointer;
}
@media (hover: hover) and (pointer: fine){ .ex-item:hover, .ex-item:focus-visible{ border-color: rgba(57,255,106,0.5); outline: none; } }
.ex-item__icon{ flex:none; width: 34px; height: 34px; border-radius: 10px; display:grid; place-items:center; background: rgba(255,255,255,0.05); font-size: 1.1rem; }
.ex-item__name{ flex:1; min-width:0; }
.ex-item small{ flex:none; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.ex-item--add{ border-color: rgba(57,255,106,0.45); }
.ex-item--add .ex-item__icon{ background: var(--green); color: #04140a; font-weight: 700; }
.ex-empty{ color: var(--muted); text-align:center; padding: 20px; margin:0; }
body.sheet-open{ overflow: hidden; }

/* ============ Таймер: «Дихання» ============ */
.mode--breath{ border-color: rgba(122,200,255,0.35); }
.mode--breath[aria-checked="true"]{ border-color: #7ac8ff; color: #7ac8ff; background: rgba(122,200,255,0.08); }
.timer[data-phase="inhale"], .timer[data-phase="hold"], .timer[data-phase="exhale"], .timer[data-phase="hold2"]{ --phase-color: #7ac8ff; }
.timer[data-phase="exhale"]{ --phase-color: #9ef0c0; }
.timer[data-mode="breath"][data-phase="done"]{ --phase-color: #9ef0c0; }
.breath-orb{ display:none; position:absolute; inset: 9%; border-radius: 50%; pointer-events:none; --k: .35; }
.timer[data-mode="breath"] .breath-orb{ display:block; }
.timer[data-mode="breath"] .timer__dial{ cursor: pointer; }
.breath-orb i{
  position:absolute; inset:0; border-radius:50%;
  transform: scale(calc(.42 + var(--k) * .58));
  background: radial-gradient(circle at 50% 40%, rgba(122,200,255,0.42), rgba(122,200,255,0.08) 62%, transparent 72%);
  box-shadow: 0 0 calc(20px + var(--k) * 50px) rgba(122,200,255,0.35);
}
.breath-orb i:nth-child(2){ transform: scale(calc(.32 + var(--k) * .5)); background: radial-gradient(circle, rgba(158,240,192,0.28), transparent 70%); box-shadow:none; }
.breath-orb i:nth-child(3){ transform: scale(calc(.5 + var(--k) * .55)); background: none; border: 1.5px solid rgba(122,200,255, calc(.15 + var(--k) * .35)); box-shadow:none; }
.timer[data-mode="breath"] .timer__time{ font-size: clamp(2.6rem, 13vw, 3.6rem); }
.timer[data-mode="breath"] .timer__phase{ font-size: 1rem; letter-spacing: .22em; }
.breath-dots{ display:flex; flex-wrap: wrap; justify-content:center; gap: 7px; margin-top: 14px; max-width: 300px; }
.breath-dots[hidden]{ display:none; }
.breath-dots i{ width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.12); transition: background .3s, transform .3s; }
.breath-dots i.is-done{ background: #7ac8ff; }
.breath-dots i.is-now{ background: #9ef0c0; transform: scale(1.35); }
.breath-patterns{ justify-content:flex-start; width:100%; }
.breath-patterns button{ display:flex; flex-direction:column; align-items:flex-start; gap: 2px; padding: 9px 14px; border-radius: 14px; text-align:left; flex: 1 1 140px; }
.breath-patterns button small{ color: var(--muted); font-weight: 500; font-size: .72rem; }
.breath-patterns button.is-active{ border-color: #7ac8ff; color: #7ac8ff; background: rgba(122,200,255,0.08); }
.setting--breath{ flex-direction: column; align-items: stretch; }

@media (max-width: 520px){
  .workout{ padding: 16px; }
  .howto li{ font-size: .74rem; padding: 10px 6px; }
  .train-tab{ padding: 8px 12px; }
}

/* ============ iPhone / сенсорні екрани ============ */
.train-page{ min-height: 100vh; min-height: 100dvh; }
.date-chip input{ font-size: 16px; }                       /* без збільшення сторінки при виборі дати */
.sheet__box{ max-height: 88vh; max-height: 88dvh; }
.ex-list{ -webkit-overflow-scrolling: touch; }
.big-stepper > button, .ctl, .mode, .soft-btn, .ex-item, .cat, .pick-btn, .today-ex__head{ -webkit-user-select: none; user-select: none; }
