/* Live 1.2.15: keep the profile-background chooser visible in iOS Safari.
 * The chooser is portalled outside the profile <dialog> in update-1.2.13.js.
 * Explicit viewport coordinates prevent the native dialog default from
 * positioning the popup at the document's top-left corner. */
.den-wrap dialog.den-profile-background-modal[open]{
  position:fixed!important;
  inset:auto!important;
  top:50%!important;
  left:50%!important;
  right:auto!important;
  bottom:auto!important;
  transform:translate(-50%,-50%)!important;
  margin:0!important;
  box-sizing:border-box!important;
  width:min(calc(100vw - 28px),680px)!important;
  max-width:680px!important;
  height:min(88dvh,850px)!important;
  max-height:88dvh!important;
  border-radius:20px!important;
  z-index:2147483000!important;
}
@media (max-width:600px){
  .den-wrap dialog.den-profile-background-modal[open]{
    width:calc(100vw - 16px)!important;
    max-width:calc(100vw - 16px)!important;
    height:min(88dvh,900px)!important;
    max-height:88dvh!important;
    border-radius:18px!important;
  }
}

.den-wrap .den-profile-card-preview {
  box-sizing:border-box; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:10px; width:100%; aspect-ratio:7/5; min-height:185px; max-height:390px;
  padding:18px; border-radius:14px; overflow:hidden; text-align:center;
  color:white; background:radial-gradient(ellipse at top,#77438d,transparent 65%),linear-gradient(125deg,#25152f,#673782);
}
.den-wrap .den-profile-card-preview .den-avatar {
  flex:none; width:clamp(80px,23vw,126px); height:clamp(80px,23vw,126px); border:2px solid white;
  border-radius:50%; object-fit:cover; object-position:var(--den-photo-focus-x,50%) var(--den-photo-focus-y,50%);
}
.den-wrap .den-profile-card-preview :is(b,small) {display:block;color:white;line-height:1.3;text-shadow:0 1px 5px #210c2c;}
.den-wrap .den-profile-card-preview b {font-size:clamp(20px,4vw,28px);}
.den-wrap .den-profile-photo-actions {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:8px; margin:10px 0 20px;
}
.den-wrap .den-profile-photo-actions > .den-profile-background-picker {
  display:block; min-width:0; padding:0!important; margin:0!important; border:0!important;
}
.den-wrap .den-profile-photo-actions .den-appearance-action {
  box-sizing:border-box; width:100%; min-width:0; min-height:46px; margin:0;
  gap:7px; padding:8px 4px; font-size:clamp(13px,3.6vw,16px); text-transform:none;
}
.den-wrap .den-profile-photo-actions .den-appearance-action::before {
  content:""; flex:0 0 19px; height:19px; background:currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7'%3E%3Cpath d='M3 7h4l2-3h6l2 3h4v13H3z'/%3E%3Ccircle cx='12' cy='13' r='3.5'/%3E%3C/svg%3E") center/contain no-repeat;
}
.den-wrap .den-profile-background-picker .den-appearance-action::before {
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7'%3E%3Crect x='2.5' y='4' width='19' height='16' rx='2'/%3E%3Ccircle cx='8' cy='9' r='1.4'/%3E%3Cpath d='m3 18 6-5 4 3 4-6 5 7'/%3E%3C/svg%3E");
}
.den-wrap .den-profile-photo-actions .den-profile-birthday-locked {grid-column:1/-1;}

.den-wrap .den-profile-modal-footer .den-button {background:#713796!important;}
.den-wrap .den-cover-cancel {width:100%;min-height:44px;border:1px solid #bda4c9;border-radius:10px;color:#512963;background:white;font:inherit;font-weight:700;cursor:pointer;}
.den-wrap .den-avatar-editor-modal .den-profile-photo-form {min-height:0;overflow:auto;overscroll-behavior:contain;margin:0;padding:16px;}
.den-wrap .den-account-preferences {margin:24px 0 16px;}
.den-wrap .den-account-preferences > :is(details,section) {
  padding:16px 0;margin:0;border:0;border-top:1px solid #e4dbe9;border-radius:0;background:transparent;box-shadow:none;
}
.den-wrap .den-account-preferences .den-profile-username-editor summary {font-size:16px;padding:2px 0;}
.den-wrap .den-account-preferences .den-profile-username-editor summary span {transform:none;}
.den-wrap .den-account-preferences summary small {display:block;color:#685c71;font-size:.9em;font-weight:500;}
.den-wrap .den-account-preferences .den-pref-action {font-size:14px;text-decoration:underline;text-underline-offset:3px;}
.den-wrap .den-story-edit {margin-block:8px;min-height:44px;}

.den-wrap .den-photo-crop-frame {touch-action:pan-y;cursor:auto;}
.den-wrap .den-crop-editing .den-photo-crop-frame {touch-action:none;cursor:grab;}
.den-wrap .den-profile-photo-crop:not(.den-crop-editing) .den-photo-crop-controls {display:none;}
.den-wrap .den-crop-heading {display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px;}
.den-wrap .den-crop-heading button {min-height:44px;padding:7px 12px;border-radius:8px;border:1px solid #cdbbd5;color:#522764;background:white;font:inherit;font-weight:700;}
.den-wrap .den-profile-saving[open] {display:flex;position:fixed;inset:0;align-items:center;justify-content:center;gap:10px;width:fit-content;max-width:86vw;height:fit-content;margin:auto;padding:18px 22px;border:0;border-radius:14px;background:white;color:#432452;font:inherit;font-weight:700;}
.den-wrap .den-profile-saving::backdrop {background:rgba(35,16,46,.42);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);}
.den-wrap .den-profile-story {margin:22px 0;padding:16px 0 0;border:0;border-top:1px solid #e5dbe9;background:transparent;box-shadow:none;}
.den-wrap .den-profile-story .den-about-form {margin:0;padding:0;border:0;background:transparent;box-shadow:none;}
.den-wrap .den-story-photos {margin:12px 0;padding:0;border:0;}
.den-wrap .den-story-photos > summary {min-height:44px;align-content:center;color:#5a356b;cursor:pointer;font-weight:700;}
.den-wrap .den-story-photos > summary small {font-weight:500;}
