@import url('../fonts/fonts.css');

/* ============================================================
   Дизайн-система — тёмная тема, акцент через CSS-переменные
   ============================================================ */
:root {
  /* Фон почти чёрный (AMOLED), карточки тёмно-серые */
  --bg: #090909;
  --bg-elev: #0f0f12;
  --surface: #17171c;
  --surface-2: #1f1f26;
  --surface-3: #2a2a33;
  --border: #2d2d36;
  --border-soft: #22222a;

  --text: #f3f3f6;
  --text-dim: #a0a0ab;
  --text-mute: #6c6c77;

  /* Акцент — оранжевый (по умолчанию) */
  --accent: #ff8a2b;
  --accent-2: #ff6a1a;
  --accent-ink: #1a0f03;           /* тёмный текст на акценте */
  --accent-soft: rgba(255, 138, 43, 0.14);
  --accent-line: rgba(255, 138, 43, 0.30);
  --glow: rgba(255, 138, 43, 0.40);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  --tap: 48px;
  --nav-h: 64px;
  --pad: 18px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: 'Comfortaa', system-ui, sans-serif;
}

/* Коралловая тема */
:root[data-accent='coral'] {
  --accent: #ff6f61;
  --accent-2: #ff8a5c;
  --accent-ink: #1a0b09;
  --accent-soft: rgba(255, 111, 97, 0.14);
  --accent-line: rgba(255, 111, 97, 0.30);
  --glow: rgba(255, 111, 97, 0.38);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 500;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  -webkit-user-select: none;
  user-select: none;
}

button { font-family: var(--font); cursor: pointer; border: none; color: inherit; }
a { color: inherit; }
input, textarea { font-family: var(--font); -webkit-user-select: text; user-select: text; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Размер иконок по умолчанию (иначе инлайн-SVG раздувается) */
svg { width: 22px; height: 22px; flex: 0 0 auto; display: block; }

/* Радиальная подсветка фона сверху для глубины */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 60% at 85% -5%, var(--accent-soft), transparent 55%),
    radial-gradient(90% 50% at 0% 0%, rgba(255,255,255,0.03), transparent 60%),
    var(--bg);
}

/* ============================================================
   Каркас: прокручиваемая область + нижняя навигация
   ============================================================ */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding: calc(var(--safe-top) + 14px) var(--pad)
           calc(var(--nav-h) + var(--safe-bottom) + 24px);
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; letter-spacing: .5px; font-size: 18px;
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 0 16px var(--glow);
}
#app .brand .mark svg { width: 18px; height: 18px; }

/* Шапка вложенного экрана */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.icon-btn {
  width: var(--tap); height: var(--tap); flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-soft);
  color: var(--text); text-decoration: none;
}
.page-title { min-width: 0; }
.page-title h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-sub { color: var(--text-mute); font-size: 13px; margin-top: 3px; }

/* ---- Карточки ---- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 18px;
}
.card + .card { margin-top: 14px; }

.eyebrow {
  font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-mute); font-weight: 600;
}

.hint { color: var(--text-mute); font-size: 13px; line-height: 1.5; margin: 14px 4px 0; }
#app .hint svg { display: inline-block; width: 15px; height: 15px; vertical-align: -3px; }

.link { color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; padding: 8px 0; }

/* Пустое состояние */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; color: var(--text-dim); padding: 28px 18px;
}
.empty .ic { color: var(--text-mute); }
#app .empty .ic svg { width: 34px; height: 34px; }

/* ============================================================
   Экран «Сегодня»
   ============================================================ */
.today-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--accent-line);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 18px 50px -24px var(--glow);
}
.today-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 90% 10%, var(--accent-soft), transparent 60%);
  pointer-events: none;
}
.hero-label { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 14px; }
#app .hero-label svg { width: 15px; height: 15px; }
.hero-title {
  font-size: 34px; font-weight: 700; line-height: 1.08; margin: 8px 0 2px;
  white-space: nowrap;
}
.hero-title .prog {
  color: var(--accent);
  text-shadow: 0 0 22px var(--glow);
}
.hero-sub { color: var(--text-dim); font-size: 14px; margin-top: 8px; }
.hero-sub b { color: var(--text); font-weight: 600; }

/* Сегментный переключатель (А/Б, тип упражнения) */
.prog-switch, .seg {
  display: inline-flex; gap: 4px;
  background: var(--surface-2); border-radius: 999px; padding: 4px;
  border: 1px solid var(--border-soft);
  position: relative; z-index: 1;
}
.prog-switch { margin-top: 16px; }
.seg { display: flex; }
.prog-switch button, .seg button {
  min-width: 68px; height: 40px; border-radius: 999px;
  background: transparent; color: var(--text-dim);
  font-weight: 600; font-size: 15px; transition: .18s;
}
.seg button { flex: 1; }
.prog-switch button[aria-pressed='true'], .seg button[aria-pressed='true'] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 0 18px var(--glow);
}

/* Превью упражнений */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 24px 2px 12px; min-height: 32px;
}
.section-head h2 { font-size: 17px; font-weight: 700; margin: 0; }

.ex-list { display: flex; flex-direction: column; gap: 10px; }
.ex-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 13px 15px;
}
.ex-badge {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 15px;
}
.ex-main { flex: 1; min-width: 0; }
.ex-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-meta { color: var(--text-mute); font-size: 13px; margin-top: 3px; }
.ex-weight { flex: 0 0 auto; text-align: right; }
.ex-weight .w { font-weight: 700; font-size: 17px; color: var(--text); }
.ex-weight .u { color: var(--text-mute); font-size: 12px; }

/* Большая кнопка */
.cta {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  margin-top: 22px;
  width: 100%; height: 60px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); text-decoration: none;
  font-weight: 700; font-size: 18px; letter-spacing: .3px;
  box-shadow: 0 10px 30px -8px var(--glow), 0 0 0 1px rgba(255,255,255,0.06) inset;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .08s;
}
.cta:active { transform: scale(.98); }
.cta:disabled { opacity: .35; box-shadow: none; }
.cta.secondary {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

/* Второстепенная кнопка */
.btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); width: 100%; margin-top: 12px; padding: 0 16px;
  border-radius: var(--r-md); background: transparent;
  border: 1px solid var(--border); color: var(--text-dim);
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.empty .btn-ghost { color: var(--accent); border-color: var(--accent-line); width: auto; }

/* Плашка «уже тренировался» */
.done-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  padding: 14px 16px; margin-top: 14px;
  color: var(--text);
}
.done-banner .ic { color: var(--accent); flex: 0 0 auto; }

/* ============================================================
   Настройки: строки-ссылки, переключатель акцента
   ============================================================ */
.rows { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.row-link {
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  text-decoration: none;
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--text-mute); font-size: 13px; }
.row-chev { color: var(--text-mute); }
#app .row-chev svg { width: 18px; height: 18px; }

.swatches { display: flex; gap: 10px; margin-top: 14px; }
.swatch {
  flex: 1; min-height: var(--tap); border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  color: var(--text-dim); font-weight: 600; font-size: 14px;
}
.swatch .dot { width: 16px; height: 16px; border-radius: 50%; }
.swatch[aria-pressed='true'] {
  color: var(--text); border-color: var(--accent-line);
  background: var(--accent-soft); box-shadow: 0 0 18px -6px var(--glow);
}

/* ============================================================
   Редактор программы: список с перетаскиванием
   ============================================================ */
.ed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ed-item {
  display: flex; align-items: stretch;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  transition: transform .16s ease;
  position: relative;
}
.drag-handle {
  width: 48px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: transparent; color: var(--text-mute);
  touch-action: none; cursor: grab;
}
.ed-body {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px 12px 0; text-decoration: none; min-height: 64px;
}
.ed-num {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
}
.ed-item.dragging {
  transition: none; z-index: 5;
  border-color: var(--accent-line);
  background: var(--surface-2);
  box-shadow: 0 14px 36px -10px rgba(0,0,0,.7), 0 0 24px -8px var(--glow);
}
.ed-item.dragging .drag-handle { color: var(--accent); cursor: grabbing; }
.is-dragging .ed-body { pointer-events: none; }

/* ============================================================
   Форма упражнения
   ============================================================ */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.text-input {
  width: 100%; min-height: var(--tap);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 13px 15px; font-size: 16px; font-weight: 600;
  resize: vertical;
}
.text-input::placeholder { color: var(--text-mute); font-weight: 500; }
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.field-card { padding: 6px 14px; }
.field-row {
  display: flex; align-items: center; gap: 6px;
  min-height: 64px;
}
.field-row + .field-row { border-top: 1px solid var(--border-soft); }
.field-row .field-label { flex: 1; font-size: 15px; color: var(--text); }
.field-unit { color: var(--text-mute); font-size: 13px; width: 18px; flex: 0 0 auto; }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text);
}
.stepper button:active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
#app .stepper svg { width: 18px; height: 18px; }
.stepper input {
  width: 52px; height: 44px; text-align: center;
  background: transparent; border: none; color: var(--text);
  font-size: 20px; font-weight: 700;
}
.stepper input:focus { outline: none; color: var(--accent); }

/* ============================================================
   Заглушки прочих экранов (заполним на след. этапах)
   ============================================================ */
.placeholder {
  display: grid; place-items: center; text-align: center;
  min-height: 60vh; color: var(--text-mute); gap: 10px;
}
.placeholder .big { font-size: 20px; color: var(--text-dim); font-weight: 600; }
.placeholder .ic { opacity: .5; }
#app .placeholder .ic svg { width: 46px; height: 46px; }

/* ============================================================
   Нижняя навигация
   ============================================================ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 480px; margin: 0 auto;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: color-mix(in srgb, var(--bg-elev) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-soft);
}
.tabbar a {
  flex: 1; min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-mute); text-decoration: none;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
  position: relative;
}
#app .tabbar a svg { width: 24px; height: 24px; transition: .18s; }
.tabbar a[aria-current='page'] { color: var(--accent); }
.tabbar a[aria-current='page'] svg { filter: drop-shadow(0 0 7px var(--glow)); }
.tabbar a[aria-current='page']::before {
  content: '';
  position: absolute; top: 6px;
  width: 24px; height: 3px; border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
}

/* ============================================================
   Настройки: переключатель, маленькая кнопка
   ============================================================ */
.field-card.plain { padding: 0; background: none; border: none; margin-top: 6px; }
.field-label small { display: block; color: var(--text-mute); font-size: 12px; font-weight: 500; margin-top: 3px; }
.stepper output { min-width: 56px; text-align: center; font-size: 18px; font-weight: 700; }
.switch {
  width: 56px; height: 32px; border-radius: 999px; flex: 0 0 auto;
  background: var(--surface-3); border: 1px solid var(--border);
  position: relative; transition: .18s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--text-dim); transition: .18s;
}
.switch[aria-checked='true'] { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 14px var(--glow); }
.switch[aria-checked='true']::after { left: 27px; background: var(--accent-ink); }
.btn-small {
  min-height: 40px; padding: 0 14px; border-radius: 12px; flex: 0 0 auto;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--accent); font-size: 14px; font-weight: 600;
}
.btn-small:disabled { color: var(--text-mute); }
.btn-small.on { color: var(--text); }
.row-link.standalone { margin-top: 14px; }

/* ============================================================
   Экран тренировки
   ============================================================ */
.screen.full { padding-bottom: 0; }
.screen.workout { touch-action: pan-y; }
.wk-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-right: 90px; }
.wk-progress { display: flex; gap: 5px; margin-bottom: 18px; }
.wk-seg {
  flex: 1; height: 24px; background: transparent; position: relative; padding: 0;
}
.wk-seg::before {
  content: ''; position: absolute; left: 0; right: 0; top: 10px; height: 5px; border-radius: 3px;
  background: var(--surface-3);
}
.wk-seg.done::before { background: var(--accent-line); }
.wk-seg.skipped::before { background: var(--border-soft); }
.wk-seg.cur::before { background: var(--accent); box-shadow: 0 0 10px var(--glow); }

.wk-pane { animation: fade .2s ease; }
.wk-pane.from-right { animation: from-right .22s ease; }
.wk-pane.from-left { animation: from-left .22s ease; }
@keyframes from-right { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes from-left { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }

.wk-count { color: var(--text-mute); font-size: 13px; font-weight: 600; }
.wk-name { font-size: 26px; font-weight: 700; margin: 6px 0 4px; line-height: 1.15; }
.wk-meta { color: var(--text-dim); font-size: 14px; }
.wk-last {
  margin: 14px 0 16px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border-soft);
  color: var(--text-dim); font-size: 14px;
}
.wk-last b { color: var(--text); font-weight: 700; }
.wk-when { color: var(--text-mute); }

.wk-sets { display: flex; flex-direction: column; gap: 8px; }
.set-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: 6px 6px 6px 8px;
}
.set-main {
  flex: 1; min-height: 48px; display: flex; align-items: center; gap: 12px;
  background: transparent; text-align: left; padding: 0;
}
.set-n {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-dim); font-weight: 700; font-size: 14px;
}
.set-row.done .set-n { background: var(--accent-soft); color: var(--accent); }
.set-val { font-size: 18px; font-weight: 700; }
.set-val small { font-size: 12px; color: var(--text-mute); font-weight: 600; }
.set-row.done .set-val { color: var(--text-dim); }
.set-check {
  width: 48px; height: 48px; border-radius: 14px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-mute);
}
.set-check.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: var(--accent-ink); box-shadow: 0 0 14px var(--glow);
}

.set-open { flex-direction: column; align-items: stretch; gap: 4px; padding: 12px; border-color: var(--accent-line); }
.set-open-head { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 4px; }
.num-row { display: flex; align-items: center; gap: 8px; min-height: 60px; }
.num-row .field-label { flex: 1; font-size: 15px; color: var(--text); }
.stepper.big button { width: 52px; height: 52px; border-radius: 16px; }
.stepper.big input { width: 70px; font-size: 26px; }
.set-done {
  margin-top: 8px; min-height: 54px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font-size: 17px; font-weight: 700;
  box-shadow: 0 8px 24px -8px var(--glow);
}
.set-done.on { background: var(--surface-2); color: var(--accent); border: 1px solid var(--accent-line); box-shadow: none; }

.wk-row-btns { display: flex; gap: 10px; }
.wk-row-btns .btn-ghost { flex: 1; }
.wk-note { margin-top: 12px; }
.wk-note summary {
  min-height: var(--tap); display: flex; align-items: center;
  color: var(--text-dim); font-size: 14px; font-weight: 600; cursor: pointer; list-style: none;
}
.wk-note summary::before { content: '+'; color: var(--accent); margin-right: 8px; font-size: 18px; }
.wk-note[open] summary::before { content: '−'; }
.link-btn {
  display: block; width: 100%; min-height: var(--tap); margin-top: 6px;
  background: transparent; color: var(--text-mute); font-size: 14px; font-weight: 600;
}

.wk-nav {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 10px; margin: 18px calc(-1 * var(--pad)) 0;
  padding: 16px var(--pad) calc(var(--safe-bottom) + 12px);
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}
.nav-btn {
  min-width: 60px; height: 60px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-size: 17px; font-weight: 700;
}
.nav-btn:disabled { opacity: .35; }
.nav-btn.primary {
  flex: 1; border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); box-shadow: 0 10px 30px -8px var(--glow);
}

/* Нижний лист (диалог) */
dialog.sheet {
  width: min(100% - 24px, 456px); margin: auto auto calc(var(--safe-bottom) + 12px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-xl); padding: 20px;
}
dialog.sheet::backdrop { background: rgba(0,0,0,.7); }
.sheet-title { margin: 0; font-size: 19px; }
.sheet-btns { display: flex; gap: 10px; }
.sheet-btns .btn-ghost { margin: 0; flex: 1; }
.sheet-btns .cta { position: static; margin: 0; flex: 1.4; height: 52px; font-size: 16px; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: var(--tap); color: var(--text-dim); font-size: 15px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ============================================================
   Таймер отдыха
   ============================================================ */
.tm-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 14px) var(--pad) calc(var(--safe-bottom) + 20px);
  background:
    radial-gradient(90% 55% at 50% 42%, var(--accent-soft), transparent 70%),
    rgba(9, 9, 9, 0.98);
  animation: fade .18s ease;
}
.tm-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tm-label { color: var(--text-dim); font-size: 15px; font-weight: 600; letter-spacing: .5px; text-align: center; }
.tm-win, .tm-win-ph {
  min-width: 96px; height: var(--tap); border-radius: 999px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; font-weight: 600;
}
.tm-win-ph { visibility: hidden; }
.tm-win.on { color: var(--accent); border-color: var(--accent-line); }
.tm-win svg { width: 20px; height: 20px; }

.tm-center { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.tm-digits {
  display: flex; justify-content: center;
  font-size: min(38vw, 200px); font-weight: 700; line-height: 1;
  color: var(--accent); text-shadow: 0 0 40px var(--glow), 0 0 90px var(--glow);
}
.tm-digits .d { width: .64em; text-align: center; }
.tm-digits .c { width: .3em; text-align: center; margin-top: -.06em; }
.tm-overlay.paused .tm-digits { opacity: .5; text-shadow: none; }
.tm-overlay.ended .tm-digits { animation: pulse .6s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .45; } }
.tm-bar { width: 72%; height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 26px; overflow: hidden; }
.tm-bar span { display: block; height: 100%; background: var(--accent); box-shadow: 0 0 10px var(--glow); transition: width .25s linear; }
.tm-next { color: var(--text-dim); font-size: 15px; margin-top: 18px; text-align: center; min-height: 20px; }

.tm-controls { display: flex; align-items: center; justify-content: center; gap: 18px; }
.tm-btn {
  width: 76px; height: 64px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 18px; font-weight: 700;
}
.tm-play {
  width: 88px; height: 88px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); box-shadow: 0 0 30px var(--glow);
}
.tm-play svg { width: 32px; height: 32px; stroke-width: 2.8; }
.tm-skip { margin-top: 18px; }

.tm-pill {
  position: fixed; z-index: 90;
  top: calc(var(--safe-top) + 12px); right: max(16px, calc(50% - 224px));
  height: 44px; padding: 0 16px 0 12px; border-radius: 999px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--accent-line);
  color: var(--accent); font-size: 17px; font-weight: 700;
  box-shadow: 0 0 20px -4px var(--glow);
}
.tm-pill svg { width: 20px; height: 20px; }
.tm-pill.paused { color: var(--text-dim); }

/* Тост */
.toast {
  position: fixed; left: 50%; z-index: 120;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px);
  transform: translateX(-50%);
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 18px; font: 600 14px var(--font);
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  max-width: 82%; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }
