.profile-message { padding-block: 4rem; }
.profile-message a { margin-inline-start: .75rem; }
:root { --profile-cover-ratio: 3 / 1; }
.profile-back {
  position: absolute;
  top: .75rem;
  left: var(--gutter);
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .45rem .85rem;
  border: 1px solid #395866;
  border-radius: .3rem;
  color: var(--text);
  background: #091620e6;
  font-size: .9rem;
  font-weight: 700;
}
.profile-back:is(:hover, :focus-visible) { color: var(--cyan); background: #193643; }
.profile-header {
  border-bottom: 1px solid #395866;
  background: #0d1e29;
}
.profile-banner {
  position: relative;
  aspect-ratio: var(--profile-cover-ratio);
  background: radial-gradient(ellipse at 30% 20%, #2c6271, #132831 60%, #0d1e29);
}
.profile-banner img,
.profile-cover-preview img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.profile-banner img { position: absolute; inset: 0; }
.profile-banner::after {
  content: "";
  position: absolute;
  inset: 68% 0 0;
  background: linear-gradient(transparent, #060d19a6);
  pointer-events: none;
}
#edit-cover {
  position: absolute;
  top: .75rem;
  right: var(--gutter);
  background: #091620f2;
  color: var(--text);
}
#edit-cover:is(:hover, :focus-visible) { background: #193643; }
.profile-header-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem 1.5rem;
  padding-block: .7rem .95rem;
}
.profile-identity {
  display: flex;
  align-items: flex-start;
  gap: clamp(.75rem, 2vw, 1.5rem);
  min-width: 0;
}
.profile-portrait {
  display: grid;
  position: relative;
  flex: none;
  place-items: center;
  overflow: hidden;
  width: clamp(64px, 8.2vw, 116px);
  aspect-ratio: 1;
  border: 3px solid #0d1e29;
  border-radius: 50%;
  background: #264f5b;
  color: #dcffff;
  font-size: clamp(1.5rem, 3vw, 2.45rem);
  font-weight: 700;
}
#portrait { margin-block-start: clamp(-2.8rem, -3vw, -1.9rem); }
.profile-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-identity-text { min-width: 0; }
.profile-identity h1 {
  font-size: clamp(1.7rem, 3.8vw, 3.75rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  letter-spacing: -.035em;
}
.profile-membership { margin-block-start: .32rem; color: #b8d5df; font-size: .9rem; }
.profile-header-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .5rem; }
.profile-header .action, .profile-editor .action, #more-photos { border-radius: .3rem; }
.profile-header .action { padding: .55rem .85rem; }
.profile-share { grid-column: 1 / -1; display: grid; gap: .35rem; font-size: .9rem; }
.profile-header-content > .profile-feedback { grid-column: 1 / -1; text-align: end; }
.profile-feedback:empty { display: none; }
.profile-header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1.5rem;
  min-height: 70px;
  border-top: 1px solid #304954;
  background: #0a1621;
}
.profile-nav { display: flex; flex-wrap: wrap; gap: clamp(.85rem, 2vw, 1.65rem); }
.profile-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.profile-nav a:is(:hover, :focus-visible) { border-color: var(--cyan); color: var(--text); }
.profile-head-stats { display: flex; flex-wrap: wrap; gap: .45rem clamp(.75rem, 2.4vw, 2.25rem); margin: .7rem 0; }
.profile-head-stats div { display: flex; flex-direction: column-reverse; }
.profile-head-stats dd { margin: 0; font-size: clamp(1.15rem, 2.1vw, 1.7rem); font-weight: 700; line-height: 1.12; font-variant-numeric: tabular-nums; }
.profile-head-stats dt { color: var(--muted); font-size: .76rem; }
.profile-body {
  display: grid;
  grid-template-columns: minmax(215px, 1fr) minmax(0, 3.65fr);
  align-items: start;
  gap: clamp(1.2rem, 3vw, 2.8rem);
  padding-block-start: clamp(1.15rem, 3.3vw, 2.75rem);
}
.profile-sidebar {
  min-width: 0;
  padding: clamp(.9rem, 1.8vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: #0a1722;
}
.profile-body h2 { font-size: clamp(1.1rem, 1.7vw, 1.55rem); line-height: 1.35; }
.profile-bio { margin-block: .7rem; overflow-wrap: anywhere; white-space: pre-wrap; }
#profile-bio-empty { margin-block-start: .65rem; }
.profile-sidebar dl { display: grid; gap: .45rem; margin: .8rem 0 0; }
.profile-sidebar dl div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .55rem; font-size: .88rem; }
.profile-sidebar dt { color: var(--muted); }
.profile-sidebar dd { margin: 0; overflow-wrap: anywhere; text-align: end; }
.profile-jp-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  margin-top: .8rem;
  padding-top: .4rem;
  border-top: 1px solid var(--line);
  color: var(--cyan);
  font-size: .9rem;
  font-weight: 700;
}
.profile-jp-link:is(:hover, :focus-visible) { text-decoration: underline; text-underline-offset: .2em; }
.profile-content { display: grid; min-width: 0; gap: clamp(1.55rem, 4vw, 3rem); }
.profile-section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .55rem;
  margin-bottom: .85rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid #395461;
}
.profile-section-head > span, .profile-note { color: var(--muted); font-size: .86rem; }
#profile-popular { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.profile-album-empty { padding: clamp(.9rem, 3vw, 1.6rem); border: 1px dashed #3f5b6c; border-radius: .35rem; }
.profile-album-empty a { display: inline-flex; align-items: center; min-height: 44px; }
.profile-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.profile-charts figure { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .35rem; background: #0a1620; }
.profile-charts figcaption { margin-bottom: .7rem; font-weight: 700; }
#more-photos { margin-top: .9rem; }

.profile-editor {
  position: fixed;
  inset: 0;
  width: min(48rem, calc(100% - 1.5rem));
  max-width: none;
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #4a6b79;
  border-radius: .75rem;
  background: #0c1c27;
  color: var(--text);
  box-shadow: 0 20px 80px #0009;
}
.profile-editor::backdrop { background: #020810cf; }
.profile-editor-header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.2rem;
  padding: .9rem clamp(.9rem, 3vw, 1.5rem);
  border-bottom: 1px solid var(--line);
  background: #102430;
}
.profile-editor-header h2 { font-size: clamp(1.4rem, 4.3vw, 2rem); line-height: 1.25; }
.profile-editor-header p { margin-top: .35rem; }
.profile-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: .85rem;
  padding: clamp(.75rem, 3vw, 1.5rem);
  align-items: start;
}
.profile-form { min-width: 0; height: 100%; padding: 1rem; border: 1px solid var(--line); border-radius: .4rem; background: #0a1722; }
.profile-form fieldset { display: grid; gap: .55rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.profile-form h3 { margin-bottom: .3rem; font-size: 1.05rem; }
.profile-form label { font-size: .88rem; font-weight: 700; }
.profile-form :is(input:not([type="file"]), textarea, select), .profile-share input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .53rem .65rem;
  border: 1px solid #54727e;
  border-radius: .25rem;
  background: #060f19;
  color: var(--text);
  line-height: 1.45;
}
.profile-form textarea { resize: vertical; }
.profile-form :is(input, textarea, select) { scroll-margin-block-start: 6rem; }
.profile-form h3:focus { outline: none; }
.profile-label-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .5rem; }
.profile-label-row span { font-variant-numeric: tabular-nums; }
.profile-form .action { justify-self: start; margin-block-start: .25rem; padding: .55rem .85rem; }
.profile-form .action:disabled { opacity: .55; }
.profile-avatar-preview { width: 72px; }
.profile-file { position: relative; display: flex; align-items: center; gap: .55rem; min-width: 0; }
.profile-file-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 44px;
  padding-inline: .65rem;
  border: 1px solid #54727e;
  border-radius: .25rem;
  color: var(--text);
  cursor: pointer;
}
.profile-file:hover .profile-file-button { border-color: var(--cyan); }
.profile-file:focus-within .profile-file-button { outline: 2px solid var(--gold); outline-offset: 4px; }
.profile-file-name { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.profile-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; }
.profile-text-button {
  min-height: 44px;
  padding: .2rem .1rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .88rem;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.profile-text-button:hover { color: var(--text); }
.profile-cover-form { grid-column: 1 / -1; }
.profile-cover-preview { aspect-ratio: var(--profile-cover-ratio); overflow: hidden; border: 1px solid #395461; border-radius: .3rem; background: #132831; }
.profile-cover-fields { display: grid; gap: .5rem; }
.profile-feedback { color: var(--cyan); font-size: .87rem; }
.profile-form .profile-feedback:not(:empty) { margin-block-start: .65rem; }
.profile-feedback[data-error="true"] { color: #ffbbb1; }

@media (max-width: 1020px) {
  .profile-body #profile-album { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  :root { --profile-cover-ratio: 2.25 / 1; }
  .profile-body { grid-template-columns: minmax(0, 1fr); }
  .profile-sidebar dl { display: flex; flex-wrap: wrap; gap: .45rem 1.15rem; }
  .profile-sidebar dl div { display: flex; gap: .45rem; }
}
@media (max-width: 640px) {
  :root { --profile-cover-ratio: 1.75 / 1; }
  .profile-header-content { grid-template-columns: minmax(0, 1fr); }
  .profile-header-actions { justify-content: start; }
  .profile-header-content > .profile-feedback { text-align: start; }
  .profile-header-bottom { flex-direction: column-reverse; align-items: stretch; gap: 0; }
  .profile-head-stats { margin: .75rem 0 .4rem; }
  .profile-nav { border-top: 1px solid #304954; }
  #profile-popular, .profile-body #profile-album { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-charts, .profile-editor-body { grid-template-columns: minmax(0, 1fr); }
}
