/* Room-first controls. Canvas geometry stays fixed throughout a furniture edit. */
.pet-panel-top{position:sticky;top:0;z-index:2;background:var(--paper);box-shadow:0 -20px 0 var(--paper);border-bottom:1px solid var(--line);padding-bottom:10px}
#pet-quick-name{font-size:13px;font-weight:600;line-height:1.5;margin:0 0 8px;overflow-wrap:anywhere}
.pet-quick-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.pet-quick-buttons button{min-width:0;min-height:44px;font-size:12px;padding:8px 4px}
#change-coat{background:#e7ecd9;color:#40573a;border-color:#b8c8a9}
.oss-icon{width:22px;height:22px;object-fit:contain;opacity:.75;flex-shrink:0}
#pet-detail .pet-detail-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}
#pet-detail .pet-detail-actions button{min-height:44px}
#pet-detail #follow-pet{grid-column:1/-1;background:#e7ecd9;color:#40573a}
#pet-detail #release-pet{grid-column:1/-1;color:#85543b;margin-top:6px}
#release-portrait{display:block;width:108px;height:72px;object-fit:contain;margin:auto}
#release-dialog{width:420px;max-height:calc(100dvh - 24px)}
#release-dialog .rename-buttons button{flex:1;min-height:44px;min-width:0}
#release-confirm{background:#85543b}
.personality-row{display:flex;align-items:center;gap:12px;margin:8px 0 0}
.personality-row label{font-size:12px;color:var(--muted)}
#pet-personality{flex:1;min-width:0;min-height:44px;border:1px solid var(--line);border-radius:10px;background:#fffdf5;color:var(--ink);font:inherit;font-size:16px;padding:8px}
#personality-note{font-size:12px;line-height:1.6;color:var(--muted);margin:6px 0 12px}
#pet-mood,.resident-chip small{white-space:normal;overflow-wrap:anywhere}
.resident-chip small{display:block;max-height:2.8em;overflow:hidden;font-size:10px;line-height:1.4}
#follow-status{position:absolute;left:max(16px,env(safe-area-inset-left));top:max(170px,calc(env(safe-area-inset-top) + 65px));max-width:calc(100% - 32px);display:flex;align-items:center;gap:8px;padding:4px 5px 4px 12px;background:#fbf9f0f5;border:1px solid var(--line);border-radius:13px;z-index:2}
#follow-name{font-size:12px;overflow-wrap:anywhere}#stop-follow{min-height:44px;flex-shrink:0}
body.watching #follow-status{display:none}
@media(max-width:1000px), (max-height:600px){#follow-status{top:max(68px,calc(env(safe-area-inset-top) + 60px))}}
#coat-dialog{padding:24px;max-height:calc(100dvh - 24px)}#coat-title{margin:8px 40px 4px 0;font-size:20px}
#coat-pet-name{font-size:14px;margin:0 0 12px;overflow-wrap:anywhere}#coat-current{margin:12px 0 16px;font-size:12px}
#coat-form .rename-buttons button{min-width:0;flex:1;min-height:48px;font-size:13px;padding:10px 6px}
@media(max-width:360px){#coat-dialog{padding:18px}#coat-dialog .coat-choices{gap:6px}}
@media(max-height:430px){
 #coat-dialog{padding:14px 20px}#coat-title{font-size:18px;line-height:1.3;margin:0 40px 2px 0}
 #coat-pet-name{font-size:12px;line-height:1.4;margin:0}
 #coat-form .coat-choices{margin:8px 0}#coat-form legend{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 #coat-form .coat-choices label{padding:6px 2px}#coat-form .coat-choices label:has(:checked){padding:5px 1px}
 #coat-current{font-size:11px;line-height:1.4;margin:6px 0 8px}#coat-form .rename-buttons button{min-height:44px;font-size:12px;padding:6px}
}
.residents-heading{display:flex;justify-content:space-between;align-items:center;gap:6px;margin:6px 0 12px}
#pet-count{font-size:12px;white-space:nowrap;color:var(--muted)}
#welcome-pet{display:flex;gap:6px;align-items:center;min-height:44px;font-size:12px;padding:6px 10px}
#pet-list{max-height:270px;overflow:auto;overscroll-behavior:contain;padding:4px 3px;scrollbar-width:thin}
.pet-entry{min-width:0}.pet-card{width:100%}.pet-card strong{overflow-wrap:anywhere}.resident-chip>span{max-width:74px}.resident-chip>span>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#room-dialog{width:780px;max-width:calc(100vw - 24px);padding:0;overflow:hidden;border-radius:22px}
#room-dialog[open]{display:flex;flex-direction:column;max-height:calc(100dvh - 32px)}
.room-dialog-heading{position:relative;padding:22px 28px 16px;flex-shrink:0}.room-dialog-heading h2{margin:4px 48px 4px 0}.room-dialog-heading p{font-size:13px;color:var(--muted)}
#room-styles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:4px 24px 18px;overflow:auto;overscroll-behavior:contain;min-height:80px}
.room-card{position:relative;border:2px solid transparent;border-radius:13px;background:#eeeee2;padding:5px;text-align:left;display:flex;flex-direction:column;min-width:0;gap:4px}
.room-card[aria-pressed=true]{border-color:var(--green);background:#e4ead9;box-shadow:0 0 0 1px var(--green)}
.room-card[aria-pressed=true]:after{content:'✓';position:absolute;top:10px;right:10px;width:26px;height:26px;line-height:26px;text-align:center;border-radius:50%;background:var(--green);color:white}
.room-card img{width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:7px}.room-card strong{font-size:13px;padding:3px 5px 0}.room-card>span{font-size:11px;line-height:1.6;color:#69745f;padding:0 5px}.room-card small{font-size:10px;min-height:15px;padding:0 5px;color:var(--green)}
.room-dialog-footer{flex-shrink:0;border-top:1px solid var(--line);padding:14px 28px 20px;display:grid;grid-template-columns:1fr auto;gap:3px 12px;align-items:center;background:var(--paper)}
#room-choice{font-size:14px;font-weight:600;line-height:1.5}.room-dialog-footer .small{font-size:11px;grid-column:1}.room-dialog-footer .primary{grid-column:2;grid-row:1/3;min-height:48px;font-size:13px;padding:10px 18px}
#welcome-dialog{width:440px}#welcome-title{font-size:20px;margin-right:24px}#welcome-dialog>p{font-size:13px;margin:8px 0}
.coat-choices{border:0;padding:0;min-width:0;margin:12px 0 0;display:block}
.coat-strip{display:flex;gap:8px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scroll-padding-inline:3px;padding:3px 3px 8px;scrollbar-width:thin;scrollbar-color:#b2bfa1 #efefe3;touch-action:pan-x}
.coat-strip label{flex:0 0 104px;scroll-snap-align:start;min-width:0}
.coat-navigation{display:flex;align-items:center;gap:6px;margin:4px 0 10px}
.coat-navigation .icon-button{flex:0 0 44px;min-height:44px;border:1px solid var(--line);background:#f2f1e7;font-size:28px;padding:0}
.coat-navigation .icon-button:disabled{cursor:default}
.coat-navigation p,#coat-current{flex:1;min-width:0;font-size:11px;line-height:1.5;text-align:center;margin:0}
.coat-total{font-size:11px;color:var(--muted);font-weight:400}
.coat-choices legend{font-size:12px;margin-bottom:8px}.coat-choices label{position:relative;border:1px solid var(--line);border-radius:12px;background:#efefe3;cursor:pointer;text-align:center;padding:8px 2px;display:flex;align-items:center;flex-direction:column;gap:3px;font-size:12px}
.coat-choices label:has(:checked){border:2px solid var(--green);background:#e1e9d7;padding:7px 1px}.coat-choices img{width:100%;height:58px;object-fit:contain}.coat-choices input{position:absolute;top:7px;left:7px;accent-color:var(--green);width:16px;height:16px;margin:0}
.coat-choices label:focus-within{outline:3px solid #ae7a32;outline-offset:0}
#welcome-form>label{font-size:13px;display:block;margin:6px 0}#welcome-name{width:100%;min-height:48px;font-size:16px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;color:var(--ink);background:#fffdf7}
#welcome-help{font-size:11px;margin:6px 0 14px}#welcome-error{color:#925338;font-size:13px}#welcome-form .rename-buttons{gap:8px}#welcome-form .rename-buttons button{font-size:13px;padding:10px 12px;min-height:44px}
@media(max-width:600px){
 #room-styles{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:4px 14px 14px}.room-dialog-heading{padding:16px 18px 12px}.room-dialog-heading h2{font-size:20px}
 .room-card>span{display:none}.room-card strong{font-size:12px}.room-dialog-footer{padding:12px 16px 16px;grid-template-columns:1fr}.room-dialog-footer .primary{grid-column:1;grid-row:3;margin-top:7px;width:100%}
 #pet-list{max-height:210px}.coat-choices{gap:5px}#welcome-dialog{padding:22px 18px}#welcome-title{font-size:18px}
}
@media(max-height:430px){
 .room-dialog-heading{padding:10px 20px}.room-dialog-heading .eyebrow,.room-dialog-heading p{display:none}.room-dialog-heading h2{font-size:18px;margin:0}
 .room-dialog-footer{padding:8px 20px}.room-card>span{display:none}#room-styles{padding-bottom:10px}
 #welcome-dialog{padding:18px}.coat-choices{margin:8px 0}.coat-choices img{height:42px}#welcome-dialog>p{display:none}
 #coat-form .coat-choices{margin:6px 0 0}#coat-form .coat-choices img{height:34px}
 #coat-form .coat-choices label{padding:4px 2px;font-size:11px}#coat-form .coat-choices label:has(:checked){padding:3px 1px}
 #coat-form .coat-navigation{margin:2px 0 6px}#coat-current{margin:0}
}
:root{--room-safe-left:max(12px,env(safe-area-inset-left));--room-safe-right:max(12px,env(safe-area-inset-right));--room-safe-bottom:max(10px,env(safe-area-inset-bottom));--control-size:48px;--overlay:#faf7eef2}
body.in-room.editing #world{inset:150px 3vw 120px}
body.editing .topbar{height:78px}
body.watching #canvas{pointer-events:none}
#edit-tools{position:absolute;top:94px;left:3vw;right:3vw;display:flex;align-items:center;justify-content:space-between;pointer-events:none;z-index:5}
#edit-tools>*{pointer-events:auto}
.edit-heading{display:flex;align-items:center;gap:4px;padding:0 4px 0 16px;border:1px solid var(--line);border-radius:14px;background:var(--overlay);box-shadow:var(--shadow)}
.edit-heading>span{font-size:13px;font-weight:600;margin-right:8px}
#edit-tools button{min-width:44px;min-height:48px}
#finish-edit{font-size:13px;padding:10px 18px}
#edit-idle{position:absolute;right:3vw;bottom:24px;display:flex;align-items:center;gap:16px;z-index:4}
#edit-idle p{font-size:13px;padding:6px 12px;border-radius:8px;background:#faf7eedb;color:#58664d;pointer-events:none}
#add-furniture{font-size:14px;min-height:52px}
#editor.drawer{left:3vw;right:3vw;top:auto;bottom:24px;width:auto;max-height:calc(100dvh - 170px);padding:12px 16px;overflow:auto;z-index:6}
#editor .drawer-head{min-height:44px;gap:16px}
#editor .drawer-head h2{font-size:16px;white-space:nowrap;margin:0}
#editor .drawer-head .icon-button{width:44px;height:44px;flex-shrink:0}
#editor .categories{margin:0;display:flex;gap:4px;flex:1;justify-content:center}
#editor .categories button{min-height:44px;min-width:60px;font-size:13px;padding:8px 15px}
#editor .editor-body{display:block;margin-top:8px;max-height:none;overflow:visible}
#editor .catalog{width:100%;gap:10px;padding:3px 2px 6px;overscroll-behavior-x:contain}
#editor .catalog button{flex:0 0 112px;font-size:12px;min-height:98px;padding:3px 4px 7px;border-radius:12px}
#editor .catalog img{width:90px;height:66px}
.catalog-search{display:flex;gap:6px;align-items:center;margin:6px 0 2px}
#furniture-search{flex:1;min-width:0;max-width:360px;height:44px;border:1px solid var(--line);border-radius:10px;background:#fffdf7;color:var(--ink);font:inherit;font-size:16px;padding:8px 12px}
#clear-furniture-search{flex:0 0 44px;font-size:24px}
#furniture-search::-webkit-search-cancel-button{display:none}
#catalog-count{font-size:11px;white-space:nowrap;margin-left:auto;color:var(--muted)}
#catalog-empty{padding:10px 4px}
#selection-actions.prop-toolbar{position:absolute;right:3vw;bottom:24px;display:flex;align-items:center;gap:5px;padding:6px;background:var(--overlay);border:1px solid var(--line);border-radius:17px;box-shadow:var(--shadow);max-width:calc(100% - 24px);z-index:5}
.selected-identity{display:flex;align-items:center;gap:3px;width:150px;padding-right:8px;min-width:0}
.selected-identity img{width:44px;height:44px;object-fit:contain;flex-shrink:0}
.selected-identity strong{font-size:13px;line-height:1.4;font-weight:550;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
#selection-actions>button{min-height:48px;min-width:44px;flex-shrink:0;font-size:13px;gap:6px;padding:8px 12px}
#selection-actions>.icon-button{width:44px;padding:0}
#selection-actions svg{width:20px;height:20px}
#selection-actions #move-prop{background:#e6ecd9;border-color:#c6d4b4}
#selection-actions #remove{color:#7d5846}
#fine-controls{position:absolute;right:6px;bottom:calc(100% + 8px);margin:0;padding:6px;background:var(--paper);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow)}
#fine-controls button{width:48px;height:48px;font-size:20px}
body.editing #placement-hint{top:auto;bottom:24px;left:50%;right:auto;transform:translateX(-50%);max-width:calc(100% - 24px);white-space:normal;font-size:14px;min-height:56px;padding:5px 6px 5px 16px;gap:12px;z-index:5}
#placement-hint button{min-height:44px;min-width:44px;font-size:12px;flex-shrink:0;border-radius:9px}
#cancel-placement{font-size:23px!important}
#items-dialog label{display:block;font-size:14px;margin-top:18px;margin-bottom:8px}
#placed-items{width:100%;min-height:48px;background:#fffdf7;border:1px solid var(--line);border-radius:9px;font-size:16px;color:var(--ink);padding:8px}
#toast{display:flex;align-items:center;gap:14px;padding:5px 6px 5px 16px;min-height:48px;bottom:100px;font-size:13px;pointer-events:none}
#toast-undo{min-height:44px;min-width:88px;padding:8px 12px;color:#fff;background:#ffffff20;border:1px solid #ffffff60;border-radius:8px;font-size:13px;white-space:nowrap;pointer-events:auto}

@media (orientation:portrait), (orientation:landscape) and (max-height:600px), (orientation:landscape) and (pointer:coarse){
 body.in-room #world,body.in-room.editing #world,body.in-room.watching #world{inset:0}
 .garden-heading,.activity{display:none}
 .topbar{top:max(10px,env(safe-area-inset-top));left:var(--room-safe-left);right:var(--room-safe-right);height:48px;padding:0;background:none;border:0;pointer-events:none}
 .topbar .brand{width:48px;height:48px;min-height:48px;justify-content:center;padding:0;background:var(--overlay);border:1px solid #ded7c6;border-radius:14px;box-shadow:var(--shadow);pointer-events:auto}
 .topbar .brand>span,.topbar .day-note{display:none}
 .topbar .brand svg{width:23px;height:23px}
 .top-actions{position:relative;gap:4px;background:var(--overlay);border:1px solid #ded7c6;border-radius:14px;padding:0 3px;box-shadow:var(--shadow);pointer-events:auto}
 .top-actions .icon-button{height:48px;width:48px}
 #save-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 body.storage-error #save-status{width:auto;height:auto;top:55px;right:0;clip-path:none;overflow:visible;font-size:12px;background:var(--paper);border-radius:8px;padding:6px 10px;box-shadow:var(--shadow)}
 .bottom-bar{left:auto;right:var(--room-safe-right);bottom:var(--room-safe-bottom);height:56px;padding:3px;gap:3px;border-radius:17px;max-width:calc(100% - 24px);background:var(--overlay);box-shadow:0 4px 20px #4c43271f}
 .bottom-bar .resident-chips{display:none}
 .main-actions{gap:2px}
 .bottom-bar .tool-button{height:48px;min-height:48px;font-size:13px;padding:8px 12px;gap:7px;border-radius:12px}
 .bottom-bar #residents,.bottom-bar #pause{width:48px;justify-content:center;padding:0}
 .bottom-bar #residents span,.bottom-bar #pause span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .bottom-bar .tool-button svg{width:22px;height:22px}
 .bottom-bar #watch{display:flex;justify-content:center;align-items:center;font-size:0;padding:0;width:44px;height:48px;min-height:48px;gap:0}
 .bottom-bar #watch span{font-size:23px}
 body.pets-open .bottom-bar{visibility:hidden;pointer-events:none}
 body.editing .topbar{visibility:hidden;pointer-events:none}
 body.editing .topbar *{pointer-events:none}
 #edit-tools{top:max(10px,env(safe-area-inset-top));left:var(--room-safe-left);right:var(--room-safe-right)}
 .edit-heading{height:50px;padding-left:12px;gap:0}
 .edit-heading>span{font-size:13px;margin-right:6px}
 #edit-idle{right:var(--room-safe-right);left:var(--room-safe-left);bottom:var(--room-safe-bottom);justify-content:flex-end;gap:12px}
 #edit-idle p{font-size:12px;line-height:1.5}
 #add-furniture{min-height:52px;padding:10px 16px;font-size:14px}
 #editor.drawer{left:var(--room-safe-left);right:var(--room-safe-right);top:auto;bottom:var(--room-safe-bottom);width:auto;max-height:calc(100dvh - 84px);padding:6px 10px 8px;border-radius:16px}
 #editor .drawer-head{gap:6px;min-height:44px}
 #editor .drawer-head h2{font-size:14px}
 #editor #item-count{display:none}
 #editor .categories{gap:1px}
 #editor .categories button{min-height:44px;min-width:58px;font-size:12px;padding:7px 12px}
 #editor .editor-body{margin-top:3px;max-height:none}
 #editor .catalog{gap:8px;padding-bottom:4px}
 #editor .catalog button{flex-basis:120px;min-height:86px;font-size:12px;padding:1px 4px 5px}
 #editor .catalog img{width:82px;height:57px}
 #selection-actions.prop-toolbar{right:var(--room-safe-right);bottom:var(--room-safe-bottom);gap:3px;padding:4px;border-radius:15px;max-width:calc(100% - var(--room-safe-left) - var(--room-safe-right))}
 .selected-identity{width:128px;gap:1px;padding-right:4px}
 .selected-identity strong{font-size:12px}
 #selection-actions>button{font-size:13px;padding:8px 10px;gap:5px}
 body.editing #placement-hint{top:auto;bottom:var(--room-safe-bottom);left:50%;right:auto;max-width:calc(100% - var(--room-safe-left) - var(--room-safe-right));transform:translateX(-50%);font-size:13px;padding:5px 6px 5px 13px;flex-wrap:nowrap;gap:10px}
 body.editing #placement-hint button{font-size:12px}
 #toast{bottom:calc(var(--room-safe-bottom) + 68px);font-size:12px;max-width:calc(100% - 24px);padding:5px 6px 5px 12px}
 #exit-watch{right:var(--room-safe-right);bottom:var(--room-safe-bottom);min-height:48px;font-size:12px;background:var(--overlay)}
 .pet-panel{top:max(68px,calc(env(safe-area-inset-top) + 60px));right:var(--room-safe-right);width:310px;max-width:calc(100% - 24px);bottom:auto;max-height:calc(100dvh - 80px);padding:12px 15px}
 .pet-panel h2{font-size:16px}.pet-panel .drawer-head .icon-button{width:44px;height:44px}
 .pet-panel>.muted{font-size:12px;margin:0 0 8px}.pet-card strong{font-size:12px}.pet-card{min-height:66px}
 #pet-mood{font-size:12px;white-space:normal}#pet-coat{font-size:11px}
 .pet-detail-actions .quiet{min-height:44px;font-size:12px}
 #pet-panel #names{font-size:12px;min-height:44px}.diary summary{font-size:12px;min-height:44px;line-height:44px}
 #rename-form input{font-size:16px;min-height:44px}#rename-form button{min-height:44px;font-size:12px}
 dialog .icon-button{width:44px;height:44px}dialog p{font-size:13px}dialog .small-button{min-height:44px}
}

/* Names are available directly from every resident's card. */
.pet-entry{min-width:0}
.pet-card strong{max-width:100%;overflow-wrap:anywhere}
.pet-rename{width:100%;min-height:44px;padding:6px 0;background:transparent;color:#526d49;font-size:11px;text-decoration:underline;text-underline-offset:4px}
.rename-heading{display:flex;align-items:center;gap:8px;margin-right:22px}
.rename-heading img{width:76px;height:56px;object-fit:contain}
#rename-dialog{padding:24px;max-height:calc(100dvh - 24px)}
#rename-dialog h2{font-size:20px;white-space:nowrap}
#rename-form{margin-top:12px}
#rename-form label{font-size:13px;overflow-wrap:anywhere;margin-bottom:8px}
#rename-form input{font-size:16px;min-height:48px;width:100%}
#rename-form .small{font-size:12px;margin:8px 0 14px}
#rename-error{font-size:13px;color:#984330;margin:8px 0}
.rename-buttons{display:flex;gap:8px;justify-content:flex-end}
.rename-buttons button{min-height:48px;min-width:100px;font-size:14px}
#pet-detail-name{overflow-wrap:anywhere}
#room-view{display:none}

@media (orientation:portrait){
 body.in-room #world,body.in-room.editing #world,body.in-room.watching #world{inset:calc(env(safe-area-inset-top) + 72px) 0 calc(var(--room-safe-bottom) + 146px)}
 #home-screen{padding:30px 24px;justify-content:center;overflow-y:auto;background:linear-gradient(180deg,#f6f3e9f5 0%,#f6f3e9eb 58%,#f6f3e9a0 100%)}
 .home-paper{width:340px;max-width:100%}.home-flourish{font-size:11px;letter-spacing:.1em}
 h1{font-size:38px;margin:18px 0 12px;line-height:1.3}h1 span{font-size:56px}
 .home-description{font-size:13px;line-height:1.9;letter-spacing:.02em}
 .home-pets{height:86px;margin:4px 0}.home-pets img{width:100px;height:68px}.home-pets img:nth-child(2){width:122px;height:84px}
 .start-button{min-height:52px;font-size:16px}.home-paper>.text-button,.home-paper>.quiet{min-height:44px;margin:4px 0;font-size:12px}
 .save-note{font-size:10px}.home-caption{display:none}
 .bottom-bar{left:var(--room-safe-left);right:var(--room-safe-right);justify-content:center;max-width:none;height:64px;gap:2px}
 .main-actions{flex:1;gap:2px;justify-content:space-between}
 .bottom-bar .tool-button{height:54px;font-size:11px;flex-direction:column;gap:2px;padding:4px 9px;justify-content:center;flex:1}
 .bottom-bar #residents{width:auto;padding:4px 9px}.bottom-bar #residents span{position:static;width:auto;height:auto;clip-path:none;font-size:11px}
 .bottom-bar #pause{width:44px;flex:0 0 44px}.bottom-bar #watch{width:44px}
 #room-view{display:flex;position:absolute;bottom:calc(var(--room-safe-bottom) + 108px);left:var(--room-safe-left);right:var(--room-safe-right);gap:2px;align-items:center;max-width:350px;margin:auto;background:var(--overlay);border:1px solid var(--line);border-radius:14px;padding:0 4px;z-index:4}
 #room-view .icon-button{width:44px;min-width:44px;height:44px;font-size:27px;padding:0}
 #view-position{appearance:none;flex:1;width:0;min-width:30px;height:44px;margin:0;padding:0 2px;border:0;background:transparent;accent-color:var(--green)}
 #view-position::-webkit-slider-runnable-track{height:4px;background:#ced5bf;border-radius:2px}
 #view-position::-webkit-slider-thumb{appearance:none;margin-top:-8px;width:20px;height:20px;border-radius:50%;background:var(--green);border:2px solid var(--paper)}
 #view-position:disabled{opacity:.4}#view-overview{min-width:58px;min-height:44px;padding:6px;font-size:13px;border:0;background:transparent}
 body.watching #room-view,body.pets-open #room-view,body.catalog-open #room-view{display:none}
 #edit-tools{gap:6px}.edit-heading{padding-left:10px}.edit-heading>span{font-size:12px;margin-right:2px}
 #finish-edit{font-size:12px;padding:8px 12px;white-space:nowrap}
 #selection-actions.prop-toolbar{left:var(--room-safe-left);right:var(--room-safe-right);max-width:none;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:6px;border-radius:16px}
 .selected-identity{grid-column:1/3;grid-row:1;width:auto;height:36px;padding-right:50px}.selected-identity img{height:32px;width:36px}.selected-identity strong{font-size:13px}
 #selection-actions>button{min-height:44px;width:auto;padding:6px;font-size:13px;justify-content:center}
 #selection-actions #move-prop{grid-column:1;grid-row:2}#selection-actions #flip{grid-column:2;grid-row:2}#selection-actions #remove{grid-column:3;grid-row:2}
 #selection-actions #fine-adjust{position:absolute;right:50px;top:2px;width:44px}#selection-actions #deselect-prop{position:absolute;right:6px;top:2px;width:44px}
 #fine-controls{bottom:calc(100% + 54px)}
 #edit-idle{gap:6px;justify-content:space-between}#edit-idle p{font-size:11px;max-width:145px;padding:4px 6px}#add-furniture{font-size:13px;min-height:48px;padding:10px}
 #editor.drawer{max-height:50dvh;padding:10px 12px}#editor .drawer-head{flex-wrap:wrap;gap:0}
 #editor .drawer-head h2{order:0;flex:1}#editor #close-catalog{order:1}#editor .categories{order:2;flex-basis:100%;justify-content:space-between}
 #editor .categories button{flex:1;min-width:0;padding:6px 4px;font-size:12px}
 #editor .catalog{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;overflow:visible;max-height:none}
 #editor .catalog button{min-height:90px;font-size:11px;padding:4px;width:100%}#editor .catalog img{width:100%;height:58px;object-fit:contain}
 body.editing #placement-hint{bottom:var(--room-safe-bottom);width:calc(100% - var(--room-safe-left) - var(--room-safe-right));font-size:12px;gap:6px;padding:6px 6px 6px 12px}
 #placement-text{flex:1;min-width:0}#place-center{max-width:92px}
 .pet-panel{top:auto;bottom:var(--room-safe-bottom);left:var(--room-safe-left);right:var(--room-safe-right);width:auto;max-width:none;max-height:62dvh;padding:12px 16px;border-radius:20px}
 #pet-list{gap:6px}.pet-card img{max-width:100%;height:48px}.pet-card{min-height:84px}.pet-card strong{font-size:12px}
 .pet-portrait{padding:8px 0}.pet-portrait img{width:96px;height:64px}.pet-portrait h3{font-size:17px}.diary{margin-top:10px;padding-top:6px}
 #toast{bottom:calc(var(--room-safe-bottom) + 158px);width:max-content;max-width:calc(100% - 24px);z-index:20}
}
@media (orientation:portrait) and (max-height:650px){
 #home-screen{padding:12px 22px;align-items:flex-start}.home-paper{margin:auto}.home-flourish{display:none}
 h1{font-size:30px;margin:4px 0 10px}h1 span{font-size:44px}.home-pets{height:64px}.home-pets img{height:55px;width:86px}.home-pets img:nth-child(2){height:66px;width:100px}
 .home-paper>.text-button,.home-paper>.quiet{margin:0}.pet-panel{max-height:75dvh}
}

@media (orientation:landscape) and (max-height:430px){
 #home-screen{padding:10px 6vw}.home-paper{max-width:46%;width:330px}
 .home-flourish,.home-caption{display:none}
 h1{font-size:29px;line-height:1.2;margin:0 0 12px}h1 span{font-size:42px}
 .home-description{font-size:12px;line-height:1.7;letter-spacing:0}
 .home-pets{height:48px;margin:0}.home-pets img{height:44px;width:70px}.home-pets img:nth-child(2){height:52px;width:88px}
 .start-button{min-height:48px;font-size:14px}
 .home-paper>.text-button,.home-paper>.quiet{min-height:44px;font-size:12px;margin:0;padding:6px}
 .save-note{font-size:10px;line-height:1.5}
}
@media (orientation:landscape) and (max-height:345px){
 .home-pets{display:none}.save-note{display:none}
 .home-description{margin-bottom:10px}
}

@media (orientation:landscape) and (max-width:620px){
 .selected-identity{width:92px}.selected-identity img{width:36px;height:40px}
 #selection-actions>button{padding:8px;font-size:12px}
 #selection-actions #flip span{display:none}#selection-actions #flip{width:44px;min-width:44px}
 #editor .drawer-head h2{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 #edit-idle p{max-width:190px;font-size:12px}
}

/* A room tap greets the resident without covering the room with the full list. */
#pet-panel.compact-pet{top:auto;bottom:120px;max-height:144px;padding:10px 12px}
.compact-pet .pet-panel-top{position:static;padding:0;border:0;box-shadow:none}
.compact-pet .drawer-head{gap:4px;margin-bottom:6px;min-height:44px}
.compact-pet #pet-title{flex:1;min-width:0;margin:0;font-size:14px;line-height:1.5;overflow-wrap:anywhere}
.compact-pet .drawer-head button{flex-shrink:0;width:44px;height:44px}
.compact-pet #pet-quick-name{display:none}
@media (orientation:portrait), (orientation:landscape) and (max-height:600px), (orientation:landscape) and (pointer:coarse){
 #pet-panel.compact-pet{bottom:var(--room-safe-bottom)}
}
@media (orientation:landscape) and (max-height:600px), (orientation:landscape) and (pointer:coarse){
 #pet-panel.compact-pet{left:auto;width:min(560px,calc(100% - 24px));max-width:none}
 .compact-pet .pet-panel-top{display:grid;grid-template-columns:minmax(70px,1fr) repeat(2,minmax(90px,110px)) 44px 44px;gap:6px;align-items:center}
 .compact-pet .drawer-head,.compact-pet #pet-quick-actions,.compact-pet .pet-quick-buttons{display:contents}
 .compact-pet #pet-title{grid-column:1;grid-row:1;font-size:13px}
 .compact-pet #rename-pet{grid-column:2;grid-row:1}
 .compact-pet #change-coat{grid-column:3;grid-row:1}
 .compact-pet #pet-details{grid-column:4;grid-row:1}
 .compact-pet #close-pets{grid-column:5;grid-row:1}
}

/* Bounded catalog: fixed controls, independently scrolling furniture page. */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap;border:0!important}
#editor.drawer{display:flex;flex-direction:column;overflow:hidden;gap:6px;max-height:62dvh}
#editor .catalog-controls{display:flex;align-items:center;gap:8px;flex-shrink:0}
#furniture-category{min-width:0;width:210px;max-width:38%;height:44px;border:1px solid var(--line);border-radius:10px;background:#fffdf7;color:var(--ink);font:inherit;font-size:16px;padding:6px 10px}
#editor .catalog-search{display:flex;flex:1;gap:4px;margin:0;min-width:0}
#editor #furniture-search{max-width:none;width:0}
#editor #close-catalog{flex:0 0 44px;height:44px}
#editor .editor-body{min-height:0;overflow-y:auto;overscroll-behavior:contain;margin:0;padding:0 2px;flex:1;max-height:none}
#editor .catalog{align-items:stretch;scroll-padding:3px}
#editor .catalog button{min-height:98px;min-width:0;flex-shrink:0}
#editor .catalog button span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;line-height:1.5;min-height:3em}
#editor .catalog-navigation{display:flex;align-items:center;gap:8px;justify-content:center;flex-shrink:0}
#editor .catalog-navigation button{width:44px;height:44px;font-size:30px;border:1px solid var(--line);background:#f2f1e7}
#editor .catalog-navigation button:disabled{cursor:default;opacity:.38}
.catalog-position{min-width:160px;text-align:center;display:flex;flex-direction:column;gap:1px}
#catalog-count{font-size:11px;margin:0;color:var(--muted)}
#catalog-page{font-size:12px;line-height:1.5;color:var(--ink)}
@media(orientation:portrait){
 #editor.drawer{max-height:62dvh;padding:10px 12px}
 #editor .catalog-controls{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:6px}
 #furniture-category{max-width:none;width:100%;grid-column:1;grid-row:1}
 #editor #close-catalog{grid-column:2;grid-row:1}
 #editor .catalog-search{grid-column:1/-1;grid-row:2}
 #editor .catalog{padding:3px 0;gap:6px}
 #editor .catalog button{font-size:11px;min-height:96px}
 #editor .catalog img{height:58px}
}
@media(orientation:landscape) and (max-height:600px){
 #editor.drawer{max-height:calc(100dvh - 78px);padding:8px 12px;gap:4px}
 #furniture-category{width:190px;max-width:36%}
 #editor .catalog img{height:54px}
 #editor .catalog button{min-height:92px}
}
