/* Courtyard scenery and companions use the 1536 x 1536 design plane. */
.home-town-home{min-width:0;display:grid;gap:8px}
.home-town-scene{position:relative;isolation:isolate;width:min(100%,640px);aspect-ratio:1;margin:0 auto;overflow:hidden;background:#152638;--town-sprite-size:40px}
.home-town-art{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none}
.home-town-label,.home-town-label-detail{display:block;color:#fff3d9;font-family:"Yu Mincho","Hiragino Mincho ProN",serif;text-shadow:1px 0 1px #101827,-1px 0 1px #101827,0 2px 3px #000,0 0 7px #000;line-height:1.25;white-space:nowrap;pointer-events:none}
.home-town-label{display:inline-block;padding:4px 8px;border:1px solid #efd49870;border-radius:7px;background:#172235b8;font-size:clamp(13px,3.7cqw,19px);font-weight:700}.home-town-label-detail{display:none}
.home-town-world{position:absolute;width:100%;aspect-ratio:1}
.home-town-heading{position:absolute;z-index:4;top:10px;left:0;width:100%;text-align:center;color:#fff3d9;text-shadow:1px 0 1px #101827,-1px 0 1px #101827,0 2px 4px #000,0 0 7px #000;pointer-events:none}
.home-town-heading span{display:block;font-family:"Yu Mincho",serif;font-size:11px;letter-spacing:2px}.home-town-heading strong{font-family:Georgia,serif;font-size:clamp(23px,6cqw,34px);letter-spacing:2px}
.home-town-facilities,.home-town-companions{position:absolute;inset:0;pointer-events:none}
.home-town-facilities{z-index:4}.home-town-companions{z-index:3}
.home-town-facility{position:absolute;width:clamp(80px,28%,124px);height:calc(var(--town-shop-size,64px) + 26px);min-width:44px;min-height:44px;transform:translate(-50%,-50%);padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;pointer-events:auto;cursor:pointer;touch-action:manipulation}
.home-town-facility:hover,.home-town-facility.active,.home-town-facility:active{background:transparent;box-shadow:none;transform:translate(-50%,-50%)}
.home-town-facility.expedition-locked{opacity:1;filter:none;cursor:not-allowed}.home-town-facility.expedition-locked::after{content:"帰還後に利用";position:absolute;left:50%;bottom:0;transform:translateX(-50%);color:#fff3d9;font-size:10px;white-space:nowrap;text-shadow:0 1px 3px #000,0 0 5px #000}
.home-town-facility:focus-visible{outline:2px solid #ffdf92;outline-offset:-3px;background:rgb(255 223 146 / 8%)}
.home-town-sr{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.home-town-walker{position:absolute;width:44px;height:44px;transform:translate(-50%,-100%);border:0;padding:0;background:none;box-shadow:none;pointer-events:auto;cursor:pointer;touch-action:manipulation}
.home-town-walker:hover,.home-town-walker:active{transform:translate(-50%,-100%);background:none;box-shadow:none}
.home-town-walker-ground{position:absolute;left:50%;bottom:0;width:var(--town-sprite-size);height:var(--town-sprite-size);transform:translateX(-50%);transform-origin:50% 100%;filter:drop-shadow(0 2px 1px #0008)}
.home-town-walker-ground::after{content:"";position:absolute;left:22%;right:22%;bottom:-1px;height:3px;z-index:-1;border-radius:50%;background:#111b2080}
.home-town-walker :is(img,svg.monster-companion-art){width:100%;height:100%;object-fit:contain;pointer-events:none;transform-origin:50% 85%;animation:home-town-breathe 2.4s ease-in-out infinite}
.home-town-walker.is-walking img{animation:home-town-steps .32s ease-in-out infinite alternate}
.home-town-walker:hover img,.home-town-walker:focus-visible img{animation-play-state:paused}
.home-town-walker:focus-visible{outline:2px solid #ffdf92;outline-offset:0;border-radius:4px}
.home-town-walker:hover::after,.home-town-walker:focus-visible::after{content:attr(data-town-name);position:absolute;bottom:calc(var(--town-sprite-size) + 3px);left:50%;transform:translateX(-50%);max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#fff0cf;font-size:10px;font-weight:600;text-shadow:1px 0 1px #101827,-1px 0 1px #101827,0 2px 4px #000,0 0 7px #000;pointer-events:none}
.home-town-home.is-paused .home-town-walker :is(img,svg.monster-companion-art){animation:none}
.home-town-walker.is-speaking .home-town-walker-ground{filter:drop-shadow(0 0 3px #ffe6a3) drop-shadow(0 2px 1px #0008)}
.home-town-walker.is-speaking::after{display:none}
.home-town-speech{position:absolute;z-index:6;width:min(250px,calc(100% - 16px));padding:6px 10px 10px;border:2px solid #aa8b54;border-radius:16px;background:linear-gradient(145deg,#23364af5,#101c2df7);color:#f7f0df;box-shadow:0 8px 24px #0006,inset 0 1px #ffffff12;backdrop-filter:blur(6px);font-family:"Yu Gothic","Hiragino Kaku Gothic ProN",sans-serif;pointer-events:none}
.home-town-speech[hidden]{display:none}
.home-town-speech>header>strong::before{content:"◆";margin-right:5px;font-size:8px;color:#b99a60}
.home-town-speech::after{position:absolute;left:var(--speech-tail-x,50%);bottom:-7px;width:10px;height:10px;border-right:2px solid #aa8b54;border-bottom:2px solid #aa8b54;transform:translateX(-50%) rotate(45deg);background:#19293b;content:""}
.home-town-speech[data-tail="top"]::after{top:-7px;bottom:auto;transform:translateX(-50%) rotate(225deg)}
.home-town-speech[data-tail="left"]::after{top:var(--speech-tail-y);bottom:auto;left:-7px;transform:translateY(-50%) rotate(135deg)}
.home-town-speech[data-tail="right"]::after{top:var(--speech-tail-y);bottom:auto;left:auto;right:-7px;transform:translateY(-50%) rotate(-45deg)}
.home-town-speech>header{display:flex;align-items:center;gap:2px;min-width:0;min-height:44px}
.home-town-speech>header>strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#efd19b;font-weight:700;letter-spacing:.04em}
.home-town-speech[data-controls-side="left"]>header{flex-direction:row-reverse}
.home-town-speech[data-controls-row="bottom"]{display:flex;flex-direction:column}.home-town-speech[data-controls-row="bottom"]>header{order:2}.home-town-speech[data-controls-row="bottom"]>p{order:1;margin:0 0 2px}
.home-town-speech>p{margin:2px 0 0;font-size:13px;line-height:1.55;overflow-wrap:anywhere}
.home-town-scene .home-town-speech button{min-width:44px;min-height:44px;flex-shrink:0;padding:4px;border:0;border-radius:6px;background:transparent;color:#ddd0b7;font-size:12px;box-shadow:none;pointer-events:auto;touch-action:manipulation}
.home-town-scene .home-town-speech button:hover,.home-town-scene .home-town-speech button:active{background:#59482f;transform:none}
.home-town-scene .home-town-speech button:focus-visible{outline:2px solid #f1ca82;outline-offset:-2px}
.home-town-speech:has([data-town-orb-reminder]:not([hidden])){display:flex;align-items:center;gap:4px;padding:4px}
.home-town-scene .home-town-speech [data-town-orb-reminder]{flex:1 1 0;min-width:0;text-align:left;color:inherit;font-size:var(--ga-font-note,.75rem);line-height:1.5;overflow-wrap:anywhere}
.home-town-home .home-town-scene .home-town-speech button:not(:disabled):is(:active,.button-pressing,.button-confirmed){transform:none;animation:none;background:#59482f}
.home-town-home .home-town-scene button.home-town-facility:not(:disabled):is(:active,.button-pressing,.button-confirmed){transform:translate(-50%,-50%);animation:none;filter:brightness(1.15);box-shadow:inset 0 0 0 2px #ffdf92,0 0 14px #ffdf9266;border:0;border-radius:10px;background:rgb(255 223 146 / 20%)}
.home-town-home .home-town-scene button.home-town-walker:not(:disabled):is(:active,.button-pressing,.button-confirmed){transform:translate(-50%,-100%);animation:none;filter:none;box-shadow:none;border:0;background:none}
.home-town-home .home-town-scene button:is(.home-town-facility,.home-town-walker).button-confirmed::after{animation:none}
.home-town-location{position:absolute;bottom:84px;left:5%;width:90%;z-index:4;text-align:center;pointer-events:none;color:#fff3d9;text-shadow:1px 0 1px #101827,-1px 0 1px #101827,0 2px 4px #000,0 0 7px #000}
.home-town-location h2{margin:0;font-family:"Yu Mincho",serif;font-size:clamp(18px,4.6vw,31px);font-weight:500;line-height:1.35;overflow-wrap:anywhere}
.home-town-departure{position:absolute;bottom:16px;left:10%;width:80%;min-height:52px;z-index:4;display:grid;grid-template-columns:32px minmax(0,1fr) 16px;align-items:center;gap:6px;padding:8px 14px;border:2px solid #e6c270;border-radius:12px 3px 12px 3px;background:linear-gradient(120deg,#b47b2b,#dfb75e 35%,#b78031 80%,#d6af5b);color:#fff9e9;box-shadow:0 0 0 3px #122131,0 0 0 4px #d1b477,0 4px 13px #0009,inset 0 0 0 1px #f5e0a3;text-shadow:0 2px 3px #563414}
.home-town-departure img{width:32px;height:32px;object-fit:contain}.home-town-departure strong{font-family:"Yu Mincho",serif;font-size:clamp(18px,5.2vw,29px);font-weight:600;line-height:1.2;overflow-wrap:anywhere}.home-town-departure>span{font-size:29px}.home-town-departure:hover{filter:brightness(1.1)}
.home-town-detail{margin:0;text-align:center;font-size:.8125rem;line-height:1.6;color:var(--muted)}
.home-town-tools{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}.home-town-tools button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;min-width:130px;padding:6px 10px;font-size:.8125rem;border:1px solid var(--line);border-radius:5px;background:var(--surface);color:var(--text)}.home-town-tools img{width:22px;height:22px;object-fit:contain}
.home-town-hint{margin:0;text-align:center;font-size:.75rem;line-height:1.5;color:var(--muted)}
.home-town-appearance{min-width:0;padding:0;border:1px solid var(--line);border-radius:6px;overflow:hidden;background:var(--surface)}.home-town-appearance>summary{min-height:44px;padding:12px;font-size:.8125rem;cursor:pointer}
.home-screen .home-town-appearance .home-party-stage{width:100%;margin:0;height:260px;--party-offset:clamp(82px,22vw,160px)}
.home-screen .home-town-appearance .home-party-member{width:clamp(105px,22vw,200px);height:190px}
.home-screen .home-town-appearance .profile-background-trigger{min-height:44px;min-width:90px;font-size:.8125rem;opacity:1}
.home-screen .home-town-appearance .profile-background-trigger strong{font-size:.8125rem}
@keyframes home-town-steps{from{transform:translateY(0) rotate(-3deg)}to{transform:translateY(-2px) rotate(3deg)}}
@keyframes home-town-breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.015)}}
@media(max-width:700px){.home-town-scene{width:calc(100% + 24px);max-width:none;margin-left:-12px;margin-right:-12px;--town-sprite-size:clamp(30px,9vw,40px)}.home-screen .home-town-appearance .home-party-stage{width:100%;margin:0}.home-town-location h2{font-size:clamp(18px,5vw,25px)}}
@media(prefers-reduced-motion:reduce){.home-town-walker :is(img,svg.monster-companion-art){animation:none!important}}

/* Fit all eight shops and the departure control into the current viewport. */
html:has(.home-town-screen),body:has(.home-town-screen){overflow:hidden;overscroll-behavior:none}
body:has(.home-town-screen) main{height:calc(100dvh - var(--app-header-height) - 49px);padding:0;overflow:hidden;container-type:size}
.home-town-screen{height:100%;min-height:0;position:relative;display:grid;place-items:center;gap:0}
.home-town-screen{grid-template-rows:minmax(0,1fr)}
body:has(.home-town-screen) main:has(>.tutorial-guide-compact){display:flex;flex-direction:column;overflow-y:auto;overscroll-behavior:contain}
body:has(.home-town-screen) main>.tutorial-guide-compact{flex:0 0 auto}
body:has(.home-town-screen) main:has(>.tutorial-guide-compact)>.home-town-screen{flex:1 1 0;width:100%;min-height:0}
.home-screen:has(>.home-law-gate){position:relative}
.home-screen>.home-law-gate{position:absolute;z-index:5;top:12px;right:12px;left:auto;display:grid;grid-template-columns:1fr;place-items:center;width:52px;min-width:52px;height:52px;min-height:52px;margin:0;padding:0;gap:0;border:0;border-radius:8px;background:transparent;box-shadow:none;touch-action:manipulation}
.home-screen>.home-law-gate::before,.home-screen>.home-law-gate::after{display:none}
.home-screen>.home-law-gate .home-law-gate-mark{width:44px;height:44px;border:0;background:transparent;box-shadow:none}
.home-screen>.home-law-gate .home-law-gate-mark::before{display:none}
.home-screen>.home-law-gate .home-law-gate-icon{width:44px;height:44px}
.home-screen>.home-law-gate:focus-visible{outline:2px solid #dfbdcf;outline-offset:2px}
.home-town-screen .home-town-heading{top:12px}
.home-town-screen .home-town-home{width:100%;height:100%;min-height:0;display:grid;place-items:center;gap:0}
.home-town-screen .home-town-scene{width:min(100%,640px);height:100%;aspect-ratio:auto;margin:0;--town-sprite-size:clamp(22px,6cqw,30px)}
.home-town-screen>.home-alert{position:absolute;left:8px;right:72px;top:4px;z-index:5;margin:0;padding:4px 5px;border-radius:4px;text-align:center;background:#121827d9;font-size:.6rem;line-height:1.3;pointer-events:none}
body:has(.home-town-screen).app-update-available main{height:calc(100dvh - var(--app-header-height) - 49px - var(--app-update-flow-space))}
@media(max-width:700px){
 body:has(.home-town-screen){
  display:flex;
  flex-direction:column;
  height:100dvh;
  min-height:0;
  padding-bottom:var(--mobile-navigation-height);
  overflow:clip;
 }
 body:has(.home-town-screen)>:is(.site-header,.pwa-install-banner,.update-prompt){flex:none}
 body:has(.home-town-screen) #app{flex:1 1 0;height:auto;min-height:0;width:100%;padding:0}
 .home-town-screen .home-town-scene{width:100%;height:100%;margin:0}
}

/* Scene choices share the same design plane and walkable geometry. */
.home-town-background-dialog{box-sizing:border-box;width:min(440px,calc(100% - 24px));max-height:calc(100dvh - 32px);margin:auto;padding:16px;border:1px solid #a58a54;border-radius:16px;background:linear-gradient(150deg,#203247,#111d2b);color:#f7f0df;box-shadow:0 16px 60px #0009;overflow:auto;overscroll-behavior:contain}
.home-town-background-dialog::backdrop{background:#030a13b8;backdrop-filter:blur(3px)}
.home-town-background-dialog>header{display:flex;align-items:center;justify-content:space-between;gap:12px}.home-town-background-dialog header small{font-size:9px;letter-spacing:.15em;color:#d0b783}.home-town-background-dialog h2{margin:4px 0 0;font-size:18px;color:#f7e4b6}.home-town-background-dialog>p{margin:12px 0;font-size:12px;line-height:1.6;color:#c4ccd6}
.home-town-background-dialog header button{min-width:44px;min-height:44px;padding:0;border:1px solid #b79a6066;border-radius:10px;background:#18283b;color:#f3ddb0;font-size:18px;touch-action:manipulation}
.home-town-background-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.home-town-background-grid>button{position:relative;display:flex;flex-direction:column;min-width:0;padding:0 0 9px;overflow:hidden;border:2px solid #3a4b60;border-radius:10px;background:#142335;color:#f7f0df;text-align:left;touch-action:manipulation;box-shadow:none}
.home-town-background-grid img{display:block;width:100%;height:auto;aspect-ratio:1;object-fit:cover;border-radius:0}.home-town-background-grid strong{padding:8px 8px 0;font-size:13px}.home-town-background-grid span{padding:4px 8px 0;font-size:11px;line-height:1.4;color:#bac6d7}.home-town-background-grid em{position:absolute;right:6px;top:6px;padding:3px 7px;border-radius:20px;background:#0e1c2de8;color:#f1d291;font-size:10px;font-style:normal}
.home-town-background-grid>button[aria-pressed="true"]{border-color:#dfbf78}.home-town-background-grid>button:hover{border-color:#b89c64}.home-town-background-dialog button:focus-visible{outline:2px solid #f1ca82;outline-offset:-4px}

.home-town-scene{overflow:clip}.home-town-world{aspect-ratio:auto;touch-action:manipulation;user-select:none}
@media(min-width:701px){
 body:has(.home-town-screen) .global-chat{top:calc(var(--app-header-height) + 96px);right:0;bottom:auto;left:auto;width:32px}
 body:has(.home-town-screen) .chat-peek{position:relative;display:grid;grid-template-columns:1fr;place-items:center;width:32px;height:64px;min-height:64px;padding:0;border:1px solid rgb(192 164 102 / 55%);border-right:0;border-radius:10px 0 0 10px}
 body:has(.home-town-screen) :is(.chat-peek-channel,.chat-preview){display:none}
 body:has(.home-town-screen) .chat-peek-arrow{font-size:1.35rem}
 body:has(.home-town-screen).chat-open .chat-peek{visibility:hidden;pointer-events:none}
}

.settings-section .home-town-background-grid{width:100%;max-width:440px}.settings-section .home-town-background-grid button{min-height:44px}

/* Buildings are independent, uniformly sized icons above the open plaza. */
.home-town-art{object-fit:cover}
.home-town-facility{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:2px;transform:translate(-50%,-18px)}
.home-town-facility:is(:hover,:active,.active){transform:translate(-50%,-18px)}
.home-town-label{font-size:clamp(12px,3.3cqw,18px);padding:3px 7px;line-height:1.25}
.home-town-shop{display:block;flex:0 0 auto;width:var(--town-shop-size,64px);height:var(--town-shop-size,64px);object-fit:contain;pointer-events:none;filter:drop-shadow(0 3px 2px #16223665)}
.home-town-home .home-town-scene button.home-town-facility:not(:disabled):is(:active,.button-pressing,.button-confirmed){transform:translate(-50%,-18px)}
.home-town-home[data-background="evening"] .home-town-shop{filter:brightness(.85) saturate(1.08) drop-shadow(0 3px 2px #07122490)}
.home-town-home[data-background="snow"] .home-town-shop{filter:saturate(.88) drop-shadow(0 3px 2px #46658765)}
.home-town-location{left:28%;width:44%}
.home-town-location h2{font-size:clamp(14px,3.6cqw,20px)}

/* A companion courtyard above a fixed facility panel and the next journey. */
.home-town-screen .home-town-home{max-width:640px;grid-template-rows:minmax(0,1fr) auto auto;place-items:stretch;background:linear-gradient(145deg,#203346,#111c2b)}
.home-town-screen .home-town-scene{min-height:0;width:100%;--town-sprite-size:clamp(24px,7cqw,32px);border-bottom:1px solid #b7a06b70}
.home-town-art{object-position:50% 76%}
.home-town-facilities{position:relative;inset:auto;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;padding:12px 12px 8px;pointer-events:auto;background:linear-gradient(#1d2d3eee,#172637);border-top:1px solid #ffffff0e}
.home-town-home button.home-town-facility{position:relative;inset:auto;display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:clamp(76px,14cqh,110px);min-width:0;min-height:44px;gap:3px;padding:5px 2px;border:1px solid #a98e574d;border-radius:10px;transform:none;background:linear-gradient(145deg,#314358,#1a2a3b);box-shadow:inset 0 1px 0 #ffffff0a;transition:background .15s,filter .15s,border-color .15s}
.home-town-home .home-town-facility .home-town-shop{width:clamp(40px,10cqw,64px);height:clamp(40px,10cqw,64px);filter:drop-shadow(0 2px 2px #080f1d80)}
.home-town-home .home-town-label{display:block;max-width:100%;padding:0;border:0;border-radius:0;background:none;font-size:clamp(11px,3.1cqw,16px);font-family:"Yu Gothic","Hiragino Kaku Gothic ProN",sans-serif;line-height:1.25;text-shadow:0 1px 2px #0008}
.home-town-home button.home-town-facility:is(:hover,:active,.active){transform:none;background:linear-gradient(145deg,#3c5369,#26394c);border-color:#d0af6d}
.home-town-home button.home-town-facility:not(:disabled):is(:active,.button-pressing,.button-confirmed){transform:none;animation:none;filter:brightness(1.12);border-color:#ffe0a1;box-shadow:inset 0 0 0 1px #ffdf9266,0 0 12px #ffdf9233;background:linear-gradient(145deg,#435b70,#2b4054)}
.home-town-home button.home-town-facility.button-confirmed::after{animation:none}
.home-town-home .home-town-facility.expedition-locked::after{left:0;bottom:2px;width:100%;transform:none;font-size:9px;text-align:center}
.home-town-home .home-town-facility.expedition-locked{padding-bottom:14px}
.home-town-journey{display:grid;gap:8px;padding:4px 16px 12px;background:linear-gradient(#172637,#101b2a)}
.home-town-location{position:static;inset:auto;width:100%;text-shadow:none;color:#d4c6a8}
.home-town-location h2{font-family:"Yu Gothic","Hiragino Kaku Gothic ProN",sans-serif;font-size:clamp(12px,3.3cqw,17px);line-height:1.5}
.home-town-departure{position:relative;inset:auto;width:100%;min-height:54px;margin:0;box-shadow:0 0 0 2px #122131,0 0 0 3px #d1b477,inset 0 0 0 1px #f5e0a3}
.home-town-walker[data-town-party-index] .home-town-walker-ground{width:clamp(52px,16cqw,78px);height:clamp(52px,16cqw,78px)}
.home-town-walker[data-town-party-index]{width:clamp(52px,16cqw,78px);height:clamp(52px,16cqw,78px);overflow:visible}
.home-town-member-name{position:absolute;top:calc(100% + 3px);left:50%;transform:translateX(-50%);max-width:calc(23cqw);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 5px;border-radius:4px;background:#172637b8;color:#fff1d3;font-size:clamp(10px,2.8cqw,13px);line-height:1.25;pointer-events:none}
.home-town-walker[data-town-party-index]:is(:hover,:focus-visible)::after{display:none}
@media(max-height:600px){.home-town-home button.home-town-facility{height:70px}.home-town-home .home-town-facility .home-town-shop{width:38px;height:38px}.home-town-facilities{padding:8px 10px 6px;gap:6px}.home-town-journey{gap:4px;padding:2px 14px 9px}.home-town-departure{min-height:48px}.home-town-walker[data-town-party-index],.home-town-walker[data-town-party-index] .home-town-walker-ground{width:52px;height:52px}}

/* Sanctuary home: facilities above the party, with journey controls below. */
.home-town-screen .home-town-home{display:grid;grid-template-areas:"facilities" "party" "location" "journey";grid-template-rows:auto minmax(0,1fr) auto auto;place-items:stretch;gap:8px;padding:10px;position:relative;max-width:640px;isolation:isolate;container-type:inline-size;background:#101626}
.home-town-screen .home-town-scene{position:absolute;inset:0;width:100%;height:100%;border:0}
.home-town-art{object-fit:cover;object-position:50% 50%}
.home-town-home::after{content:"";position:absolute;inset:0;z-index:2;pointer-events:none;background:linear-gradient(90deg,#070c2080,transparent 26%,transparent 74%,#070c2080),linear-gradient(0deg,#080d21ef,transparent 28%)}
.home-town-home .home-town-facilities{grid-area:facilities;position:relative;z-index:4;inset:auto;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,auto);align-items:center;gap:4px 6px;padding:4px;border:0;border-bottom:1px solid #cdbb9133;border-radius:10px;background:linear-gradient(180deg,#0d142bd9,#0d142b70);pointer-events:auto}
.home-town-home button.home-town-facility{position:relative;inset:auto;display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:72px;min-width:44px;min-height:44px;gap:4px;padding:2px;border:0;border-radius:10px;transform:none;background:none;box-shadow:none;pointer-events:auto;overflow:visible}
.home-town-facility-medallion{display:grid;place-items:center;flex:0 0 auto;width:44px;height:44px;border:1px solid #cdbb91;border-radius:50%;background:radial-gradient(circle at 40% 30%,#354158ee,#101729f5);box-shadow:0 0 0 2px #0d1729,0 0 0 3px #cdbb9166,0 4px 12px #0008,inset 0 0 12px #64719e33}
.home-town-home .home-town-facility .home-town-shop{width:32px;height:32px;object-fit:contain;filter:drop-shadow(0 2px 2px #0009)}
.home-town-home .home-town-label{padding:0;border:0;background:none;font-size:12px;line-height:1.3;font-family:"Yu Mincho","Hiragino Mincho ProN",serif;color:#f8efdf;text-shadow:0 2px 4px #000,0 0 6px #000}
.home-town-home button.home-town-facility:is(:hover,:active,.active){transform:none;background:#b4c3ff0d;border:0;box-shadow:none}
.home-town-home button.home-town-facility:not(:disabled):is(:active,.button-pressing,.button-confirmed){transform:none;animation:none;filter:brightness(1.22);border:0;background:#e5c98d1c;box-shadow:0 0 16px #d5b87b44}
.home-town-home button.home-town-facility.button-confirmed::after{animation:none}
.home-town-home .home-town-facility.expedition-locked::after{bottom:0;font-size:9px}
.home-town-home .home-town-facility.expedition-locked{padding-bottom:12px}
.home-town-home .home-town-walker[data-town-party-index],.home-town-home .home-town-walker[data-town-party-index] .home-town-walker-ground{width:clamp(100px,34cqw,190px);height:clamp(100px,34cqw,190px)}
.home-town-home .home-town-walker[data-town-featured="true"],.home-town-home .home-town-walker[data-town-featured="true"] .home-town-walker-ground{width:clamp(120px,42cqw,230px);height:clamp(120px,42cqw,230px)}
.home-town-home .home-town-member-name{font-size:11px;background:#0d132bcc;border:1px solid #baae8c55;max-width:24cqw}
.home-town-home .home-town-location{grid-area:location;position:relative;z-index:4;inset:auto;width:100%;transform:none;color:#e6ddc9;text-shadow:0 2px 4px #000}
.home-town-home .home-town-location h2{font-size:13px;line-height:1.5}
.home-town-home>.home-sanctuary-party{grid-area:party;--party-offset:22cqw;position:relative;z-index:3;inset:auto;width:100%;height:100%;min-height:0;margin:0;overflow:hidden;border:0;border-radius:0;background:none;box-shadow:none;perspective:900px;touch-action:pan-y}
.home-town-home>.home-sanctuary-party::before,.home-town-home>.home-sanctuary-party::after,.home-town-home>.home-sanctuary-party>.equipment-party-background,.home-town-home>.home-sanctuary-party>.profile-background-trigger{display:none}
.home-town-home>.home-sanctuary-party .home-party-member{bottom:56px;width:48%;height:calc(100% - 56px);display:block;transition:transform 440ms cubic-bezier(.22,.72,.25,1),opacity 440ms ease,filter 440ms ease}
.home-town-home>.home-sanctuary-party .home-party-member .actor-image{width:100%;height:100%;max-width:none;max-height:none;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 6px 8px #05091799)}
.home-town-home>.home-sanctuary-party .home-party-member::after{display:none}
.home-town-home>.home-sanctuary-party .home-party-member.position-center{--party-transform:translateX(-50%) scale(1);opacity:1;filter:none}
.home-town-home>.home-sanctuary-party .home-party-member.position-left{--party-transform:translateX(calc(-50% - var(--party-offset))) translateY(-8px) rotateY(8deg) scale(.8);opacity:1;filter:brightness(.92)}
.home-town-home>.home-sanctuary-party .home-party-member.position-right{--party-transform:translateX(calc(-50% + var(--party-offset))) translateY(-8px) rotateY(-8deg) scale(.8);opacity:1;filter:brightness(.92)}
.home-town-home>.home-sanctuary-party .home-party-caption{right:52px;left:52px;bottom:0;width:auto;height:44px;min-height:44px;overflow:visible;clip-path:none;display:flex;flex-wrap:wrap;align-content:center;gap:2px 7px;padding:3px 6px;border-radius:6px;background:#0d1424b8;text-align:center;pointer-events:none}
.home-town-home>.home-sanctuary-party .home-party-caption small{position:static;flex-basis:100%;font-size:9px}
.home-town-home>.home-sanctuary-party .home-party-arrow{top:auto;bottom:0;width:44px;height:44px;min-height:44px;min-width:44px;font-size:24px;background:#0d1424a8}
.home-town-home>.home-sanctuary-party .home-party-arrow-left{left:0}.home-town-home>.home-sanctuary-party .home-party-arrow-right{right:0}
@media(prefers-reduced-motion:reduce){.home-town-home>.home-sanctuary-party .home-party-member{transition:none}}
.home-town-home .home-town-journey{grid-area:journey;position:relative;z-index:4;inset:auto;display:grid;grid-template-columns:minmax(0,1fr);gap:8px;padding:0;background:none}
.home-town-home .home-town-journey>button{position:relative;inset:auto;display:grid;grid-template-columns:36px minmax(0,1fr) 8px;align-items:center;gap:7px;width:100%;height:68px;min-width:0;min-height:44px;margin:0;padding:8px;border:1px solid #b7a57c;border-radius:10px 3px 10px 3px;background:linear-gradient(135deg,#26314cf2,#0e1628f5);box-shadow:0 0 0 2px #080d1a,0 5px 15px #0007,inset 0 0 0 2px #b7a57c20;color:#f8efd9;text-shadow:0 1px 2px #000}
.home-town-home .home-town-journey>.home-town-departure{border-color:#d2b876;background:linear-gradient(135deg,#605036ee,#24273df5)}
.home-town-home .home-town-journey>.home-law-gate{height:48px;grid-template-columns:26px minmax(0,1fr) 8px;border-color:#b7a57c70;background:linear-gradient(135deg,#1b243be6,#0e1628ed);box-shadow:inset 0 0 0 1px #b7a57c10}
.home-town-home .home-town-journey>.home-law-gate>img{width:26px;height:26px}
.home-town-home .home-law-gate .home-sanctuary-card-copy{grid-template-columns:auto minmax(0,1fr);align-items:center;gap:1px 8px}
.home-town-home .home-law-gate .home-sanctuary-card-copy strong{font-size:14px}
.home-town-home .home-law-gate .home-sanctuary-card-copy em{grid-column:1 / -1}
.home-town-home .home-town-journey>button>img{width:36px;height:36px;object-fit:contain}
.home-town-home .home-town-journey>button::before,.home-town-home .home-town-journey>.home-law-gate::after{display:none}
.home-town-home .home-town-journey>button>span:last-child{font-size:22px}
.home-sanctuary-card-copy{display:grid;gap:4px;min-width:0;text-align:left}
.home-town-home .home-sanctuary-card-copy small{font-size:9px;color:#d4c6a8;white-space:nowrap}
.home-town-home .home-sanctuary-card-copy strong{font-family:"Yu Mincho","Hiragino Mincho ProN",serif;font-size:clamp(13px,3.6cqw,19px);font-weight:700;line-height:1.25;overflow-wrap:anywhere}
.home-town-home .home-sanctuary-card-copy em{font-size:9px;font-style:normal;color:#c8c8d8;line-height:1.3}
.home-town-home .home-law-gate.is-open{border-color:#bda5e4;box-shadow:0 0 0 2px #080d1a,0 0 16px #ae88ff35}
.home-town-screen:has(>.home-alert){grid-template-rows:auto minmax(0,1fr)}
.home-town-screen>.home-alert{position:relative;inset:auto;width:100%;max-width:640px;padding:6px}
@media(max-height:650px){
 .home-town-screen .home-town-home{gap:6px;padding:8px}
 .home-town-home button.home-town-facility{height:60px;gap:3px}
 .home-town-facility-medallion{width:34px;height:34px}
 .home-town-home .home-town-facility .home-town-shop{width:26px;height:26px}
 .home-town-home .home-town-label{font-size:11px}
 .home-town-home .home-town-journey{gap:6px}
 .home-town-home .home-town-journey>button{grid-template-columns:28px minmax(0,1fr) 7px;gap:5px;padding:6px}
 .home-town-home .home-town-journey>button>img{width:28px;height:28px}
 .home-town-home .home-sanctuary-card-copy small,.home-town-home .home-sanctuary-card-copy em{font-size:8px}
}

@media(max-height:480px){
 body:has(.home-town-screen) main{overflow-y:auto}
 .home-town-screen{height:auto;min-height:100%}
 .home-town-screen .home-town-home{height:auto;min-height:480px;grid-template-rows:auto minmax(170px,1fr) auto auto}
}

/* New sanctuary landscapes keep all three party members on the floor on short screens. */
@media(max-height:650px){.home-town-home:is([data-background="stone"],[data-background="evening"],[data-background="snow"],[data-background="garden"]) .home-town-art{object-position:50% 85%}}

/* Street home: scenery, facility signs, small companions and one primary departure. */
.home-town-screen .home-town-home[data-layout="street"]{display:block;position:relative;isolation:isolate;width:100%;max-width:480px;height:100%;min-height:0;padding:0;gap:0;container-type:size;overflow:clip;background:#101626}
.home-town-home[data-layout="street"] .home-town-scene{inset:0;aspect-ratio:auto;max-width:none}
.home-town-home[data-layout="street"] .home-town-art{object-position:50% 50%}
.home-town-home[data-layout="street"]::after{background:linear-gradient(180deg,#08142b44,transparent 24%,transparent 73%,#030b20d9),linear-gradient(90deg,#07101b50,transparent 29%,transparent 71%,#07101b50)}
.home-town-brand{position:absolute;z-index:3;left:4.6%;top:3.2%;text-align:center;text-shadow:0 2px 6px #000c;pointer-events:none}
.home-town-brand strong{font:small-caps clamp(23px,7cqw,33px) Georgia,serif;letter-spacing:1.8px;color:#fff0d7}
.home-town-brand>span{display:block;font-family:"Yu Mincho",serif;font-size:9px;letter-spacing:3px;margin-top:3px}
.home-town-brand p{font-family:"Yu Mincho",serif;font-size:10px;letter-spacing:3px;margin-top:13px}
.home-town-home[data-layout="street"] .home-town-location{position:absolute;grid-area:auto;z-index:3;inset:0 4.6% auto auto;width:clamp(57px,16cqw,76px);height:clamp(112px,18cqh,139px);display:flex;flex-direction:column;align-items:center;padding:6px 5px 22px;border:1px solid #d3b270;background:linear-gradient(90deg,#11213cef,#192a47ec,#11213cef);clip-path:polygon(0 0,100% 0,100% 84%,50% 100%,0 84%);pointer-events:none}
.home-town-home[data-layout="street"] .home-town-location>span{font:35px/40px Georgia,serif;color:#bc985b}
.home-town-home[data-layout="street"] .home-town-location h2{font-family:"Yu Mincho",serif;font-size:12px;font-weight:500;line-height:1.55;text-align:center;white-space:normal;margin:3px 0}
.home-town-location>small{font:8px "Yu Mincho",serif;color:#d6c7a4;white-space:nowrap}
.home-town-portal{position:absolute;z-index:3;top:33%;left:50%;transform:translateX(-50%);width:36%;text-align:center;font-family:"Yu Mincho",serif;color:#fff2d9;text-shadow:0 2px 7px #031343,0 0 12px #0089ff;pointer-events:none}
.home-town-portal strong{font-size:clamp(17px,5.4cqw,26px);font-weight:500;line-height:1.3;overflow-wrap:anywhere}
.home-town-portal small{display:block;font-size:9px;margin-top:5px;letter-spacing:1px}
.home-town-portal>span{display:block;font:35px/17px Georgia,serif;color:#ffeab4;margin-top:25px}
.home-town-home[data-layout="street"] .home-town-facilities{position:absolute;grid-area:auto;inset:0;z-index:4;display:block;gap:0;padding:0;border:0;border-radius:0;background:none;pointer-events:none}
.home-town-home[data-layout="street"] button.home-town-facility{position:absolute;inset:auto;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;width:32%;max-width:153px;height:48px;min-height:44px;gap:0;padding:4px 0;border:0;border-radius:4px;background:none;box-shadow:none;transform:none;pointer-events:auto}
.home-town-home[data-layout="street"] button.town-side-left{left:2%}
.home-town-home[data-layout="street"] button.town-side-right{right:2%;flex-direction:row-reverse;text-align:right}
.home-town-home[data-layout="street"] button.town-row-1{top:24%}.home-town-home[data-layout="street"] button.town-row-2{top:37.5%}.home-town-home[data-layout="street"] button.town-row-3{top:51%}.home-town-home[data-layout="street"] button.town-row-4{top:60.5%}
.home-town-home[data-layout="street"] .home-town-facility-medallion{flex:0 0 clamp(34px,9.7cqw,44px);width:clamp(34px,9.7cqw,44px);height:clamp(34px,9.7cqw,44px);border-color:#e4c586;box-shadow:0 0 0 2px #111624,0 0 0 3px #987c49,0 4px 10px #0009;z-index:1}
.home-town-home[data-layout="street"] .home-town-facility .home-town-shop{width:clamp(26px,7.2cqw,32px);height:clamp(26px,7.2cqw,32px)}
.home-town-sign{display:block;flex:1;min-width:0;padding:5px 3px 5px 7px;background:linear-gradient(90deg,#0b152df0,#0b152dc7,transparent);border-radius:0 4px 4px 0}
.town-side-right .home-town-sign{padding:5px 7px 5px 3px;background:linear-gradient(-90deg,#0b152df0,#0b152dc7,transparent);border-radius:4px 0 0 4px}
.home-town-home[data-layout="street"] .home-town-label{font-size:clamp(12px,3.5cqw,16px);line-height:1.3;font-weight:500;white-space:nowrap}
.home-town-home[data-layout="street"] .home-town-label-detail{display:block;font-size:clamp(7px,2.05cqw,10px);line-height:1.4;margin-top:3px;color:#eee6d4;white-space:nowrap}
.home-town-home[data-layout="street"] button.home-town-facility:is(:hover,:active,.active){background:#b4c3ff0d;transform:none;border:0}
.home-town-home[data-layout="street"] .home-town-facility.expedition-locked::after{bottom:-7px;font-size:8px}
.home-town-home[data-layout="street"]>.home-sanctuary-party{position:absolute;grid-area:auto;left:50%;bottom:22.8%;transform:translateX(-50%);--party-offset:18cqw;width:58%;height:clamp(105px,15cqh,120px);min-height:0;z-index:3;overflow:visible;perspective:none}
.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-member{bottom:28px;width:35%;height:calc(100% - 28px);padding:0;min-width:44px;min-height:44px}
.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-member .actor-image{filter:drop-shadow(0 3px 2px #080c2270)}
.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-member.position-center{--party-transform:translateX(-50%) translateY(6px) scale(1)}
.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-member.position-left{--party-transform:translateX(calc(-50% - var(--party-offset))) scale(.85);opacity:1;filter:none}
.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-member.position-right{--party-transform:translateX(calc(-50% + var(--party-offset))) scale(.85);opacity:1;filter:none}
.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-caption{bottom:0;right:24px;left:24px;height:23px;min-height:23px;gap:0;padding:2px 4px;border:1px solid #beab7444;border-radius:12px;background:#0c15299c;pointer-events:none}
.home-town-home[data-layout="street"] .home-party-name{font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.home-town-home[data-layout="street"] .home-party-caption :is(small,.home-party-role){display:none}
.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-arrow{top:auto;bottom:21px;height:44px;width:28px;min-width:28px;z-index:5;font-size:22px;background:#0c152933}
.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-arrow-left{left:-30px}.home-town-home[data-layout="street"]>.home-sanctuary-party .home-party-arrow-right{right:-30px}
.home-town-home[data-layout="street"] .home-town-journey{position:absolute;grid-area:auto;z-index:4;inset:0;display:block;padding:0;background:none;pointer-events:none}
.home-town-home[data-layout="street"] .home-town-journey>button{position:absolute;pointer-events:auto;min-width:0}
.home-town-home[data-layout="street"] .home-town-journey>.home-town-departure{left:50%;bottom:9%;transform:translateX(-50%);width:86%;min-height:76px;padding:8px 12px;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse at 50% 5%,#367ee2,#11377f 57%,#091934);border:2px solid #e4c886;outline:1px solid #604b2e;outline-offset:3px;border-radius:45% 45% 38% 38% / 16% 16% 18% 18%;box-shadow:0 0 0 6px #091b3bcc,inset 0 0 0 2px #977c4b,inset 0 -8px 15px #04103c,0 5px 24px #02091de6;text-shadow:0 2px 4px #001441;overflow:visible;gap:0}
.home-town-home[data-layout="street"] .home-town-departure::after{content:"✧";position:absolute;top:-24px;left:50%;transform:translateX(-50%);font-size:35px;color:#ffe5a7;text-shadow:0 0 10px #ffd372;pointer-events:none;animation:none}
.home-town-home[data-layout="street"] .home-town-departure :is(img,span:last-child:not(.home-sanctuary-card-copy)){display:none}
.home-town-home[data-layout="street"] .home-town-departure .home-sanctuary-card-copy{display:grid;justify-items:center;text-align:center;gap:3px;width:100%}
.home-town-home[data-layout="street"] .home-town-departure .home-sanctuary-card-copy strong{font-size:clamp(23px,7cqw,33px);line-height:1.15;color:#fff5e0;overflow-wrap:anywhere}
.home-town-home[data-layout="street"] .home-town-departure small{font-size:8px;letter-spacing:2px;color:#d4e3fd}
.home-town-home[data-layout="street"] .home-town-departure em{font-size:11px;letter-spacing:3px;color:#dcecff}
.home-town-home[data-layout="street"] .home-town-journey>.home-town-departure:not(:disabled):is(:active,.button-pressing,.button-confirmed){transform:translateX(-50%);animation:none;filter:brightness(1.15)}
.home-town-home[data-layout="street"] .home-town-journey>.home-law-gate{right:2.5%;bottom:1.5%;display:grid;grid-template-columns:34px minmax(0,1fr) 8px;gap:7px;min-height:39px;max-width:53%;padding:3px 8px 3px 4px;border:1px solid #ab9264;border-radius:4px;background:linear-gradient(105deg,#20133dea,#101931e8);box-shadow:none}
.home-town-home[data-layout="street"] .home-law-gate>img{width:34px;height:32px;object-fit:contain}
.home-town-home[data-layout="street"] .home-law-gate .home-sanctuary-card-copy{gap:2px}
.home-town-home[data-layout="street"] .home-law-gate strong{font-size:12px}.home-town-home[data-layout="street"] .home-law-gate small{font-size:8px}.home-town-home[data-layout="street"] .home-law-gate em{font-size:8px}.home-town-home[data-layout="street"] .home-law-gate>span:last-child{font-size:18px}
@media(max-height:680px){
 .home-town-home[data-layout="street"] .home-town-brand{top:2%}.home-town-brand strong{font-size:23px}.home-town-brand p{margin-top:7px}
 .home-town-home[data-layout="street"] .home-town-location{height:104px;padding-top:2px}.home-town-home[data-layout="street"] .home-town-location>span{font-size:28px;line-height:31px}
 .home-town-home[data-layout="street"] button.town-row-1{top:18%}.home-town-home[data-layout="street"] button.town-row-2{top:28%}.home-town-home[data-layout="street"] button.town-row-3{top:38%}.home-town-home[data-layout="street"] button.town-row-4{top:48%}
 .home-town-home[data-layout="street"]>.home-sanctuary-party{bottom:24%;height:105px;width:55%}
 .home-town-home[data-layout="street"] .home-town-journey>.home-town-departure{bottom:10%;min-height:64px}.home-town-home[data-layout="street"] .home-town-departure small{display:none}
 .home-town-home[data-layout="street"] .home-town-portal{top:30%}.home-town-home[data-layout="street"] .home-town-portal>span{margin-top:15px}
 .home-town-home[data-layout="street"] .home-town-journey>.home-law-gate{bottom:1%;min-height:36px}.home-town-home[data-layout="street"] .home-law-gate em{display:none}
}
@media(max-height:480px){.home-town-screen .home-town-home[data-layout="street"]{height:520px;min-height:520px;grid-template-rows:none}}
@media(prefers-reduced-motion:reduce){.home-town-home[data-layout="street"] .home-party-member{transition:none}}
/* Keep the existing chat entrance clear of the right-hand facilities on short phones. */
body:has(.home-town-home[data-layout="street"]) .global-chat{top:calc(var(--app-header-height) + 14px);bottom:auto;right:0;left:auto;width:32px}
body:has(.home-town-home[data-layout="street"]) .chat-peek{height:44px;min-height:44px}
.home-town-home[data-layout="street"] .home-town-location{right:10%}

/* Weekly anomaly entry stays inside the room heading, clear of the room controls. */
.home-room-heading>.home-anomaly-entry,.home-screen>.home-anomaly-entry{display:flex;align-items:center;justify-content:center;gap:6px;width:auto;min-width:0;height:auto;min-height:48px;padding:4px 8px;border:1px solid #b77a8e;border-radius:4px;background:linear-gradient(135deg,#622b41f5,#321b29f5);color:#fff2e8;box-shadow:inset 0 1px 0 #ffffff14,0 2px 8px #14081266;text-shadow:none;white-space:normal;touch-action:manipulation}
.home-room-heading>.home-anomaly-entry{flex:0 0 auto;max-width:52%}
.home-room-heading:has(>.home-anomaly-entry)>div{min-width:0}
.home-room-heading:has(>.home-anomaly-entry) h2{overflow-wrap:anywhere}
.home-room-heading>.home-anomaly-entry .home-law-gate-mark,.home-screen>.home-anomaly-entry .home-law-gate-mark{display:grid;place-items:center;flex:0 0 30px;width:30px;height:30px;border:0;background:transparent;box-shadow:none}
.home-room-heading>.home-anomaly-entry .home-law-gate-mark::before{display:none}
.home-room-heading>.home-anomaly-entry .home-law-gate-icon,.home-screen>.home-anomaly-entry .home-law-gate-icon{width:30px;height:30px;object-fit:contain}
.home-anomaly-entry .home-anomaly-entry-copy{display:grid;gap:2px;text-align:left;color:inherit}
.home-anomaly-entry .home-anomaly-entry-copy strong{font-size:.8125rem;line-height:1.25;white-space:nowrap}
.home-anomaly-entry .home-anomaly-entry-copy small{font-size:.6875rem;line-height:1.25;color:#f1bacb}
.home-anomaly-entry{position:relative}
.home-anomaly-entry .home-anomaly-reward-notice{position:absolute;z-index:1;top:3px;right:3px;width:10px;height:10px;border:2px solid var(--surface);border-radius:50%;background:#ff4038;pointer-events:none}
.home-room-heading>.home-anomaly-entry:focus-visible,.home-screen>.home-anomaly-entry:focus-visible{outline:2px solid #ffd9a5;outline-offset:2px}

.home-room-heading:has(>.home-anomaly-entry){right:44px}
