/* Edit profile v2 (owner 11/7): a labelled Edit button people can see + a modern editor panel. Clean graphite, gold accents,
   no purple. Loaded after every older profile/editor sheet, so it wins over their rules. */

/* ---- the button on your own profile hero ---- */
#profile .pfx-hero button.pe-edit, #profile button.pe-edit {
  position: static !important; flex: 0 0 auto; display: inline-flex !important; align-items: center; gap: 8px;
  width: auto !important; min-width: 0 !important; max-width: none !important; height: 38px !important; min-height: 0 !important; max-height: none !important;
  margin: 0 !important; padding: 0 16px 0 13px !important; border-radius: 999px !important;
  border: 1px solid rgba(255,195,74,.55) !important; background: linear-gradient(180deg, rgba(255,205,90,.16), rgba(255,180,40,.08)) !important;
  color: #ffd677 !important; font: 800 13px/1 system-ui, sans-serif !important; letter-spacing: .04em !important; text-transform: none !important;
  box-shadow: 0 0 0 0 rgba(255,195,74,.0), 0 6px 18px rgba(0,0,0,.45) !important; cursor: pointer; transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}
#profile button.pe-edit svg { width: 15px !important; height: 15px !important; fill: none !important; stroke: currentColor !important; stroke-width: 2.1; flex: none; pointer-events: none; }
#profile button.pe-edit:hover { background: linear-gradient(180deg, #ffd34d, #e0a915) !important; color: #141005 !important; box-shadow: 0 0 0 3px rgba(255,195,74,.18), 0 8px 22px rgba(0,0,0,.5) !important; transform: translateY(-1px); }
#profile button.pe-edit:active { transform: none; }
@media (max-width: 520px) { #profile button.pe-edit { height: 34px !important; padding: 0 13px 0 11px !important; font-size: 12px !important; } }

/* "Member since" (original Discord join, lib/originalJoins.js) next to the status pill */
#profile .pfx-pill.pfx-pill-since { border-color: rgba(242,195,107,.45) !important; color: #ffd677 !important; background: rgba(242,195,107,.08) !important; }
#profile .pfx-pill.pfx-pill-since::before { content: "★"; margin-right: 5px; font-size: 11px; }

/* ---- the panel ---- */
#profile-editor.pe2 { width: min(560px, calc(100vw - 24px)) !important; max-height: 88vh; max-height: 88svh; padding: 0 !important; overflow: hidden !important;
  border-radius: 20px !important; border: 1px solid rgba(255,255,255,.1) !important; background: #111317 !important; color: #e9ecf1 !important;
  box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(0,0,0,.4) !important; }
#profile-editor.pe2::backdrop { background: rgba(4,5,7,.72) !important; backdrop-filter: blur(4px); }
#profile-editor.pe2[open] { display: flex !important; flex-direction: column; animation: peIn .22s cubic-bezier(.2,.9,.3,1); }
@keyframes peIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
#profile-editor.pe2 #profile-settings-form { display: flex !important; flex-direction: column; min-height: 0; max-height: inherit; gap: 0 !important; padding: 0 !important; margin: 0; }

#profile-editor.pe2 .panel-head { position: static !important; flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 !important;
  padding: 18px 18px 14px !important; background: transparent !important; border: 0 !important; border-bottom: 1px solid rgba(255,255,255,.07) !important; }
#profile-editor.pe2 .pe-ttl h2 { margin: 0 !important; font: 800 22px/1.1 system-ui, sans-serif !important; letter-spacing: .01em; color: #fff !important; text-shadow: none !important; text-transform: none !important; }
#profile-editor.pe2 .pe-ttl p { margin: 4px 0 0; font: 500 13px/1.35 system-ui, sans-serif; color: #8d95a3; }
#profile-editor.pe2 button#close-profile-editor { flex: 0 0 36px; width: 36px !important; height: 36px !important; min-width: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important;
  display: grid; place-items: center; border-radius: 50% !important; border: 1px solid rgba(255,255,255,.12) !important; background: rgba(255,255,255,.04) !important;
  color: #c9ced6 !important; font: 400 22px/1 system-ui, sans-serif !important; box-shadow: none !important; }
#profile-editor.pe2 button#close-profile-editor:hover { background: rgba(255,255,255,.1) !important; color: #fff !important; border-color: rgba(255,255,255,.25) !important; }

#profile-editor.pe2 .pe-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 16px; padding: 16px 18px 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }

/* live banner preview */
#profile-editor.pe2 .pe-preview { position: relative; aspect-ratio: 16 / 5; border-radius: 14px; overflow: hidden; background: #0a0b0e center / cover no-repeat;
  border: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 -40px 60px rgba(0,0,0,.45); }
#profile-editor.pe2 .pe-preview.empty { background-image: linear-gradient(135deg, #1a1d23, #0c0d10) !important; }
#profile-editor.pe2 .pe-preview.empty::after { content: "No banner yet"; position: absolute; inset: 0; display: grid; place-items: center; font: 600 13px system-ui, sans-serif; color: #5f6773; }
#profile-editor.pe2 .pe-tag { position: absolute; left: 10px; bottom: 10px; z-index: 1; padding: 4px 9px; border-radius: 999px; background: rgba(0,0,0,.6); color: #e9ecf1; font: 700 10.5px/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }

/* labels + bio */
#profile-editor.pe2 label.pe-field { display: grid !important; gap: 8px; margin: 0 !important; color: inherit !important; font: inherit !important; text-transform: none !important; letter-spacing: 0 !important; }
#profile-editor.pe2 .pe-lbl, #profile-editor.pe2 legend { display: flex; align-items: baseline; justify-content: space-between; font: 800 11px/1 system-ui, sans-serif !important; letter-spacing: .12em !important; text-transform: uppercase !important; color: #f2c36b !important; }
#profile-editor.pe2 #bio-count { font: 600 11.5px/1 system-ui, sans-serif; letter-spacing: 0; text-transform: none; color: #6f7784; }
#profile-editor.pe2 #profile-bio-input { box-sizing: border-box; width: 100%; min-height: 104px; resize: vertical; margin: 0; padding: 12px 14px !important; border-radius: 12px !important;
  border: 1px solid rgba(255,255,255,.1) !important; background: #0a0b0e !important; color: #fff !important; font: 400 15px/1.45 system-ui, sans-serif !important; }
#profile-editor.pe2 input:not([type="file"]):focus, #profile-editor.pe2 textarea:focus { outline: none; border-color: rgba(242,195,107,.7) !important; box-shadow: 0 0 0 3px rgba(242,195,107,.14) !important; }

/* banner section */
#profile-editor.pe2 fieldset.pe-banner { display: grid; gap: 12px; min-width: 0; margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; }
#profile-editor.pe2 fieldset.pe-banner legend { padding: 0 !important; margin: 0 0 10px; float: left; width: 100%; }
#profile-editor.pe2 fieldset.pe-banner legend + * { clear: both; }
#profile-editor.pe2 label.pe-drop { position: relative; display: grid !important; justify-items: center; gap: 6px; margin: 0 !important; padding: 18px 14px !important; border-radius: 14px;
  border: 1.5px dashed rgba(242,195,107,.4) !important; background: rgba(242,195,107,.04) !important; color: #e9ecf1 !important; text-align: center; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
#profile-editor.pe2 label.pe-drop:hover { background: rgba(242,195,107,.09) !important; border-color: rgba(242,195,107,.7) !important; }
#profile-editor.pe2 label.pe-drop svg { width: 26px; height: 26px; color: #f2c36b; }
#profile-editor.pe2 label.pe-drop b { font: 700 14px/1.2 system-ui, sans-serif; color: #fff; text-transform: none; letter-spacing: 0; }
#profile-editor.pe2 label.pe-drop small { font: 500 12px/1.3 system-ui, sans-serif; color: #8d95a3; text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
#profile-editor.pe2 label.pe-drop input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
#profile-editor.pe2 .profile-editor-divider { display: flex; align-items: center; gap: 10px; margin: 0 !important; font: 600 11.5px/1 system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #6f7784 !important; }
#profile-editor.pe2 .profile-editor-divider::before, #profile-editor.pe2 .profile-editor-divider::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.08); }
#profile-editor.pe2 .giphy-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#profile-editor.pe2 .giphy-search input { box-sizing: border-box; height: 42px; margin: 0; padding: 0 14px !important; border-radius: 12px !important; border: 1px solid rgba(255,255,255,.1) !important; background: #0a0b0e !important; color: #fff !important; font: 400 15px system-ui, sans-serif !important; }
#profile-editor.pe2 .giphy-search button#search-giphy { height: 42px !important; min-height: 0 !important; margin: 0 !important; padding: 0 18px !important; border-radius: 12px !important; border: 1px solid rgba(255,255,255,.14) !important;
  background: rgba(255,255,255,.06) !important; color: #fff !important; font: 700 14px/1 system-ui, sans-serif !important; letter-spacing: .02em !important; text-transform: none !important; box-shadow: none !important; }
#profile-editor.pe2 .giphy-search button#search-giphy:hover { background: rgba(255,255,255,.12) !important; }
#profile-editor.pe2 .giphy-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#profile-editor.pe2 .giphy-results:empty { display: none; }
#profile-editor.pe2 .giphy-results button { position: relative; aspect-ratio: 16 / 10; width: 100% !important; height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: hidden;
  border-radius: 10px !important; border: 2px solid transparent !important; background: #0a0b0e !important; box-shadow: none !important; cursor: pointer; transition: border-color .12s ease, transform .12s ease; }
#profile-editor.pe2 .giphy-results button:hover { border-color: #f2c36b !important; transform: translateY(-1px); }
#profile-editor.pe2 .giphy-results img { width: 100%; height: 100%; object-fit: cover; display: block; }
#profile-editor.pe2 .pe-note { font: 500 12px/1.3 system-ui, sans-serif; color: #6f7784; }
#profile-editor.pe2 .giphy-results:empty + .pe-note { display: none; }
#profile-editor.pe2 #profile-editor-status { margin: 0 !important; font: 600 13px/1.4 system-ui, sans-serif; color: #ffb3bd; }
#profile-editor.pe2 #profile-editor-status:empty { display: none; }

/* footer */
#profile-editor.pe2 .pe-foot { flex: none; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(255,255,255,.07); background: #0e1014; }
#profile-editor.pe2 .pe-foot button { height: 42px !important; min-height: 0 !important; margin: 0 !important; padding: 0 20px !important; border-radius: 999px !important; font: 800 14px/1 system-ui, sans-serif !important; letter-spacing: .02em !important; text-transform: none !important; cursor: pointer; }
#profile-editor.pe2 .pe-foot .pe-cancel { border: 1px solid rgba(255,255,255,.14) !important; background: transparent !important; color: #c9ced6 !important; box-shadow: none !important; }
#profile-editor.pe2 .pe-foot .pe-cancel:hover { background: rgba(255,255,255,.06) !important; color: #fff !important; }
#profile-editor.pe2 .pe-foot button[type="submit"] { border: 0 !important; background: linear-gradient(180deg, #ffd34d, #e0a915) !important; color: #141005 !important; box-shadow: 0 8px 22px rgba(224,169,21,.25) !important; }
#profile-editor.pe2 .pe-foot button[type="submit"]:hover { filter: brightness(1.06); }
#profile-editor.pe2 .pe-foot button[type="submit"]:disabled { opacity: .6; cursor: default; }

/* phones: full width, below the status bar (installed app), comfortable 16 px inputs (no iOS zoom) */
@media (max-width: 640px) {
  #profile-editor.pe2 { width: calc(100vw - 16px) !important; margin-top: calc(var(--safe-top, 0px) + 8px) !important; max-height: calc(100vh - var(--safe-top, 0px) - 16px); max-height: calc(100svh - var(--safe-top, 0px) - 16px); border-radius: 18px !important; }
  #profile-editor.pe2 .pe-body { padding: 14px; gap: 14px; }
  #profile-editor.pe2 .panel-head { padding: 16px 14px 12px !important; }
  #profile-editor.pe2 .pe-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
  #profile-editor.pe2 .pe-foot button { flex: 1 1 0; }
  #profile-editor.pe2 #profile-bio-input, #profile-editor.pe2 .giphy-search input { font-size: 16px !important; }
}
