.community-online{display:grid;gap:1rem}
.community-search{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.65rem;align-items:end}
.community-search input{width:100%}
.community-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.65rem;padding:.7rem 0;border-block-end:1px solid var(--line)}
.community-identity,.community-actions{display:flex;align-items:center;gap:.55rem;flex-wrap:wrap}
.community-identity img{width:42px;height:42px;object-fit:cover;border-radius:50%}
.community-identity strong{overflow-wrap:anywhere}
.community-settings{display:grid;gap:.65rem}
.community-settings label{display:grid;grid-template-columns:1.25rem minmax(0,1fr);gap:.65rem;align-items:start;text-align:start;line-height:1.45}
.community-settings input[type=checkbox]{width:1.1rem;height:1.1rem;margin:.17rem 0 0;padding:0}
.community-online [hidden]{display:none!important}
@media(max-width:440px){.community-search{grid-template-columns:1fr}.community-actions{width:100%}}

.community-suggestions{display:flex;overflow-x:auto;gap:.65rem;padding:.15rem .15rem .65rem;scroll-snap-type:x proximity}
.community-suggestion{flex:0 0 8.5rem;min-height:6.5rem;white-space:normal;scroll-snap-align:start}
.community-suggestion .community-identity{flex-direction:column;justify-content:center;gap:.5rem}
.community-suggestion .community-identity img{width:50px;height:50px}
.community-suggestion strong{max-width:100%;text-align:center}

.community-bio{white-space:pre-wrap;overflow-wrap:anywhere}.community-identity small{color:var(--muted);font-size:.75rem}.community-suggestion{min-height:8rem}
.community-visit-stage{position:relative;aspect-ratio:520/355;max-width:780px;margin:0 auto 1rem;overflow:hidden;border-radius:.55rem;background:#a9b5ca;cursor:pointer}
.community-visit-stage>svg{display:block;width:100%;height:100%}
.community-visit-actor{position:absolute;width:11%;transform:translate(-50%,-82%);text-align:center;pointer-events:none;transition:left 95ms linear,top 95ms linear}
.community-visit-host{pointer-events:auto}
.community-visit-actor svg{display:block;width:100%;height:auto}
.community-visit-actor span{display:block;white-space:nowrap;width:max-content;margin:auto;padding:.12rem .3rem;background:#252139;color:#fff;font-size:clamp(.55rem,2vw,.8rem);border-radius:.2rem}
.community-visit-host.visit-greeting{animation:visit-wave .38s ease}
@keyframes visit-wave{50%{transform:translate(-50%,-92%)}}
@media(prefers-reduced-motion:reduce){.community-visit-actor{transition:none}.community-visit-host.visit-greeting{animation:none}}

.community-house-item {
  position: absolute;
  transform: translate(-50%, -85%);
  z-index: 2;
  min-width: 34px;
  min-height: 34px;
  padding: 3px;
  border: 1px solid #ffd479;
  border-radius: 8px;
  background: #211d38;
}
[data-house-layer] [role="button"] { cursor: pointer; }
#houseVisitorLog { margin: 10px 0; }
#communityChat{width:min(92vw,40rem);max-height:85dvh;padding:1rem;border:1px solid #6e7299;border-radius:1rem;background:#151e2e;color:#f2efff}
#communityChat::backdrop{background:#090c18b8}
#communityChat header{display:flex;align-items:center;justify-content:space-between;gap:.75rem}
#communityChatTitle{min-inline-size:0;overflow-wrap:anywhere}
#communityChatClose{flex:none;min-inline-size:44px;min-block-size:44px}
#communityChatFriends{display:flex;flex-wrap:wrap;gap:.4rem;margin:.5rem 0}
#communityChatLog{max-height:40dvh;overflow:auto;display:grid;gap:.5rem;margin:.75rem 0}
#communityChatLog article{max-width:85%;padding:.55rem .75rem;border-radius:.75rem;background:#263650;overflow-wrap:anywhere}
#communityChatLog article.community-chat-mine{justify-self:end;background:#48406e}
#communityChatLog p{margin:0;white-space:pre-wrap}
#communityChatLog time{display:block;margin-top:.3rem}
#communityChatForm textarea{display:block;width:100%;min-height:4rem;box-sizing:border-box;margin:.3rem 0}
#communityChat [hidden]{display:none!important}
#tab-comunidad .community-hub-header{
 display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px;
 border:1px solid #72658e;background:#23223a
}
.community-hub-header h3,.community-hub-header p{margin:0}
.community-hub-header p{margin-top:5px;font-size:14px;color:var(--muted)}
#tab-comunidad .community-hub-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
#tab-comunidad .community-hub-nav button{
 min-width:0;padding:7px 3px;font-size:clamp(11px,3vw,15px);background:#25263e;border-color:#63587e
}
#tab-comunidad .community-hub-nav [aria-pressed=true]{background:#31494f;border-color:#8ce2d6;color:#f3fffc}
#tab-comunidad :is(button,select,input[type=search]){min-height:44px}
#tab-comunidad button{white-space:normal;overflow-wrap:anywhere}
#tab-comunidad [data-community-panel]{display:grid;gap:12px;min-width:0}
#tab-comunidad [data-community-panel]>.panel{margin:0;min-width:0;padding:14px}
#tab-comunidad .community-row{
 min-width:0;margin-top:8px;padding:10px;border:1px solid #605677;
 background:#21263a
}
#tab-comunidad .community-row .community-actions{flex:0 1 auto}
#tab-comunidad .community-actions button{font-size:14px;padding:6px 9px}
#tab-comunidad #communityOnlineRank .community-row{
 display:grid;grid-template-columns:2rem minmax(0,1fr) auto;gap:8px
}
#tab-comunidad #communityOnlineRank .community-row>button{grid-column:2/-1;justify-self:start}
.community-rank-place{display:grid;place-items:center;min-height:2rem;background:#403758;color:#f9dfa4}
.community-rank-score{font-size:14px;text-align:end;overflow-wrap:anywhere}
[data-personal-copy]{min-inline-size:0;overflow-wrap:anywhere}
@media(max-width:440px){
 #tab-comunidad .community-search{grid-template-columns:minmax(0,1fr) auto;gap:6px}
 #tab-comunidad .community-search button{padding-inline:8px}
 #tab-comunidad .community-hub-header{padding:10px}
 #tab-comunidad .community-hub-header p{max-width:23ch}
 #tab-comunidad .community-row .community-actions{width:100%}
}

#tab-comunidad .community-actions button {
 display:inline-flex;
 align-items:center;
 justify-content:center;
 gap:6px;
}
#tab-comunidad .community-actions .pixel-glyph,
#tab-comunidad .community-actions .companion-icon {
 flex:0 0 19px;
 width:19px;
 height:19px;
}
#tab-comunidad .community-actions button:focus-visible {
 outline:2px solid var(--cyan);
 outline-offset:2px;
}

#tab-comunidad .community-row .community-identity {
 min-inline-size:0;
 max-inline-size:100%;
}
#tab-comunidad .community-row .community-identity img {flex:none}
@media(max-width:440px) {
 #tab-comunidad .community-row .community-actions {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,120px),1fr));
 }
 #tab-comunidad .community-row .community-actions button {min-inline-size:0}
}

#communitySearchForm input {min-inline-size:0;width:100%}
#communitySearchForm button {
 display:inline-flex;
 align-items:center;
 justify-content:center;
 gap:6px;
}
#communitySearchForm .companion-icon {
 flex:0 0 20px;
 width:20px;
 height:20px;
}
@media(max-width:355px) {
 #tab-comunidad #communitySearchForm {grid-template-columns:minmax(0,1fr)}
 #communitySearchForm button {width:100%}
}

#communityChatForm button[type="submit"] {
 min-height:44px;
 display:inline-flex;
 align-items:center;
 justify-content:center;
 gap:6px;
}
#communityChatForm .companion-icon {
 flex:0 0 20px;
 width:20px;
 height:20px;
}
#communityChatForm :is(textarea,button):focus-visible {
 outline:2px solid var(--cyan);
 outline-offset:2px;
}
@media(max-width:440px) {
 #communityChatForm button[type="submit"] {width:100%}
}
@media(max-height:480px) {
 #communityChatComposer:has(#communityChatForm:not([hidden])) {
  position:sticky;
  inset-block-end:0;
  z-index:1;
  background:#151e2e;
  padding-block:.25rem;
 }
}
#communityChatStatus { margin-block:.25rem; overflow-wrap:anywhere; }
#communityChatStatus:empty { margin:0; }

#communityChatForm button[aria-busy="true"] .companion-icon {opacity:.55}
#communityChatForm button[aria-busy="true"] {cursor:progress}

.visit-movement .visit-direction {
 display:grid;
 place-items:center;
 flex:0 0 44px;
 width:44px;
 height:44px;
 padding:0;
}
.visit-movement .visit-direction .companion-icon {
 width:20px;
 height:20px;
 transform:rotate(var(--visit-arrow));
}
.visit-gift-actions label {min-width:0}
.visit-gift-actions select {display:block;width:100%;min-height:44px}
:is(.visit-movement,.visit-gift-actions) button:focus-visible {
 outline:2px solid var(--cyan);
 outline-offset:2px;
}
@media(max-width:440px) {
 .visit-gift-actions label {flex:1 0 100%}
 .visit-gift-actions button {flex:1 1 120px;min-height:44px;white-space:normal}
}
.community-rank-cta{border:2px solid #8feadf;color:#8feadf}.community-afk-row{display:flex;gap:.8rem;align-items:center;flex-wrap:wrap}.community-afk-row .community-rank-score{margin-inline-start:auto}.community-afk-row:nth-child(-n+3) .community-rank-place{color:#ffe3a1}
.community-online-dot:not([hidden]) {
 display:inline-block;
 inline-size:.55rem;
 block-size:.55rem;
 margin-inline-start:.35rem;
 vertical-align:middle;
 border-radius:50%;
 background:#62e59b;
 box-shadow:0 0 0 1px #1e613f;
}
.community-online-dot[hidden] { display:none; }
.community-chat-seen { display:block; margin-block-start:.25rem; color:#a4edc5; }
.community-chat-emoji {
 display:inline-block;
 inline-size:1.65em;
 block-size:1.65em;
 vertical-align:middle;
 background-image:url('assets/chat-emojis-v1.png');
 background-size:1200% 100%;
 background-repeat:no-repeat;
 image-rendering:pixelated;
}
.community-chat-emoji-bar { margin-block:.45rem; }
.community-chat-emoji-picker {
 display:grid;
 grid-template-columns:repeat(auto-fit,minmax(44px,1fr));
 gap:.3rem;
 max-inline-size:22rem;
 margin-block-start:.4rem;
}
.community-chat-emoji-picker button { display:grid;place-items:center;min-inline-size:44px;min-block-size:44px;padding:.15rem; }
.community-message-notice:not([hidden]) {
 position:fixed;
 z-index:1050;
 inset-block-start:calc(env(safe-area-inset-top,0px) + .65rem);
 inset-inline-end:.65rem;
 display:grid;
 grid-template-columns:minmax(0,1fr) auto auto;
 align-items:center;
 gap:.45rem;
 inline-size:min(28rem,calc(100% - 1.3rem));
 box-sizing:border-box;
 padding:.55rem;
 background:#263752;
 border:1px solid #a9a0e4;
 color:#f7f3ff;
 box-shadow:0 4px 16px #08091da0;
}
.community-message-notice p { margin:0;overflow-wrap:anywhere; }
.community-message-notice button { min-block-size:44px;white-space:normal; }

.visit-state-bars{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px;margin:10px 0}.visit-state-bars label{font-size:11px;display:grid;gap:5px}.visit-state-bars progress{width:100%;height:10px;accent-color:#a589e4}.community-visit-stage.visit-expanded{position:fixed;inset:auto;top:50%;left:50%;transform:translate(-50%,-50%);width:min(calc(100vw - 24px),calc((100dvh - 80px)*520/355));height:auto;max-width:none;aspect-ratio:520/355;z-index:10050;border:2px solid #ae98da}.visit-expanded>svg{object-fit:contain}.visit-expand-close{display:none}.visit-expanded .visit-expand-close{display:block;position:absolute;top:8px;right:8px;z-index:2;width:44px;height:44px;padding:0;font-size:26px;background:#29233f;color:#fff}.visit-walking .character-pose{animation:visit-step .2s steps(2) infinite}@keyframes visit-step{to{transform:translateY(-1px)}}@media(prefers-reduced-motion:reduce){.visit-walking .character-pose{animation:none}.community-visit-actor{transition:none}}

.pet-community-bar{position:absolute;left:12px;bottom:86px;width:100px;z-index:4;font-size:10px;color:#fff;text-shadow:1px 1px #28213e}.pet-community-bar label{display:flex;justify-content:space-between;gap:4px}.pet-community-bar progress{display:block;width:100%;height:10px;accent-color:#f5bf75}

.visit-bond-help{background:linear-gradient(135deg,#7851b7,#b66c9e);border:2px solid #edc4f3;font-weight:bold;min-height:48px}.companion-help-float{position:absolute;left:50%;top:24%;transform:translateX(-50%);z-index:25;max-width:90%;padding:10px 14px;background:#332746ee;border:2px solid #bfe5c4;border-radius:8px;color:#e4ffe6;text-align:center;pointer-events:none;font-size:12px;animation:companion-help-rise 4.2s ease-out forwards}@keyframes companion-help-rise{0%{opacity:0;translate:0 15px}12%,75%{opacity:1}100%{opacity:0;translate:0 -35px}}@media(prefers-reduced-motion:reduce){.companion-help-float{animation:none}}

.community-visit-stage>.visit-bond-help{position:absolute;left:8px;bottom:8px;z-index:8;max-width:calc(100% - 16px);min-height:44px;padding:8px 12px;font-size:11px;box-shadow:0 2px 6px #201b3d88}.community-visit-stage>.visit-bond-help:disabled{opacity:.65}

/* Visit controls use the same in-scene expand affordance as Companion. */
.visit-expand {position:absolute;inset:auto 10px 10px auto;z-index:5;display:grid;place-items:center;width:48px;height:48px;min-width:48px;padding:8px;background:#241b39e8;color:#fff4ff;border:2px solid #c6abe7}
.visit-expand :is(svg,.companion-icon){width:24px;height:24px}
.visit-expanded .visit-expand{display:none}
.visit-expanded .visit-expand-close{z-index:6;top:max(8px,env(safe-area-inset-top,0px));right:max(8px,env(safe-area-inset-right,0px));min-height:48px;min-width:48px}
.community-visit-stage.visit-expanded{box-shadow:0 0 0 100vmax #15172cf5}
body:has(.visit-expanded){overflow:hidden}
.community-visit-stage ~ [role=status]:empty{display:none}

#tab-comunidad #communityOnlineRank .community-afk-row {
 display:grid;grid-template-columns:3rem 3.25rem minmax(0,1fr) auto;align-items:center;gap:.5rem;
 padding:.65rem;border-bottom:1px solid #554a68;
}
.community-afk-row .rank-companion img {width:100%;height:54px;object-fit:contain;image-rendering:pixelated}
.community-afk-row .community-rank-place {display:grid;justify-items:center}
.community-rank-place svg {width:25px;height:25px}
.community-rank-place[data-podium="1"] {color:#ffdb77!important}
.community-rank-place[data-podium="2"] {color:#cad5e6!important}
.community-rank-place[data-podium="3"] {color:#dfa576!important}
#communityOnlineRank .community-rank-score {display:inline-flex;align-items:center;gap:5px;color:#91ece3;font-size:1.25rem;font-weight:bold}
.community-rank-score svg {width:25px;height:25px;flex:none}
#tab-comunidad #communityOnlineRank .community-afk-row>button {grid-column:3/-1;justify-self:end}
@media(max-width:540px){
 #tab-comunidad #communityOnlineRank .community-afk-row {grid-template-columns:2.4rem 3rem minmax(0,1fr)}
 #communityOnlineRank .community-afk-row .community-rank-score {grid-column:3;margin:0;justify-self:start}
 #communityOnlineRank .rank-companion {grid-column:2;grid-row:1/3}
}

#houseVisitorLog .community-suggestions{list-style:none;padding-inline-start:0}
#houseVisitorLog .community-suggestions li{flex:none}
#houseVisitorLog .community-suggestion{width:8.5rem}
.recent-visitor-sprite{display:grid;place-items:center;height:4rem}
.recent-visitor-sprite svg{width:4rem;height:4rem}
#closeFriendVisit{background:#853340;color:white;border-color:#ff8596}

#houseVisitorLog li:has(.community-suggestion){width:10rem}
#houseVisitorLog .community-suggestion{box-sizing:border-box;display:grid;align-content:center;width:100%;height:9rem;padding:.5rem}
#houseVisitorLog .community-identity{display:grid;grid-template-columns:minmax(0,1fr);justify-items:center;gap:.25rem;min-width:0}
#houseVisitorLog .community-identity strong{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#houseVisitorLog .community-identity time{color:#9edfd9;font-size:.75rem;line-height:1.25;text-align:center}
