/* Account editor. Keep avatar/achievement scenes and other overlays independent. */
#overlay-profile .profile-box {
  --profile-accent: var(--auth-btn-hover-color, #e4c16e);
  --profile-text: #f1f4ee;
  --profile-muted: #acbab0;
  --profile-line: rgba(220, 234, 218, 0.12);
}
#overlay-profile .profile-box:not(.profile-box-avatar-mode):not(.profile-box-achievements-mode) {
  display: block;
  width: min(680px, calc(100vw - 28px));
  min-width: 0;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  padding: 28px;
  border: 1px solid var(--profile-line);
  border-radius: 24px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.035), transparent 65%), var(--auth-dropdown-bg, #14241c);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 220, 200, 0.25) transparent;
}
#profile-main-view { gap: 24px; color: var(--profile-text); text-align: left; }
.profile-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.profile-eyebrow { color: var(--profile-muted); font-size: 0.66rem; font-weight: 700; letter-spacing: 2px; }
.profile-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: -7px -7px -7px 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--profile-muted);
  font: inherit;
  font-size: 1.4rem;
  cursor: pointer;
}
.profile-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--profile-text); }
.profile-identity { display: flex; align-items: center; gap: 22px; padding: 0 0 2px; }
.profile-identity .profile-avatar-trigger { border-radius: 50%; }
.profile-identity .profile-avatar-trigger::after { content: none; }
.profile-identity .profile-avatar-trigger img {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(230, 235, 220, 0.08);
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 1px var(--profile-line), 0 8px 22px rgba(0, 0, 0, 0.2);
}
.profile-avatar-edit {
  position: absolute;
  right: -2px;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 3px solid #17271f;
  border-radius: 50%;
  color: #142218;
  background: var(--profile-accent);
}
.profile-avatar-edit svg { width: 14px; height: 14px; }
.profile-identity-copy { min-width: 0; }
.profile-identity-copy h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 1.95rem); font-weight: 700; letter-spacing: -0.7px; line-height: 1.2; overflow-wrap: anywhere; }
.profile-identity-copy p { margin: 7px 0 4px; font-size: 0.85rem; color: var(--profile-muted); line-height: 1.5; }
.profile-avatar-link { padding: 5px 0; min-height: 32px; border: 0; background: transparent; color: var(--profile-accent); font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.profile-avatar-link span { margin-left: 4px; }
.profile-avatar-link:hover { text-decoration: underline; text-underline-offset: 4px; }
#profile-main-view .profile-progression { padding: 15px 18px; gap: 16px; border-color: var(--profile-line); border-radius: 14px; background: rgba(0, 0, 0, 0.14); }
#profile-main-view .progression-level-seal { width: 48px; height: 54px; border-width: 1px; border-color: var(--profile-line); border-radius: 12px; box-shadow: none; background: rgba(255, 255, 255, 0.025); }
#profile-main-view .progression-level-seal strong { font-size: 1.4rem; }
#profile-main-view .progression-level-seal small { font-size: 0.48rem; letter-spacing: 1px; }
#profile-main-view .progression-bar { height: 5px; margin: 9px 0 3px; }
#profile-main-view .progression-link { min-height: 30px; font-size: 0.73rem; }
#profile-main-view .progression-summary-line strong { font-size: 0.81rem; }
#profile-main-view .profile-form-fields { gap: 20px; margin: 0; }
.profile-account-section h3 { margin: 0 0 16px; font-size: 0.94rem; font-weight: 600; letter-spacing: -0.1px; }
.profile-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.profile-field-wide { grid-column: 1 / -1; }
#profile-main-view .profile-field { min-width: 0; gap: 8px; }
#profile-main-view .profile-field label { color: #d7e1d8; font-size: 0.76rem; font-weight: 500; letter-spacing: 0; line-height: 1.3; }
#profile-main-view .profile-field input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--profile-line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.19);
  color: var(--profile-text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: border-color 140ms, background 140ms;
}
#profile-main-view .profile-field input:hover { border-color: rgba(220, 234, 218, 0.25); }
#profile-main-view .profile-field input:focus { border-color: var(--profile-accent); background: rgba(0, 0, 0, 0.25); outline: 2px solid rgba(222, 230, 208, 0.1); outline-offset: 2px; }
.profile-field small { color: var(--profile-muted); font-size: 0.69rem; line-height: 1.5; }
.profile-security { padding: 0 16px; border: 1px solid var(--profile-line); border-radius: 12px; background: rgba(255, 255, 255, 0.018); }
.profile-security summary { display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 16px 0; list-style: none; cursor: pointer; }
.profile-security summary::-webkit-details-marker { display: none; }
.profile-security summary > span { flex: 1; min-width: 0; }
.profile-security summary strong { display: block; font-size: 0.82rem; font-weight: 600; }
.profile-security summary small { display: block; margin-top: 5px; color: var(--profile-muted); font-size: 0.71rem; line-height: 1.5; }
.profile-security-icon { flex: 0 0 20px; width: 20px; height: 20px; color: var(--profile-muted); }
.profile-security-chevron { flex: 0 0 18px; width: 18px; height: 18px; color: var(--profile-muted); transition: transform 140ms; }
.profile-security[open] .profile-security-chevron { transform: rotate(180deg); }
.profile-password-fields { padding: 3px 0 18px; }
.profile-form-error { color: #ffb4ad; font-size: 0.8rem; line-height: 1.5; }
.profile-form-error:empty { display: none; }
.profile-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-top: 20px; border-top: 1px solid var(--profile-line); }
.profile-footer > p { color: var(--profile-muted); font-size: 0.69rem; line-height: 1.5; }
.profile-actions { display: flex; gap: 10px; flex-shrink: 0; }
.profile-cancel, .profile-save { min-height: 44px; padding: 11px 18px; border-radius: 9px; font: inherit; font-size: 0.8rem; font-weight: 600; line-height: 1.4; cursor: pointer; transition: filter 140ms, background 140ms; }
.profile-cancel { color: #d7e1d8; background: transparent; border: 1px solid var(--profile-line); }
.profile-cancel:hover { background: rgba(255, 255, 255, 0.05); }
.profile-save { color: #122217; background: var(--profile-accent); border: 1px solid transparent; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14); }
.profile-save:hover { filter: brightness(1.1); }
.profile-save:disabled { opacity: 0.5; cursor: wait; }
#profile-main-view button:focus-visible, .profile-security summary:focus-visible { outline: 2px solid var(--profile-accent); outline-offset: 4px; }
@media (max-width: 560px) {
  #overlay-profile .profile-box:not(.profile-box-avatar-mode):not(.profile-box-achievements-mode) { padding: 20px; border-radius: 20px; max-height: calc(100dvh - 28px); }
  #profile-main-view { gap: 22px; }
  .profile-identity { gap: 16px; }
  .profile-identity .profile-avatar-trigger img { width: 70px; height: 70px; }
  .profile-field-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #profile-main-view .profile-field input { font-size: 16px; }
  #profile-main-view .profile-progression { padding: 12px; gap: 12px; }
  #profile-main-view .progression-link { min-height: 36px; }
  .profile-footer { padding-top: 18px; }
  .profile-footer > p { display: none; }
  .profile-actions { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .profile-cancel, .profile-save { padding: 11px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  #profile-main-view *, #profile-main-view *::after { transition: none !important; }
}
