.profile-chip {
  position: relative;
}
.profile-chip::after {
  content: '⌄';
  margin-left: 2px;
  color: var(--soft);
  font-size: .72rem;
  transition: transform .18s var(--ease-out), color .18s var(--ease-out);
}
.profile-chip:hover::after { color: var(--accent); transform: translateY(1px); }

.profile-modal {
  width: min(520px, calc(100vw - 24px));
}
.profile-modal-loading {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}
.profile-photo-editor {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  align-items: center;
  margin: 4px 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-2);
}
.profile-avatar-large {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 900;
}
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.profile-photo-actions input { display: none; }
.profile-photo-copy { margin: 0 0 9px; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.profile-identity {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--input);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  overflow-wrap: anywhere;
}
.profile-private-note { display: block; margin-top: 5px; color: var(--soft); font-size: .7rem; line-height: 1.35; }
.profile-actions { display: grid; gap: 8px; margin-top: 14px; }
.profile-upload-progress { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: var(--track); }
.profile-upload-progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .18s var(--ease-out); }

.challenge-search-shell {
  margin: 18px 0 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
}
.challenge-search-field {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 48px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--input);
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out), background-color .18s var(--ease-out);
}
.challenge-search-field:focus-within {
  border-color: color-mix(in srgb, var(--accent), var(--line) 35%);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface-2);
}
.challenge-search-icon { color: var(--accent); font-size: 1.05rem; }
.challenge-search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .94rem;
}
.challenge-search-field input::placeholder { color: var(--soft); }
.challenge-search-clear {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: background-color .16s var(--ease-out), color .16s var(--ease-out), transform .16s var(--ease-out);
}
.challenge-search-clear:hover { background: var(--accent-soft); color: var(--accent); }
.challenge-search-clear:active { transform: scale(.94); }
.challenge-search-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--soft);
  font-size: .7rem;
  font-weight: 700;
}
.challenge-search-empty {
  margin-top: 12px;
  padding: 20px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  background: var(--input);
}
.category.search-open .challenge-list {
  grid-template-rows: 1fr !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
.category[hidden], .challenge-row[hidden], .challenge-search-empty[hidden], .challenge-search-clear[hidden] { display: none !important; }

@media (max-width: 620px) {
  .profile-modal { width: min(100%, calc(100vw - 16px)); }
  .profile-photo-editor { grid-template-columns: 76px 1fr; gap: 12px; padding: 12px; }
  .profile-avatar-large { width: 76px; height: 76px; }
  .challenge-search-shell { margin-top: 14px; padding: 9px; border-radius: 16px; }
  .challenge-search-field { min-height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  .profile-chip::after,
  .challenge-search-field,
  .challenge-search-clear,
  .profile-upload-progress span { transition: none !important; }
}
