/* Телефон на первом экране. Корпус — светлый матовый, из того же «пластилина», что и сцены;
   экран — главный экран приложения по макету Figma «Экраны v7». */
.part--phone {
  --pw: calc(var(--u) * 0.56 * var(--k, 1) * var(--phone-gain, 1)); /* на узком экране телефон крупнее — задаёт main.js */
  --clay-light: #fdfcf9;
  --clay: #efece5;
  --clay-shade: #d6d1c6;
  --clay-shadow: rgb(112 100 82 / 0.3);
  --bezel: #1d2122;
  width: var(--pw);
  height: calc(var(--pw) * 2.106);
  transform: translate(-50%, calc(-100% + var(--u) * 0.02));
}
.phone {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 2.5%;
  border-radius: calc(var(--pw) * 0.15);
  background: linear-gradient(150deg, var(--clay-light) 0%, var(--clay) 46%, var(--clay-shade) 100%);
  box-shadow:
    inset calc(var(--pw) * 0.008) calc(var(--pw) * 0.01) calc(var(--pw) * 0.012) rgb(255 255 255 / 0.95),
    inset calc(var(--pw) * -0.01) calc(var(--pw) * -0.014) calc(var(--pw) * 0.022) var(--clay-shadow),
    0 1px 2px rgb(60 54 46 / 0.22),
    0 calc(var(--pw) * 0.1) calc(var(--pw) * 0.16) calc(var(--pw) * -0.07) rgb(60 54 46 / 0.34);
}
/* Кнопки на гранях: выглядывают из-за корпуса */
.phone::before,
.phone::after {
  content: '';
  position: absolute;
  z-index: -1;
  width: calc(var(--pw) * 0.03);
  border-radius: calc(var(--pw) * 0.012);
  background: linear-gradient(90deg, var(--clay-shade), var(--clay) 50%, var(--clay-shade));
  box-shadow: 0 1px 1px rgb(60 54 46 / 0.25);
}
.phone::before { left: calc(var(--pw) * -0.012); top: 19%; height: 11%; }
.phone::after { right: calc(var(--pw) * -0.012); top: 25%; height: 8%; }
.phone__screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: calc(var(--pw) * 0.128);
  background: #eef8f7;
  box-shadow: 0 0 0 calc(var(--pw) * 0.009) var(--bezel), 0 0 0 calc(var(--pw) * 0.014) rgb(255 255 255 / 0.55);
}
.phone__shadow {
  position: absolute;
  left: 50%;
  bottom: calc(var(--u) * -0.03);
  width: 130%;
  height: calc(var(--u) * 0.07);
  transform: translateX(-50%);
  border-radius: 50%;
  /* плотное пятно под самым корпусом и мягкий ореол вокруг — телефон стоит на плите, а не висит */
  background:
    radial-gradient(closest-side, rgb(60 54 46 / 0.3), rgb(60 54 46 / 0)) center / 74% 52% no-repeat,
    radial-gradient(closest-side, rgb(60 54 46 / 0.26), rgb(60 54 46 / 0));
  z-index: -1;
}

/* Экран: токены ДС v7 живут только здесь и с токенами лендинга не смешиваются */
.ph {
  --ph-text: #16191a;
  --ph-text-2: #5a615c;
  --ph-text-off: #a9afab;
  --ph-card: #fff;
  --ph-selected: #16191a;
  --ph-on-selected: #fff;
  --ph-on-selected-2: rgb(255 255 255 / 0.75);
  --ph-muted: #eef3f1;
  --ph-bar: rgb(255 255 255 / 0.96);
  --ph-divider: #e2e5e0;
  --ph-action: #06d6c4;
  --ph-high: #f0b429;
  --ph-high-subtle: #fdf2d4;
  --ph-band: #e2f5eb;
  --ph-band-label: #2f6b50;
  --ph-marker: #eaf2ef;
  --ph-tint: #c5f2ee;
  --ph-page: #eef8f7;
  --ph-r-md: 12px;
  --ph-r-xl: 16px;
  --ph-r-full: 999px;
  --ph-shadow-card: 0 1px 2px rgb(22 25 26 / 0.05);
  --ph-shadow-floating: 0 0 0 0.5px rgb(22 25 26 / 0.06), 0 4px 18px rgb(22 25 26 / 0.12);
  --ph-shadow-fab: 0 6px 16px rgb(4 130 118 / 0.32);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  width: 390px;
  height: 844px;
  transform: scale(calc(var(--phone-k) * 0.95));
  transform-origin: 0 0;
  background: linear-gradient(var(--ph-tint) 0, var(--ph-page) 340px);
  color: var(--ph-text);
  font: 400 17px/22px var(--font);
}
/* «Островок» камеры — часть корпуса, не макета */
.ph::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 11px;
  width: 112px;
  height: 33px;
  margin-left: -56px;
  border-radius: var(--ph-r-full);
  background: var(--bezel);
}
.ph img { display: block; flex: none; }
:where(.ph) :where(ul, p) { margin: 0; padding: 0; list-style: none; }
.ph b { font-weight: 600; }
.ph-micro { font-size: 13px; line-height: 18px; color: var(--ph-text-2); }
.ph-card { border-radius: var(--ph-r-xl); background: var(--ph-card); box-shadow: var(--ph-shadow-card); }

.ph-status { display: flex; flex: none; justify-content: space-between; align-items: center; height: 54px; padding: 12px 27px 0 30px; }
.ph-sys { display: flex; gap: 6px; align-items: flex-end; }
.ph-sys i { width: 18px; height: 11px; border-radius: 3px; background: var(--ph-text); }
.ph-sys i:nth-child(1) { width: 17px; clip-path: polygon(0 100%, 100% 0, 100% 100%); border-radius: 0; }
.ph-sys i:nth-child(2) { width: 15px; border-radius: 8px 8px 2px 2px; }
.ph-sys i:nth-child(3) { width: 25px; border: 1.5px solid var(--ph-text); background: linear-gradient(90deg, var(--ph-text) 70%, transparent 70%) content-box; padding: 1.5px; }

.ph-head { display: flex; flex: none; gap: 8px; align-items: flex-end; height: 70px; padding: 8px 16px 6px; }
.ph-head__titles { flex: 1; display: flex; flex-direction: column; }
.ph-title { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -0.4px; }
.ph-date { font-size: 15px; line-height: 20px; color: var(--ph-text-2); }
.ph-head__action { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--ph-r-md); background: var(--ph-card); box-shadow: var(--ph-shadow-card); }

.ph-week { display: flex; flex: none; justify-content: space-between; height: 85px; padding: 6px 8px 10px; }
.ph-day { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 44px; padding: 6px 0 8px; border-radius: var(--ph-r-full); }
.ph-day__dow { font-size: 12px; line-height: 16px; color: var(--ph-text-2); }
.ph-day__num { display: grid; place-items: center; min-height: 30px; font-weight: 600; }
.ph-day__dot { width: 5px; height: 5px; }
.ph-day--selected { background: var(--ph-selected); }
.ph-day--selected .ph-day__dow { color: var(--ph-on-selected-2); }
.ph-day--selected .ph-day__num { color: var(--ph-on-selected); }
.ph-day--future :is(.ph-day__dow, .ph-day__num) { color: var(--ph-text-off); }
.ph-day--future .ph-day__num { font-weight: 400; }

.ph-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px 0; }
.ph-sensor { align-self: flex-start; display: flex; align-items: center; gap: 4px; height: 32px; padding: 4px 10px 4px 8px; border-radius: var(--ph-r-full); background: var(--ph-card); box-shadow: var(--ph-shadow-card); font-size: 13px; line-height: 18px; color: var(--ph-text-2); white-space: nowrap; }

/* В макете у карточек прозрачная рамка 1 px — она входит в высоту */
.ph-now { padding: 1px 0; }
.ph-now__row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px 10px; }
.ph-now__reading { display: flex; flex-direction: column; }
.ph-now__value { display: flex; align-items: center; gap: 2px; }
.ph-now__value b { font-size: 56px; line-height: 58px; letter-spacing: -1.2px; }
.ph-now__status { flex: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-top: 10px; }
.ph-zone { display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px 0 4px; border-radius: var(--ph-r-full); background: var(--ph-high-subtle); font-size: 14px; line-height: 20px; font-weight: 600; }
.ph-zone i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ph-high); }
.ph-now__footer { padding: 0 16px; }
.ph-now__footer p { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 8px 0; border-top: 1px solid var(--ph-divider); font-size: 14px; line-height: 20px; }
.ph-now__footer span { flex: 1; }

/* График дня: линия и сетка — готовый слой из макета, поверх него подписи и точка «сейчас» */
.ph-chart { display: flex; flex-direction: column; gap: 2px; padding: 15px 0 9px; overflow: hidden; }
.ph-plot { position: relative; height: 148px; }
.ph-plot > * { position: absolute; }
.ph-plot__band { left: 0; top: 54.9px; width: 100%; height: 55.7px; background: var(--ph-band); }
.ph-plot__lines { left: 0; top: 0; animation: ph-draw 1.6s 0.3s cubic-bezier(0.4, 0, 0.6, 1) both; }
.ph-plot__threshold { left: 16px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ph-band-label); white-space: nowrap; }
.ph-plot__hour { top: 132px; font-size: 11px; line-height: 13px; font-weight: 500; letter-spacing: 0.1px; color: var(--ph-text-2); }
.ph-plot__now { width: 18px; height: 18px; animation: ph-pop 0.3s 1.4s both; }
.ph-plot__now img { position: absolute; left: 0; top: 0; }
.ph-plot__now img:first-child { animation: ph-pulse 2.6s 1.8s ease-out infinite; }
.ph-plot__now img:last-child { left: 1.5px; top: 1.5px; }
/* Ореол дышит, только пока сцена с телефоном стоит наверху; в остальное время — на паузе */
.node--phone:not(.is-live) .ph-plot__now img:first-child { animation-play-state: paused; }
/* Один раз: слой с линией открывается слева направо, затем появляется точка; дальше дышит только ореол */
/* Круг замкнулся — график на экране рисуется заново, уже за весь день */
[data-live="outro"] .ph-plot__lines { animation-name: ph-redraw; }
[data-live="outro"] .ph-plot__now { animation-name: ph-repop; }
@keyframes ph-redraw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ph-repop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes ph-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ph-pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes ph-pulse { 0% { opacity: 0; transform: scale(0.6); } 15% { opacity: 1; transform: none; } 75%, 100% { opacity: 0; transform: scale(2.2); } }

.ph-markers { position: relative; height: 30px; }
.ph-marker { position: absolute; top: 2px; display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 26px; min-height: 26px; padding: 4px 6px; border-radius: var(--ph-r-full); background: var(--ph-marker); font-size: 12px; line-height: 16px; }

.ph-section { height: 42px; padding: 8px 4px 6px; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.3px; }
.ph-totals { display: flex; min-height: 106px; padding: 12px 0; }
.ph-total { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 12px; font-size: 12px; line-height: 16px; color: var(--ph-text-2); }
.ph-total + .ph-total { border-left: 1px solid var(--ph-divider); }
.ph-total__label { display: flex; align-items: center; gap: 4px; padding-bottom: 2px; }
.ph-total b { font-size: 18px; line-height: 24px; font-weight: 700; color: var(--ph-text); }
.ph-daypart { display: flex; align-items: baseline; gap: 8px; height: 44px; padding: 14px 6px 0; font-size: 15px; line-height: 20px; color: var(--ph-text-2); }
.ph-daypart b { font-size: 17px; line-height: 22px; font-weight: 700; color: var(--ph-text); }

.ph-tabs { position: absolute; left: 16px; right: 16px; top: 750px; display: flex; align-items: center; gap: 12px; }
.ph-bar { flex: 1; display: flex; gap: 4px; height: 60px; padding: 4px; border: 1px solid var(--ph-divider); border-radius: var(--ph-r-full); background: var(--ph-bar); box-shadow: var(--ph-shadow-floating); }
.ph-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: var(--ph-r-full); font-size: 11px; line-height: 13px; font-weight: 500; letter-spacing: 0.1px; color: var(--ph-text-2); }
.ph-tab--selected { background: var(--ph-muted); font-weight: 600; color: var(--ph-text); }
.ph-fab { display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: var(--ph-r-full); background: var(--ph-action); box-shadow: var(--ph-shadow-fab); }
