/* Profile picker: big animal faces for the child, short forms for the parent. */
.room-profile {
  --profile-avatar: clamp(96px, 16vmin, 144px);
  --profile-card: calc(var(--profile-avatar) + 48px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.room-profile button { touch-action: manipulation; }
.room-profile input {
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

.profile-head { display: grid; justify-items: center; gap: 8px; text-align: center; padding-right: 56px; padding-left: 56px; }
.profile-title { margin: 0; font-family: var(--font-display); font-size: clamp(28px, 5vmin, 44px); line-height: 1.2; }
.profile-account { margin: 0; color: var(--ink-soft); font-size: 17px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 12px; }
.profile-link {
  min-height: 48px;
  padding: 0 12px;
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.profile-notice,
.profile-error,
.profile-note,
.profile-hint,
.profile-seats { margin: 0; max-width: 560px; text-align: center; font-size: 16px; line-height: 1.45; }
.profile-notice { padding: 12px 20px; border-radius: 16px; background: #DCFCE7; color: #14532D; }
.profile-error { padding: 12px 16px; border-radius: 12px; background: #FEE2E2; color: #7F1D1D; }
.profile-note,
.profile-hint { color: var(--ink-soft); }
.profile-seats { font-weight: 700; color: #166534; }
.profile-seats.is-full { color: #9A3412; }

.profile-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--touch-gap);
  max-width: calc(4 * var(--profile-card) + 3 * var(--touch-gap));
}
.profile-card {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 12px;
  width: var(--profile-card);
  padding: 16px 8px 14px;
  border-radius: var(--round);
  background: var(--paper);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .1);
}
.profile-card:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, .1); }
.profile-avatar {
  display: grid;
  place-items: center;
  width: var(--profile-avatar);
  height: var(--profile-avatar);
  min-width: 96px;
  min-height: 96px;
  border-radius: 50%;
  background: #FEF3C7;
}
.profile-avatar img { width: 78%; height: 78%; }
.profile-name { font-family: var(--font-display); font-size: 20px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.profile-avatar-new { background: #E0F2FE; color: var(--blue); }
.profile-avatar-new svg { width: 42%; height: 42%; }
.profile-new[disabled] { cursor: not-allowed; opacity: .55; box-shadow: none; }
.profile-new[disabled] .profile-avatar-new { background: var(--line); color: var(--ink-soft); }

.profile-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; }
.profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 5px 0 #1D4ED8;
}
.profile-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #1D4ED8; }
.profile-btn svg { width: 28px; height: 28px; }
.profile-btn-soft { background: var(--paper); color: var(--ink); box-shadow: 0 5px 0 rgba(0, 0, 0, .12); }
.profile-btn-soft:active { box-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.profile-guest { min-height: 80px; background: var(--green); box-shadow: 0 5px 0 #15803D; font-size: 21px; }
.profile-guest:active { box-shadow: 0 2px 0 #15803D; }
.profile-guest-text { display: grid; justify-items: start; gap: 2px; text-align: left; }
.profile-guest-note { font-size: 15px; font-weight: 700; opacity: .9; }
.profile-btn[disabled] { cursor: not-allowed; opacity: .5; transform: none; }

.profile-panel {
  display: grid;
  gap: 18px;
  width: min(560px, 100%);
  margin-block: auto;
  padding: 28px;
  border-radius: var(--round);
  background: var(--paper);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .08);
}
.profile-panel-title { margin: 0; font-family: var(--font-display); font-size: 26px; line-height: 1.25; text-align: center; }
.profile-panel-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.profile-confirm { justify-items: center; text-align: center; }

.profile-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px; border-radius: 999px; background: #F3F4F6; }
.profile-tab { min-height: 52px; border-radius: 999px; font-size: 18px; font-weight: 700; color: var(--ink-soft); }
.profile-tab.is-active { background: var(--paper); color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .1); }

.profile-field { display: grid; gap: 8px; font-size: 16px; font-weight: 700; }
.profile-field input {
  min-height: 56px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 600;
}
.profile-field input:focus { outline: none; border-color: var(--blue); }
.profile-field input:disabled { opacity: .55; }
.profile-field input::placeholder { color: #9CA3AF; font-weight: 500; }

/* Sign-up email: a short helper line tucked under its field. */
.profile-field + .profile-note { margin-top: -8px; max-width: none; text-align: left; font-size: 14px; }

.profile-avatars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}
.profile-avatars legend { margin-bottom: 10px; font-size: 16px; font-weight: 700; }
.avatar-choice {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 64px;
  border: 3px solid transparent;
  border-radius: 18px;
  background: #FEF3C7;
}
.avatar-choice img { width: 76%; height: 76%; }
.avatar-choice.is-chosen { border-color: var(--blue); background: #DBEAFE; }

.profile-grid-small { --profile-avatar: 96px; }

/* Too many players at once: three pets bob gently above a calm message and two big buttons. */
.profile-busy { justify-items: center; text-align: center; }
.profile-busy-pets {
  --profile-avatar: clamp(96px, 14vmin, 120px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.profile-busy-pets .profile-avatar { animation: profile-busy-bob 2.4s ease-in-out infinite; }
.profile-busy-pets .profile-avatar:nth-child(2) { background: #DCFCE7; animation-delay: .3s; }
.profile-busy-pets .profile-avatar:nth-child(3) { background: #E0F2FE; animation-delay: .6s; }
.profile-busy .profile-panel-actions { width: 100%; }
.profile-busy .profile-btn { min-width: min(240px, 100%); }
@keyframes profile-busy-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  .profile-busy-pets .profile-avatar { animation: none; }
}

@media (max-width: 599px) {
  .room-profile { gap: 18px; }
  .profile-head { padding-left: 0; }
  .profile-grid { gap: 16px; }
  .profile-card { --profile-card: calc(var(--profile-avatar) + 24px); }
  .profile-panel { padding: 20px; }
  .profile-actions { width: 100%; }
  .profile-actions .profile-btn { width: 100%; padding: 0 16px; font-size: 18px; }
  .profile-busy-pets { gap: 8px; }
  .profile-busy-pets .profile-avatar { --profile-avatar: 96px; }
  .profile-busy .profile-btn { width: 100%; padding: 0 16px; font-size: 18px; }
  .profile-name { font-size: 18px; }
}
