.city-phone {
  --phone-frame: #0e161b;
  --phone-bg: #152027;
  --phone-head: #1a2a30;
  --phone-surface: #203038;
  --phone-tile: #25373d;
  --phone-art: #2d4145;
  --phone-rule: #34454d;
  --phone-border: #64777e;
  --phone-text: #faf3df;
  --phone-muted: #bccbd0;
  --phone-accent: #f0c881;
  --phone-ink: #2d2113;
  --phone-bezel: #8e754e;
  --phone-shadow: rgb(6 10 14 / .68);
  --phone-scrim: rgb(7 13 18 / .62);
  color-scheme: dark;
  box-sizing: border-box;
  width: min(464px, calc(100% - 16px));
  max-width: none;
  max-height: calc(100dvh - 20px);
  margin: auto;
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--phone-bezel);
  border-radius: 28px;
  background: var(--phone-frame);
  color: var(--phone-text);
  font: inherit;
  box-shadow: 0 18px 64px var(--phone-shadow);
}
.city-phone::backdrop { background: var(--phone-scrim); }
.city-phone [hidden] { display: none; }
.phone-device {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(710px, calc(100dvh - 34px));
  overflow: hidden;
  border-radius: 22px;
  background: var(--phone-bg);
}
.phone-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--phone-rule);
  background: var(--phone-head);
}
.phone-head:has([data-phone-back]:not([hidden])) { grid-template-columns: 44px minmax(0, 1fr) 44px; }
.phone-title-block { grid-column: 1; grid-row: 1; display: flex; align-items: center; min-width: 0; gap: 10px; }
.phone-title-block > div { min-width: 0; }
.phone-head h2 { margin: 0; font: 1.42rem/1.12 var(--game, system-ui); }
.phone-current-model { display: block; margin-top: 3px; color: var(--phone-muted); font-size: .76rem; overflow-wrap: anywhere; }
.phone-device-art {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: var(--phone-art);
}
.phone-device-art img { width: 48px; height: 48px; object-fit: contain; }
.phone-head [data-phone-back] { grid-column: 1; grid-row: 1; font-size: 1.5rem; line-height: 1; }
.phone-head [data-phone-close] { grid-column: -2; grid-row: 1; }
.phone-head:has([data-phone-back]:not([hidden])) .phone-title-block { grid-column: 2; }
.phone-head:has([data-phone-back]:not([hidden])) .phone-device-art { display: none; }
.city-phone button, .city-phone input, .city-phone textarea, .city-phone select {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--phone-border);
  border-radius: 10px;
  background: var(--phone-surface);
  color: var(--phone-text);
  font: inherit;
}
.city-phone button { padding: 7px 11px; cursor: pointer; }
.city-phone button:hover:not(:disabled) { border-color: var(--phone-accent); }
.city-phone button:disabled { color: var(--phone-muted); opacity: .8; cursor: default; }
.city-phone :is(button, input, textarea, select):focus-visible { outline: 2px solid var(--phone-accent); outline-offset: 2px; }
.city-phone .phone-primary {
  background: var(--phone-accent);
  border-color: var(--phone-accent);
  color: var(--phone-ink);
  font-weight: 750;
}
.phone-screen {
  padding: 14px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--phone-border) transparent;
  scrollbar-width: thin;
}
.phone-screen:has(.phone-compose, .phone-history) { display: flex; min-height: 0; flex-direction: column; }
.phone-launcher, .phone-directory { min-width: 0; }
.phone-launcher h3, .phone-directory h3#phoneDirectoryTitle { margin: 0 0 8px; font-size: .91rem; font-weight: 760; }
.phone-feature-links, .phone-service-links { display: grid; gap: 7px; }
.phone-feature-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.phone-service-links { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 7px; }
.city-phone .phone-feature-links button, .city-phone .phone-service-links button {
  display: flex;
  align-items: center;
  gap: 6px;
  border-color: var(--phone-rule);
  background: var(--phone-surface);
  font-size: .84rem;
  font-weight: 720;
  line-height: 1.28;
}
.city-phone .phone-feature-links button { min-height: 60px; background: var(--phone-tile); text-align: start; }
.city-phone .phone-service-links button { min-height: 65px; flex-direction: column; justify-content: center; padding: 6px 3px; }
.phone-feature-links img, .phone-shortcut-icon img { object-fit: contain; flex: none; }
.phone-shortcut-icon { position: relative; display: grid; place-items: center; }
.phone-service-links .phone-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.phone-count { position: absolute; inset: -2px -12px auto auto; }
.phone-count {
  min-width: 17px;
  box-sizing: border-box;
  padding: 1px 4px;
  color: var(--phone-ink);
  background: var(--phone-accent);
  border-radius: 999px;
  text-align: center;
  font-size: .67rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.22;
}
.phone-freight-links { margin-top: 10px; }
.phone-freight-links details { margin: 5px 0; }
.phone-freight-links summary { min-height: 44px; align-content: center; cursor: pointer; }
.phone-directory { border-top: 1px solid var(--phone-rule); margin-top: 14px; padding-top: 12px; }
.phone-commerce h3 { margin: 0 0 14px; font-size: 1.05rem; }
.phone-commerce h3:focus { outline: none; }
.phone-commerce-balance {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 0 0 14px;
  color: var(--phone-muted);
  font-size: .86rem;
}
.phone-commerce-balance b { color: var(--phone-text); }
.phone-commerce-form { display: grid; gap: 12px; }
.phone-commerce-form label { display: grid; gap: 5px; color: var(--phone-muted); font-size: .88rem; }
.phone-commerce-form :is(input, select) { width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 1rem; }
.phone-commerce-form .phone-empty { margin: 0; }
.phone-commerce-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.phone-commerce-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--phone-border);
  border-radius: 12px;
  background: var(--phone-surface);
}
.phone-commerce-summary dt { color: var(--phone-muted); }
.phone-commerce-summary dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.phone-commerce-summary b { color: var(--phone-accent); }
.phone-commerce-feedback { color: #ffb6b0; }
.phone-commerce-feedback:empty { display: none; }
.phone-commerce-feedback, .phone-commerce-success { overflow-wrap: anywhere; font-size: .88rem; }
.phone-recent-orders { margin-top: 19px; }
.phone-recent-orders h4 { margin: 0; font-size: .9rem; }
.phone-recent-orders ul { list-style: none; padding: 0; margin: 7px 0 0; }
.phone-recent-orders li { padding: 8px 0; border-bottom: 1px solid var(--phone-border); overflow-wrap: anywhere; }
.phone-recent-orders small { display: block; margin-top: 3px; color: var(--phone-muted); }
.ct-online-sales { margin: 8px 0; }
.ct-online-sales label { display: flex; align-items: center; gap: 7px; width: fit-content; min-height: 44px; font-weight: 700; }
.ct-online-sales input { width: 17px; height: 17px; margin: 0; accent-color: var(--gold2); }
.ct-online-sales p { margin-top: 0; }
.phone-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-bottom: 12px; }
.city-phone .phone-tabs button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  min-height: 44px;
  border-radius: 8px;
  border-color: var(--phone-rule);
  background: var(--phone-bg);
  color: var(--phone-muted);
  padding: 4px 3px;
  font-size: .77rem;
  line-height: 1.3;
}
.city-phone .phone-tabs button[aria-pressed="true"] {
  background: var(--phone-tile);
  border-color: var(--phone-bezel);
  color: var(--phone-accent);
  font-weight: 760;
}
.phone-player-search button { min-width: 54px; }
.phone-player-search input::placeholder { color: var(--phone-muted); }
@media (max-width: 359px) {
  .phone-screen { padding: 11px; }
  .city-phone .phone-feature-links button { padding-inline: 6px; }
  .phone-feature-links img { width: 29px; height: 29px; }
  .city-phone .phone-service-links button { font-size: .76rem; }
}
.phone-staff-labor h4 { margin: 0; font-size: 1rem; }
.phone-staff-labor .phone-form { flex-direction: column; align-items: stretch; }
.phone-staff-labor select { width: 100%; padding: 7px 10px; }
.phone-lock { padding: 14px; border: 1px solid var(--phone-border); border-radius: 12px; background: var(--phone-surface); }
.phone-lock h3 { margin: 0; font-size: 1rem; }
.phone-lock .phone-empty { margin: 7px 0 14px; }
.phone-form { display: flex; gap: 8px; align-items: end; }
.phone-form label { display: grid; flex: 1; gap: 5px; font-size: .86rem; color: var(--phone-muted); }
.phone-form :is(input, textarea) { width: 100%; padding: 8px 10px; font-size: 1rem; box-sizing: border-box; }
.phone-form textarea { resize: vertical; max-height: 116px; }
.phone-list { list-style: none; display: grid; margin: 10px 0 0; padding: 0; }
.phone-list > li + li { border-top: 1px solid var(--phone-rule); }
.city-phone .phone-list .phone-contact {
  min-height: 56px;
  padding: 7px 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
}
.city-phone .phone-list button.phone-contact:hover { background: var(--phone-surface); border-color: var(--phone-rule); }
.phone-list .phone-face { width: 36px; height: 36px; }
.phone-relationship-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.phone-relationship-tabs button[aria-pressed="true"] { background: var(--phone-accent, #f4c866); color: #30230f; }
.phone-relationship-group { margin-top: 1rem; }
.phone-relationship-group h3 { margin: 0; font-size: .93rem; }
.phone-relationship-group .phone-list { margin-top: .45rem; }
.phone-npc-filter {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 7px; margin-top: .9rem;
}
.phone-npc-filter label { display: grid; min-width: 0; gap: 4px; color: var(--phone-muted); font-size: .82rem; }
.phone-npc-filter :is(input, select) { width: 100%; min-width: 0; box-sizing: border-box; min-height: 42px; padding: 5px 7px; font-size: .94rem; }
.phone-contact {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
}
.phone-face {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--phone-art);
  color: var(--phone-text);
  font-weight: 750;
  flex: none;
}
.phone-unavailable { box-sizing: border-box; padding: 7px 11px; border: 1px solid var(--phone-border); border-radius: 10px; }
.phone-face img { width: 100%; height: 100%; object-fit: cover; }
.phone-contact :is(strong, small) { display: block; overflow-wrap: anywhere; }
.phone-contact small, .phone-peer p, .phone-message time { color: var(--phone-muted); }
.phone-peer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--phone-border);
}
.phone-peer h3 { color: var(--phone-text); margin: 0 0 2px; font-size: 1rem; overflow-wrap: anywhere; }
.phone-peer p { margin: 0; font-size: .84rem; overflow-wrap: anywhere; }
.phone-peer-details { flex: 1; min-width: 0; }
.phone-peer:has(.phone-relationship) { align-items: flex-start; }
.phone-relationship { margin-top: 8px; }
.phone-relationship-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 8px;
  color: var(--phone-muted);
  font-size: .8rem;
}
.phone-relationship-line :is(strong, b) { color: var(--phone-text); }
.phone-relationship-line b { font-variant-numeric: tabular-nums; }
.phone-relationship meter {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 5px;
  border: 0;
  border-radius: 999px;
  background: var(--phone-surface);
}
.phone-relationship meter::-webkit-meter-bar {
  border: 0;
  border-radius: 999px;
  background: var(--phone-surface);
}
.phone-relationship meter::-webkit-meter-optimum-value { border-radius: 999px; background: var(--phone-accent); }
.phone-relationship meter::-moz-meter-bar { border-radius: 999px; background: var(--phone-accent); }
.phone-history { flex: 1; min-height: 96px; padding: 10px 2px; overflow: auto; overscroll-behavior: contain; }
.phone-compose { margin-top: 10px; }
.phone-player-relation {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--phone-border);
}
.phone-player-relation:empty { display: none; }
.phone-player-relation p { margin: 0; color: var(--phone-muted); font-size: .8rem; line-height: 1.45; }
.phone-relation-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.phone-relation-actions p { flex: 1 1 145px; }
.phone-relation-actions button { font-size: .86rem; }

.phone-message {
  width: fit-content;
  max-width: min(85%, 320px);
  margin: 8px 0;
  padding: 9px 12px;
  border-radius: 12px 12px 12px 3px;
  background: var(--phone-surface);
  color: var(--phone-text);
  overflow-wrap: anywhere;
}
.phone-message.own { margin-left: auto; border-radius: 12px 12px 3px 12px; background: #365483; }
.phone-message p { margin: 0; line-height: 1.55; }
.phone-message time { display: block; margin-top: 4px; font-size: .72rem; }
.phone-actions { display: grid; gap: 7px; margin-top: 12px; }
.phone-actions button { text-align: left; }
.phone-empty { color: var(--phone-muted); margin: 14px 0; font-size: .88rem; line-height: 1.5; }
.phone-feedback { margin: 0; padding: 9px 14px; color: var(--phone-accent); font-size: .86rem; overflow-wrap: anywhere; }
.phone-feedback:empty { padding: 0; }

.ai-rivalry {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  padding: 11px 13px;
  border: 1px solid #d87c5e80;
  border-radius: 10px;
  background: #d34e3215;
  overflow-wrap: anywhere;
}
.ai-rivalry-score { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.ai-rivalry-score b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-rivalry-meter { height: 7px; overflow: hidden; border-radius: 999px; background: #9f675650; }
.ai-rivalry-meter span {
  display: block;
  height: 100%;
  width: var(--rivalry-score);
  border-radius: inherit;
  background: linear-gradient(90deg, #ffae6e, #ec654a);
}
.ai-rivalry p { margin: 0; font-size: .83rem; line-height: 1.4; }
.ai-rivalry-warning { padding-inline-start: 10px; border-inline-start: 3px solid #ec654a; }
@media (prefers-reduced-motion: no-preference) {
  .ai-rivalry-meter span { animation: ai-rivalry-fill 250ms ease-out; }
}
@keyframes ai-rivalry-fill { from { width: var(--rivalry-before); } }

.city-phone .phone-inlaw {
  display: grid;
  gap: .65rem;
}
.city-phone .phone-inlaw .phone-actions:empty {
  display: none;
}
.city-phone .phone-inlaw form,
.city-phone .phone-inlaw label,
.city-phone .phone-inlaw select {
  min-width: 0;
}
.city-phone .phone-inlaw select {
  width: 100%;
  text-overflow: ellipsis;
}
.city-phone .phone-inlaw .phone-inlaw-sensitive {
  border-color: #cf9085;
}
