/* Phone windows leave at least half the scene visible, including ornate frames.
   Backdrops remain full-screen; only their content panels receive these limits. */
.wardrobe-category-navigation { display:contents; }
.wardrobe-scroll-button[hidden] { display:none !important; }
.social-remove-icon { display:none; }
#characterCreatorWindow :is(.character-creator-hair-card,.character-creator-clothing-card) { touch-action:none; }
.creator-card-touching .character-creator-ear-tint-window { pointer-events:none; }
/* Creator uses its full phone layout, with smaller controls and unchanged option art. */
@media (max-width:720px) {
  #characterCreatorWindow .character-creator-controls { padding:4px 8px 8px; gap:4px; }
  #characterCreatorWindow .character-creator-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; padding-bottom:0; }
  #characterCreatorWindow .character-creator-tab { min-height:24px; height:24px; padding:2px 4px; font-size:8px; }
  #characterCreatorWindow .character-creator-preview-area { padding:8px 8px 0; }
  #characterCreatorWindow .character-creator-preview-frame { display:flex; align-items:flex-start; justify-content:center; width:210px; max-width:100%; height:160px; overflow:hidden; }
  #characterCreatorWindow #characterCreatorPreviewCanvas { width:210px; max-width:100%; margin-top:-15px; flex-shrink:0; }
  #characterCreatorWindow :is(.character-creator-hair-fixed-controls,.character-creator-section,.character-creator-tab-panel,.character-creator-outfit-group) { gap:4px; }
  #characterCreatorWindow :is(.character-creator-option-row,.character-creator-hair-category-tabs) { gap:4px; }
  #characterCreatorWindow :is(.character-creator-option,.character-creator-hair-category-tab) { min-width:48px; min-height:24px; padding:2px 5px; font-size:8px; }
  #characterCreatorWindow .character-creator-section-title { font-size:10px; }
  #characterCreatorWindow .character-creator-hair-category-grid { grid-template-columns:repeat(auto-fill,minmax(100px,1fr)); gap:4px; }
  #characterCreatorWindow .character-creator-hair-card { box-sizing:border-box; min-height:100px; padding:1px; }
  #characterCreatorWindow .character-creator-hair-preview { width:96px; height:96px; flex:0 0 96px; }
  #characterCreatorWindow .character-creator-apply-button { min-height:24px; padding:3px 8px; font-size:8px; }
  #characterCreatorWindow .character-creator-tint-row { flex-wrap:nowrap; gap:4px; }
  #characterCreatorWindow .character-creator-tint-swatch { box-sizing:border-box; flex:0 1 28px; width:28px; min-width:0; height:28px; padding:3px; }
  #characterCreatorWindow .character-creator-tint-swatch-dot { box-sizing:border-box; width:20px; height:20px; flex-shrink:0; }
}
@media (max-width:720px) and (orientation:landscape) {
  #characterCreatorWindow .character-creator-body { flex-direction:row; }
  #characterCreatorWindow .character-creator-preview-area { flex:0 0 30%; min-width:0; box-sizing:border-box; padding:8px; border-bottom:0; border-right:1px solid var(--luma-border-soft); }
  #characterCreatorWindow .character-creator-preview-frame { height:auto; align-items:center; }
  #characterCreatorWindow #characterCreatorPreviewCanvas { margin-top:0; }
}
.settings-diagnostics-controls { display:grid; gap:6px; }
#settingsWindow .settings-diagnostics-controls .diagnostics-copy { width:100%; min-width:0; min-height:28px; margin:0; padding:5px 8px; border-radius:9px; font:500 10px/1.3 var(--luma-font-family); white-space:normal; }
#settingsWindow .settings-diagnostics-footer .diagnostics-copy { grid-column:1 / -1; }
#settingsWindow #logoutButton { display:flex; align-items:center; justify-content:center; text-align:center; font-size:12px; line-height:1.2; }
@media (max-width:700px), (pointer:coarse) and (max-width:900px) {
  :root { --mobile-window-width:calc(90vw - 32px); --mobile-window-height:calc(55dvh - 40px); --mobile-card-scale:.6; --mobile-card-rail-width:52px; }

  body :is(.luma-window-backdrop:not(.character-creator-window) > .luma-panel,
    .luma-slab-home-card, .shop-window > .shop-card, .maid-crafting-window,
    .garden-lot-panel, .returning-guest-card, .creative-catalogue,
    .flower-colour-editor, .headwear-mask-editor, .mannequin-outfit-window,
    .item-sale-panel, .slab-tutorial-card,
    .builder-floor-palette, .builder-wall-palette,
    .shop-purchase-card, #itemContextCard:not(.collecting-front):not(.collecting-back)) {
    box-sizing:border-box;
    min-width:0 !important; min-height:0 !important;
    max-width:var(--mobile-window-width) !important;
    max-height:var(--mobile-window-height) !important;
    font-size:11px;
    overscroll-behavior:contain;
  }
  body :is(.settings-card, .guest-upgrade-card, .visit-home-card, .social-card,
    .profile-card, .friend-confirm-card, .shop-confirm-card,
    .garden-lot-panel, .returning-guest-card, .creative-catalogue,
    .flower-colour-editor, .headwear-mask-editor,
    .item-sale-panel, .wall-paint-card, .shop-purchase-card) {
    padding:10px !important; gap:8px; overflow:auto;
  }
  body :is(.settings-card, .guest-upgrade-card, .visit-home-card, .social-card,
    .profile-card, .friend-confirm-card, .shop-confirm-card,
    .garden-lot-panel, .returning-guest-card, .creative-catalogue,
    .flower-colour-editor, .headwear-mask-editor, .mannequin-outfit-window,
    .item-sale-panel, .wall-paint-card, .shop-purchase-card)
    :is(h1,h2,h3) { font-size:14px; margin-block:4px 7px; }
  body :is(.settings-card, .guest-upgrade-card, .visit-home-card, .social-card,
    .profile-card, .friend-confirm-card, .shop-confirm-card,
    .garden-lot-panel, .returning-guest-card, .creative-catalogue,
    .flower-colour-editor, .headwear-mask-editor, .mannequin-outfit-window,
    .item-sale-panel, .wall-paint-card, .shop-purchase-card) button {
    min-height:32px; padding:5px 8px; font-size:11px;
  }
  body :is(.settings-card, .guest-upgrade-card, .visit-home-card, .social-card,
    .profile-card, .garden-lot-panel, .returning-guest-card,
    .creative-catalogue, .flower-colour-editor, .headwear-mask-editor,
    .mannequin-outfit-window, .item-sale-panel, .wall-paint-card)
    :is(input,select,textarea) { box-sizing:border-box; min-width:0; max-width:100%; }
  #settingsWindow .settings-card { gap:0; overflow:hidden !important; }
  body .garden-lot-panel.garden-sale-panel { padding:6px !important; gap:3px; }
  body .garden-sale-panel > * { flex-shrink:0; }
  body .garden-sale-panel :is(p,label) { font-size:8px; line-height:1.35; }
  body .garden-sale-panel .garden-lot-controls { grid-template-columns:minmax(0,1fr) 72px; gap:6px; }
  body .garden-sale-panel .garden-lot-controls label { gap:3px; }
  body .garden-sale-panel .garden-lot-controls :is(select,input) { height:24px; min-height:24px; padding:3px 6px; font-size:8px; }
  body .garden-sale-panel .garden-lineage-summary { padding:4px 6px; }
  body .garden-sale-panel > [role=status]:empty { display:none; }
  body .garden-sale-panel .garden-sale-actions { gap:6px; }
  body .garden-sale-panel .garden-sale-actions button,
  body .garden-sale-panel > button { min-height:24px; padding:3px 6px; font-size:8px; line-height:1.35; }
  #settingsWindow .settings-card::after { inset:0; }
  #settingsWindow .settings-header { position:relative; isolation:isolate; }
  #settingsWindow .settings-header::before { content:""; position:absolute; inset:-16px -10px -4px; z-index:-1; background:inherit; pointer-events:none; }
  #settingsWindow .settings-header > div { padding-left:6px; }
  #settingsWindow .settings-scroll-content { padding:6px 0; gap:6px; overflow-x:hidden; }
  #settingsWindow .settings-section { flex:0 0 auto; padding:6px; gap:4px; border-radius:12px; }
  #settingsWindow :is(.settings-section-heading,.settings-control-title) { font-size:10px; line-height:1.3; }
  #settingsWindow .settings-control-header { gap:6px; }
  #settingsWindow .settings-control-header > div:first-child { min-width:0; }
  #settingsWindow .settings-control-description { font-size:8px; margin:2px 0 0; line-height:1.35; }
  #settingsWindow .settings-control-value { padding:3px 5px; font-size:8px; }
  #settingsWindow .settings-audio-control { gap:4px; }
  #settingsWindow .settings-audio-control + .settings-audio-control { padding-top:6px; }
  #settingsWindow .settings-slider { box-sizing:border-box; min-height:24px; height:24px; margin:2px 0; padding:0; }
  #settingsWindow .settings-slider::-webkit-slider-thumb { width:18px; height:18px; }
  #settingsWindow .settings-slider::-moz-range-thumb { width:16px; height:16px; }
  #settingsWindow .settings-slider-labels { font-size:8px; }
  #settingsWindow .settings-toggle-row, #settingsWindow .settings-display-controls .settings-toggle-row { min-height:24px; box-sizing:border-box; margin:0; padding:2px 0; gap:5px; font-size:8px; line-height:1.35; }
  #settingsWindow .settings-toggle-row input { flex:0 0 14px; width:14px; height:14px; margin:0; }
  #settingsWindow .settings-display-controls { gap:3px; margin-top:0; }
  #settingsWindow .settings-section button { min-height:24px; padding:3px 6px; font-size:8px; }
  #settingsWindow .settings-diagnostics-controls { gap:4px; }
  #settingsWindow .settings-diagnostics-controls .diagnostics-copy, #settingsWindow .settings-diagnostics-footer .diagnostics-copy { min-height:24px; padding:3px 6px; font-size:8px; }
  #settingsWindow .settings-diagnostics-footer { grid-template-columns:minmax(0,1fr); padding:4px 0 0; gap:0; }
  .profile-body { min-height:0; overflow:auto; gap:8px; }
  .creative-catalogue-list { min-height:0; overflow:auto; }
  .slab-tutorial-card { overflow-y:auto; }
  :is(.builder-floor-palette,.builder-wall-palette) { overflow:auto; padding:8px; }
  .flower-colour-editor > canvas { width:90px; height:90px; flex-shrink:0; }
  .headwear-mask-editor canvas { width:min(100%,140px); height:auto; max-height:none; }
  .mannequin-outfit-window { overflow:auto; }
  .mannequin-outfit-body { gap:8px; padding:8px; }

  /* Preserve four columns, with a smaller header and more room for scrolling. */
  #inventoryWindow .items-card { height:var(--mobile-window-height); }
  #inventoryWindow .items-header { position:relative; isolation:isolate; padding:5px 8px; gap:5px; }
  #inventoryWindow .items-header > div { box-sizing:border-box; padding-left:8px; }
  #inventoryWindow .items-header::before {
    content:""; position:absolute; inset:-16px 0 -4px; z-index:-1;
    background:inherit; pointer-events:none;
  }
  #inventoryWindow .items-title { font-size:16px; }
  #inventoryWindow .items-subtitle { display:none; }
  #inventoryWindow :is(.items-back-button,.items-close-button) { width:32px; height:32px; min-height:32px; }
  #inventoryWindow .items-main-tabs { padding:2px 8px; gap:5px; }
  #inventoryWindow .items-main-tab { height:24px; min-height:24px; padding:2px 8px; font-size:8px !important; }
  #inventoryWindow .items-toolbar { padding:2px 8px; gap:5px; }
  #inventoryWindow .items-filter-wrap { width:80px; flex-basis:80px; }
  #inventoryWindow :is(.items-filter-select,.items-search-input) { height:24px; min-height:24px; padding-block:2px; font-size:8px !important; }
  #inventoryWindow .items-filter-option { box-sizing:border-box; height:24px; min-height:24px; margin-bottom:2px; padding:2px 5px; gap:4px; border-radius:8px; font-size:8px !important; }
  #inventoryWindow .items-filter-menu { box-sizing:border-box; width:90px; padding:4px; border-radius:12px; max-height:min(180px,calc(var(--mobile-window-height) - 80px)); }
  #inventoryWindow .items-view { margin:0 5px 5px; }
  #inventoryWindow :is(.inventory-slot,.inventory-slot.has-garden-colour,.wardrobe-item) { height:auto; min-height:90px; padding:5px 3px; gap:3px; }
  #inventoryWindow :is(.inventory-slot,.inventory-slot.has-garden-colour) { min-height:0; }
  #inventoryWindow :is(.inventory-item-icon,.wardrobe-item-icon) { height:36px; flex-basis:36px; max-width:100%; }
  #inventoryWindow .wardrobe-item-icon { width:52px; height:52px; flex-basis:52px; }
  #inventoryWindow .wardrobe-item-checkmark { width:24px; height:24px; min-width:24px; min-height:24px; top:auto; right:4px; bottom:4px; }
  #inventoryWindow .wardrobe-item { padding-bottom:20px; }
  #inventoryWindow .wardrobe-category-navigation { display:block; position:relative; flex:0 0 auto; padding-inline:22px; }
  #inventoryWindow .wardrobe-tabs { display:flex; flex-wrap:nowrap; width:100%; min-width:0; box-sizing:border-box; gap:4px; padding:2px 0; margin:0; overflow-x:auto; scrollbar-width:none; touch-action:pan-x; }
  #inventoryWindow .wardrobe-tab { flex:0 0 auto; box-sizing:border-box; min-width:64px; height:24px; min-height:24px; padding:2px 6px; font-size:8px; }
  #inventoryWindow .wardrobe-scroll-button { position:absolute; top:2px; width:20px; height:24px; min-height:24px; padding:0; border:1px solid #d4bac8; border-radius:8px; background:#f2e6f0; color:#64434a; font:18px/1 var(--luma-font-family); }
  #inventoryWindow .wardrobe-scroll-button.previous { left:0; }
  #inventoryWindow .wardrobe-scroll-button.next { right:0; }
  #inventoryWindow .inventory-item-name { font-size:9px; }
  #inventoryWindow .inventory-quantity { font-size:9px; padding:2px 4px; }

  /* Visit Homes shares compact navigation, with one scroll area per tab. */
  #visitHomeWindow .visit-home-card { gap:0; overflow:hidden !important; }
  #visitHomeWindow .visit-home-header { position:relative; isolation:isolate; }
  #visitHomeWindow .visit-home-header::before { content:""; position:absolute; inset:-16px -10px -4px; z-index:-1; background:inherit; pointer-events:none; }
  #visitHomeWindow .visit-home-header > div { padding-left:6px; }
  #visitHomeWindow .visit-home-title { font-size:14px !important; line-height:1.2; }
  #visitHomeWindow .visit-home-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:4px 0; background:transparent; }
  #visitHomeWindow .visit-home-tabs button { min-width:0; min-height:24px; height:24px; padding:2px 3px; font-size:8px; white-space:nowrap; }
  #visitHomeWindow .visit-home-tab-panel { padding:6px 0 0; overflow-x:hidden; overscroll-behavior:contain; }
  #visitHomeWindow .home-discovery-list { gap:10px; padding:6px 2px 4px 0; }
  #visitHomeWindow .home-discovery-entry { position:relative; flex:0 0 auto; box-sizing:border-box; min-height:54px; padding:4px 6px; gap:6px; overflow:visible; }
  #visitHomeWindow #publicHomesPanel { box-sizing:border-box; width:calc(100% + 16px); margin-left:-16px; padding-left:16px; }
  #visitHomeWindow .home-discovery-icon { width:44px; height:40px; min-width:0; min-height:0; flex:0 0 44px; }
  #visitHomeWindow .home-discovery-icon.has-portrait { position:static; width:44px; height:40px; flex-basis:44px; }
  #visitHomeWindow .social-portrait { width:48px; height:60px; left:6px; bottom:-2px; }
  #visitHomeWindow .social-portrait:not(.social-portrait-companion) { clip-path:inset(0 0 2px); }
  #visitHomeWindow .social-portrait-companion { --social-companion-ratio:.375; --social-companion-left:6px; --social-companion-bottom:-2px; }
  #visitHomeWindow .home-discovery-name { font-size:10px; line-height:1.3; white-space:normal; overflow-wrap:anywhere; }
  #visitHomeWindow .home-discovery-owner { margin-top:2px; font-size:8px; line-height:1.3; overflow-wrap:anywhere; }
  #visitHomeWindow .home-discovery-presence { margin-top:3px; gap:2px; }
  #visitHomeWindow :is(.home-owner-status,.home-player-count,.home-tag-badge) { font-size:7px; line-height:10px; padding:1px 3px; }
  #visitHomeWindow .home-discovery-visit-button { width:40px; height:24px; min-height:24px; padding:2px 4px; font-size:8px; }
  #visitHomeWindow .home-discovery-empty { padding:12px 6px; font-size:9px; }
  #visitHomeWindow .visit-home-label { display:block; margin:2px 0 4px; font-size:10px; }
  #visitHomeWindow #visitUsernameInput { height:28px; min-height:28px; margin:0 0 6px; padding:4px 6px; font-size:10px; }
  #visitHomeWindow #visitHomeSubmitButton { height:24px; min-height:24px; padding:2px 6px; font-size:8px; }
  #visitHomeWindow :is(.home-name-control,.home-privacy-control,.home-tags-control) { padding:6px; margin-bottom:6px; border-radius:12px; }
  #visitHomeWindow :is(.home-name-label,.home-privacy-description,.home-tags-control > label) { font-size:10px; line-height:1.3; }
  #visitHomeWindow .home-name-form { margin:4px 0 0; gap:4px; }
  #visitHomeWindow .home-name-form input { height:26px; padding:3px 5px; font-size:9px; }
  #visitHomeWindow .home-name-form button { min-height:24px; height:24px; padding:2px 6px; font-size:8px; }
  #visitHomeWindow .home-privacy-options { gap:4px; }
  #visitHomeWindow .home-privacy-button { min-height:48px; padding:4px 2px; gap:2px; font-size:8px; border-radius:10px; }
  #visitHomeWindow .home-privacy-button::before { font-size:12px; }
  #visitHomeWindow .home-privacy-button small { font-size:7px; }
  #visitHomeWindow .home-privacy-button.active::after { width:12px; height:12px; top:-4px; right:-2px; font-size:8px; }
  #visitHomeWindow .home-privacy-hint { margin-top:4px; padding:4px; font-size:8px; line-height:1.35; }
  #visitHomeWindow #homeTagsToggle { min-height:24px; padding:3px 5px; font-size:8px; }
  #visitHomeWindow #homeTagsMenu { padding:3px; }
  #visitHomeWindow #homeTagsMenu label { min-height:24px; box-sizing:border-box; padding:3px; gap:4px; font-size:8px; }
  #visitHomeWindow #homeTagsMenu input { width:12px; height:12px; flex-basis:12px; }
  #visitHomeWindow #homeTagsSave { min-height:24px; padding:2px 6px; font-size:8px; }
  #visitHomeWindow :is(.home-tags-help,.home-name-status,#homeTagsStatus) { margin-block:3px; font-size:8px; line-height:1.35; overflow-wrap:anywhere; }

  /* Mobile Social: fixed navigation above a contained, scrollable card list. */
  #socialWindow .social-card { display:flex; flex-direction:column; overflow:hidden !important; }
  #socialWindow .social-header { position:relative; isolation:isolate; }
  #socialWindow .social-header::before { content:""; position:absolute; inset:-16px -10px -4px; z-index:-1; background:inherit; pointer-events:none; }
  #socialWindow .social-header > div { padding-left:6px; }
  #socialWindow .social-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); flex:0 0 auto; gap:4px; padding:2px 0; margin:0; overflow:visible; }
  #socialWindow .social-tab { box-sizing:border-box; width:100%; min-width:0; height:24px; min-height:24px; padding:2px 4px; font-size:8px; }
  #socialWindow .social-tab-panel { box-sizing:border-box; min-height:0; max-height:none; flex:1 1 auto; width:calc(100% + 16px); padding:4px 0 0 16px; margin:0 0 0 -16px; overflow:hidden; }
  #socialWindow .social-tab-panel:not(.hidden) { display:flex; flex-direction:column; }
  #socialWindow .social-list { display:flex; flex-direction:column; box-sizing:border-box; flex:1 1 auto; height:auto; min-height:0; padding:10px 2px 4px 16px; gap:10px; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; }
  #socialWindow .social-row { box-sizing:border-box; flex:0 0 auto; grid-template-columns:minmax(0,1fr) auto; align-items:center; min-width:0; min-height:54px; padding:6px; gap:4px; }
  #socialWindow .social-row-identity { min-width:0; gap:6px; }
  #socialWindow .social-row-avatar { width:32px; height:32px; flex:0 0 32px; }
  #socialWindow .social-row-avatar.has-portrait { width:32px; height:40px; flex:0 0 32px; }
  #socialWindow .social-portrait { position:static; display:block; width:32px; height:40px; }
  #socialWindow .social-row { position:relative; overflow:visible; }
  #socialWindow .social-row-avatar.has-portrait { position:static; width:44px; flex-basis:44px; }
  #socialWindow .social-portrait { position:absolute; left:6px; bottom:-2px; width:48px; height:60px; }
  #socialWindow .social-portrait:not(.social-portrait-companion) { clip-path:inset(0 0 2px); }
  #socialWindow .social-portrait-companion { --social-companion-ratio:.375; --social-companion-left:6px; --social-companion-bottom:-2px; }
  #socialWindow .social-row-text { min-width:0; }
  #socialWindow .social-row-name { font-size:11px; line-height:1.3; white-space:normal; overflow-wrap:anywhere; }
  #socialWindow .social-row-meta { font-size:8px; line-height:1.3; white-space:normal; overflow-wrap:anywhere; }
  #socialWindow .social-row-actions { width:auto; min-width:0; gap:4px; }
  #socialWindow .social-action-button { box-sizing:border-box; flex:0 0 auto; width:44px; min-width:0; height:24px; min-height:24px; padding:2px 6px; font-size:8px; }
  #socialWindow #socialFriendsList .social-remove-friend { display:grid; place-items:center; width:24px; padding:0; }
  #socialWindow .social-remove-label { display:none; }
  #socialWindow .social-remove-icon { display:block; width:14px; height:14px; }
  #socialWindow .social-empty-state { flex-shrink:0; padding:12px 6px; }
  #socialWindow .social-empty-title { font-size:11px; }
  #socialWindow .social-empty-text { font-size:8px; }
  #removeFriendConfirmWindow .friend-confirm-card { position:relative; isolation:isolate; width:240px; height:auto; background:#fff8ed !important; color:#624a40; }
  #removeFriendConfirmWindow .friend-confirm-card::after {
    content:""; position:absolute; inset:0; z-index:10; box-sizing:border-box;
    border:1px solid transparent;
    border-image:url('assets/UI/ui-luna-slab-frame.png') 150 / 62px / 16px 8px 16px 16px stretch;
    pointer-events:none;
  }
  #removeFriendConfirmWindow .friend-confirm-header { position:relative; isolation:isolate; border:0; background:linear-gradient(135deg,#b7a8e8,#c6b9e6 60%,#ead2dd); }
  #removeFriendConfirmWindow .friend-confirm-header::before { content:""; position:absolute; inset:-16px -10px -4px; z-index:-1; background:inherit; pointer-events:none; }
  #removeFriendConfirmWindow .friend-confirm-title { color:#fff8ff; }
  #removeFriendConfirmWindow .friend-confirm-subtitle { color:#fff8ff; }
  #removeFriendConfirmWindow .friend-confirm-body { padding:10px 4px; background:#fff8ed; }
  #removeFriendConfirmWindow .friend-confirm-name { font-size:12px; line-height:1.3; color:#624a40; }
  #removeFriendConfirmWindow .friend-confirm-message { margin-top:5px; font-size:9px; line-height:1.4; color:#795d58; }
  #removeFriendConfirmWindow .friend-confirm-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:4px 0 0; gap:6px; border:0; background:#fff8ed; }
  #removeFriendConfirmWindow .friend-confirm-actions button { min-width:0; min-height:24px; height:24px; padding:2px 5px; font-size:8px; }

  #lumaSlabWindow .luma-slab-home-card { padding:8px; }
  #lumaSlabWindow .luma-slab-phone-content { box-sizing:border-box; max-height:calc(var(--mobile-window-height) - 16px); min-height:0; overflow-y:auto; }
  #lumaSlabWindow .luma-slab-home-header { min-height:44px; gap:5px; }
  #lumaSlabWindow .luma-slab-move-strip { min-height:40px; }
  #lumaSlabWindow .luma-slab-brand { font-size:14px; }
  #lumaSlabWindow :is(.luma-slab-app-grid,.luma-slab-travel-grid) { gap:4px; margin-block:4px; }
  #lumaSlabWindow :is(.luma-slab-app-grid,.luma-slab-travel-grid) button { height:56px; min-height:56px; min-width:0; padding:3px; gap:2px; font-size:9px; border-radius:12px; }
  #lumaSlabWindow :is(.luma-slab-app-grid,.luma-slab-travel-grid) button > span { font-size:20px; line-height:24px; }
  #lumaSlabWindow .luma-slab-travel-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #lumaSlabWindow .luma-slab-travel-grid #lumaSlabGoHome { grid-column:1 / -1; width:100%; min-height:56px; }
  #lumaSlabWindow .luma-slab-button-icon { width:24px !important; height:24px !important; }
  /* Narrow home menu: two app rows, Go Home, then the two travel choices. */
  #lumaSlabWindow:not(.showing-outfit):not(.showing-journal) .luma-slab-home-card { width:168px; padding-top:16px; }
  #lumaSlabWindow:not(.showing-outfit):not(.showing-journal) .luma-slab-phone-content { padding-bottom:4px; }
  #lumaSlabWindow:not(.showing-outfit):not(.showing-journal) .luma-slab-home-header { padding:0; margin-bottom:4px; min-height:32px; gap:3px; }
  #lumaSlabWindow:not(.showing-outfit):not(.showing-journal) .luma-slab-move-strip { min-height:32px; gap:2px; }
  #lumaSlabWindow:not(.showing-outfit):not(.showing-journal) .luma-slab-brand { font-size:14px; white-space:nowrap; }
  #lumaSlabWindow:not(.showing-outfit):not(.showing-journal) .luma-slab-brand-tagline { font-size:5px; letter-spacing:0; }
  #lumaSlabWindow:not(.showing-outfit):not(.showing-journal) :is(#lumaSlabSettings,#lumaSlabClose) {
    width:32px !important; height:32px !important; min-width:32px !important; min-height:32px !important; flex-basis:32px !important;
  }
  #lumaSlabWindow:not(.showing-outfit):not(.showing-journal) #lumaSlabSettings img { width:32px; height:32px; }
  /* Four square equipment rows keep every slot in view on a 360x640 phone. */
  #lumaSlabWindow.showing-outfit .luma-slab-home-card { width:196px; }
  #lumaSlabWindow.showing-outfit .luma-slab-phone-content { padding-bottom:4px; }
  #lumaSlabWindow.showing-outfit .luma-slab-home-header { padding:4px; margin-bottom:6px; min-height:40px; }
  #lumaSlabWindow.showing-outfit .luma-slab-move-strip { min-height:32px; }
  #lumaSlabWindow.showing-outfit .luma-slab-brand { font-size:14px; }
  #lumaSlabWindow.showing-outfit .luma-slab-brand-tagline { font-size:5px; letter-spacing:0; }
  #lumaSlabWindow.showing-outfit :is(#lumaSlabOutfitBack,#lumaSlabSettings,#lumaSlabClose) {
    width:32px !important; height:32px !important; min-width:32px !important; min-height:32px !important; flex-basis:32px !important;
  }
  #lumaSlabWindow.showing-outfit #lumaSlabSettings img { width:32px; height:32px; }
  #lumaSlabWindow.showing-outfit .luma-slab-outfit-slots { grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; }
  #lumaSlabWindow.showing-outfit .luma-slab-outfit-slot { aspect-ratio:1; height:auto; min-height:0; padding:3px; gap:2px; border-radius:12px; }
  #lumaSlabWindow.showing-outfit .luma-slab-outfit-icon { width:22px; height:22px; font-size:16px; }
  #lumaSlabWindow.showing-outfit .luma-slab-outfit-slot > span:last-child { min-width:0; max-width:100%; }
  #lumaSlabWindow.showing-outfit .luma-slab-outfit-slot strong { margin:0; font-size:9px; line-height:11px; }
  #lumaSlabWindow.showing-outfit .luma-slab-outfit-slot > span > span { font-size:8px; line-height:10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  /* Journal keeps its header and tabs visible while each checklist scrolls. */
  #lumaSlabWindow.showing-journal .luma-slab-home-card { height:min(340px,var(--mobile-window-height)); }
  #lumaSlabWindow.showing-journal .luma-slab-phone-content { display:flex; flex-direction:column; height:100%; max-height:none; overflow:hidden; padding-bottom:0; }
  #lumaSlabWindow.showing-journal .luma-slab-home-header { flex:0 0 auto; }
  #lumaSlabJournal:not(.hidden) { display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }
  #lumaSlabJournal .luma-slab-journal-tabs { flex:0 0 auto; gap:4px; margin:0 0 4px; }
  #lumaSlabJournal .luma-slab-journal-tabs button { height:24px; min-height:24px; padding:2px 4px; font-size:8px; }
  #lumaSlabJournal .luma-slab-journal-panel { flex:1 1 auto; min-height:0; padding:6px; overflow-y:auto; overscroll-behavior:contain; }
  #lumaSlabJournal .luma-slab-journal-panel h3 { margin:0 0 4px; font-size:10px; line-height:1.3; }
  #lumaSlabJournal .luma-slab-journal-panel p { margin:4px 0; font-size:9px; line-height:1.35; }
  #lumaSlabJournal .journal-collection { display:flex; flex-direction:column; overflow:hidden; }
  #lumaSlabJournal .journal-collection[hidden] { display:none; }
  #lumaSlabJournal .journal-collection-progress { flex:0 0 auto; height:12px; gap:4px; margin-bottom:4px; }
  #lumaSlabJournal .journal-collection-progress span { font-size:8px; line-height:12px; }
  #lumaSlabJournal .journal-collection-progress progress { height:6px; }
  #lumaSlabJournal .journal-collection-layout { flex:1 1 auto; height:auto; min-height:0; gap:4px; }
  #lumaSlabJournal .journal-collection-types { gap:3px; padding-bottom:3px; }
  #lumaSlabJournal .journal-collection-types button { min-height:24px; height:24px; padding:2px 5px; font-size:8px; white-space:nowrap; }
  #lumaSlabJournal .journal-collection-results { overflow:hidden; }
  #lumaSlabJournal .journal-collection-list { grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; }
  body #journalCollectionList .journal-collection-card { height:76px; padding:3px 2px !important; gap:2px; }
  #lumaSlabJournal .journal-collection-card .journal-collection-icon { height:32px; flex-basis:32px; font-size:24px; }
  #lumaSlabJournal .journal-collection-card .journal-collection-name { min-height:20px; font-size:8px; line-height:10px; }
  #lumaSlabJournal .journal-collection-seen { font-size:8px; line-height:10px; }
  #lumaSlabJournal #journalCollectionStatus { font-size:8px; margin:0 0 4px; }
  #lumaSlabJournal .luma-slab-journal-checklist { display:flex; flex-direction:column; gap:4px; }
  #lumaSlabJournal .journal-task { gap:3px; padding:6px; font-size:8px; line-height:1.3; }
  #lumaSlabJournal .journal-task strong { font-size:10px; }
  #lumaSlabJournal .journal-task-reward img { width:12px; height:12px; }
  #lumaSlabJournal .journal-task-progress { font-size:8px; line-height:1.35; }

  .shop-window .shop-header, .crafting-shop .crafting-header { padding:7px 10px; gap:6px; }
  .shop-window .shop-title, .crafting-shop .crafting-header h2 { margin:0; font-size:15px; }
  .shop-window .shop-content { padding:0 7px 7px; min-height:0; overflow:auto; gap:7px; }
  .crafting-shop .crafting-body { padding:7px; gap:7px; }
  .shop-window .shop-item-preview { width:36px; height:36px; flex-basis:36px; }
  .crafting-shop .crafting-grid .inventory-slot { min-height:90px; }
  .crafting-shop .crafting-grid .inventory-item-icon { width:36px; height:36px; flex-basis:36px; }
  .shop-window .shop-item-name, .crafting-shop .inventory-item-name { font-size:9px; }
  body #shopPurchaseCard { padding:8px !important; gap:4px; }
  #shopPurchaseCard > * { flex-shrink:0; }
  #shopPurchaseCard .shop-purchase-heading { flex-direction:row; gap:6px; padding:0 36px 0 0; }
  #shopPurchaseCard .shop-purchase-preview { width:48px; height:52px; flex:0 0 48px; }
  #shopPurchaseCard .shop-purchase-title-group { width:auto; min-width:0; text-align:left; }
  #shopPurchaseCard .shop-purchase-name { font-size:14px; }
  #shopPurchaseCard :is(.shop-purchase-meta,.shop-purchase-description,.shop-purchase-status,.shop-purchase-quantity-label) { font-size:8px; line-height:1.35; }
  #shopPurchaseCard .shop-purchase-description { margin:0; }
  #shopPurchaseCard #shopPurchaseCloseButton { top:8px; right:8px; }
  #shopPurchaseCard .shop-purchase-quantity-section { padding:4px 0; gap:6px; }
  #shopPurchaseCard .shop-purchase-quantity-controls { gap:4px; }
  #shopPurchaseCard .shop-purchase-quantity-button { width:24px; height:24px; min-height:24px; padding:0; font-size:16px; }
  #shopPurchaseCard .shop-purchase-quantity-input { width:44px; height:24px; min-height:24px; padding:2px 4px; font-size:8px; }
  #shopPurchaseCard .shop-purchase-total-row { padding:2px 0; gap:4px; }
  #shopPurchaseCard .shop-purchase-total-row > span { font-size:8px; }
  #shopPurchaseCard .shop-purchase-total-row strong { font-size:12px; }
  #shopPurchaseCard .shop-purchase-total-row .luma-inline-crown-icon { width:14px; height:18px; flex:0 0 14px; }
  #shopPurchaseCard #shopPurchaseButton { min-height:24px; margin:0; padding:3px 6px; font-size:8px; }
  #shopPurchaseCard .shop-purchase-color-entry { padding:4px; gap:4px; margin:0; }
  #shopPurchaseCard .shop-purchase-color-swatch { width:20px; height:20px; flex-basis:20px; }
  #shopPurchaseCard .shop-purchase-color-hex { font-size:8px; }
  #shopPurchaseCard #shopPurchaseChangeColorButton { min-height:24px; padding:3px 6px; font-size:8px; gap:4px; }
  body #shopPurchaseConfirmWindow.simple-purchase-confirmation .shop-confirm-card { padding:8px !important; gap:4px; }
  #shopPurchaseConfirmWindow.simple-purchase-confirmation .shop-confirm-item { padding:2px 0; }
  #shopPurchaseConfirmWindow.simple-purchase-confirmation .shop-confirm-item-name { font-size:10px; line-height:1.35; }
  #shopPurchaseConfirmWindow.simple-purchase-confirmation .shop-confirm-prompt-crown .luma-inline-crown-icon { width:14px; height:18px; }
  #shopPurchaseConfirmWindow.simple-purchase-confirmation .shop-confirm-actions { margin-top:4px; gap:6px; }
  #shopPurchaseConfirmWindow.simple-purchase-confirmation :is(.shop-confirm-cancel-button,.shop-confirm-purchase-button) { min-height:24px; padding:3px 6px; font-size:8px; }

  /* Scale the art as a whole. The separate action rail keeps its physical size. */
  body :is(#itemContextCard,.item-card-fade-copy):is(.collecting-front,.collecting-back) {
    zoom:var(--mobile-card-scale) !important;
    width:calc(280px + var(--mobile-card-rail-width) / var(--mobile-card-scale)); height:420px;
    max-width:none; max-height:none;
  }
  body :is(#itemContextCard,.item-card-fade-copy):is(.collecting-front,.collecting-back) .item-context-close {
    left:calc(280px + 8px / var(--mobile-card-scale)); top:0;
    width:calc(44px / var(--mobile-card-scale)) !important; min-width:0 !important;
    height:calc(32px / var(--mobile-card-scale)) !important; font-size:calc(12px / var(--mobile-card-scale)) !important;
  }
  body :is(#itemContextCard,.item-card-fade-copy):is(.collecting-front,.collecting-back) .item-context-actions {
    left:calc(280px + 8px / var(--mobile-card-scale)); top:calc(38px / var(--mobile-card-scale)) !important;
    width:calc((var(--mobile-card-rail-width) - 8px) / var(--mobile-card-scale)) !important; max-height:calc(420px - 38px / var(--mobile-card-scale)); gap:calc(4px / var(--mobile-card-scale)); padding:0;
  }
  body :is(#itemContextCard,.item-card-fade-copy):is(.collecting-front,.collecting-back) .item-context-actions button {
    width:100% !important; flex:0 0 auto !important; height:calc(32px / var(--mobile-card-scale)) !important; min-height:calc(32px / var(--mobile-card-scale)) !important; font-size:calc(10px / var(--mobile-card-scale));
  }
  body :is(#itemContextCard,.item-card-fade-copy):is(.collecting-front,.collecting-back) .item-context-actions.luma-action-ribbon button[data-action=inspect] { position:relative !important; top:auto !important; left:auto !important; font-size:calc(20px / var(--mobile-card-scale)); }
  body :is(#itemContextCard,.item-card-fade-copy):is(.collecting-front,.collecting-back) .luma-action__icon { font-size:calc(20px / var(--mobile-card-scale)) !important; }

  .npc-dialogue-overlay .npc-dialogue-stage {
    box-sizing:border-box; align-self:center; justify-self:center; margin:auto;
    width:var(--mobile-window-width); height:var(--mobile-window-height);
    grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto;
    padding:0; gap:0; overflow:visible;
  }
  .npc-dialogue-overlay .npc-dialogue-art-panel { grid-column:1; grid-row:1; justify-content:center; margin-bottom:-14px; min-height:0; }
  .npc-dialogue-overlay .npc-dialogue-art {
    --npc-dialogue-art-x:0px; --npc-dialogue-art-y:0px;
    width:auto; height:100%; max-height:100%; max-width:100%; object-fit:contain; object-position:center bottom;
  }
  .npc-dialogue-overlay .npc-dialogue-content { grid-column:1; grid-row:2; min-width:0; width:100%; max-width:100%; gap:6px; padding:0; }
  .npc-dialogue-overlay .npc-dialogue-bubble { box-sizing:border-box; width:100%; min-height:0; max-width:100%; padding:10px; }
  .npc-dialogue-overlay .npc-dialogue-name { font-size:10px; margin-bottom:4px; }
  .npc-dialogue-overlay .npc-dialogue-text { font-size:10px; line-height:1.4; max-height:calc(var(--mobile-window-height) * .46); overflow-y:auto; }
  .npc-dialogue-overlay .npc-dialogue-primary-button { box-sizing:border-box; width:100%; min-width:0; min-height:32px; padding:7px 10px; font-size:10px; margin:0; }

  /* Mimi fills the tall portrait area, with her dialogue in front. */
  .npc-dialogue-overlay.mimi-dialogue .npc-dialogue-stage {
    height:84dvh; max-height:calc(100dvh - 24px);
    margin:auto auto max(12px,3dvh); grid-template-rows:minmax(0,1fr);
  }
  .npc-dialogue-overlay.mimi-dialogue .npc-dialogue-art-panel { grid-row:1; margin-bottom:0; }
  .npc-dialogue-overlay.mimi-dialogue .npc-dialogue-art { height:100%; max-width:none; }
  .npc-dialogue-overlay.mimi-dialogue .npc-dialogue-content { grid-row:1; align-self:end; }

  /* Share the approved Slab header spacing across phone windows. */
  body :is(.luma-window-backdrop:not(.character-creator-window) > .luma-panel, .luma-slab-home-card,
    .shop-window > .shop-card, .maid-crafting-window, .garden-lot-panel,
    .creative-catalogue, .flower-colour-editor, .headwear-mask-editor,
    .mannequin-outfit-window, .item-sale-panel) { padding-top:16px !important; }
  body :is(.luma-window-header:not(.character-creator-header), .shop-header, .shop-confirm-header, .friend-confirm-header,
    .luma-slab-home-header, .crafting-header, .garden-lot-panel > header,
    .flower-colour-editor > header, .headwear-mask-editor > header,
    .mannequin-outfit-window > header, .item-sale-header, .creative-catalogue-header) {
    display:flex; align-items:center; flex-wrap:nowrap; box-sizing:border-box;
    min-height:32px !important; gap:4px !important; padding:0 !important; margin:0 0 4px !important;
    flex-shrink:0;
  }
  body :is(.luma-window-header:not(.character-creator-header), .shop-header, .shop-confirm-header, .friend-confirm-header,
    .luma-slab-home-header, .crafting-header, .garden-lot-panel > header,
    .flower-colour-editor > header, .headwear-mask-editor > header,
    .mannequin-outfit-window > header, .item-sale-header, .creative-catalogue-header)
    > :is(div,h2,strong) { min-width:0; flex:1; }
  body :is(.luma-window-header:not(.character-creator-header), .shop-header, .shop-confirm-header, .friend-confirm-header,
    .luma-slab-home-header, .crafting-header, .garden-lot-panel > header,
    .flower-colour-editor > header, .headwear-mask-editor > header,
    .mannequin-outfit-window > header, .item-sale-header, .creative-catalogue-header)
    :is(.luma-window-title,.shop-title,.shop-confirm-title,.friend-confirm-title,h2,strong) {
    margin:0 !important; font-size:14px !important; font-weight:700; line-height:1.2;
    overflow-wrap:anywhere;
  }
  body :is(.luma-window-header:not(.character-creator-header), .shop-header, .shop-confirm-header, .friend-confirm-header,
    .luma-slab-home-header) :is(.luma-window-subtitle,.shop-subtitle,
    .shop-confirm-subtitle,.friend-confirm-subtitle,.luma-slab-brand-tagline) {
    display:block !important; margin:2px 0 0 !important; font-size:5px !important;
    line-height:1.4; letter-spacing:0; text-transform:uppercase; overflow-wrap:anywhere;
  }
  body #lumaSlabWindow .luma-slab-move-strip { min-height:32px; gap:0; }
  body :is(.luma-window-header:not(.character-creator-header), .shop-header, .shop-confirm-header, .friend-confirm-header,
    .luma-slab-home-header, .crafting-header, .garden-lot-panel > header,
    .flower-colour-editor > header, .headwear-mask-editor > header,
    .mannequin-outfit-window > header, .item-sale-header, .creative-catalogue-header) > button {
    display:grid; place-items:center; box-sizing:border-box;
    width:32px !important; height:32px !important; min-width:32px !important; min-height:32px !important;
    flex:0 0 32px !important; margin:0 !important; padding:0 !important;
    border-radius:10px !important; font-size:18px !important; line-height:1 !important;
    background:var(--slab-button,#f2e6f0) !important; color:#514254 !important;
    border:1px solid #ffffffad; box-shadow:inset 0 1px 0 #fff,0 2px 5px #60493520;
  }
  body #lumaSlabWindow .luma-slab-home-header .luma-slab-back { display:none !important; }
  body #lumaSlabWindow.showing-outfit #lumaSlabOutfitBack,
  body #lumaSlabWindow.showing-journal #lumaSlabJournalBack { display:grid !important; }
  body :is(#inventoryWindow .items-header,.shop-window .shop-header,.crafting-shop .crafting-header) {
    padding-inline:8px !important;
  }
  /* Keep worded editor actions readable; icon controls use the square size. */
  body :is(.headwear-mask-editor > header,.creative-catalogue-header) > button {
    width:auto !important; flex:0 0 auto !important; padding:0 6px !important; font-size:11px !important;
  }
}
@media (orientation:landscape) and (max-width:700px), (orientation:landscape) and (pointer:coarse) and (max-width:900px) {
  :root { --mobile-window-width:calc(70vw - 32px); --mobile-window-height:calc(70dvh - 40px); }
  body :is(#itemContextCard,.item-card-fade-copy):is(.collecting-front,.collecting-back) .item-context-actions.luma-action-ribbon { width:calc(44px / var(--mobile-card-scale)) !important; }
  body :is(#itemContextCard,.item-card-fade-copy):is(.collecting-front,.collecting-back) .item-context-actions.luma-action-ribbon:has(> button:nth-child(5)) { display:grid !important; grid-template-columns:repeat(2,minmax(0,1fr)); width:calc(88px / var(--mobile-card-scale)) !important; }
  /* A side portrait leaves room for the bubble on short landscape screens. */
  .npc-dialogue-overlay .npc-dialogue-stage { grid-template-columns:minmax(0,1fr) minmax(0,2fr); grid-template-rows:minmax(0,1fr); gap:12px; }
  .npc-dialogue-overlay .npc-dialogue-art-panel { grid-column:1; margin-bottom:0; }
  .npc-dialogue-overlay .npc-dialogue-content { grid-column:2; grid-row:1; }
}

/* Plain shop catalogues use their own content height, as the creator does. */
@media (max-width:700px), (pointer:coarse) and (max-width:900px) {
  body :is(#furnitureShopWindow, #clothingShopWindow).shop-window > .shop-card {
    max-width:calc(100vw - 20px) !important;
    max-height:calc(100dvh - 20px) !important;
    padding:0 !important;
  }
  body :is(#furnitureShopWindow, #clothingShopWindow) .shop-header {
    padding:10px 12px !important; margin:0 !important;
  }
  body :is(#furnitureShopWindow, #clothingShopWindow) .shop-header .shop-title {
    font-size:17px !important; text-shadow:none;
  }
  body :is(#furnitureShopWindow, #clothingShopWindow) .shop-header .shop-subtitle {
    font-size:8px !important; text-shadow:none;
  }
}
@media(max-width:720px){
 #visitHomeWindow .home-discovery-entry{min-height:54px;padding:6px;gap:6px}
 #visitHomeWindow .home-discovery-icon.has-portrait{min-width:44px;min-height:40px}
 #visitHomeWindow .home-discovery-name{font-size:11px;line-height:1.3}
 #visitHomeWindow .home-discovery-meta{gap:2px 4px;margin-top:2px;font-size:8px;line-height:1.3}
 #visitHomeWindow .home-discovery-owner{font-size:8px}
 #visitHomeWindow :is(.home-owner-status,.home-player-count,.home-tag-badge){font-size:7px;line-height:10px;padding:1px 3px}
 #visitHomeWindow .home-discovery-visit-button{width:40px;height:24px;min-height:24px;padding:2px 4px;font-size:8px}
}

@media(max-width:600px){#socialWindow .social-tabs {grid-template-columns:repeat(4,minmax(0,1fr));}#socialWindow #socialSettingsPanel {overflow-y:auto;display:block;}#socialWindow #socialSettingsPanel.hidden {display:none;}}
