.profile-person{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:2px;background:transparent;border:0;color:inherit;gap:2px}.profile-person small{font-size:calc(11px * var(--font-overall,1) * var(--font-section,1));max-width:120px;overflow-wrap:anywhere;line-height:1.2}.profile-avatar{position:relative;overflow:hidden;display:inline-grid;place-items:center;width:36px;height:36px;flex-shrink:0;border-radius:50%;background:var(--surface-elevated,#35453e);color:var(--text-primary,#fff)}.profile-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.profile-name{display:inline;min-height:44px;border:0;background:transparent;color:inherit;padding:2px 4px;text-align:left;font:inherit}.profile-name small{font-size:.8em;opacity:.8}.direct-peer-row{display:flex;gap:4px;align-items:center}.direct-peer-row>[data-direct-peer]{flex:1;min-width:0}.profile-card-photo .profile-avatar{width:80px;height:80px}.profile-card-photo .profile-handle{display:none}#profile-dialog{max-width:440px;width:calc(100% - 24px);max-height:calc(100dvh - 24px);overflow:auto;border:1px solid var(--border,#60756a);border-radius:16px;background:var(--surface,#15221b);color:var(--text-primary,#f2f5f3);padding:20px;padding-bottom:max(20px,env(safe-area-inset-bottom))}#profile-dialog::backdrop{background:rgba(0,0,0,.55)}.profile-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.profile-dialog-heading h2{margin:0}.profile-dialog-heading button,#profile-dialog button{min-height:44px}.profile-card-photo{text-align:center;margin-top:14px}.profile-sheet h3,.profile-card-handle{text-align:center}.profile-upload{display:block;margin-top:24px}.profile-upload input{max-width:100%}#profile-error{min-height:1.4em;white-space:pre-wrap}#profile-handle-form{display:grid;gap:10px}#profile-handle-form label{display:grid;gap:6px}#profile-handle-form input{min-height:44px}html[data-theme="light"] #profile-dialog{background:var(--surface,#fff);color:var(--text-primary,#17271f)}html[data-theme="light"] .profile-avatar{background:var(--surface-elevated,#e4e9e6);color:var(--text-primary,#17271f)}

.profile-name{display:inline-flex;align-items:center;gap:6px;vertical-align:middle}.profile-name>span:last-child{display:inline-flex;flex-direction:column}.profile-name small{display:block}

.profile-link{display:inline-block;min-height:44px;background:transparent;border:0;color:inherit;font:inherit;padding:2px 0;text-align:left}

.profile-load-status{font-size:calc(12px * var(--font-overall,1) * var(--font-section,1));max-width:220px;line-height:1.4;white-space:normal}.profile:has(.profile-load-status){flex-wrap:wrap}

#profile-photo-editor canvas{display:block;width:100%;max-width:320px;aspect-ratio:1;touch-action:none;cursor:move;border:1px solid currentColor;border-radius:8px}#profile-photo-editor input{width:100%;min-height:44px}#profile-photo-editor canvas:focus-visible{outline:3px solid currentColor;outline-offset:3px}#profile-later{margin-top:16px;width:100%}

/* Profile dialog presentation only. Keep upload and persistence behavior intact. */
#profile-dialog{box-sizing:border-box;padding:0;max-height:calc(100dvh - 24px);overscroll-behavior:contain;scrollbar-gutter:stable;scroll-padding-block:68px 24px}
#profile-dialog .profile-sheet{padding:16px;padding-bottom:max(16px,env(safe-area-inset-bottom));min-width:0}
#profile-dialog .profile-dialog-heading{position:sticky;top:0;z-index:2;margin:-16px -16px 12px;padding:12px 16px;background:var(--surface,#15221b);border-bottom:1px solid var(--border,#60756a)}
html[data-theme="light"] #profile-dialog .profile-dialog-heading{background:var(--surface,#fff)}
#profile-dialog .profile-dialog-heading h2{font-size:calc(18px * var(--font-overall,1) * var(--font-section,1));line-height:1.4}
#profile-dialog .profile-card-photo{margin:4px 0}
#profile-dialog .profile-card-photo .profile-avatar{width:56px;height:56px}
#profile-dialog .profile-sheet h3{margin:6px 0 2px;font-size:calc(20px * var(--font-overall,1) * var(--font-section,1));overflow-wrap:anywhere}
#profile-dialog .profile-card-handle{margin:0 0 10px;font-size:calc(13px * var(--font-overall,1) * var(--font-section,1));opacity:.75;overflow-wrap:anywhere}
#profile-dialog .profile-card-handle:empty,#profile-dialog #profile-error:empty,#profile-photo-editor:empty{display:none}
#profile-dialog .muted,#profile-dialog small{font-size:calc(12px * var(--font-overall,1) * var(--font-section,1));line-height:1.5}
#profile-dialog #profile-error{margin:8px 0;font-size:calc(13px * var(--font-overall,1) * var(--font-section,1));line-height:1.5;min-height:0}
#profile-dialog #profile-handle-form{gap:8px}
#profile-dialog #profile-handle-form input{box-sizing:border-box;width:100%;padding:10px 12px;border-radius:10px;border:1px solid var(--border,#60756a);background:var(--surface-elevated,#24392c);color:inherit;font:inherit;font-size:calc(16px * var(--font-overall,1) * var(--font-section,1))}
#profile-dialog button:not(.profile-person){box-sizing:border-box;min-height:44px;padding:10px 14px;border:1px solid var(--border,#60756a);border-radius:10px;font:inherit;font-size:calc(14px * var(--font-overall,1) * var(--font-section,1));line-height:1.3;background:var(--surface-elevated,#24392c);color:inherit;cursor:pointer}
#profile-dialog button.primary{background:var(--accent,#b7e3c1);color:#102015;border-color:transparent;font-weight:600}
#profile-dialog button:disabled{opacity:.5;cursor:default}
#profile-dialog button:focus-visible,#profile-dialog .profile-upload:focus-within{outline:2px solid currentColor;outline-offset:3px}
#profile-dialog .profile-upload{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-height:46px;margin-top:16px;padding:10px 14px;border:1px solid var(--border,#60756a);border-radius:10px;background:var(--surface-elevated,#24392c);font-size:calc(14px * var(--font-overall,1) * var(--font-section,1));font-weight:600;cursor:pointer;overflow:hidden}
#profile-dialog .profile-upload input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
#profile-dialog .profile-upload:has(input:disabled){opacity:.5;cursor:default}
#profile-photo-editor{margin:12px 0}
#profile-photo-editor p{font-size:calc(12px * var(--font-overall,1) * var(--font-section,1));line-height:1.5;margin:0 0 8px}
#profile-photo-editor canvas{box-sizing:border-box;width:min(100%,240px);height:auto;margin-inline:auto}
#profile-photo-editor label{display:grid;gap:2px;margin-top:8px;font-size:calc(13px * var(--font-overall,1) * var(--font-section,1))}
#profile-photo-editor input{box-sizing:border-box;margin:0;accent-color:var(--accent,#b7e3c1)}
.profile-photo-actions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;margin:10px 0}
.profile-photo-actions:not(:has(button:not([hidden]))){display:none}
#profile-dialog [hidden]{display:none!important}
#profile-photo-delete{width:100%;margin-top:8px}
html[data-theme="light"] #profile-dialog :is(button.secondary,button[data-profile-close],.profile-upload,#profile-handle-form input){background:var(--surface-elevated,#edf2ee)}
@media(max-width:480px){
 #profile-dialog{width:calc(100% - 16px);max-height:calc(100dvh - 16px);border-radius:14px}
 #profile-dialog .profile-sheet{padding:12px;padding-bottom:max(12px,env(safe-area-inset-bottom))}
 #profile-dialog .profile-dialog-heading{margin:-12px -12px 10px;padding:10px 12px}
 #profile-photo-editor canvas{width:min(100%,220px,32dvh)}
 #profile-dialog .profile-upload{margin-top:12px}
}

html:has(#profile-dialog[open]),body:has(#profile-dialog[open]){overflow:hidden;overscroll-behavior:none}

/* Compact two-section dialog: photo first, handle settings collapsed. */
#profile-dialog .profile-identity{display:flex;gap:12px;align-items:center;margin-bottom:12px}
#profile-dialog .profile-identity h3,#profile-dialog .profile-identity .profile-card-handle{text-align:left;margin:0;line-height:1.4}
#profile-dialog .profile-identity .profile-card-photo{margin:0}
#profile-dialog .profile-photo-section{padding:12px;border:1px solid var(--border,#60756a);border-radius:12px}
#profile-dialog h4{margin:0 0 10px;font-size:calc(14px * var(--font-overall,1) * var(--font-section,1));display:flex;align-items:center;justify-content:space-between}
#profile-dialog h4 small{font-weight:400;opacity:.7}
#profile-dialog .profile-picker-row,.profile-photo-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
#profile-dialog .profile-picker-row button,#profile-dialog .profile-photo-actions button{appearance:none;-webkit-appearance:none;margin:0;width:100%;height:44px;border-radius:10px;font:inherit;font-size:calc(14px * var(--font-overall,1) * var(--font-section,1));font-weight:600;box-shadow:none}
#profile-dialog .profile-picker-row button,#profile-dialog .profile-photo-actions .secondary{background:var(--surface-elevated,#24392c);color:inherit;border:1px solid var(--border,#60756a)}
#profile-dialog .profile-photo-actions .primary{background:var(--accent,#b7e3c1);color:#102015;border:1px solid transparent}
#profile-dialog .profile-file-state{margin:8px 0 0;font-size:calc(12px * var(--font-overall,1) * var(--font-section,1));line-height:1.4;overflow-wrap:anywhere;color:inherit;opacity:.8}
#profile-dialog .profile-photo-help{margin:8px 0 0;font-size:calc(11px * var(--font-overall,1) * var(--font-section,1));opacity:.65}
#profile-dialog #profile-photo-editor{margin:8px 0}
#profile-dialog #profile-photo-editor p{margin:0 0 6px;font-size:calc(11px * var(--font-overall,1) * var(--font-section,1))}
#profile-dialog #profile-photo-editor canvas{width:min(100%,180px,24dvh);height:auto}
#profile-dialog #profile-photo-editor label{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:calc(12px * var(--font-overall,1) * var(--font-section,1))}
#profile-dialog #profile-photo-editor input{min-width:0;flex:1;min-height:44px}
#profile-dialog .profile-handle-section{margin-top:12px;border-top:1px solid var(--border,#60756a);padding-top:4px}
#profile-dialog .profile-handle-section summary{min-height:44px;box-sizing:border-box;padding:12px 0;font-size:calc(14px * var(--font-overall,1) * var(--font-section,1));font-weight:600;cursor:pointer}
#profile-dialog #profile-later{margin-top:12px}
html[data-theme="light"] #profile-dialog .profile-picker-row button{background:var(--surface-elevated,#edf2ee)}
@media(max-width:480px){#profile-dialog #profile-photo-editor canvas{width:min(100%,160px,22dvh)}}

@media(max-width:480px) and (max-height:700px){
 #profile-dialog .profile-sheet{padding:8px;padding-bottom:max(8px,env(safe-area-inset-bottom))}
 #profile-dialog .profile-dialog-heading{margin:-8px -8px 8px;padding:8px}
 #profile-dialog .profile-identity{margin-bottom:8px}
 #profile-dialog .profile-card-photo .profile-avatar{width:44px;height:44px}
 #profile-dialog .profile-photo-section{padding:8px}
 #profile-dialog h4{margin-bottom:6px}
 #profile-dialog #profile-photo-editor canvas{width:min(100%,112px,19dvh)}
 #profile-dialog .profile-handle-section{margin-top:8px}
}

#profile-dialog[aria-busy="true"] #profile-photo-editor{pointer-events:none;opacity:.65}
#profile-dialog #profile-error[data-state="busy"]{padding:8px 10px;border:1px solid currentColor;border-radius:8px;font-weight:600}
#profile-dialog #profile-error[data-state="success"]{padding:8px 10px;border-inline-start:3px solid #6ebc8a;font-weight:600}
#profile-dialog #profile-error[data-state="error"]{padding:8px 10px;border-inline-start:3px solid #e48b80;font-weight:600}
#profile-dialog #profile-photo-save:disabled{opacity:.85;cursor:wait}

.profile-bio-section{border-top:1px solid var(--border);padding-top:16px;margin:16px 0}.profile-bio-section h4{margin:0 0 8px;font-size:calc(14px * var(--font-overall,1) * var(--font-title,1))}.profile-bio-text{margin:0 0 12px;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;font-size:calc(14px * var(--font-overall,1) * var(--font-body,1))}.profile-bio-section form{display:grid;gap:10px;min-width:0}.profile-bio-section label{margin:0}.profile-bio-section small{color:var(--muted);line-height:1.5;font-size:calc(12px * var(--font-overall,1) * var(--font-body,1))}.profile-bio-section button{justify-self:start;max-width:100%;white-space:normal;overflow-wrap:anywhere}

.profile-character-picker{margin:12px 0}.profile-character-picker summary{cursor:pointer;font-weight:600;padding:10px 0}.profile-character-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;max-height:340px;overflow:auto;padding:4px}.profile-character{min-width:0;padding:5px;border:2px solid transparent;border-radius:12px;background:var(--surface,rgba(128,128,128,.12));color:inherit;cursor:pointer}.profile-character[aria-pressed="true"]{border-color:var(--accent,#54ba8b)}.profile-character:focus-visible{outline:2px solid currentColor}.profile-character span{display:block;width:100%;aspect-ratio:1;background-repeat:no-repeat;border-radius:50%}.profile-character small{display:block;font-size:11px;margin-top:3px}.profile-character-preview{display:block;width:min(160px,100%);aspect-ratio:1;border-radius:50%;margin:8px auto}@media(max-width:360px){.profile-character-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}

.character-art-1{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:5.475334857889578% 13.908833254605574%;}
.character-art-2{background-image:url(/character-two.jpg);background-size:114.2857142857% 114.2857142857%;background-position:50% 50%;}
.character-art-3{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:64.74518131329631% 13.908833254605574%;}
.character-art-4{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:94.81378634433192% 13.908833254605574%;}
.character-art-5{background-image:url(/character-five.jpg);background-size:114.2857142857% 114.2857142857%;background-position:50% 50%;}
.character-art-6{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:35.254818686703686% 51.950873878129435%;}
.character-art-7{background-image:url(/character-seven.jpg);background-size:114.2857142857% 114.2857142857%;background-position:50% 50%;}
.character-art-8{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:94.81378634433192% 51.950873878129435%;}
.character-art-9{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:5.475334857889578% 90.41095890410959%;}
.character-art-10{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:35.254818686703686% 90.41095890410959%;}
.character-art-11{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:64.74518131329631% 90.41095890410959%;}
.character-art-12{background-image:url(/character-sheet-1.jpg);background-size:528.1118881118881% 396.08391608391605%;background-position:94.81378634433192% 90.41095890410959%;}
.character-art-13{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:4.667878387309979% 2.8193732838905063%;}
.character-art-14{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:34.79180436219432% 2.8193732838905063%;}
.character-art-15{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:65.11070720423001% 2.8193732838905063%;}
.character-art-16{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:95.62458691341705% 2.8193732838905063%;}
.character-art-17{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:4.667878387309979% 47.91236164972967%;}
.character-art-18{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:34.79180436219432% 47.91236164972967%;}
.character-art-19{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:65.11070720423001% 47.91236164972967%;}
.character-art-20{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:95.62458691341705% 47.91236164972967%;}
.character-art-21{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:4.667878387309979% 93.5063832196337%;}
.character-art-22{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:34.79180436219432% 93.5063832196337%;}
.character-art-23{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:65.11070720423001% 93.5063832196337%;}
.character-art-24{background-image:url(/character-sheet-2.jpg);background-size:503.46666666666664% 335.51333333333326%;background-position:95.62458691341705% 93.5063832196337%;}

.profile-character{display:block;width:100%}.profile-character small{text-align:center;white-space:normal}

#profile-dialog button.profile-character{display:block;width:100%;padding:5px;border:2px solid transparent}#profile-dialog button.profile-character[aria-pressed=true]{border-color:var(--accent,#54ba8b)}
