/* Décor uniquement ; les arrière-plans, dimensions et défilements natifs sont conservés. */
.realm-frame:not(#player-profile-dialog) {
  --frame-tl: url('../assets/relooking/profile-frame/corner-top-left.webp');
  --frame-tr: url('../assets/relooking/profile-frame/corner-top-right.webp');
  --frame-bl: url('../assets/relooking/profile-frame/corner-bottom-left.webp');
  --frame-br: url('../assets/relooking/profile-frame/corner-bottom-right.webp');
  --frame-top: url('../assets/relooking/profile-frame/edge-top.webp');
  --frame-bottom: url('../assets/relooking/profile-frame/edge-bottom.webp');
  --frame-left: url('../assets/relooking/profile-frame/edge-left.webp');
  --frame-right: url('../assets/relooking/profile-frame/edge-right.webp');
  --frame-corner-max: 44px;
  --frame-corner-size: min(var(--frame-corner-max), var(--frame-safe-corner, 28px));
  --frame-band-size: min(18px, var(--frame-safe-band, 10px));
  border-image: none;
  border-radius: 0;
  background-image: var(--frame-tl), var(--frame-tr), var(--frame-bl), var(--frame-br), var(--frame-top), var(--frame-bottom), var(--frame-left), var(--frame-right), var(--frame-underlay);
  background-position: left top, right top, left bottom, right bottom, center top, center bottom, left center, right center, var(--frame-underlay-position);
  background-size: var(--frame-corner-size) auto, var(--frame-corner-size) auto, var(--frame-corner-size) auto, var(--frame-corner-size) auto, auto var(--frame-band-size), auto var(--frame-band-size), var(--frame-band-size) auto, var(--frame-band-size) auto, var(--frame-underlay-size);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat-x, repeat-x, repeat-y, repeat-y, var(--frame-underlay-repeat);
  background-origin: border-box, border-box, border-box, border-box, border-box, border-box, border-box, border-box, var(--frame-underlay-origin);
  background-clip: border-box, border-box, border-box, border-box, border-box, border-box, border-box, border-box, var(--frame-underlay-clip);
  background-attachment: scroll;
}
.realm-frame.realm-frame-noble:not(#player-profile-dialog),
.realm-frame.realm-frame-prestigious:not(#player-profile-dialog) {
  --frame-tl: url('../assets/relooking/noble-frame/corner-top-left.webp');
  --frame-tr: url('../assets/relooking/noble-frame/corner-top-right.webp');
  --frame-bl: url('../assets/relooking/noble-frame/corner-bottom-left.webp');
  --frame-br: url('../assets/relooking/noble-frame/corner-bottom-right.webp');
  --frame-corner-max: 50px;
}
.realm-frame.realm-frame-compact:not(#player-profile-dialog) { --frame-corner-max: 32px; }
.realm-frame.realm-frame-prestigious:not(#player-profile-dialog) { --frame-corner-max: 56px; }
/* Le marché a un en-tête opaque et aucun padding extérieur : ses deux coins
   supérieurs sont peints sur cet en-tête, sans déplacer son contenu. */
#market-dialog.realm-frame > .market-header {
  background-image: var(--frame-tl), var(--frame-tr), var(--frame-top), var(--frame-header-image);
  background-position: left top, right top, center top, var(--frame-header-position);
  background-size: var(--frame-corner-size) auto, var(--frame-corner-size) auto, auto var(--frame-band-size), var(--frame-header-size);
  background-repeat: no-repeat, no-repeat, repeat-x, var(--frame-header-repeat);
  background-origin: border-box;
}
.realm-frame:not(#player-profile-dialog) .realm-frame-sticky-header {
  top: var(--frame-band-size);
}
@media (max-width: 540px) {
  .realm-frame:not(#player-profile-dialog) { --frame-corner-max: 32px; }
  .realm-frame.realm-frame-compact:not(#player-profile-dialog) { --frame-corner-max: 26px; }
}

/* Boîte aux lettres : rythme intérieur, sans modifier les matériaux du cadre
   ni les états et actions de la messagerie. */
#messaging-dialog {
  box-sizing: border-box;
  padding: 1.5rem;
  max-height: calc(100dvh - 2rem);
}
#messaging-dialog .messaging-header {
  gap: .75rem;
  padding: .8rem 1rem;
  margin-bottom: 1rem;
}
#messaging-dialog #messaging-title {
  margin: 0;
  padding: 0;
  border-bottom: 0;
  line-height: 1.3;
}
#messaging-dialog #message-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
  margin-bottom: 1.1rem;
  align-items: stretch;
}
#messaging-dialog #message-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: .55rem .65rem;
  line-height: 1.25;
  font-size: .9rem;
  text-align: center;
}
#messaging-dialog #message-mailbox { gap: 1.1rem; }
#messaging-dialog .message-list-pane { padding: .25rem; }
#messaging-dialog .private-message-row { padding: .9rem 1rem; gap: .4rem; }
#messaging-dialog #message-reading { padding: 1.1rem; }
#messaging-dialog #message-compose { padding: .25rem; }
#messaging-dialog .message-recipient-form { margin-bottom: 1rem; }
#messaging-dialog .message-compose-form { gap: .65rem; }
#messaging-dialog #message-recipient-selected:empty { display: none; }
#messaging-dialog #message-subject,
#messaging-dialog #message-body { min-width: 0; width: 100%; }
#messaging-dialog #message-pending-access { width: auto; margin-block: .5rem .8rem; }
@media (max-width: 40rem) {
  #messaging-dialog { width: calc(100% - 1rem); padding: 1rem; max-height: calc(100dvh - 1rem); }
  #messaging-dialog .messaging-header { padding: .75rem; gap: .5rem; }
  #messaging-dialog #messaging-title { font-size: clamp(1.05rem, 4.5vw, 1.4rem); }
  #messaging-dialog #message-tabs { gap: .4rem; margin-bottom: 1rem; }
  #messaging-dialog #message-tabs button { padding: .5rem .2rem; font-size: .76rem; }
  #messaging-dialog .private-message-row { padding: .8rem; }
  #messaging-dialog #message-reading { padding: .8rem; }
  #messaging-dialog .social-search-controls { flex-wrap: wrap; }
  #messaging-dialog .social-search-controls input { flex: 1 1 9rem; min-width: 0; }
}
