:root {
  --bgc-app: #101010;
  --text: #ececec;
  --muted: #a6a6a6;
  --accent: #7c5cff;
  --accent-2: #8d7bff;
  --border: #ffffff16;
  --danger: #ff6b6b;
  --danger-lo: rgba(255, 107, 107, .1);
  --mono: 'DM Mono', monospace;
  --pad: clamp(14px, 3vw, 26px);
  --maxw: 1100px;
  --fs-xxs: clamp(.78rem, .18vw + .70rem, .86rem);
  --fs-xs:  clamp(.86rem, .24vw + .78rem, .95rem);
  --fs-sm:  clamp(.96rem, .30vw + .86rem, 1.06rem);
  --fs-lg:  clamp(1.18rem, .70vw + 1rem, 1.34rem);
  --fs-2xl: clamp(1.6rem, 1.5vw + 1.1rem, 2.14rem);
  --input-h: clamp(42px, 1.2vw + 36px, 50px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bgc-app);
}

/* ── Layout ── */
.profile-edit {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--pad);
}

.profile-edit__head { margin: 0 0 10px; }

.profile-edit__head h1 {
  margin: 0 0 6px;
  font: 800 var(--fs-2xl) / 1.1 "Exo", system-ui;
}

.profile-edit__head .muted {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* ── Hero ── */
.pe-hero { position: relative; }

.pe-hero__banner {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #101010;
}

.pe-hero__banner img {
  display: block;
  width: 100%;
  height: clamp(160px, 18vw, 220px);
  object-fit: cover;
  filter: brightness(.96) contrast(1.02);
}

.pe-hero__banner dotlottie-player {
  display: block;
  width: 100%;
  height: clamp(160px, 18vw, 220px);
}

.pe-identity {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 14px;
  border-radius: 14px;
}

.pe-identity__avatar { position: relative; }

.pe-identity__avatar img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.pe-identity__avatar dotlottie-player {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: #101010;
}

.pe-identity__meta .name {
  display: block;
  font-weight: 800;
  letter-spacing: .2px;
  font-size: clamp(1.02rem, .5vw + .9rem, 1.22rem);
}

.pe-identity__meta .handle {
  color: var(--muted);
  font-size: var(--fs-xxs);
}

.is-clickable { position: relative; cursor: pointer; }

.media-edit,
.media-remove {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0d0e14cc;
  color: #fff;
  border: 1px solid #ffffff26;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 800;
  font-size: .9rem;
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .15s ease, transform .15s ease;
  cursor: pointer;
}

.pe-hero__banner:hover .media-edit,
.pe-hero__banner:hover .media-remove,
.pe-identity__avatar:hover .media-edit,
.pe-identity__avatar:hover .media-remove {
  opacity: 1;
  transform: translateY(0);
}

.media-remove {
  opacity: 1 !important;
  transform: translateY(0) !important;
  right: 12px;
  top: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  border-radius: 999px;
  font-size: .95rem;
  line-height: 1;
}

.media-edit[data-target="banner"]     { right: 12px; bottom: 12px; }
.media-edit[data-target="avatar"]     { right: -6px; bottom: -6px; padding: 6px; }
.media-remove[data-remove="avatar"]   { top: -6px; right: -6px; width: 22px; height: 22px; font-size: .75rem; }

/* ── Form ── */
.pe-formwrap { margin-top: 22px; }

.pe-card {
  background: var(--bgc-app);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  container-type: inline-size;
}

.pe-card__title {
  margin: 0 0 10px;
  font: 800 var(--fs-lg) / 1.15 "Exo", system-ui;
}

.pe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pe-grid .cell.full { grid-column: 1 / -1; }

@container (max-width: 820px) {
  .pe-grid { grid-template-columns: 1fr; }
}

/* ── Champ unifié ── */
.pe-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pe-label {
  display: block;
  font-size: var(--fs-xxs);
  color: var(--muted);
  opacity: .92;
  margin: 0;
}

.pe-input {
  width: 100%;
  height: var(--input-h);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #ffffff18;
  background: var(--bgc-app);
  color: var(--text);
  font-size: var(--fs-sm);
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}

textarea.pe-input {
  height: auto;
  min-height: 120px;
  border-radius: 14px;
  line-height: 1.45;
  resize: none;
}

.pe-input::placeholder { color: var(--muted); opacity: .7; }

.pe-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(141, 123, 255, .15);
}

/* ── États d'erreur — pattern identique à login / register / new-music ── */
.pe-input.is-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px var(--danger-lo) !important;
  outline: none;
}

.pe-field-error {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--danger);
  margin: 0;
  line-height: 1.4;
}

/* ── Actions ── */
.pe-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn {
  height: clamp(40px, 1.2vw + 34px, 46px);
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid #ffffff16;
  background: #101010;
  color: #fff;
  font-weight: 800;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: transform .08s, filter .12s;
}

.btn:hover  { transform: translateY(-1px); filter: brightness(1.06); }
.btn:active { transform: translateY(0) scale(.99); }

.btn--ghost {
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pe-actions--sticky {
  position: sticky;
  bottom: 12px;
  display: none;
  gap: 10px;
  justify-content: space-between;
  background: #0c0d12cc;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  padding: 10px;
  border-radius: 14px;
  margin-top: 10px;
}

.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .pe-hero__banner img,
  .pe-hero__banner dotlottie-player { height: clamp(130px, 16vw, 180px); }
  .pe-identity { grid-template-columns: auto 1fr; gap: 12px; }
}

@media (max-width: 700px) {
  :root {
    --pad: 14px;
    --fs-xxs: .84rem;
    --fs-xs: .92rem;
    --fs-sm: 1rem;
    --input-h: 42px;
  }

  .profile-edit { max-width: 680px; }
  .profile-edit__head h1 { font-size: 1.2rem; }
  .pe-hero__banner { border-radius: 12px; }
  .pe-hero__banner img,
  .pe-hero__banner dotlottie-player { height: 120px; object-fit: cover; }
  .media-edit[data-target="banner"] { opacity: 1; }
  .pe-identity { padding: 12px; gap: 10px; }
  .pe-identity__avatar img,
  .pe-identity__avatar dotlottie-player { width: 56px; height: 56px; }
  .media-edit[data-target="avatar"] { opacity: 1; right: -4px; bottom: -4px; }
  .media-edit span { display: none; }
  .pe-grid { grid-template-columns: 1fr; gap: 8px; }
  .pe-input { border-radius: 10px; font-size: .98rem; }
  textarea.pe-input { min-height: 94px; border-radius: 10px; }
  .pe-actions { display: none; }
  .pe-actions--sticky {
    display: flex;
    bottom: 10px;
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
  }
  .btn { height: 44px; border-radius: 10px; background: #1a1b24; }
  .btn--ghost {
    background: transparent;
    border: 0;
    color: #bdbdbd;
    text-decoration: underline;
    height: auto;
    padding: 6px 0;
  }
}

@media (max-width: 360px) {
  .pe-actions--sticky { padding: 6px; }
  .btn { height: 42px; }
  .pe-hero__banner img { height: 108px; }
}