/* The same room layout scales within a readable board on all device sizes. */
:root{--board-width:480px;--available-h:100dvh;--shell-height:42px}
html{min-width:280px;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{min-width:280px;overscroll-behavior-y:none}
#game{width:min(100%,var(--board-width));height:calc(var(--available-h) - var(--shell-height))!important;margin-inline:auto}
#sound-dock,#daily-review,#fishing-sound-review,#dialogue-review{width:min(100%,var(--board-width));box-sizing:border-box}
#sound-dock{height:auto;min-height:44px;gap:6px;padding-top:max(4px,env(safe-area-inset-top));padding-inline:max(8px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-right))}
#sound-dock button{min-height:36px!important;white-space:nowrap}
#game #panel{min-width:0;min-height:0;overflow-x:hidden;overflow-wrap:anywhere;overscroll-behavior:contain}
#game .modal-head{flex-shrink:0}#game .modal-head h1{min-width:0;overflow-wrap:anywhere}
#game #tabs{flex-shrink:0}#game .actions{flex-wrap:wrap}#game .actions>.action{min-width:0}
#game input:not([type=range]):not([type=checkbox]):not([type=radio]),#game select,#game textarea{max-width:100%;font-size:16px}
#game img,#game video{max-width:100%}
#game .bottom{padding-bottom:env(safe-area-inset-bottom);height:calc(62px + env(safe-area-inset-bottom));bottom:8px}
#game .bottom button{min-width:0;min-height:44px}
#game .action,#game .walk-dialogue-controls button{min-height:44px}
#game .rhythm-pads{gap:6px}#game .rhythm-pads .action{min-height:48px}
#scene{touch-action:manipulation}
@media(min-width:700px) and (min-height:700px){:root{--board-width:480px}#game{box-shadow:0 0 0 3px #829989,8px 0 #203e3433,-8px 0 #203e3433}#game #modal{left:16px;right:16px}#game #panel{font-size:14px}}
@media(min-width:1100px) and (min-height:850px){:root{--board-width:520px}}
@media(max-width:360px){#sound-dock{gap:4px;padding-inline:6px;font-size:10px}#sound-dock>span{display:none}#sound-dock button{flex:1;margin-left:0!important}#game .hud{left:8px;right:8px}#game .brand{gap:4px}#game .creator-watermark{font-size:8px}#game #modal{left:5px;right:5px}#game #panel{padding:8px}#game .bottom{left:5px;right:5px}#game .bottom button{font-size:11px;padding-inline:1px}}
/* Short landscape displays use the whole viewport for the active task. */
@media(max-height:560px){body{overflow-y:auto}#game{min-height:560px}#game #modal:not([hidden]){position:fixed;inset:6px max(6px,calc((100vw - 680px)/2));height:auto;max-height:none;transform:none;z-index:1000;display:flex;flex-direction:column}#game #modal #panel{flex:1;min-height:0}#game #modal .panel-help{margin:0}#game #modal .modal-head{min-height:44px;padding-block:2px}#game #modal #feedback:empty{display:none}#game #modal .daily-dialogue-log{height:25dvh;max-height:25dvh}#game #modal.performance-focused .rhythm-show{display:grid;grid-template-columns:minmax(170px,1fr) minmax(220px,1.2fr);gap:6px}#game #modal.performance-focused .rhythm-show>h3{display:none}#game #modal.performance-focused .rhythm-stage{grid-column:1;grid-row:1 / span 3;display:flex;flex-direction:column}#game #modal.performance-focused .rhythm-cast.choreographed{height:100px;min-height:100px;padding:2px 8px 10px}#game #modal.performance-focused .rhythm-lanes{min-height:50px;height:clamp(50px,20dvh,100px)}#game #modal.performance-focused .rhythm-pads{grid-column:2;align-self:center}#game #modal.performance-focused .rhythm-status{grid-column:2}#game #modal.performance-focused .rhythm-show>.action{grid-column:2}#game #modal .fishing-play{display:grid;grid-template-columns:1fr 1fr;gap:6px}#game #modal .fishing-status{grid-column:1 / -1}#game #modal .fishing-controls{align-self:center;position:static}#game #modal .calibration-dial{width:110px;height:110px;margin:2px auto}}
#cloud-save-button{position:static;font:inherit;border:2px solid #8da997;background:#fffdf5;color:#526b5c;border-radius:0;box-shadow:2px 2px #7e9487;padding:4px 8px}
#cloud-save-dialog{width:min(390px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;box-sizing:border-box;border:3px solid #819989;border-radius:0;background:#f6f3e9;color:#4b564d;padding:14px;font:14px/1.65 var(--game-font);box-shadow:4px 4px #526b5c}
#cloud-save-dialog::backdrop{background:#233e3680}#cloud-save-dialog header{display:flex;align-items:center;justify-content:space-between}#cloud-save-dialog h2{font-size:17px;margin:0}#cloud-save-dialog label{display:block;margin:10px 0}#cloud-save-dialog input{display:block;box-sizing:border-box;width:100%;font:16px/1.5 var(--game-font);padding:8px;border:2px solid #819989;border-radius:0}#cloud-save-dialog button{min-height:44px;margin:4px 4px 4px 0;font:inherit;background:#deeee3;color:#4b564d;border:2px solid #819989;border-radius:0}#cloud-save-dialog .cloud-actions{display:flex;flex-wrap:wrap;gap:4px}#cloud-save-dialog .cloud-actions button{flex:1}#cloud-save-dialog .cloud-notice{color:#a4514f}#cloud-save-dialog footer{border-top:2px solid #a0b7a8;margin-top:12px;padding-top:8px}

/* Long resident status must never push the second card outside the board. */
#game .avatars{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
#game .avatars button{min-width:0;overflow:hidden}

/* Keep the canvas coordinate system inside its own play area; wide screens get a real sidebar. */
:root{--board-width: min(100vw,720px)}
#home-shell{width:min(100%,var(--board-width));margin:auto}#home-sidebar:empty{display:none}
#game{width:100%;min-height:480px}
#continue-tour{border-radius:0!important;min-height:34px!important;font-size:12px!important;padding:5px 8px!important;right:12px!important;max-width:46%;box-shadow:2px 2px #947b65}
#game .home-notices{margin-top:4px}
body.wide-home{--board-width: min(100vw,1180px)}
.wide-home #home-shell{display:grid;grid-template-columns:280px minmax(0,1fr);background:#eee9db}
.wide-home #home-sidebar{display:block;position:relative;border-right:4px solid #91ab99;padding:18px 12px;overflow:auto;height:calc(var(--available-h) - var(--shell-height))}
.wide-home #home-sidebar .hud{position:static;pointer-events:auto}
.wide-home .brand{flex-wrap:wrap;gap:10px}.wide-home .home-nameplate{width:100%}
.wide-home .avatars{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
.wide-home .avatars button{min-width:0;overflow:hidden}
.wide-home .hud-row{flex-wrap:wrap}.wide-home #sky{min-width:150px}
.wide-home #game{box-shadow:none;min-height:480px}
.wide-home #game #modal:not([hidden]):not([data-view="arcade"]){top:50%;bottom:auto;left:max(16px,calc((100% - 660px)/2));right:max(16px,calc((100% - 660px)/2));height:auto;max-height:calc(100% - 36px);transform:translateY(-50%);display:flex;flex-direction:column}
.wide-home #game #modal:not([hidden]) #panel{flex:0 1 auto;min-height:0}
@media(max-width:899px){#game{box-shadow:none}.hud .brand{margin-bottom:6px}.hud .avatars{margin-top:6px}#game #bubble{bottom:82px;padding:6px 10px}#game .bottom{bottom:4px}#game .hud{top:6px}}

.account-door{font-size:54px;text-align:center;color:#b65d56;background:#dfede3;margin:12px 0;border:3px solid #8ca896;animation:door-arrive .4s steps(4)}@keyframes door-arrive{from{transform:translateY(8px);opacity:.4}to{transform:translateY(0);opacity:1}}@media(prefers-reduced-motion:reduce){.account-door{animation:none}}
.wide-home #home-sidebar .hud .brand{display:flex;flex-wrap:wrap;gap:10px;justify-content:flex-start}
.wide-home #home-sidebar .hud .home-nameplate{flex:0 0 100%;width:100%;min-width:0}
.wide-home #home-sidebar #home-name{white-space:normal;overflow:visible;text-overflow:clip}
.wide-home #home-sidebar .hud-row #sky{flex:1 1 140px;white-space:normal}
.wide-home #home-sidebar .creator-watermark{white-space:normal}

@media(max-width:899px){.wide-home #home-shell{grid-template-columns:220px minmax(0,1fr)}.wide-home #home-sidebar{padding:8px}.wide-home #home-sidebar .hud-row #sky{min-width:110px;font-size:10px}.wide-home #game{min-height:300px}}
@media(max-height:560px){.wide-home #game{min-height:300px}.wide-home #home-sidebar .brand{margin-bottom:4px}.wide-home #home-sidebar .avatars{gap:4px;margin-top:4px}}
.wide-home #home-sidebar .home-emblem{display:none}
.wide-home #home-sidebar .hud-row{display:grid;grid-template-columns:68px minmax(0,1fr)}
.wide-home #home-sidebar .hud-row #sky{grid-column:1 / -1;grid-row:2;min-width:0;width:100%}
.wide-home #home-sidebar .hud-row button:last-child{justify-self:end}

/* Portrait devices use all available width; the browser chrome is outside this viewport. */
body:not(.wide-home){--board-width:100vw}
html{background:#deeee3}
@media(orientation:portrait){body{background:#f4f1e7}#game .hud{top:4px}#game #bubble{bottom:calc(78px + env(safe-area-inset-bottom))}#game .bottom{bottom:0}#game .home-notices{margin-top:2px}}
@media(display-mode:standalone){body:not(.wide-home){padding:0}#sound-dock{background:#deeee3}}

/* Transient messages and event entries share one stable footer slot. */
#game #bubble{height:52px;min-height:52px;max-height:52px;padding-top:6px;padding-bottom:6px;line-height:1.5}
#game #bubble:empty{display:block;visibility:hidden}
#game .hotspot[data-action="followRoomSignal"]{z-index:3;align-items:center;justify-content:flex-start;min-height:52px;background:#f1ded4;border:2px solid #af6258;box-shadow:2px 2px #b3967c;padding:5px 11px;overflow:hidden}
#game .hotspot[data-action="followRoomSignal"] span{max-height:none;padding:0;background:transparent;border:0;box-shadow:none;font:12px/1.5 var(--game-font);text-align:left;color:#8a4943}
#game .hotspot[data-action="followRoomSignal"] span:after{content:' →';display:inline}
#game[data-panel]:not([data-panel=""]) .hotspot[data-action="followRoomSignal"]{visibility:hidden}

/* The existing sound button handles autoplay permission without covering scene actions. */
#bgm-start{display:none}
#sound-dock #global-sound[data-blocked="true"]{background:#b95e59;border-color:#8d4947;color:#fffaf0;box-shadow:inset 2px 2px #df9589,2px 2px #82433f}

.social-open{flex:0 0 52px;height:34px;min-height:34px;font:12px var(--game-font);color:#52735f;background:#deeee3;border:2px solid #829989;box-shadow:2px 2px #637e70;border-radius:0}
#social-dialog{width:min(600px,calc(100vw - 20px));max-height:calc(100dvh - 20px);padding:0;border:3px solid #819989;border-radius:0;background:#f6f3e9;color:#4b564d;font:13px/1.65 var(--game-font);box-shadow:4px 4px #526b5c;overflow:hidden}
#social-dialog[open]{display:flex;flex-direction:column}#social-dialog::backdrop{background:#233e3680}#social-dialog header{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:#b96059;color:#fffdf5;border-bottom:3px solid #8e4d47}#social-dialog h2{margin:0;font:18px var(--game-font)}#social-dialog h3{margin:16px 0 8px;font:14px var(--game-font)}#social-dialog p{margin:8px 0}#social-dialog .social-body{overflow:auto;padding:0 12px 12px;overscroll-behavior:contain;min-height:0}#social-dialog label{display:block}#social-dialog input,#social-dialog select{font:16px var(--game-font);min-height:42px;max-width:100%;width:100%;padding:6px;border:2px solid #8da997;background:#fffdf5;color:#4b564d;border-radius:0}#social-dialog button{font:12px var(--game-font);min-height:44px;min-width:44px;padding:6px 10px;background:#deeee3;color:#526b5c;border:2px solid #8da997;box-shadow:2px 2px #a2b4a8;border-radius:0}#social-dialog header button{background:#fffdf5;color:#9d5049;font-size:22px}#social-dialog .social-code{display:flex;align-items:end;gap:8px;margin-top:10px}#social-dialog .social-code label{flex:1;min-width:0}#social-dialog .social-code input{letter-spacing:2px;color:#9d5049}#social-dialog .social-form-row{display:flex;gap:8px}#social-dialog #social-add{margin-top:12px}#social-dialog .social-rule{padding:8px;background:#e2ece2;border-left:4px solid #8da997;font-size:12px}#social-dialog .social-notice{flex-shrink:0;color:#a4514c;padding:0 12px;margin:6px 0;white-space:normal;overflow-wrap:anywhere}#social-dialog .social-notice:empty{display:none}#social-dialog .social-friend{display:flex;align-items:center;gap:8px;padding:8px 0;border-bottom:2px solid #c6d2c6}#social-dialog .social-friend>div,#social-dialog .social-friend>strong{flex:1;min-width:0;overflow-wrap:anywhere}#social-dialog small{display:block;font-size:11px;color:#6e7c6f}#social-dialog strong{font-weight:400}#social-dialog .social-visit{margin-top:14px;border:2px solid #91ab98;padding:10px;background:#f1f5eb}#social-dialog .social-plots{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}#social-dialog .social-plots button{padding:4px 2px;background:#e1cbab;border-color:#a38967;min-height:94px}#social-dialog .social-plots button:disabled{opacity:.7}#social-dialog .social-plots strong{display:block}#social-dialog .social-crop{display:block;height:32px}#social-dialog .social-crop svg{width:30px;height:30px}#social-dialog #social-gift{display:flex;flex-wrap:wrap;gap:8px;align-items:end}#social-dialog #social-gift label:first-child{flex:1;min-width:130px}#social-dialog #social-gift label:nth-child(2){width:66px}#social-dialog details{margin-top:14px;border-top:2px solid #91ab98}#social-dialog summary{padding:10px 0;cursor:pointer}
.social-house{position:relative;height:190px;overflow:hidden;background:linear-gradient(#eee5d2 0 60%,#d0b995 60%);border:5px solid #998165}.social-house i{position:absolute;display:block;box-sizing:border-box}.social-window{left:14%;top:14px;width:64px;height:58px;border:6px solid #af9670;background:#baddd0;box-shadow:0 5px #998165}.social-window:after{content:'';position:absolute;left:50%;top:0;height:100%;width:4px;background:#f1e7d0}.social-sofa{left:18%;right:18%;top:78px;height:58px;background:var(--social-sofa);border:6px solid #739b82;box-shadow:0 6px #927752}.social-cushion{right:22%;top:88px;width:28px;height:25px;background:#bf6659;border:4px solid #e4aa96}.social-cast{position:absolute;left:50%;bottom:22px;transform:translateX(-50%)}.social-cast .light-pair{gap:12px;margin:0}.social-table{left:25%;right:25%;bottom:9px;height:24px;background:#b28e63;border:5px solid #95734d;z-index:2}.social-pot{right:9%;bottom:18px;width:20px;height:25px;background:#bf836a;box-shadow:0 -12px #83ad87}
#social-dialog .social-form-row button{flex:0 0 auto;white-space:nowrap}
.social-house .light-pair{display:flex;gap:12px;width:148px;height:88px;margin:0}
.social-house .light-figure{position:relative;display:block;width:68px;height:88px;flex:0 0 68px;image-rendering:pixelated;animation:none}

/* A compact original pixel vignette, rather than a font-dependent house glyph. */
#cloud-save-dialog .account-door{display:flex;align-items:center;justify-content:center;height:78px;padding:5px;margin:10px 0;background:#e2eee4;border:2px solid #8ca896;box-shadow:inset 0 0 0 2px #f5f6eb,2px 2px #bccbbb;font-size:0;line-height:0}
#cloud-save-dialog .account-door svg{display:block;width:144px;height:64px;max-width:100%;image-rendering:pixelated}

/* Social actions follow the room's compact pixel controls. */
#social-dialog .social-header-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
#social-dialog header [data-social=refresh]{display:flex;align-items:center;justify-content:center;gap:6px;font:12px var(--game-font);min-height:40px;padding:6px 9px;background:#deeee3;color:#476f58;border:2px solid #8da997;box-shadow:2px 2px #8e4d47,inset 2px 2px #f0f7ed}
#social-dialog header [data-social=refresh] svg{width:16px;height:16px;flex:0 0 16px;image-rendering:pixelated}
#social-dialog header [data-social=close]{font:22px var(--game-font);min-height:40px;min-width:40px;padding:2px 6px;box-shadow:2px 2px #8e4d47}
#social-dialog button:active:not(:disabled){transform:translate(1px,1px);box-shadow:1px 1px #819989}
#social-dialog button:focus-visible,#social-dialog summary:focus-visible{outline:2px solid #9d5049;outline-offset:3px}
#social-dialog .social-guide{margin:12px 0 8px;border:2px solid #91ab98;background:#e2ece2;box-shadow:2px 2px #c6d2c6;padding:0 9px}
#social-dialog .social-guide summary{padding:8px 0;color:#526b5c}
#social-dialog .social-guide ol{padding-left:20px;margin:0 0 9px;font-size:12px}
#social-dialog .social-guide li+li{margin-top:6px}
#social-dialog .social-rule{background:transparent;border:0;padding:0;color:#6e7c6f}
