#profile-dialog {
  --profile-ink: #1b1140;
  --profile-muted: #5a4f7a;
  --profile-line: #ddd3f7;
  color-scheme: light;
  width: min(43rem, 100% - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  border: 3px solid #1b1140;
  border-radius: 1.3rem;
  background: #fffaf3;
  color: var(--profile-ink);
  overflow: auto;
  overscroll-behavior: contain;
  box-shadow: 10px 10px 0 #1b1140;
}
#profile-dialog::backdrop { background: #0f082859; }
#profile-dialog[open] { animation: settings-in 190ms cubic-bezier(.2,.75,.25,1) both; }
:root[data-reduced-motion] #profile-dialog[open] { animation: none; }
@media (prefers-reduced-motion: reduce) { #profile-dialog[open] { animation: none; } }
.profile-close-form { position: sticky; z-index: 1; top: 0; height: 0; }
.profile-close {
  position: absolute; top: .72rem; right: .75rem; display: grid; place-items: center;
  width: 2rem; min-height: 2rem; padding: 0; border: 2px solid #1b1140; border-radius: .55rem; box-shadow: none;
  background: #fffaf3; color: #1b1140; font: 1.4rem/1 var(--font, system-ui);
}
.profile-cover {
  height: clamp(5.8rem, 18vw, 8.7rem); border-bottom: 3px solid #1b1140;
}
.profile-pattern {
  background: radial-gradient(circle, #fffaf3 0 2.2px, transparent 2.6px) 0 0 / 18px 18px, #4b33b5;
}
.profile-pattern[data-banner="rings"] {
  background:
    repeating-radial-gradient(ellipse 165px 106px at 14% 128%, transparent 0 17px, #f1bcffaa 18px, transparent 19px 29px),
    repeating-radial-gradient(ellipse 140px 100px at 91% -17%, transparent 0 20px, #c6bbff70 21px, transparent 22px 35px),
    linear-gradient(112deg, #2b225f, #623ab2 54%, #382975);
}
.profile-pattern[data-banner="stripes"] {
  background: repeating-linear-gradient(122deg, #98366d 0 12px, #b94a87 13px 19px, #98366d 20px 28px);
}
.profile-pattern[data-banner="checker"] {
  background: conic-gradient(#276d68 25%, #36887c 0 50%, #276d68 0 75%, #36887c 0) 0 0 / 32px 32px;
}
.profile-pattern[data-banner="confetti"] {
  background:
    linear-gradient(143deg, transparent 36%, #ffa59c 37% 63%, transparent 64%) 12% 24% / 15px 11px no-repeat,
    linear-gradient(30deg, transparent 32%, #96efd5 34% 66%, transparent 68%) 25% 65% / 10px 13px no-repeat,
    linear-gradient(140deg, transparent 38%, #e0bcff 39% 61%, transparent 62%) 36% 32% / 21px 11px no-repeat,
    linear-gradient(48deg, transparent 36%, #ffd078 37% 64%, transparent 65%) 56% 78% / 15px 10px no-repeat,
    linear-gradient(20deg, transparent 37%, #ff98b6 38% 62%, transparent 63%) 70% 25% / 17px 12px no-repeat,
    linear-gradient(132deg, transparent 34%, #8fe6ff 35% 65%, transparent 66%) 84% 71% / 11px 15px no-repeat,
    linear-gradient(47deg, transparent 38%, #ffd078 39% 62%, transparent 63%) 96% 42% / 18px 10px no-repeat,
    radial-gradient(circle at 7% 78%, #d8b5fa 0 2px, transparent 2.5px),
    radial-gradient(circle at 47% 20%, #ffe0a7 0 2.8px, transparent 3.3px),
    radial-gradient(circle at 63% 54%, #b8e9ff 0 1.8px, transparent 2.3px),
    radial-gradient(circle at 77% 86%, #ffc2c7 0 2.5px, transparent 3px),
    radial-gradient(circle at 91% 20%, #9be7d2 0 2px, transparent 2.5px),
    linear-gradient(110deg, #262451, #393176 55%, #32265f);
}
.profile-banner-control { display: grid; gap: .4rem; flex: 0 0 min(14rem, 48%); min-width: 0; }
#profile-banner { width: 100%; }
#profile-banner-preview { height: 2.5rem; border: 1px solid #1b1140; border-radius: .55rem; }
.profile-body { position: relative; padding: 0 clamp(1rem, 4.8vw, 2rem) 1.55rem; }
.profile-identity {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: .5rem .9rem; margin: .68rem 0 1.32rem;
}
.profile-details { display: flex; align-items: center; gap: .45rem .8rem; min-width: 0; }
.profile-nameplate { min-width: 0; overflow-wrap: anywhere; }
#profile-avatar {
  flex: 0 0 auto; width: clamp(3.3rem, 13vw, 4.7rem); height: clamp(3.3rem, 13vw, 4.7rem);
  align-self: start; margin-top: -1.65rem; border: 3px solid #1b1140; border-radius: 28%;
  color: #1b1140; background: #ffc845; font-size: 1.24rem;
}
.profile-name-row { display: flex; align-items: center; gap: .3rem; min-width: 0; }
/* Report: just the flag, no button plate; shown on other party members' profiles. */
#profile-dialog .profile-report {
  display: grid; place-items: center; flex: 0 0 auto; width: 2rem; min-height: 2rem; padding: 0;
  background: none; border: 0; border-radius: 50%; box-shadow: none; color: var(--profile-muted);
}
#profile-dialog .profile-report[hidden] { display: none; }
#profile-dialog .profile-report:is(:hover, :focus-visible) { color: #c2381f; }
#profile-dialog .profile-report:active:not(:disabled) { translate: none; box-shadow: none; }
#profile-name { margin: 0; font: 800 clamp(1.25rem, 4.5vw, 1.8rem)/1.15 var(--font, system-ui); letter-spacing: -.035em; }
#profile-type { color: var(--profile-muted); font-size: .83rem; margin-top: .14rem; }
.profile-links { display: flex; align-items: center; flex: 0 0 auto; gap: .15rem; }
.profile-links a { display: grid; place-items: center; width: 2rem; height: 2.35rem; border-radius: .35rem; }
#profile-youtube { color: #b9163d; }
#profile-twitch { color: #6432a8; }
.profile-links a:hover { filter: brightness(.78); }
.profile-links svg { width: 1.32rem; height: 1.32rem; }
#edit-player-profile {
  justify-self: end; padding: .35rem .6rem; min-height: 2rem;
  border-color: #1b1140; background: #fffaf3; color: #1b1140; box-shadow: 2px 2px 0 #1b1140; font-size: .8rem;
}
#profile-dialog :focus-visible { outline-color: #1b1140; }
#profile-dialog h3 { margin: 0 0 .57rem; font-size: .97rem; font-weight: 720; }
.profile-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .57rem; margin: 0; }
.profile-stats > div {
  display: flex; flex-direction: column-reverse; justify-content: start; gap: .25rem;
  padding: .68rem; border: 2px solid #1b1140; border-radius: .72rem; background: #f4efff;
}
.profile-stats > div:nth-child(2) { background: #dfe8ff; }
.profile-stats > div:nth-child(3) { background: #ffdbe9; }
.profile-stats dd { margin: 0; overflow-wrap: anywhere; font-size: clamp(1.13rem, 4vw, 1.55rem); line-height: 1.1; font-weight: 760; font-variant-numeric: tabular-nums; }
.profile-stats dt { color: var(--profile-muted); font-size: .79rem; line-height: 1.25; }
.profile-streak { display: flex; align-items: center; gap: .75rem; margin-top: .85rem; padding: .65rem; border: 1px solid var(--profile-line); border-radius: .72rem; }
#profile-dialog .profile-streak h3 { margin: 0 0 .13rem; }
.profile-streak p { color: var(--profile-muted); font-size: .78rem; }
.profile-flame { min-width: 3.15rem; display: grid; justify-items: center; gap: .12rem; padding: .4rem .5rem; border-radius: .52rem; color: #625d70; background: #f0edf2; line-height: 1; }
.profile-flame svg { width: 1.35rem; height: 1.35rem; }
.profile-flame.is-active { color: #a44014; background: #ffe8d8; }
.profile-breakdown { margin-top: 1.15rem; padding-top: .85rem; border-top: 1px solid var(--profile-line); }
.profile-breakdown-title { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: .25rem .7rem; }
#profile-game-count { color: var(--profile-muted); font-size: .77rem; }
#profile-status { padding: .7rem; border: 1px dashed var(--profile-line); border-radius: .57rem; color: var(--profile-muted); }
#profile-status:empty { display: none; }
.profile-game-table { overflow-x: auto; }
.profile-game-table table { border-collapse: collapse; width: 100%; text-align: left; font-size: .82rem; }
.profile-game-table :is(th,td) { padding: .5rem .35rem; border-bottom: 1px solid var(--profile-line); }
.profile-game-table thead { color: var(--profile-muted); }
.profile-game-table :is(td,th:not(:first-child)) { text-align: right; font-variant-numeric: tabular-nums; }
.profile-game-table tbody th { text-transform: capitalize; overflow-wrap: anywhere; }
@media (max-width: 28rem) {
  .profile-identity { grid-template-columns: auto minmax(0, 1fr); column-gap: .55rem; }
  #edit-player-profile { grid-column: 2; }
}
@media (max-width: 24rem) {
  .profile-details { column-gap: .25rem; }
  .profile-links { gap: 0; }
  .profile-stats > div { padding: .55rem .42rem; }
}
@media (max-width: 23rem) {
  .profile-banner-control { flex-basis: 100%; }
}

