/* Редизайн 2026-11, фаза 2 — экраны группы «home». Только var(--…), токены — в tokens.css (блок screens:home). */

/* ══ Нижнее меню: дуотон активной иконки «Мой день» (MyDay.dc.html) ══ */
.kp-nav__btn#tab-myday[aria-current="page"] svg circle { fill: var(--accent-a20); }
.kp-nav__btn:focus-visible, .kp-nav__sos:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
/* Экран нарисовал своё меню (bottomNavHtml) — глобальное (app/index.js) не дублируем. */
body:has(#app .kp-nav) #global-tabbar { display: none; }

/* ══ Главная «Капля» (Main.dc.html) ══ */
.hm { padding-top: env(safe-area-inset-top); }
.hm a { color: inherit; text-decoration: none; }
.hm-head { display: flex; align-items: center; justify-content: space-between; padding-top: var(--hm-head-pt); }
.hm-who { display: flex; align-items: center; gap: var(--hm-gap-10); min-width: 0; }
.hm-avatar {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: var(--hm-avatar); height: var(--hm-avatar); border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: var(--accent-light); font-size: var(--fs-body); font-weight: 700;
}
.hm-avatar svg { fill: var(--accent-light); }
.hm-hello { display: flex; flex-direction: column; min-width: 0; }
.hm-greet { font-size: var(--fs-caption); color: var(--text-secondary); }
.hm-name { font-size: var(--fs-header-title); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-theme {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: var(--tap-min); height: var(--tap-min); padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface-sos);
}
.hm-theme svg { fill: none; stroke: var(--text-secondary); stroke-width: 1.75; stroke-linecap: round; }

.hm-vessel { margin: var(--sp-1) calc(-1 * var(--gutter)) 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hm-vessel .kp-vessel__label { color: var(--hm-vessel-label); }
.hm-vessel .kp-vessel--empty .kp-vessel__label { color: var(--text-secondary); }
.hm-sediment { margin: var(--sp-2) 0 0; text-align: center; font-size: var(--fs-caption); color: var(--text-secondary); }

/* Тропа вех */
.hm-trail { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--hm-trail-mt); }
.hm-trail__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.hm-trail__title { font-size: var(--fs-callout); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-trail__eta { flex-shrink: 0; font-size: var(--fs-caption); font-weight: 600; color: var(--accent-light); }
.hm-trail__track { display: block; }
.hm-trail__track svg { display: block; width: 100%; height: auto; overflow: visible; }
.hm-trail__line, .hm-trail__fill { fill: none; stroke-width: 3; stroke-linecap: round; }
.hm-trail__line { stroke: var(--border); }
.hm-trail__fill { stroke: var(--accent); }
.hm-trail__done { fill: var(--accent); }
.hm-trail__cur { fill: var(--accent-a20); stroke: var(--accent-light); stroke-width: 1.75; filter: var(--glow); }
.hm-trail__todo { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.hm-trail__lbls { position: relative; display: block; height: var(--sp-3); margin-top: var(--sp-px5); }
.hm-trail__lbl {
  position: absolute; top: 0; left: var(--x); transform: translateX(-50%);
  max-width: 24%; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-tiny); line-height: 1; color: var(--text-secondary);
}
.hm-trail__lbl:first-child { left: 0; transform: none; text-align: left; }
.hm-trail__lbl:last-child:not(:first-child) { left: auto; right: 0; transform: none; text-align: right; }
.hm-trail__lbl.is-cur { color: var(--text); }

/* Строка цифр */
.hm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--sp-3); padding: 0; }
.hm-stat { display: flex; flex-direction: column; gap: var(--hm-gap-6); min-width: 0; padding: var(--hm-pad-14); }
.hm-stat + .hm-stat { border-left: 1px solid var(--border); }
.hm-stat__k { font-size: var(--fs-small); color: var(--text-secondary); }
.hm-stat__v { font-size: var(--hm-fs-stat); font-weight: 700; color: var(--text); white-space: nowrap; }
.hm-stat__v small { font-size: var(--fs-caption); font-weight: 700; color: var(--text-secondary); }
.hm-stat__s { font-size: var(--fs-micro); color: var(--text-secondary); }

/* Капсула + Задание дня */
.hm-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.hm-tile { display: flex; flex-direction: column; gap: var(--hm-gap-10); min-width: 0; }
.hm-tile__t { font-size: var(--fs-callout); font-weight: 600; color: var(--text); }
.hm-tile__s { font-size: var(--fs-small); line-height: 1.4; color: var(--text-secondary); }
.hm-capsule { background: linear-gradient(160deg, var(--warning-a15), var(--surface) 60%); }
.hm-capsule__drop { fill: var(--hm-warning-a75); stroke: var(--warning); }
.hm-capsule__wave { fill: none; stroke: var(--bg); stroke-opacity: .6; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hm-task__box {
  display: flex; align-items: center; justify-content: center;
  width: var(--hm-task-box); height: var(--hm-task-box); border-radius: var(--hm-r-task);
  border: 1.5px solid var(--accent);
  transition: background-color var(--dur) var(--ease);
}
.hm-task__box svg { fill: none; stroke: var(--accent-light); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#card-myday.is-done .hm-task__box { background: var(--accent); }
#card-myday.is-done .hm-task__box svg { stroke: var(--on-accent); stroke-width: 2.4; }

/* ══ Мой день (MyDay.dc.html) ══ */
.md { background: var(--bg); padding-top: 0; }
.md-head {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 calc(-1 * var(--gutter));
  padding: calc(env(safe-area-inset-top) + var(--sp-4)) var(--sp-3) var(--sp-2);
  background: var(--surface-sos);
  -webkit-backdrop-filter: blur(var(--nav-blur)); backdrop-filter: blur(var(--nav-blur));
  border-bottom: 1px solid var(--md-head-border);
}
.md-head__arrow {
  display: flex; align-items: center; justify-content: center;
  width: var(--tap-min); height: var(--tap-min); padding: 0; border: 0; background: none; cursor: pointer;
}
.md-head__arrow svg { fill: none; stroke: var(--text-secondary); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.md-head__arrow:disabled { opacity: .35; cursor: default; }
.md-head__c { display: flex; flex-direction: column; align-items: center; gap: var(--radius-xs); min-width: 0; }
.md-head__date { margin: 0; font-size: var(--fs-header-title); font-weight: 600; color: var(--text); white-space: nowrap; }
.md-head__day { font-size: var(--fs-small); color: var(--accent-light); }

.md-body { display: flex; flex-direction: column; gap: var(--sp-3); padding-top: var(--sp-4); }
.md-card { padding: var(--md-pad-18); }
.md-over { display: block; font-size: var(--fs-small); letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); }
.md-over--accent { color: var(--accent-light); }
.md-over--warning { color: var(--warning); }
.md-hint { font-size: var(--fs-caption); color: var(--text-secondary); }

/* Задание дня: квадрат 48 px, заливка «каплей» снизу вверх */
.md-task { position: relative; display: flex; gap: var(--hm-pad-14); align-items: flex-start; }
.md-task__check {
  position: relative; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  width: var(--md-check); height: var(--md-check); padding: 0; cursor: pointer;
  border: 1.5px solid var(--accent); border-radius: var(--r-m); background: var(--md-accent-a12);
}
.md-task__check:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.md-task__fill {
  position: absolute; inset: 0; background: linear-gradient(var(--accent), var(--accent-dark));
  transform: scaleY(0); transform-origin: bottom; transition: transform var(--dur-grow) var(--ease);
}
.md-task__check svg { position: relative; fill: none; stroke: var(--on-accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity var(--dur) var(--ease); }
.md-task.is-done .md-task__fill { transform: scaleY(1); }
.md-task.is-done .md-task__check svg { opacity: 1; transition-delay: 200ms; }
.md-task__txt { display: flex; flex-direction: column; gap: var(--sp-1); flex: 1; min-width: 0; }
.md-task__body { font-size: var(--fs-body); font-weight: 600; line-height: 1.35; color: var(--text); }
.md-confetti { position: absolute; right: var(--sp-3); top: calc(-1 * var(--hm-gap-10)); pointer-events: none; opacity: 0; }
.md-task.is-done .md-confetti { opacity: 1; }
.md-c1 { fill: var(--accent-light); fill-opacity: .8; }
.md-c2 { fill: var(--accent); }
.md-c3 { fill: var(--accent-light); fill-opacity: .6; }
.md-c4 { fill: var(--accent); fill-opacity: .8; }
.md-c5 { fill: var(--accent-light); fill-opacity: .5; }
.md-confetti path { transform-box: fill-box; transform-origin: center bottom; }
.md-task.is-burst .md-confetti path { animation: md-burst 1s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
@keyframes md-burst { 0% { transform: translateY(24px) scale(.3); opacity: 0; } 40% { transform: translateY(-6px) scale(1.1); opacity: 1; } 100% { transform: none; opacity: 1; } }

/* Факт дня */
.md-fact { display: flex; gap: var(--sp-4); align-items: center; }
.md-organ { flex-shrink: 0; width: var(--md-organ); height: var(--md-organ); }
.md-organ__bg { fill: var(--md-accent-a10); }
.md-organ__body { fill: var(--accent-a15); stroke: var(--accent-light); stroke-width: 1.75; stroke-linejoin: round; }
.md-organ__line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; }
.md-fact__txt { display: flex; flex-direction: column; gap: var(--hm-gap-6); flex: 1; min-width: 0; }
.md-fact__body { margin: 0; font-size: var(--fs-label); line-height: 1.5; color: var(--text); }

/* Миф / правда */
.md-myth { padding: 0; overflow: hidden; }
.md-myth__top { display: flex; flex-direction: column; gap: var(--hm-gap-6); padding: var(--sp-4) var(--md-pad-18) var(--sp-3); }
.md-myth__myth { font-size: var(--fs-label); color: var(--text-secondary); text-decoration: line-through; text-decoration-color: var(--md-myth-strike); }
.md-myth__truth { display: flex; flex-direction: column; gap: var(--hm-gap-6); padding: var(--hm-pad-14) var(--md-pad-18) var(--sp-4); background: var(--md-truth-bg); }
.md-myth__text { font-size: var(--fs-label); line-height: 1.5; color: var(--text); }

/* Желание выпить: термометр-капля 0..10 */
.md-crave { display: flex; flex-direction: column; gap: var(--sp-4); }
.md-crave__head { display: flex; justify-content: space-between; align-items: baseline; }
.md-crave__title { margin: 0; font-size: var(--fs-card-title); font-weight: 600; color: var(--text); }
.md-crave__row { display: flex; gap: var(--md-pad-18); align-items: stretch; }
.md-therm { position: relative; flex-shrink: 0; width: var(--md-therm-w); height: var(--md-therm-h); cursor: grab; touch-action: none; border-radius: var(--r-m); }
.md-therm.is-drag { cursor: grabbing; }
.md-therm:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 4px; }
.md-therm svg { display: block; }
.md-therm__glass { fill: var(--md-field-bg); stroke: var(--border); stroke-width: 1.5; }
.md-therm__liquid { transition: transform var(--dur) var(--ease); }
.md-therm.is-drag .md-therm__liquid { transition-duration: var(--dur-press); }
.md-therm__fill { fill: var(--accent); transition: fill var(--dur) var(--ease); }
.md-therm__wave { fill: none; stroke: var(--accent-light); stroke-width: 1.5; }
.md-therm[data-band="wave"] .md-therm__fill { fill: var(--warning); }
.md-therm[data-band="strong"] .md-therm__fill { fill: var(--danger); }
.md-therm[data-band="wave"] .md-therm__wave, .md-therm[data-band="strong"] .md-therm__wave { stroke: var(--text); stroke-opacity: .5; }
.md-therm__scale text { fill: var(--text-secondary); font-family: var(--font-num); font-size: var(--md-fs-scale); }
.md-therm__num { position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; font-size: var(--fs-h2); font-weight: 700; color: var(--on-accent); pointer-events: none; }
.md-crave__side { display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-2); flex: 1; min-width: 0; padding: var(--sp-1) 0; }
.md-band { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3) var(--hm-pad-14); border-radius: var(--r-m); background: var(--md-accent-a10); border: 1px solid var(--md-accent-a30); }
.md-band__t { font-size: var(--fs-label); font-weight: 600; color: var(--accent-light); }
.md-band__s { font-size: var(--fs-caption); line-height: 1.45; color: var(--text); }
.md-band__a { align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--tap-min); margin-bottom: calc(-1 * var(--sp-3)); font-size: var(--fs-caption); font-weight: 600; color: var(--accent-light); text-decoration: none; }
.md-band[data-band="wave"] { background: var(--md-warning-a10); border-color: var(--warning-a50); }
.md-band[data-band="wave"] .md-band__t { color: var(--warning); }
.md-band[data-band="strong"] { background: var(--md-danger-a10); border-color: var(--danger-a45); }
.md-band[data-band="strong"] .md-band__t, .md-band[data-band="strong"] .md-band__a { color: var(--danger); }
.md-field { display: flex; flex-direction: column; gap: var(--sp-2); }
.md-field__row { display: flex; justify-content: space-between; }
.md-textarea {
  box-sizing: border-box; min-height: 88px; padding: var(--sp-3) var(--hm-pad-14);
  border: 1px solid var(--border); border-radius: var(--r-m); background: var(--md-field-bg);
  color: var(--text); font: 400 var(--fs-callout) var(--font-text); resize: none;
}
.md-textarea:focus-visible { outline: none; border-color: var(--accent); }
.md-save { width: 100%; border-radius: var(--r-full); font-size: var(--fs-body); }

/* Эта неделя */
.md-week { display: flex; flex-direction: column; gap: var(--hm-gap-10); padding: var(--hm-pad-14) var(--sp-4); }
.md-week__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--hm-gap-6); text-align: center; }
.md-week__d { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); font-size: var(--fs-micro); color: var(--text-secondary); }
.md-week__ring { fill: none; stroke: var(--border); stroke-width: 1.5; }
.md-week__drop { fill: none; }
.md-week__d.is-filled .md-week__ring { fill: var(--accent-a20); stroke: none; }
.md-week__d.is-filled .md-week__drop { fill: var(--accent); }
.md-week__d.is-today { color: var(--accent-light); font-weight: 600; }
.md-week__d.is-today .md-week__ring { stroke: var(--accent-light); }
.md-week__d.is-today.is-filled .md-week__drop { fill: var(--accent-light); }
.md-fly { position: fixed; z-index: 60; pointer-events: none; }
.md-fly svg { display: block; fill: var(--accent-light); }
@media (prefers-reduced-motion: reduce) {
  .md-task__fill, .md-task__check svg, .md-therm__liquid, .md-therm__fill { transition: none; }
  .md-task.is-burst .md-confetti path { animation: none; }
}

/* ══ PIN (Pin.dc.html) ══ */
.pin-screen {
  position: relative; box-sizing: border-box; display: flex; flex-direction: column; align-items: center;
  min-height: 100dvh; max-width: var(--content-max); margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + var(--pin-top)) var(--sp-6) calc(env(safe-area-inset-bottom) + var(--sp-8));
  background: var(--pin-bg); color: var(--text); font-family: var(--font-text);
}
.pin-top { display: flex; flex-direction: column; align-items: center; gap: var(--hm-gap-10); }
.pin-logo { fill: var(--accent-a20); stroke: var(--accent-light); stroke-width: 1.75; }
.pin-title { margin: 0; font-size: var(--pin-fs-title); font-weight: 600; color: var(--text); text-align: center; }
.pin-sub { margin: 0; font-size: var(--fs-label); color: var(--text-secondary); }
.pin-sub.is-error { color: var(--danger); }
.pin-pad { display: flex; flex-direction: column; align-items: center; }
.pin-dots { display: flex; justify-content: center; gap: var(--pin-gap-dots); margin-top: var(--sp-8); }
.pin-dots.shake { animation: kp-shake var(--dur) var(--ease); }
.pin-dot__outline { fill: none; stroke: var(--border); stroke-width: 1.5; transition: stroke var(--dur) var(--ease); }
.pin-dot__fill { fill: var(--accent); transform: translateY(28px); transition: transform var(--dur) var(--ease); }
.pin-dot.is-filled .pin-dot__fill { transform: none; }
.pin-dot.is-filled .pin-dot__outline { stroke: var(--accent); }
.pin-dots.is-error .pin-dot__outline { stroke: var(--danger); }
.pin-dots.is-error .pin-dot__fill { fill: var(--danger); }
.pin-keys {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: var(--sp-4);
  width: 300px; max-width: 100%; margin-top: var(--sp-10);
}
.pin-key {
  justify-self: center; display: flex; align-items: center; justify-content: center;
  width: var(--key-size); height: var(--key-size); padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface-sos);
  color: var(--text); font: 600 var(--fs-key) var(--font-num);
}
.pin-key--ghost { border-color: transparent; background: transparent; }
.pin-key svg { fill: none; stroke: var(--text-secondary); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.pin-key:focus-visible, .pin-link:focus-visible, .pin-sos:focus-visible, .wb-link:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.pin-foot {
  position: absolute; left: var(--sp-6); right: var(--sp-6); bottom: calc(env(safe-area-inset-bottom) + var(--sp-8));
  display: flex; justify-content: space-between; align-items: center;
}
.pin-link, .wb-link {
  display: flex; align-items: center; min-height: var(--tap-min); padding: 0;
  border: 0; background: none; cursor: pointer; font: 400 var(--fs-label) var(--font-text); color: var(--accent-light);
}
.pin-sos {
  display: flex; align-items: center; justify-content: center; margin-left: auto;
  width: var(--sos-btn); height: var(--sos-btn); padding: 0; border: 0; border-radius: var(--r-full); cursor: pointer;
  background: var(--danger); color: var(--on-primary); font: 700 var(--fs-sos) var(--font-text);
  box-shadow: var(--pin-sos-shadow);
}
.pin-sheet__p { margin: 0 0 var(--sp-3); font-size: var(--fs-callout); line-height: 1.5; color: var(--text); }
.pin-sheet__p + .kp-btn, .kp-sheet .kp-btn + .kp-btn { margin-top: var(--sp-2); }
/* Низкий экран (375×667): клавиатура не должна наезжать на «Забыл PIN» и SOS */
@media (max-height: 700px) {
  .pin-screen { padding-top: calc(env(safe-area-inset-top) + var(--sp-6)); padding-bottom: calc(env(safe-area-inset-bottom) + var(--sos-btn) + var(--sp-10)); }
  .pin-keys { margin-top: var(--sp-6); row-gap: var(--sp-3); }
  .pin-dots { margin-top: var(--sp-5); }
}

/* ══ «С возвращением» (WelcomeBack.dc.html) ══ */
.wb-screen {
  box-sizing: border-box; display: flex; flex-direction: column;
  min-height: 100dvh; max-width: var(--content-max); margin: 0 auto;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + var(--sp-8));
  background: var(--wb-bg); color: var(--text); font-family: var(--font-text);
}
.wb-art { display: block; width: 100%; height: auto; margin-top: var(--wb-art-top); }
.wb-text, .wb-actions { margin-left: var(--gutter); margin-right: var(--gutter); }
.wb-glass { fill: var(--accent-light-a05); stroke: var(--accent-light-a35); stroke-width: 1.5; }
.wb-glare { fill: none; stroke: var(--text); stroke-opacity: .3; stroke-width: 5; stroke-linecap: round; }
.wb-shadow { fill: var(--accent-light); opacity: .12; }
.wb-text { display: flex; flex-direction: column; gap: var(--hm-gap-10); margin-top: var(--sp-5); padding: 0 var(--sp-1); text-align: center; }
.wb-hello { font-size: var(--fs-label); color: var(--accent-light); }
.wb-title { margin: 0; font-size: var(--wb-fs-title); font-weight: 700; line-height: 1.2; color: var(--text); }
.wb-sub { margin: 0; font-size: var(--fs-callout); line-height: 1.5; color: var(--text-secondary); }
.wb-num { color: var(--text); }
.wb-actions { display: flex; flex-direction: column; gap: var(--hm-gap-10); margin-top: auto; padding-top: var(--sp-8); }
.wb-btn { border-radius: var(--r-full); font-size: var(--fs-body); }
.wb-btn--alt { background: var(--surface); }
.wb-link { align-self: center; }
@media (max-height: 700px) {
  .wb-art { margin-top: 0; width: 80%; align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  .pin-dot__fill, .pin-dot__outline { transition: none; }
  .pin-dots.shake { animation: none; }
}
