/* Компоненты: стекло, кнопки-пилюли, чипы, степперы, листы, док, таймер, поля. */

/* ─── стекло ─── */
.g {
  position: relative;
  background: linear-gradient(165deg, var(--glass-top), var(--glass-bottom));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  backdrop-filter: blur(var(--blur)) saturate(170%);
  border: 1px solid var(--edge);
  /* блик сверху (specular) + мягкая тень снизу */
  box-shadow: 0 12px 40px var(--shade), inset 0 1px 0 var(--specular), inset 0 -1px 0 var(--hair);
}
.card {
  border-radius: var(--r-lg);
  padding: var(--card-pad);
}
/* герой: 32 − 20 = 12 у вложенных блоков */
.card.xl {
  border-radius: var(--r-xl);
  padding: var(--s5);
}
.card.pad-sm {
  padding: var(--s3);
}
/* 28 − 12 = 16 */
.card.pad-sm > .wt-line {
  border-radius: var(--r-md);
}
.card.flat {
  box-shadow: 0 6px 22px var(--shade), inset 0 1px 0 var(--specular);
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-bottom: var(--s3);
  min-height: 32px;
}
.card-title h2 {
  font-size: var(--fs-lg);
}
.card-title > .info-btn {
  margin: -8px -8px -8px auto;
}
.info-btn {
  color: var(--mut);
}
.info-btn .i {
  width: var(--ic);
  height: var(--ic);
}
.prose {
  display: grid;
  gap: var(--s3);
  font-size: var(--fs-md);
  line-height: 1.5;
}
.prose p {
  margin: 0;
}
body.training .g {
  background: var(--glass-strong);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 6px 18px var(--shade);
}
body.training .dock.g,
body.training .bar.g {
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

/* ─── кнопки ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s5);
  border-radius: var(--pill);
  border: 1px solid var(--edge);
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--specular);
  color: var(--ink);
  font-weight: 550;
  font-size: var(--fs-base);
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.35s var(--ease), background 0.3s var(--ease), box-shadow 0.35s var(--ease);
  user-select: none;
  touch-action: manipulation;
}
.btn:active {
  transform: scale(0.96);
}
.btn.main {
  background: var(--main-bg);
  color: var(--main-ink);
  border-color: transparent;
  box-shadow: var(--main-shadow);
}
.btn.accent {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.btn.ghost {
  background: transparent;
  border-color: var(--hair-2);
  box-shadow: none;
}
.btn.danger {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: transparent;
}
.btn.big {
  min-height: var(--h-lg);
  font-size: 17px;
  padding: 0 var(--s6);
}
.btn.block {
  width: 100%;
}
.btn.sm {
  min-height: var(--h-sm);
  padding: 0 14px;
  gap: 6px;
  font-size: 14.5px;
}
.btn.sm .i {
  width: 18px;
  height: 18px;
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.btn .i {
  width: 20px;
  height: 20px;
}
/* многострочная кнопка — не пилюля (концентричность ломается) */
.btn.multi {
  white-space: normal;
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
  text-align: left;
  justify-content: flex-start;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--glass);
  color: var(--ink);
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
  touch-action: manipulation;
}
.icon-btn:active {
  transform: scale(0.92);
}
.icon-btn.plain {
  border-color: transparent;
  background: transparent;
}
.link-btn {
  border: 0;
  background: none;
  padding: 10px 4px;
  min-height: 44px;
  color: var(--ink-2);
  font-size: var(--fs-md);
  font-weight: 500;
  justify-self: center;
  text-align: center;
  text-decoration: underline;
  text-decoration-color: var(--hair-2);
  text-underline-offset: 4px;
}
svg.i {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ─── чипы и бейджи ─── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--pill);
  border: 1px solid var(--hair-2);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  white-space: nowrap;
}
button.chip,
a.chip {
  min-height: 40px;
  text-decoration: none;
}
.chip.wrap {
  white-space: normal;
  line-height: 1.3;
  padding: 6px 12px;
  border-radius: var(--r-sm);
}
.chip.on {
  background: var(--ink);
  color: var(--on-ink);
  border-color: transparent;
  box-shadow: 0 0 18px var(--glow);
}
.chip .i {
  width: 16px;
  height: 16px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.wt-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  background: var(--c, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--accent)) 22%, transparent);
}
.wt-badge {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  width: 100%;
  padding: var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  background: color-mix(in srgb, var(--c) 11%, transparent);
  text-align: left;
}
.wt-line {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 56px;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  text-align: left;
  color: var(--ink);
}
.wt-line b {
  display: block;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.3;
}
.wt-meta {
  display: block;
  font-size: var(--fs-sm);
  color: var(--mut);
  font-variant-numeric: tabular-nums;
}
.wt-line .i {
  width: 20px;
  height: 20px;
  color: var(--mut);
}
.wt-badge .wt-dot {
  margin-top: 6px;
}
.wt-badge b {
  font-weight: 600;
  font-size: var(--fs-md);
}
.wt-badge .wt-sum {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sm);
  line-height: 1.35;
  color: var(--mut);
}
.wt-badge .i {
  width: 20px;
  height: 20px;
}
.tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  padding: 0 8px;
  vertical-align: 1px;
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--ink-2);
}

/* ─── сегменты ─── */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--pill);
  background: var(--glass);
  border: 1px solid var(--edge);
}
.seg button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--mut);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}
.seg button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--on-ink);
}

/* ─── степпер ─── */
.stepper {
  display: grid;
  grid-template-columns: var(--tap) minmax(48px, 1fr) var(--tap);
  align-items: center;
  border-radius: var(--pill);
  background: var(--field);
  border: 1px solid var(--hair);
}
.stepper button {
  height: 52px;
  border: 0;
  background: transparent;
  border-radius: var(--pill);
  display: grid;
  place-items: center;
  touch-action: manipulation;
  user-select: none;
}
.stepper button:active {
  background: var(--glass-press);
}
.stepper .val {
  min-width: 0;
  height: 52px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: center;
  font-family: var(--font-text);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stepper .val .ph {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--mut-2);
}
.stepper .val-input {
  width: 100%;
  border-radius: var(--r-sm);
  background: var(--glass-strong);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.stepper-label {
  font-size: var(--fs-xs);
  color: var(--mut);
  margin: 0 0 var(--s1) var(--s4);
}

/* ─── поля ─── */
.field {
  display: grid;
  gap: 6px;
}
.field > span {
  font-size: 13.5px;
  color: var(--mut);
  padding-left: 4px;
}
.input,
textarea.input,
select.input {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hair-2);
  background: var(--field);
  color: var(--ink);
  font-size: 16px;
}
textarea.input {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
}
textarea.input.code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 13px;
}
.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  font-size: 15.5px;
}
.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--ink);
  flex: none;
}

/* ─── списки ─── */
.list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.list-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 56px;
  padding: var(--s2) var(--s1);
  border: 0;
  border-bottom: 1px solid var(--hair);
  background: none;
  text-align: left;
  width: 100%;
  color: inherit;
}
a.list-row {
  text-decoration: none;
}
.list-row:last-child {
  border-bottom: 0;
}
.list-row .i.chev {
  color: var(--mut-2);
  width: 18px;
  height: 18px;
}
.list-ic {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--glass);
  border: 1px solid var(--edge);
  flex: none;
}

/* ─── нижний док (стеклянная пилюля) ─── */
.dock {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(8px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  padding: 6px 4px;
  border-radius: var(--r-xl);
  width: min(calc(100vw - 16px), 440px);
}
/* как навигация Material 3: индикатор-пилюля за иконкой, подпись под ней */
.dock button {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--s1);
  min-height: 56px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mut);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: -0.01em;
  line-height: 14px;
  white-space: nowrap;
  transition: color 0.4s var(--ease), transform 0.3s var(--ease);
  position: relative;
}
.dock .ind {
  display: grid;
  place-items: center;
  width: 52px;
  height: 30px;
  border-radius: var(--pill);
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.dock .ind .i {
  width: 22px;
  height: 22px;
}
.dock button[aria-current='page'] {
  color: var(--ink);
  font-weight: 650;
}
.dock button[aria-current='page'] .ind {
  background: var(--accent-soft);
  box-shadow: inset 0 1px 0 var(--specular), 0 0 20px var(--accent-glow);
}
.dock button:active {
  transform: scale(0.94);
}
.dock .badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 2px var(--bg);
}

/* ─── нижняя панель действий (над доком, в зоне большого пальца) ─── */
.bar {
  position: fixed;
  z-index: 29;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--dock-h) + 18px + var(--safe-b));
  width: min(calc(100vw - 16px), 540px);
  display: flex;
  gap: var(--s2);
  padding: 6px;
  border-radius: var(--pill);
}
.bar .btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 var(--s3);
}

/* ─── листы (bottom sheet) ─── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 9, 13, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade 0.3s var(--ease) both;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet {
  position: fixed;
  z-index: 51;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 560px);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid var(--edge);
  border-bottom: 0;
  box-shadow: 0 -10px 50px var(--shade-2);
  animation: up 0.45s var(--ease) both;
}
@keyframes up {
  from {
    transform: translate(-50%, 40px);
    opacity: 0;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s2) var(--s1) var(--s5);
}
.sheet-head h2 {
  flex: 1 1 auto;
  font-size: var(--fs-lg);
}
.sheet-grip {
  width: 40px;
  height: 5px;
  border-radius: 5px;
  background: var(--hair-2);
  margin: 8px auto 0;
}
.sheet-body {
  overflow-y: auto;
  padding: var(--s1) var(--s5) calc(var(--s5) + var(--safe-b));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s3);
  overscroll-behavior: contain;
}

/* ─── тосты ─── */
.toasts {
  position: fixed;
  z-index: 70;
  left: 50%;
  top: calc(12px + var(--safe-t));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(calc(100vw - 24px), 520px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 52px;
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  /* текст бывает в 2–3 строки — не пилюля; 18 − 8 = 10 у кнопки внутри */
  border-radius: 18px;
  background: var(--toast);
  color: var(--on-toast);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--hair-2);
  box-shadow: 0 10px 30px var(--shade-2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1.35;
  animation: in 0.4s var(--ease) both;
}
.toast > span {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--s1) 0;
}
.toast .btn {
  flex: none;
  min-height: 36px;
  padding: 0 var(--s3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--on-toast);
  border-color: transparent;
  box-shadow: none;
  font-size: 14px;
}

/* ─── сообщения ─── */
.note {
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  font-size: 14.5px;
  line-height: 1.45;
}
.note .row {
  margin-top: var(--s2);
}
.note.warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}
.note.bad {
  background: var(--bad-soft);
}
.errors {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.errors code {
  font-size: 12.5px;
  background: var(--hair);
  padding: 1px 5px;
  border-radius: 6px;
}
.empty {
  text-align: center;
  padding: 18px 10px;
  color: var(--mut);
  font-size: 14.5px;
}
details.disclosure > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--tap);
  font-weight: 600;
}
details.disclosure > summary::-webkit-details-marker {
  display: none;
}
details.disclosure > summary .i {
  transition: transform 0.4s var(--ease);
}
details.disclosure[open] > summary .i.chev {
  transform: rotate(90deg);
}

/* ─── графики ─── */
.chart {
  position: relative;
  width: 100%;
}
.chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
  touch-action: pan-y;
}
.chart text {
  fill: var(--mut);
  font-size: 11px;
  font-family: var(--font-text);
}
.chart .grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
}
.chart-tip {
  position: absolute;
  top: 0;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--edge);
  box-shadow: 0 6px 18px var(--shade);
  font-size: 12.5px;
  white-space: nowrap;
  transform: translateX(-50%);
}
.chart-tip b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12.5px;
  color: var(--mut);
  margin-top: 6px;
}
.legend i {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--c);
}
.legend i.dot-key {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend i.band-key {
  height: 10px;
  opacity: 0.35;
}
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.stat {
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--glass);
  border: 1px solid var(--edge);
}
.stat b {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.stat span {
  display: block;
  font-size: 12.5px;
  color: var(--mut);
  margin-top: 4px;
  line-height: 1.3;
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.tbl th,
.tbl td {
  text-align: left;
  padding: 8px 4px;
  border-bottom: 1px solid var(--hair);
}
.tbl th {
  font-weight: 500;
  color: var(--mut);
  font-size: 12.5px;
}
.tbl td.r,
.tbl th.r {
  text-align: right;
}

/* ─── доступность: «уменьшить прозрачность» — плотные поверхности без размытия ─── */
@media (prefers-reduced-transparency: reduce) {
  .g,
  .sheet,
  .toast {
    background: var(--solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .bloom {
    display: none;
  }
}

/* ─── выбор оформления: превью рисуется токенами самой палитры ─── */
.stepper-label.theme-group {
  margin-left: var(--s1);
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s2);
}
.theme-pick {
  display: grid;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  color: var(--ink);
}
.ts,
.ts-split {
  position: relative;
  display: grid;
  height: 88px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--hair-2);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.ts {
  place-items: center;
  background:
    radial-gradient(60% 70% at 15% 15%, var(--b1), transparent 70%),
    radial-gradient(55% 60% at 90% 40%, var(--b2), transparent 70%),
    radial-gradient(60% 60% at 40% 100%, var(--b3), transparent 70%),
    var(--bg);
}
.ts-split {
  grid-template-columns: 1fr 1fr;
}
.ts-split .ts {
  height: 100%;
  border: 0;
  border-radius: 0;
}
.ts-card {
  display: grid;
  gap: 5px;
  width: 64%;
  padding: 8px;
  border-radius: 10px;
  background: linear-gradient(165deg, var(--glass-top), var(--glass-bottom));
  border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 var(--specular);
}
.ts-split .ts-card {
  width: 78%;
}
.ts-line {
  height: 4px;
  border-radius: 2px;
  background: var(--ink);
}
.ts-line.short {
  width: 60%;
  background: var(--mut);
}
.ts-btn {
  height: 10px;
  border-radius: 5px;
  background: var(--main-bg);
  box-shadow: 0 0 10px var(--accent-glow);
}
.ts-name {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
}
.theme-pick.on .ts,
.theme-pick.on .ts-split {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.theme-pick.on .ts-name {
  color: var(--ink);
  font-weight: 650;
}
.theme-pick:active .ts,
.theme-pick:active .ts-split {
  transform: scale(0.96);
}
