#city-hud #city-phone-toggle {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  gap: 6px; min-height: 46px; padding: 0 12px; border-color: #ffe4a5; border-radius: 11px;
  background: linear-gradient(160deg,#ffe6a8,#f2bd58); color: #332510; text-shadow: none;
  box-shadow: inset 0 1px 0 #fff5cf,0 2px 6px #0006; font: 700 16px/1 Arial,sans-serif; white-space: nowrap;
}
#city-tools #city-phone-toggle svg { flex: none; width: 26px; height: 26px; stroke: none; }
#city-hud #city-phone-toggle[aria-expanded="true"] {
  background: #3a3021; color: #ffe2a0; border-color: #ffd075; box-shadow: inset 0 1px 3px #0004;
}
@media (hover: hover) {
  #city-phone-toggle:hover { filter: brightness(1.08); }
}
/* Под кошельком ставим обе подписи под значками, чтобы ряд с паузой поместился слева от аппарата. */
@media (max-height: 600px), (max-width: 760px) {
  .city-amber.touch #city-hud :is(#city-phone-toggle,#city-activities) {
    flex-direction: column; justify-content: center; min-width: 44px; min-height: 44px; gap: 1px; padding: 2px 7px; font-size: 13px;
  }
  .touch #city-tools #city-phone-toggle svg { width: 21px; height: 21px; }
}
#city-phone-toggle.phone-has-update::after, .phone-has-update .phone-app-icon::after {
  content: ''; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%;
  background: #ef363e; box-shadow: 0 0 0 2px #323429; pointer-events: none;
}
.phone-has-update .phone-app-icon::after { top: -1px; right: -1px; }
/* Заказ диспетчера занимает этот угол до ответа. */
#city-phone-toggle:has(#phone-order-badge:not([hidden]))::after { content: none; }
@media (prefers-reduced-motion: no-preference) {
  #city-phone-toggle.phone-has-update[aria-expanded="false"]:has(#phone-order-badge[hidden])::before {
    content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
    box-shadow: 0 0 0 1px #ffcf69,0 0 8px 2px #ffc3549c; opacity: 0; animation: city-phone-glow 20s 2s ease-in-out infinite;
  }
  @keyframes city-phone-glow { 0%, 9%, 100% { opacity: 0; } 4% { opacity: .85; } }
  /* Движется рисунок, чтобы границы зоны касания оставались на месте. */
  #city-phone :is(.phone-app-icon,#phone-back svg) { transition: transform 110ms ease; }
  #city-phone :is(.phone-apps button,#phone-back):active :is(.phone-app-icon,svg) { transform: scale(.94); }
}
#city-phone button:active:not(:disabled) { filter: brightness(.91); }

#city-phone {
  --phone-ink: #f7f3e9; --phone-muted: #a7b7af; --phone-bg: #101819; --phone-panel: #1b2828;
  position: absolute; left: var(--ch-gap); bottom: var(--ch-gap); z-index: 1; pointer-events: auto;
  width: min(clamp(198px,18.6vw,320px),43vh); aspect-ratio: 300 / 586; padding: 5px;
  border: 1px solid #46504b; border-radius: 12% / 6.2%;
  background: linear-gradient(110deg,#828b85,#202a29 12%,#77817a 40%,#131b1b 61%,#7c867e 96%,#49514d);
  box-shadow: inset 0 0 0 1px #ffffff36,0 4px 12px #0006;
  color: var(--phone-ink); font: 500 13px/1.35 -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; text-shadow: none;
}
.phone-glass {
  position: relative; height: 100%; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 10% / 5.1%; border: 1px solid #12181a; background: var(--phone-bg); container-type: inline-size; color-scheme: dark;
}
.phone-glass:has(#phone-home:not([hidden])) { background: #10232e url('../assets/city-phone-evening.webp') center / cover no-repeat; }
#city-phone svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#city-phone button { padding: 0; border: 0; background: none; border-radius: 8px; }
#city-phone button:focus-visible { outline-offset: -3px; }
#city-phone .phone-dragging, #city-phone .phone-dragging * { cursor: grabbing; }
.phone-status { position: relative; display: flex; justify-content: space-between; align-items: center; flex: none; height: 30px; padding: 0 16px; }
.phone-status b { font: 700 9px/1 Arial,sans-serif; letter-spacing: 1.6px; }
.phone-status::before {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 6px; height: 6px; border: 1px solid #344043; border-radius: 50%; background: #080d0e;
}
#city-phone .phone-status svg { width: 33px; height: 13px; }

#phone-home, #phone-app { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#phone-home { padding-top: 14px; }
.phone-place, #phone-time, #phone-date { margin: 0 6%; }
.phone-place { display: flex; align-items: center; gap: 4px; color: #f2f4e9; font-size: 10px; font-weight: 650; letter-spacing: 1.4px; text-transform: uppercase; }
#city-phone .phone-place svg { width: 13px; height: 13px; }
#phone-time { font-weight: 400; font-size: 54px; font-size: clamp(38px,22cqw,66px); line-height: 1.04; letter-spacing: -.075em; font-variant-numeric: tabular-nums; }
#phone-date { color: #e7e9de; font-size: 13px; }
#phone-date::first-letter { text-transform: uppercase; }
.phone-apps {
  display: grid; flex: none; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px 4px;
  margin-top: auto; padding: 34px 4% 6px; background: linear-gradient(transparent,#0a1729bb 45%,#0b1a27c7);
}
#city-phone .phone-apps button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 0; min-height: 44px; padding: 2px 0; border-radius: 12px; color: #fff;
}
.phone-apps b { max-width: 100%; font-size: 12px; font-weight: 600; line-height: 1.3; }
.phone-app-icon {
  width: 46px; width: clamp(36px,17.5cqw,54px); aspect-ratio: 1; position: relative; display: block; border-radius: 24%;
  background: url('../assets/city-phone-apps.webp') var(--app-pos) / 340% 227.6% no-repeat;
  box-shadow: 0 2px 5px #0005,inset 0 0 0 1px #ffffff26;
}
.phone-apps [data-app="taxi"] { --app-pos: 3.6% 6.8%; }
.phone-apps [data-app="news"] { --app-pos: 50.05% 6.8%; }
.phone-apps [data-app="camera"] { --app-pos: 96.3% 6.8%; }
.phone-apps [data-app="farm"] { --app-pos: 3.6% 93.5%; }
.phone-apps [data-app="messages"] { --app-pos: 50.05% 93.5%; }
.phone-apps [data-app="calls"] { --app-pos: 96.3% 93.5%; }

#phone-app { overflow-x: hidden; }
#phone-app > header { display: flex; flex: none; align-items: center; gap: 5px; min-height: 46px; padding: 0 8px 2px 4px; background: var(--phone-bg); }
#phone-app-name { font-size: 18px; font-weight: 680; line-height: 1.14; letter-spacing: -.035em; }
#city-phone #phone-back { flex: none; width: 44px; min-height: 44px; display: grid; place-items: center; }
#phone-back svg { width: 19px; }
#city-phone #phone-pocket { position: relative; display: grid; flex: none; place-items: center; min-height: 26px; border-radius: 0; }
#phone-pocket span { width: 25%; height: 4px; border-radius: 4px; background: #e4e9dfb8; }
#city-phone #phone-pocket svg { display: none; }
#city-phone:has(#phone-home:not([hidden])) #phone-pocket { background: #0b1a27c7; }
.touch #city-phone #phone-pocket { min-height: 44px; }

#city-phone .phone-update-tip {
  display: grid; grid-template-columns: minmax(0,1fr) 44px; align-items: center;
  margin: 0 0 9px; padding: 0 0 6px; border: 1px solid #68583e; border-radius: 13px; background: #2b2b24; color: #ffdd92; text-align: left;
}
.phone-update-tip strong { grid-area: 1/1; padding: 5px 0 0 10px; font-size: 14px; line-height: 1.18; }
.phone-update-tip p { grid-column: 1/-1; margin: 0; padding: 0 10px 4px; color: #e0e2d7; font: 13px/1.35 -apple-system,Arial,sans-serif; }
#city-phone .phone-update-tip [data-update-open] {
  grid-column: 1/-1; justify-self: start; min-height: 44px; max-width: calc(100% - 16px); margin: 0 8px; padding: 4px 9px;
  color: #ffdd92; background: #39362b; border-radius: 8px; font-size: 13px; font-weight: 650; text-align: left;
}
#city-phone .phone-update-tip [data-update-dismiss] {
  grid-area: 1/2; align-self: start; justify-self: end; width: 44px; height: 44px; color: #e0ce9c; font: 20px/1 Arial,sans-serif;
}

@media (orientation: landscape) {
  .touch #city-phone {
    --phone-left: max(196px,calc(32px + 156px * var(--tb)));
    left: var(--phone-left); bottom: var(--ch-gap); width: min(240px,calc(50vw - var(--sal) - var(--phone-left) - 6px),48vh);
    max-height: calc(100% - 2 * var(--ch-gap));
  }
}
@media (max-width: 760px) and (orientation: landscape) {
  .touch #city-phone { --phone-left: calc(32px + 156px * var(--tb)); max-height: calc(100% - 106px); }
}
@media (orientation: portrait) {
  .touch #city-phone { width: min(48vw,260px); bottom: calc(26px + 156px * var(--tb)); max-height: calc(100% - 140px - 156px * var(--tb)); }
}
@media (max-height: 520px), (max-width: 600px) {
  #city-phone { padding: 4px; }
  .phone-status { height: 19px; padding: 0 10px; }
  #phone-home { padding-top: 3px; }
  .phone-place { font-size: 8px; letter-spacing: .6px; }
  #phone-time { font-size: 31px; }
  #phone-date { font-size: 10px; }
  .phone-apps { padding: 8px 2px 2px; gap: 1px; }
  #city-phone .phone-apps button { gap: 1px; padding: 0; }
  .phone-apps b { font-size: 10px; }
  .phone-app-icon { width: 29px; }
  .phone-has-update .phone-app-icon::after { width: 7px; height: 7px; }
  #phone-app > header { min-height: 44px; padding: 0 3px 0 0; gap: 1px; }
  #phone-app-name { font-size: 14px; }
  #city-phone .phone-update-tip { margin-bottom: 5px; padding-block: 0 4px; }
  .phone-update-tip strong { padding-left: 6px; font-size: 14px; }
  .phone-update-tip p { padding: 0 6px 4px; font-size: 11.5px; line-height: 1.27; }
  #city-phone .phone-update-tip [data-update-open] { margin-inline: 4px; max-width: calc(100% - 8px); padding-inline: 7px; font-size: 12px; }
}
/* В узком корпусе два столбца оставляют каждой иконке место для пальца и подписи. */
@container (max-width: 159px) {
  .phone-apps { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 4px 2px 0; gap: 0; }
  .phone-apps b { font-size: 9px; }
  #phone-time { font-size: 23px; }
  .phone-place { display: none; }
}
/* На низком экране сворачивание остаётся в шапке, пока показано объявление. */
@media (max-height: 375px) and (orientation: landscape) {
  #city-phone:has([data-update-home]:not([hidden]) .phone-update-tip) .phone-status { display: none; }
  #city-phone:has([data-update-home]:not([hidden]) .phone-update-tip) #phone-pocket {
    position: absolute; top: 0; right: 0; width: 44px; height: 44px;
  }
  #city-phone:has([data-update-home]:not([hidden]) .phone-update-tip) #phone-pocket span { display: none; }
  #city-phone:has([data-update-home]:not([hidden]) .phone-update-tip) #phone-pocket svg { display: block; width: 16px; }
  #city-phone #phone-app:has([data-update-home]:not([hidden]) .phone-update-tip) > header { padding-inline: 0 44px; gap: 0; }
}
@media (orientation: landscape) and (max-width: 600px) and (max-height: 375px) {
  .touch #city-phone:has([data-update-home]:not([hidden]) .phone-update-tip) { min-width: min(130px,36vw); max-height: calc(100% - 80px); }
}
