:root {
  --profile-night: #111b47;
  --profile-night-soft: #1b2a62;
  --profile-paper: #fffaf0;
  --profile-paper-deep: #f5e8ca;
  --profile-gold: #d5ad58;
  --profile-gold-light: #f0d68f;
  --profile-vermilion: #9f3340;
  --profile-ink: #252536;
  --profile-muted: #777181;
}

.profile-avatar {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  width: 4rem;
  height: 4rem;
  border: 2px solid rgba(240, 214, 143, .8);
  border-radius: 50%;
  background: var(--profile-night);
  box-shadow: 0 0 0 5px rgba(17, 27, 71, .12), 0 16px 32px rgba(11, 18, 47, .22);
}

.profile-avatar--small { width: 2rem; height: 2rem; }
.profile-avatar--medium { width: 4rem; height: 4rem; }
.profile-avatar--hero { width: clamp(8.5rem, 17vw, 12rem); height: clamp(8.5rem, 17vw, 12rem); }
.profile-avatar img,
img.profile-avatar { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar[hidden],
.profile-avatar-live[hidden] { display: none !important; }

.profile-private-banner {
  margin: 1rem auto 0;
  width: min(1120px, calc(100% - 2rem));
  padding: .8rem 1rem;
  border: 1px solid rgba(159, 51, 64, .32);
  background: #fff3df;
  color: #632532;
  text-align: center;
}

.profile-private-banner span {
  margin-right: .65rem;
  padding: .2rem .55rem;
  background: var(--profile-vermilion);
  color: white;
  font-size: .76rem;
  letter-spacing: .12em;
}

.profile-cover {
  position: relative;
  min-height: 31rem;
  overflow: hidden;
  isolation: isolate;
  color: white;
  background:
    radial-gradient(circle at 76% 12%, rgba(240, 214, 143, .17), transparent 26rem),
    linear-gradient(135deg, #0b1439, var(--profile-night-soft) 62%, #263473);
}

.profile-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: -1;
  height: 9rem;
  background: linear-gradient(180deg, transparent, rgba(4, 9, 29, .62));
}

.profile-cover-palace,
.profile-cover-clouds { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.profile-cover-palace::before {
  content: "";
  position: absolute;
  right: 4%;
  bottom: 0;
  width: min(48rem, 72vw);
  height: 72%;
  opacity: .16;
  background:
    linear-gradient(155deg, transparent 46%, var(--profile-gold-light) 47% 50%, transparent 51%) 50% 18% / 38% 24% no-repeat,
    linear-gradient(25deg, transparent 46%, var(--profile-gold-light) 47% 50%, transparent 51%) 50% 18% / 38% 24% no-repeat,
    linear-gradient(var(--profile-gold-light), var(--profile-gold-light)) 50% 100% / 32% 63% no-repeat,
    linear-gradient(var(--profile-gold-light), var(--profile-gold-light)) 50% 100% / 74% 34% no-repeat;
}

.profile-cover-palace i {
  position: absolute;
  right: 14%;
  bottom: 16%;
  width: 18rem;
  border-top: 1px solid rgba(240, 214, 143, .35);
}
.profile-cover-palace i:nth-child(2) { right: 5%; bottom: 28%; width: 31rem; }
.profile-cover-palace i:nth-child(3) { right: 20%; bottom: 41%; width: 11rem; }
.profile-cover-clouds span {
  position: absolute;
  width: 17rem;
  height: 4rem;
  border: 1px solid rgba(255, 250, 240, .15);
  border-width: 1px 0 0;
  border-radius: 50%;
}
.profile-cover-clouds span:nth-child(1) { top: 18%; left: -3rem; }
.profile-cover-clouds span:nth-child(2) { top: 30%; right: 9%; width: 24rem; }
.profile-cover-clouds span:nth-child(3) { bottom: 16%; left: 35%; width: 20rem; }

.profile-cover-inner {
  min-height: 31rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(12rem, auto);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.profile-portrait-wrap { position: relative; }
.profile-portrait-seal {
  position: absolute;
  right: -.8rem;
  bottom: .35rem;
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border: 2px solid rgba(255,255,255,.65);
  background: var(--profile-vermilion);
  color: white;
  font-family: serif;
  font-size: .82rem;
  letter-spacing: .08em;
  transform: rotate(-7deg);
}

.profile-cover-copy .eyebrow { color: var(--profile-gold-light); }
.profile-cover-copy h1 {
  margin: .45rem 0 1rem;
  color: white;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  line-height: 1.08;
}
.profile-bio { max-width: 43rem; color: rgba(255,255,255,.82); font-size: 1.04rem; line-height: 1.9; }
.profile-preferences { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1.3rem; }
.profile-preferences strong { margin-right: .35rem; color: var(--profile-gold-light); font-size: .8rem; letter-spacing: .08em; }
.profile-preferences span { padding: .32rem .72rem; border: 1px solid rgba(240,214,143,.35); background: rgba(255,255,255,.06); font-size: .86rem; }
.profile-cover-actions { display: flex; flex-direction: column; align-items: stretch; gap: .75rem; }
.profile-cover-actions form,
.profile-cover-actions .button { width: 100%; }
.profile-cover-actions .button { justify-content: center; text-align: center; }
.profile-text-link { color: var(--profile-gold-light); text-align: center; }

.profile-dashboard { position: relative; margin-top: -2.6rem; padding-bottom: 6rem; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid rgba(213, 173, 88, .42);
  background: rgba(255, 250, 240, .98);
  box-shadow: 0 20px 60px rgba(17, 27, 71, .16);
}
.profile-stats a { display: block; padding: 1.25rem; color: inherit; text-align: center; text-decoration: none; }
.profile-stats a + a { border-left: 1px solid rgba(213, 173, 88, .26); }
.profile-stats a:hover,.profile-stats a:focus-visible { background: rgba(240,214,143,.16); }
.profile-stats strong { display: block; color: var(--profile-night); font-family: serif; font-size: 1.8rem; }
.profile-stats span { color: var(--profile-muted); font-size: .78rem; letter-spacing: .12em; }

.profile-tabs { display: flex; gap: .45rem; margin: 3.5rem 0 2rem; border-bottom: 1px solid rgba(17, 27, 71, .15); }
.profile-tabs button {
  appearance: none;
  padding: .85rem 1.25rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--profile-muted);
  cursor: pointer;
  font: inherit;
}
.profile-tabs button span { margin-left: .4rem; color: #9b8c6f; font-size: .75rem; }
.profile-tabs button[aria-selected="true"] { border-color: var(--profile-vermilion); color: var(--profile-night); font-weight: 700; }
.profile-tab-panel[hidden] { display: none; }
.profile-section-heading { display: flex; justify-content: space-between; gap: 2rem; align-items: end; margin-bottom: 1.5rem; }
.profile-section-heading h2 { margin: .2rem 0 0; color: var(--profile-night); font-family: serif; font-size: clamp(1.6rem, 3vw, 2.35rem); }
.profile-section-heading > p { max-width: 26rem; color: var(--profile-muted); text-align: right; }
.profile-empty { grid-column: 1 / -1; padding: 3rem 1rem; border: 1px dashed rgba(17,27,71,.2); color: var(--profile-muted); text-align: center; }
.profile-pagination { display: flex; justify-content: center; gap: 1.5rem; margin-top: 2rem; }

.profile-series-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.profile-series-grid article,
.profile-post-list article {
  padding: 1.4rem;
  border: 1px solid rgba(17, 27, 71, .12);
  background: linear-gradient(145deg, #fffdf8, #f8eed9);
  box-shadow: 0 14px 34px rgba(17,27,71,.07);
}
.profile-series-grid article > p { color: var(--profile-vermilion); font-size: .75rem; letter-spacing: .1em; }
.profile-series-grid h3 { margin: .55rem 0; font-family: serif; }
.profile-series-grid article > span { display: block; min-height: 4.5rem; color: var(--profile-muted); line-height: 1.65; }
.profile-series-grid article > a,
.profile-post-list article > a { display: inline-block; margin-top: 1rem; color: var(--profile-vermilion); }
.profile-post-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.profile-post-list header { display: flex; justify-content: space-between; margin-bottom: .8rem; color: var(--profile-muted); font-size: .78rem; }
.profile-post-list header span { color: var(--profile-vermilion); }
.profile-post-list article > p,
.profile-post-list details p { line-height: 1.75; }
.profile-social-list { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; padding: 1rem; border: 1px solid rgba(17,27,71,.12); background: #fffdf8; }
.profile-social-list h2 { flex-basis: 100%; margin: 0; color: var(--profile-night); font-family: serif; font-size: 1.25rem; }
.profile-social-list a { padding: .35rem .7rem; border-radius: 999px; background: var(--profile-paper-deep); color: var(--profile-vermilion); text-decoration: none; }

.profile-editor-shell { width: min(1120px, calc(100% - 2rem)); margin: 2.5rem auto 5rem; }
.profile-editor-intro {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
  padding: 2.3rem;
  color: white;
  background: linear-gradient(135deg, var(--profile-night), #283775);
  box-shadow: 0 18px 48px rgba(17,27,71,.18);
}
.profile-editor-intro h1 { margin: .3rem 0 .7rem; color: white; font-family: serif; }
.profile-editor-intro p { max-width: 48rem; color: rgba(255,255,255,.75); }
.profile-editor-grid { display: grid; grid-template-columns: minmax(16rem, .72fr) minmax(0, 1.5fr); gap: 1.2rem; margin-top: 1.2rem; }
.profile-editor-preview,
.profile-editor-form { padding: clamp(1.3rem, 3vw, 2.2rem); border: 1px solid rgba(17,27,71,.12); background: var(--profile-paper); }
.profile-editor-preview { text-align: center; background: linear-gradient(160deg, var(--profile-night), #283875); color: white; }
.profile-editor-preview .eyebrow { color: var(--profile-gold-light); }
.profile-editor-preview h2 { margin: .35rem 0 1.4rem; color: white; font-family: serif; }
.profile-avatar-preview { min-height: 13rem; display: grid; place-items: center; margin-bottom: 1.25rem; }
.profile-avatar-live { display: block; border-radius: 50%; }
.profile-private-note { padding: .7rem; border: 1px solid rgba(240,214,143,.35); color: var(--profile-gold-light); }
.profile-editor-form fieldset { margin: 0 0 1.4rem; padding: 0; border: 0; }
.profile-editor-form legend { width: 100%; margin-bottom: .8rem; padding-bottom: .45rem; border-bottom: 1px solid rgba(17,27,71,.12); color: var(--profile-night); font-family: serif; font-size: 1.2rem; }
.profile-editor-form .field { display: grid; gap: .45rem; margin-bottom: 1rem; }
.profile-editor-form input[type="text"],
.profile-editor-form textarea,
.profile-editor-form select,
.profile-editor-form input[type="file"] { width: 100%; box-sizing: border-box; }
.profile-editor-form input[type="text"],
.profile-editor-form textarea,
.profile-editor-form select { padding: .72rem; border: 1px solid rgba(17,27,71,.22); background: white; }
.profile-editor-form ul { margin: .35rem 0 0; padding: 0; list-style: none; }
.profile-editor-form .profile-character-preferences ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; max-height: 15rem; overflow: auto; padding: .35rem; border: 1px solid rgba(17,27,71,.12); border-radius: 10px; background: rgba(246,238,220,.55); }
.profile-editor-form .profile-character-preferences li { min-width: 0; }
.profile-editor-form .profile-character-preferences label { display: flex; align-items: center; gap: .45rem; min-height: 2.2rem; padding: .35rem .5rem; border: 1px solid rgba(180,147,67,.2); border-radius: 7px; background: var(--profile-paper); color: var(--profile-night); font-size: .88rem; cursor: pointer; }
.profile-editor-form .profile-character-preferences input[type="checkbox"] { flex: 0 0 auto; accent-color: #a52e49; }
.profile-editor-form .profile-character-preferences label:focus-within { outline: 2px solid var(--profile-gold); outline-offset: 1px; }
.profile-editor-form .profile-character-preferences .themed-picker { max-width: 34rem; }
.profile-editor-form .profile-character-preferences .themed-trigger { min-height: 46px; }
.profile-editor-form .helptext { color: var(--profile-muted); font-size: .82rem; }
.profile-editor-submit { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.profile-editor-submit span { color: var(--profile-muted); font-size: .82rem; }

@media (max-width: 820px) {
  .profile-cover-inner { grid-template-columns: 1fr; text-align: center; }
  .profile-portrait-wrap { justify-self: center; }
  .profile-preferences { justify-content: center; }
  .profile-cover-actions { width: min(24rem, 100%); justify-self: center; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-stats a:nth-child(3) { border-left: 0; border-top: 1px solid rgba(213,173,88,.26); }
  .profile-stats a:nth-child(4) { border-top: 1px solid rgba(213,173,88,.26); }
  .profile-series-grid { grid-template-columns: 1fr; }
  .profile-post-list { grid-template-columns: 1fr; }
  .profile-editor-intro { align-items: start; flex-direction: column; }
  .profile-editor-grid { grid-template-columns: 1fr; }
  .profile-editor-form .profile-character-preferences ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .profile-cover-inner { padding-top: 3.5rem; padding-bottom: 4.5rem; }
  .profile-dashboard { width: min(100% - 1rem, 1120px); }
  .profile-tabs { overflow-x: auto; }
  .profile-tabs button { flex: 1 0 auto; }
  .profile-section-heading { align-items: start; flex-direction: column; }
  .profile-section-heading > p { text-align: left; }
  .profile-editor-shell { width: min(100% - 1rem, 1120px); margin-top: .5rem; }
  .profile-editor-intro,
  .profile-editor-preview,
  .profile-editor-form { padding: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .profile-tabs button { scroll-behavior: auto; }
}
.profile-avatar-preview img.profile-avatar-live{width:clamp(8.5rem,17vw,12rem);height:clamp(8.5rem,17vw,12rem);object-fit:cover;aspect-ratio:1}
.profile-editor-grid{align-items:start}
.profile-editor-preview{position:sticky;top:24px;border-radius:12px 12px 30px 12px}
.profile-editor-form,.profile-editor-intro{border-radius:12px 12px 24px 12px}
body.backend-page .profile-editor-preview .eyebrow,body.backend-page .profile-editor-intro .eyebrow{color:#edcf8b}
@media(max-width:820px){.profile-editor-preview{position:static}}
