/* Profile surfaces share the badge catalog; portraits, rarity colors and title materials stay independent. */
.rank-profile-surface:where([data-rank-frame]) {
  --rf-ink:#f1eedf; --rf-edge:#d9b45e; --rf-top:#22261d; --rf-bottom:#1a1d16;
  --rf-gem:#d9b45e; --rf-edge-rgb:217,180,94; --rf-ring2:transparent; --rf-ring3:transparent;
  --rf-corner:6px; --rf-diamonds:none; --rf-stars:none;
  --text:var(--rf-ink); --gold:var(--rf-edge); --gold-strong:var(--rf-gem);
  --muted:color-mix(in srgb,var(--rf-ink) 88%,var(--rf-bottom));
  --surface:var(--rf-bottom); --surface-deep:var(--rf-bottom); --input:var(--rf-bottom);
  --surface-2:color-mix(in srgb,var(--rf-top) 72%,var(--rf-bottom));
  --line:color-mix(in srgb,var(--rf-edge) 32%,var(--rf-bottom));
  --primary-bg:color-mix(in srgb,var(--rf-top) 80%,var(--rf-bottom)); --primary-hover:var(--rf-top);
  --primary-border:var(--rf-edge); --primary-text:var(--rf-ink); --selected-border:var(--rf-edge);
  --ga-control-border:color-mix(in srgb,var(--rf-edge) 48%,var(--rf-bottom));
  --ga-control-bg:linear-gradient(180deg,var(--surface-2),var(--surface));
  --ga-action-bg:linear-gradient(165deg,var(--rf-top),var(--rf-bottom));
  --card-accent:var(--rf-edge); --card-rgb:var(--rf-edge-rgb); --card-glow:var(--rf-top);
}
.rank-profile-surface[data-rank-frame] {
  position:relative; isolation:isolate; min-width:0; border:2px solid var(--rf-edge); color:var(--text);
  background:radial-gradient(ellipse at 85% 0%,color-mix(in srgb,var(--rf-gem) 14%,transparent),transparent 48%),linear-gradient(165deg,color-mix(in srgb,var(--rf-top) 80%,var(--rf-bottom)),var(--rf-bottom) 65%);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--rf-edge) 40%,var(--rf-bottom)),0 12px 32px #0003;
}
.rank-profile-surface[data-rank-frame]::before {
  content:""; position:absolute; z-index:4; pointer-events:none; inset:4px;
  width:auto; height:auto; aspect-ratio:auto; translate:none; border:1px solid var(--rf-ring2); border-radius:2px;
  box-shadow:inset 0 0 0 2px var(--rf-ring3);
}
.rank-profile-surface[data-rank-frame]::after {
  content:""; position:absolute; z-index:4; pointer-events:none; inset:0;
  background:linear-gradient(135deg,var(--rf-edge) 0 42%,color-mix(in srgb,var(--rf-edge) 55%,white) 43% 50%,transparent 51%) top left,
    linear-gradient(225deg,var(--rf-edge) 0 42%,color-mix(in srgb,var(--rf-edge) 55%,white) 43% 50%,transparent 51%) top right,
    linear-gradient(45deg,var(--rf-edge) 0 42%,color-mix(in srgb,var(--rf-edge) 55%,white) 43% 50%,transparent 51%) bottom left,
    linear-gradient(315deg,var(--rf-edge) 0 42%,color-mix(in srgb,var(--rf-edge) 55%,white) 43% 50%,transparent 51%) bottom right;
  background-size:calc(var(--rf-corner) * 2) calc(var(--rf-corner) * 2); background-repeat:no-repeat;
}
.rank-profile-ornament { position:absolute; z-index:4; inset:0; pointer-events:none; }
.rank-profile-ornament::before,.rank-profile-ornament::after { content:""; position:absolute; top:4px; background:linear-gradient(135deg,color-mix(in srgb,var(--rf-gem) 45%,white),var(--rf-gem) 45%,var(--rf-edge)); }
.rank-profile-ornament::before { display:var(--rf-diamonds); left:calc(50% - 12px); width:8px; height:12px; clip-path:polygon(50% 0,100% 30%,100% 70%,50% 100%,0 70%,0 30%); }
.rank-profile-ornament::after { display:var(--rf-stars); left:calc(50% + 3px); width:12px; height:12px; clip-path:polygon(50% 0,61% 34%,98% 35%,68% 57%,79% 98%,50% 74%,21% 98%,32% 57%,2% 35%,39% 34%); }
.rank-profile-surface .adventurer-profile-field> :is(select,textarea):focus-visible { border-color:var(--rf-edge); outline:2px solid var(--rf-edge); }
.build-card.rank-profile-surface .build-card-scene::after { background:linear-gradient(180deg,color-mix(in srgb,var(--rf-bottom) 72%,transparent),color-mix(in srgb,var(--rf-bottom) 18%,transparent) 35%,color-mix(in srgb,var(--rf-bottom) 40%,transparent) 55%,var(--rf-bottom) 100%); }
.build-card.rank-profile-surface :is(.build-owner,.build-weapon,.build-note) { color:var(--muted); }
.build-card.rank-profile-surface :is(.build-floor strong,.build-commands>span) { color:var(--text); }
.adventurer-card-dialog.rank-profile-surface>header { border-bottom-color:var(--line); background:linear-gradient(110deg,var(--rf-top),var(--rf-bottom)); }
.adventurer-card-dialog.rank-profile-surface :is(.adventurer-card-title-mark h2,.adventurer-card-close) { color:var(--text); }
.adventurer-card-dialog.rank-profile-surface .adventurer-card-close { border-color:var(--ga-control-border); }
