/* Profile-only styles. Existing home composition, photos and action dialogs remain scoped. */
#modal:has(.v30-profile-list){width:min(480px,calc(100vw - 28px));max-width:none;max-height:calc(100dvh - 32px);margin:auto;padding:0;border:1px solid #dedbdd;border-radius:27px;background:#fff;color:#171717;overflow:hidden;font-family:var(--popup-font)}
#modal:has(.v30-profile-list)::backdrop,#modal:has(.v30-profile-detail)::backdrop{background:#39313b66;backdrop-filter:blur(8px)}
.v30-profile-list{position:relative;height:auto;max-height:calc(100dvh - 34px);display:flex;flex-direction:column;padding:22px 26px 20px;background:#fff;min-height:0}
.v30-profile-list__nav{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;padding:0 2px 17px;background:#fff}
#modal .v30-profile-list__nav button{width:124px;height:35px;min-height:35px;margin:0;padding:3px 7px;border:1px solid #847e97;border-radius:5px;background:#fff;box-shadow:none;color:#38313f;font:500 13px/1.3 var(--popup-font);white-space:nowrap}
.v30-profile-list__scroll{min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:4px 2px}
.v30-profile-entry{display:grid;grid-template-columns:minmax(92px,35%) minmax(0,1fr);align-items:start;gap:18px;background:transparent;padding:20px 0 23px;margin:0;border:0;border-radius:0;box-shadow:none}
.v30-profile-entry:first-child{padding-top:7px}
.v30-profile-entry+.v30-profile-entry{border-top:1px solid #aaa6aa}
.v30-profile-picture{position:relative;min-width:0;padding-top:7px}
#modal .v30-profile-picture>button{display:block;position:relative;width:100%;aspect-ratio:.86;min-height:170px;overflow:hidden;padding:0;margin:0;border:0;border-radius:20px;background:#f3efeb;box-shadow:none}
#modal .v30-profile-entry:first-child .v30-profile-picture>button{background:#f4effa}
.v30-profile-picture img{position:absolute;width:174%;max-width:none;height:auto;left:50%;bottom:0;transform:translateX(-50%);pointer-events:none}
.v30-profile-relation{position:absolute;top:0;left:-3px;background:#105e9c;color:#fff;border-radius:999px;min-width:92px;padding:3px 12px;font-size:14px;font-weight:700;line-height:1.5;text-align:center}
.v30-profile-relation--self{background:#ad4b7d;width:38px;min-width:38px;height:38px;padding:8px 0;font-size:16px}
.v30-profile-info{min-width:0;padding:4px 0 0}
.v30-profile-info>header{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;min-height:65px;margin-bottom:8px}
.v30-profile-name{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;min-width:0;color:#135b9a}
.v30-profile-name--self{color:#b2477d}
#modal .v30-profile-name h3{margin:0;padding:0;font:700 24px/1.45 var(--popup-font);color:inherit;overflow-wrap:anywhere}
.v30-profile-name>span{font-size:13px;font-weight:400;color:#827b97;overflow-wrap:anywhere}
.v30-profile-badges{display:flex;align-items:flex-end;flex-direction:column;gap:5px;max-width:56%;flex-shrink:0}
#modal .v30-profile-badges button{width:auto;min-height:28px;margin:0;padding:4px 7px;border:0;border-radius:4px;background:#70a9df;box-shadow:none;color:white;font:700 13px/1.4 var(--popup-font);white-space:normal;overflow-wrap:anywhere}
#modal .v30-profile-badges .v30-profile-effect{background:#9682c8}
#modal .v30-profile-entry:first-child .v30-profile-badges .v30-profile-effect{background:#d4a0ba}
.v30-profile-fields{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px;font-size:14px;line-height:1.65;margin:3px 0}
.v30-profile-field{display:inline-flex;flex-wrap:wrap;align-items:baseline;column-gap:4px;max-width:100%;min-width:0}
.v30-profile-field>span{color:#847c94;font-weight:400}
.v30-profile-field>b{font-weight:700;color:#111;overflow-wrap:anywhere;min-width:0}
.v30-profile-earned{font-size:.9em;color:#7842ba;margin-left:2px;white-space:nowrap}
.v30-profile-fields--major{font-size:18px;gap:4px 18px;margin-bottom:6px}
.v30-profile-fields--major .v30-profile-field>span{font-size:14px}
.v30-profile-meters{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:9px;font-size:13px;line-height:1.4}
.v30-profile-meters>div{min-width:0}.v30-profile-meters span{color:#4e4752;display:block;overflow-wrap:anywhere}.v30-profile-meters b{font-weight:500}
.v30-profile-meter{height:4px;background:#eae4f5;margin-top:4px;overflow:hidden}.v30-profile-meter i{display:block;height:100%;background:#9980cb}
#modal:has(.v30-profile-detail){width:min(680px,calc(100vw - 28px));max-height:calc(100dvh - 32px);margin:auto;background:#fff;border:1px solid #dedbdd;border-radius:24px;padding:25px;overflow-y:auto;font-family:var(--popup-font)}
.v30-profile-detail{background:#fff;color:#343037}.v30-profile-detail h2{font-size:21px;color:#7543ae}.v30-profile-detail__body{font-size:15px;line-height:1.8}.v30-profile-detail__body img{max-width:100%;height:auto}
.v30-home .v30-partners{left:14px!important;right:14px;max-width:calc(100% - 28px);gap:8px}
.v30-profile-list button:focus-visible{outline:2px solid #7842ba;outline-offset:3px}
@media(max-width:600px){
 #modal:has(.v30-profile-list){width:min(480px,calc(100vw - 24px));max-height:calc(100dvh - 28px);border-radius:24px}
 .v30-profile-list{height:auto;max-height:calc(100dvh - 30px);padding:15px 15px 13px}.v30-profile-list__nav{padding-bottom:12px}
 #modal .v30-profile-list__nav button{width:108px;height:32px;min-height:32px;font-size:12px}
 .v30-profile-entry{gap:12px;grid-template-columns:minmax(84px,34%) minmax(0,1fr);padding:17px 0}
 #modal .v30-profile-picture>button{border-radius:17px;min-height:166px;aspect-ratio:.74}
 .v30-profile-picture img{width:200%}
 .v30-profile-relation{min-width:74px;font-size:12px;padding:3px 9px}.v30-profile-relation--self{width:32px;min-width:32px;height:32px;font-size:14px;padding:6px 0}
 #modal .v30-profile-name h3{font-size:21px}.v30-profile-name>span{font-size:12px}.v30-profile-name{gap:4px}
 .v30-profile-info>header{gap:4px;min-height:58px;flex-wrap:wrap;margin-bottom:5px}
 .v30-profile-badges{max-width:100%;margin-left:auto;align-items:flex-end}
 #modal .v30-profile-badges button{font-size:12px;min-height:26px;padding:3px 5px}
 .v30-profile-fields{font-size:13px;line-height:1.65;gap:2px 7px;margin:2px 0}.v30-profile-fields--major{font-size:17px;gap:3px 10px}.v30-profile-fields--major .v30-profile-field>span{font-size:13px}
 .v30-profile-meters{font-size:12px;gap:7px;margin-top:7px}
}

/* A glossary bubble stays inside the existing, unaltered profile dialog. */
#modal .v30-profile-kpi-tip{position:absolute;z-index:5;box-sizing:border-box;margin:0;padding:12px 14px;border:1px solid #e3dbee;border-radius:12px;background:#fff;box-shadow:0 8px 24px #30213f26;color:#343037;font:400 15px/1.65 var(--popup-font);text-align:left;overflow-wrap:anywhere;overflow:visible}
.v30-profile-kpi-tip::before{content:"";position:absolute;left:var(--kpi-tail-x);top:-6px;width:10px;height:10px;background:#fff;border-top:1px solid #e3dbee;border-left:1px solid #e3dbee;transform:translateX(-50%) rotate(45deg)}
.v30-profile-kpi-tip[data-side="above"]::before{top:auto;bottom:-6px;transform:translateX(-50%) rotate(225deg)}

/* Preview proposal: one person per column; no markup or game changes. */
@media(min-width:1025px){
 #modal:has(.v30-profile-list){width:min(980px,calc(100vw - 28px))}
 .v30-profile-list__scroll{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:24px;align-content:start}
 .v30-profile-entry{position:relative;padding-inline:5px}
 .v30-profile-entry+.v30-profile-entry{border-top:0}
 .v30-profile-entry:nth-child(2){padding-top:7px}
 .v30-profile-entry:nth-child(2n+3)::before{content:'';position:absolute;top:0;left:0;width:calc(200% + 24px);height:1px;background:#aaa6aa;pointer-events:none}
 #modal:has(.v30-profile-list__scroll>.v30-profile-entry:only-child){width:min(480px,calc(100vw - 28px))}
 .v30-profile-list__scroll:has(>.v30-profile-entry:only-child){grid-template-columns:minmax(0,1fr)}
}

/* Keep each desktop/tablet meter label and percentage together. */
@media(min-width:601px){.v30-profile-meters span{white-space:nowrap;overflow-wrap:normal}}
@media(min-width:1025px){
 .v30-profile-entry:nth-child(odd):not(:only-child)::after{content:'';position:absolute;top:0;bottom:0;left:calc(100% + 12px);width:1px;transform:translateX(-.5px);background:#aaa6aa;pointer-events:none}
}
