#profile-menu {
  position: fixed;
  inset: var(--profile-top, 12px) var(--profile-right, 12px) auto auto;
  width: min(342px, calc(100% - 20px));
  max-height: calc(100dvh - var(--profile-top, 12px) - 12px);
  padding: 10px;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #3c4856;
  border-radius: 17px;
  background: #20252d;
  color: #eef1f6;
  box-shadow: 0 14px 38px #0008;
  opacity: 0;
  transform: translateY(-5px) scale(.99);
  transform-origin: top right;
  transition: opacity var(--motion-panel) var(--motion-ease), transform var(--motion-panel) var(--motion-ease),
    display var(--motion-panel) allow-discrete, overlay var(--motion-panel) allow-discrete;
  pointer-events: none;
}
#profile-menu:popover-open { opacity: 1; transform: none; pointer-events: auto; }
@starting-style { #profile-menu:popover-open { opacity: 0; transform: translateY(-5px) scale(.99); } }
.profile-menu-head { display: flex; align-items: center; gap: 12px; padding: 9px 8px 11px; }
.profile-initials { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 42%; background: #45484f; color: #fff; font-weight: 650; font-size: 20px; }
.profile-menu-head div { min-width: 0; }
.profile-menu-head strong { font-size: 18px; overflow-wrap: anywhere; }
.profile-menu-head p { margin-top: 3px; font-size: 13px; color: #c3cbd6; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px; background: #191e26; border-radius: 9px; color: #b5c1d1; font-size: 13px; }
.profile-stats strong { color: #f3f5f7; font-size: 15px; }
.profile-status { padding: 8px 10px 4px; color: #b5c1d1; font-size: 13px; overflow-wrap: anywhere; }
.profile-links { list-style: none; margin: 7px 0 0; padding: 0; }
.profile-links button { display: flex; align-items: center; min-height: 41px; width: 100%; gap: 12px; border-radius: 8px; padding: 7px 10px; text-align: left; font-size: 15px; }
.profile-links button:hover { background: #ffffff12; }
.profile-links :is(svg, img) { flex: none; color: #bac2d0; }
.profile-links .profile-exit { margin-top: 5px; padding-top: 5px; border-top: 1px solid #ffffff1a; }
.profile-exit button, .profile-exit svg { color: #f0c4c4; }
.profile-exit button:hover { background: #ed87991c; }
[data-theme="light"] #profile-menu { background: #faf9fc; border-color: #d0ccd4; color: #24252b; box-shadow: 0 14px 36px #24202933; }
[data-theme="light"] :is(.profile-menu-head p,.profile-status,.profile-stats,.profile-links svg) { color: #575965; }
[data-theme="light"] .profile-stats { background: #edeaf0; }
[data-theme="light"] .profile-stats strong { color: #25252a; }
[data-theme="light"] .profile-links button:hover { background: #24252b12; }
[data-theme="light"] .profile-links .profile-exit { border-color: #27203124; }
[data-theme="light"] .profile-exit :is(button,svg) { color: #a72942; }
.profile-form { display: grid; gap: 14px; }
.profile-form label:not(.profile-confirm) { display: grid; gap: 6px; }
.profile-form input:not([type="checkbox"]) { width: 100%; box-sizing: border-box; min-height: 42px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.profile-confirm { display: flex; align-items: center; gap: 7px; }
.profile-thread, .profile-notices { display: grid; gap: 8px; max-height: min(40vh,360px); overflow: auto; padding: 0; margin: 0; list-style: none; }
.profile-thread li, .profile-notices li { padding: 10px 12px; border-radius: 10px; background: var(--surface); }
.profile-unread { display: inline-block; margin-left: 8px; color: var(--gold); font-size: 12px; }
@media (max-width: 420px) {
  #profile-menu { inset-inline-end: 10px; }
  .profile-links button { min-height: 42px; }
}
