/* ---- form pieces ---- */
.city-wrap {
  position: relative;
}
/* Floating over what's below, so the form doesn't grow while you type. The
   field holding an open list is lifted above the fields after it: each of
   those can be its own layer (see .auth-form's entrance), and Safari drew
   them over a floating list otherwise. */
.field:has(.city-results:not(.hidden)),
.city-wrap:has(.city-results:not(.hidden)) {
  position: relative;
  z-index: 20;
}
.city-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  animation: rise-in 0.2s var(--ease);
}
.city-result {
  padding: 10px 13px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.city-result:last-child {
  border-bottom: none;
}
.city-result:hover {
  background: var(--accent-dim);
}
.city-result .sub {
  color: var(--muted);
  font-size: 0.78rem;
}
.city-chosen {
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-dim);
  border-radius: 10px;
  padding: 8px 12px;
  animation: rise-in 0.3s var(--ease);
}
.photo-label {
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition:
    border-color 0.2s,
    color 0.2s;
}
.photo-label:hover {
  border-color: var(--accent);
  color: var(--text);
}
.photo-label.has-photo {
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent);
}
.photo-label img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  animation: pop-in 0.35s var(--ease);
}
/* Social accounts: the filled-in ones, one row each, then a picker to add
   another (fields.js socialInputs). */
.social-list,
.social-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
}
.social-rows:empty {
  display: none;
}
.social-item {
  animation: rise-in 0.2s var(--ease);
}
/* Looks like one text field: the network's name, the handle, and ✕. */
.social-row {
  display: grid;
  grid-template-columns: 6.2em 1fr auto;
  align-items: center;
  padding-left: 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--raised);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.social-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.social-row:has(input.invalid) {
  border-color: var(--danger);
}
.social-name {
  color: var(--muted);
  font-size: 0.9rem;
}
.social-row input,
.social-row input:focus {
  padding: 11px 0;
  border: none;
  background: none;
  box-shadow: none;
}
.social-remove {
  margin-right: 4px;
}
.social-error {
  margin-top: 4px;
  color: var(--danger);
  font-size: 0.8rem;
}
/* Picking a network to add: drawn like the "Add photo" button. */
select.social-add {
  appearance: none;
  -webkit-appearance: none;
  border-style: dashed;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}
select.social-add:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* What someone you link with sees: one row per item, showing the value,
   with a switch (sharing.js). */
.share-panel {
  display: flex;
  flex-direction: column;
  font-size: 0.92rem;
}
.share-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 2px;
}
.share-saved {
  color: var(--accent);
}
.share-saved.error {
  color: var(--danger);
}
.share-row {
  display: grid;
  grid-template-columns: 7.5em 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.share-row:last-child {
  border-bottom: none;
}
.share-row.locked,
.share-row.unfilled {
  cursor: default;
}
.share-label {
  color: var(--muted);
}
.share-value {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  overflow-wrap: anywhere;
}
.share-value .sub,
.share-always {
  color: var(--muted);
  font-size: 0.82rem;
}
.share-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.share-social {
  white-space: nowrap;
}

/* A switch: a checkbox drawn as a sliding toggle. */
input.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 42px;
  height: 26px;
  margin: 0;
  padding: 0;
  border-radius: 13px;
  border: none;
  background: var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s var(--ease);
}
input.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--raised);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s var(--spring);
}
input.switch:checked {
  background: var(--accent);
}
input.switch:checked::after {
  transform: translateX(16px);
}
input.switch:disabled {
  opacity: 0.4;
  cursor: default;
}
input.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The profile's defaults for new links, under the profile form. */
.share-defaults-box {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
#qr-extra {
  text-align: left;
  margin: 4px 0 8px;
}
/* Linking: someone already on my map. A likely match asks once; anyone
   else is behind a quiet link. */
.li-match {
  background: var(--accent-dim);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: rise-in 0.3s var(--ease);
}
.li-match p {
  margin: 0;
  font-size: 0.9rem;
}
.li-match .link-btn,
.li-pick-open {
  align-self: flex-start;
  font-size: 0.85rem;
}
.pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.pick-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.pick-row .sub {
  color: var(--muted);
  font-size: 0.8rem;
}
.pick-action {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.li-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.li-picked {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-dim);
  border-radius: 10px;
  padding: 8px 12px;
}

/* ---- handover mode ---- */
#handover {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: var(--bg);
  overflow-y: auto;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  animation: fade-in 0.3s var(--ease);
}
.handover-box {
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise-in 0.45s var(--ease);
}
.handover-box h2 {
  font-size: 2rem;
  line-height: 1.15;
}
.handover-box .hint {
  text-align: center;
}
#handover-done {
  text-align: center;
  align-items: center;
  padding-top: 16vh;
  gap: 14px;
}
.handover-wave {
  font-size: 3.5rem;
  transform-origin: 70% 70%;
  animation: wave 2.2s ease-in-out 0.3s infinite;
}
.hold-btn {
  position: relative;
  overflow: hidden;
  margin-top: 28px;
  width: 240px;
  padding: 18px;
  border-radius: 999px;
  border: 1px solid var(--text);
  background: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.hold-fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: var(--accent-dim);
}
.hold-btn.holding .hold-fill {
  width: 100%;
  transition: width 1.5s linear;
}
.hold-label {
  position: relative;
}
/* "Where you met" suggestions: a kind icon before each. */
.met-result {
  display: flex;
  align-items: center;
  gap: 10px;
}
.met-icon {
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
  flex: none;
}
#pf-share-all {
  margin-top: 10px;
}
