:root {
  --ink: #172127;
  --muted: #68747b;
  --paper: #ffffff;
  --canvas: #e9e8e4;
  --line: #dce2df;
  --green: #168562;
  --green-dark: #0d654a;
  --green-soft: #eaf5f1;
  --blue: #2b91f5;
  --danger: #b93939;
  --shadow: 0 18px 48px rgba(24, 45, 36, .10);
  --toolbar-height: 58px;
  --dock-height: 72px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-anchor: none; background: #f4f5f3; color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; }
body { min-width: 320px; }
body.mobile-save-open { overflow: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.share-notice-mobile { display: none; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.app-shell { min-height: 100vh; }
body.editor-active { overflow: hidden; }
body.editor-active .app-shell { height: var(--editor-viewport-height, 100dvh); min-height: 0; }

/* Scelta dell'ambiente */
.room-view { min-height: 100vh; background: linear-gradient(180deg, #fff 0, #f4f5f3 420px); }
.room-topbar { height: 72px; padding: 0 clamp(18px, 4vw, 58px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(215, 222, 218, .82); background: rgba(255, 255, 255, .94); }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { width: 198px; height: auto; display: block; }
.room-topbar-actions { display: flex; align-items: center; gap: 10px; }
.language-switcher { padding: 3px; display: flex; align-items: center; gap: 3px; border: 1px solid #d9e1dd; border-radius: 999px; background: #f7f9f8; }
.language-button { width: 37px; height: 29px; padding: 4px 5px; display: grid; place-items: center; overflow: hidden; border: 1px solid transparent; border-radius: 999px; background: transparent; color: inherit; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.language-button:hover, .language-button:focus-visible { border-color: #8cb8a4; background: #fff; outline: none; }
.language-button[aria-pressed="true"] { border-color: rgba(13,101,74,.46); background: #fff; box-shadow: 0 2px 7px rgba(22,74,53,.15); }
.language-flag { width: 23px; height: 15px; display: block; overflow: hidden; border-radius: 2px; box-shadow: 0 0 0 1px rgba(20,30,26,.18); stroke: none; }
.cloud-badge { min-height: 30px; padding: 7px 10px; display: flex; align-items: center; gap: 7px; border-radius: 999px; background: #eef3f0; color: #617069; font-size: 10px; font-weight: 700; }
.cloud-badge > span { width: 7px; height: 7px; border-radius: 50%; background: #9ca8a2; }
.cloud-badge.ready > span { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 133, 98, .12); }
.cloud-badge.warning > span { background: #d79233; }

.room-page { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 58px; }
.room-page-heading { max-width: 760px; margin: 0 auto 30px; text-align: center; }
.eyebrow { margin: 0 0 9px; color: var(--green-dark); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.room-page-heading h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; letter-spacing: -.045em; }
.room-page-heading > p:last-child { margin: 13px auto 0; color: var(--muted); font-size: 15px; }
.room-source { max-width: 1140px; margin: 0 auto; }

.analysis-mode { max-width: 450px; margin: 0 auto 14px; padding: 4px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.analysis-mode legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.analysis-mode-card { min-width: 0; padding: 9px 12px; display: flex; justify-content: center; border-radius: 8px; color: #5b6862; cursor: pointer; }
.analysis-mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.analysis-mode-card strong { font-size: 11px; }
.analysis-mode-card em { margin-left: 3px; padding: 2px 4px; border-radius: 4px; background: #dcefe7; color: var(--green-dark); font-size: 8px; font-style: normal; text-transform: uppercase; }
.analysis-mode-card.active { background: var(--green-soft); color: var(--green-dark); }


.drop-zone { border: 1.5px dashed #b8c6bf; background: #fbfcfb; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.drop-zone.dragging { border-color: var(--green); background: #edf7f3; transform: translateY(-1px); }
.room-upload-card { max-width: 760px; min-height: 196px; margin: 0 auto 34px; padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border-radius: 18px; text-align: center; }
.room-upload-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); }
.room-upload-icon svg { width: 24px; height: 24px; }
.room-upload-card > strong { margin-top: 2px; font-size: 16px; }
.room-upload-card > span:not(.room-upload-icon) { color: var(--muted); font-size: 11px; }
.drop-actions { margin-top: 10px; display: flex; gap: 9px; }
button.primary, button.secondary { min-height: 38px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 750; }
button.primary { border-color: var(--green); background: var(--green); color: #fff; }
button.primary:hover:not(:disabled) { border-color: var(--green-dark); background: var(--green-dark); }
button.secondary:hover:not(:disabled) { border-color: #a8b7af; background: #f7f9f8; }
button.full-width { width: 100%; margin-top: 10px; }

.photo-loaded { max-width: 760px; margin: 0 auto 22px; }
.photo-loaded:not(.hidden) { padding: 10px; display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 11px; border: 1px solid #cfe3d9; border-radius: 12px; background: #f1f8f5; }
.photo-thumb { width: 72px; height: 56px; object-fit: cover; border-radius: 8px; background: #e9eeeb; }
.photo-loaded-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.photo-loaded-copy strong { color: var(--green-dark); font-size: 11px; }
.photo-loaded-copy > span { overflow: hidden; color: #526159; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.photo-loaded-copy small { color: var(--muted); font-size: 9px; }
.loaded-check { display: inline-grid; width: 16px; height: 16px; margin-right: 3px; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 10px; }
button.photo-change { min-height: 34px; padding: 7px 10px; }
.file-chip { min-width: 0; overflow: hidden; color: #273c34; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
#photoName { display: none; }

.room-picker { display: flex; flex-direction: column; gap: 30px; }
.room-library-heading { margin-bottom: 13px; }
.room-library-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.room-library-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.room-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.room-card-shell { position: relative; min-width: 0; }
button.room-card { width: 100%; min-width: 0; padding: 0; overflow: hidden; display: block; border: 1px solid #dce3df; border-radius: 13px; background: #fff; color: var(--ink); text-align: left; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
button.room-card:hover:not(:disabled), button.room-card:focus-visible { border-color: #81ae9a; box-shadow: 0 11px 27px rgba(25, 68, 50, .11); transform: translateY(-2px); outline: none; }
.room-card-media { width: 100%; aspect-ratio: 4 / 5; display: block; overflow: hidden; background: #ebefed; }
.room-card-media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.room-card-copy { min-width: 0; padding: 10px 11px 11px; display: flex; flex-direction: column; }
.room-card-title { overflow: hidden; font-size: 11px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.room-card-meta { color: var(--muted); font-size: 9px; }
button.room-delete { position: absolute; top: 7px; right: 7px; width: 29px; height: 29px; padding: 0; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(25,37,31,.76); color: #fff; font-size: 16px; box-shadow: 0 3px 10px rgba(0,0,0,.16); }
button.room-delete:hover, button.room-delete:focus-visible { background: var(--danger); outline: 2px solid #fff; }
.room-grid-loading { grid-column: 1 / -1; padding: 18px; border: 1px dashed #cbd7d1; border-radius: 11px; color: var(--muted); font-size: 11px; text-align: center; }

/* Visualizzatore */
.editor-view { position: relative; height: 100dvh; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 292px minmax(0, 1fr); background: #eeece6; }
.catalog-panel { min-width: 0; min-height: 0; padding: 12px 16px; display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: contain; border-right: 1px solid #e4e5df; background: #fdfcfb; }
.catalog-panel > .catalog-brand, .catalog-panel > .catalog-heading, .catalog-panel > .catalog-upload { flex: 0 0 auto; }
.catalog-brand { min-height: 46px; padding: 0 3px 12px; display: flex; align-items: center; border-bottom: 1px solid #e7e7e1; }
.catalog-brand-link { width: fit-content; }
.catalog-brand-logo { width: 180px; }
.catalog-heading { padding: 16px 0 12px; }
.catalog-title-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.catalog-heading h1 { margin: 0; font-size: 18px; letter-spacing: -.03em; }
.catalog-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.favorites-toggle { position: relative; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid #dbe2de; border-radius: 50%; background: #fff; color: #33423c; transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease; }
.favorites-toggle:hover, .favorites-toggle:focus-visible { border-color: #db7a86; background: #fff5f6; color: #dc344a; outline: none; transform: translateY(-1px); }
.favorites-toggle[aria-pressed="true"] { border-color: #e25769; background: #fff0f2; color: #df3149; }
.favorites-toggle[aria-pressed="true"] svg { fill: #df3149; stroke: #df3149; }
.favorites-count { position: absolute; top: -4px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 999px; background: #313c37; color: #fff; font-size: 8px; font-weight: 800; line-height: 1; }
.favorites-count.empty { display: none; }
.catalog-library { flex: 1 1 auto; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; min-width: 0; min-height: 0; }
.catalog-navigation { display: grid; gap: 4px; min-width: 0; }
.catalog-collection-title { margin: 0; padding: 8px 2px 2px; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 650; overflow-wrap: anywhere; }
#catalogCollectionCount { font-size: 11px; font-weight: 450; color: #596660; }
.wallpaper-catalog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; scrollbar-width: thin; }
.catalog-search-label { display: block; margin: 12px 0 5px; font-size: 10px; }
.catalog-search { width: 100%; min-width: 0; padding: 10px 10px 10px 34px; border: 1px solid #dfe3de; border-radius: 9px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23515f58' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='6.5'/%3E%3Cpath d='m15 15 6 6'/%3E%3C/svg%3E") 10px center / 17px 17px no-repeat; color: var(--ink); font-size: 12px; }
.catalog-search:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.catalog-notice { padding: 10px 12px; border: 1px solid #cce2d7; border-radius: 8px; background: #f1f8f4; color: #285740; font-size: 11px; line-height: 1.5; }
.catalog-notice-error { background: #fff7ee; border-color: #e9cda9; color: #78532b; }
.catalog-heading p.catalog-notice { margin-top: 12px; }
.catalog-empty { grid-column: 1 / -1; padding: 24px 13px; border: 1px dashed #cbd5d0; border-radius: 11px; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: center; }
.catalog-browse { width: 100%; min-width: 0; min-height: 84px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: 1px solid #d5e3dc; border-radius: 11px; background: #f0f6f2; color: var(--green-dark); text-align: left; transition: background .18s ease, border-color .18s ease; }
.catalog-browse:hover { border-color: #85ac99; background: #e9f2ec; }
.catalog-browse:active { background: #e0ece4; }
.collection-selector-media { width: 30px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; }
.collection-selector-media svg { width: 28px; height: 28px; }
.collection-selector-media img { display: none; width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.collection-selector-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.collection-selector-copy small { font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: #596960; }
.collection-selector-copy strong { color: #1f3027; font-size: 15px; line-height: 19px; overflow-wrap: anywhere; }
.collection-selector-copy > span { font-size: 11px; line-height: 15px; font-weight: 450; }
.catalog-browse .collection-selector-chevron { flex: 0 0 18px; width: 18px; height: 18px; }
.catalog-browse:focus-visible, .collection-card:focus-visible, .collection-nav:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
body.collections-open { overflow: hidden; }
.collection-browser { position: fixed; inset: 0; width: min(460px, calc(100vw - 40px)); height: fit-content; max-width: none; max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 1px solid #e2e2dc; border-radius: 16px; background: #fdfcfb; color: var(--ink); box-shadow: 0 18px 54px rgba(25,34,27,.16); }
.collection-browser[open] { display: flex; flex-direction: column; animation: collectionDialogIn .24s ease both; }
.collection-browser::backdrop { background: rgba(22,28,23,.32); }
.collection-sheet-handle { display: none; }
.collection-browser-header { flex: 0 0 auto; padding: 20px 20px 14px; display: flex; align-items: flex-start; gap: 12px; }
.collection-browser-header > div { flex: 1; min-width: 0; }
.collection-browser-header h2 { margin: 0 0 9px; font-size: 22px; font-weight: 650; letter-spacing: -.025em; }
.collection-browser-header p { margin: 0; font-size: 12px; line-height: 1.5; color: #68716c; }
.collection-nav { flex: 0 0 44px; width: 44px; height: 44px; padding: 11px; border: 1px solid #e1e4df; border-radius: 50%; background: transparent; color: var(--ink); }
.collection-nav svg { width: 20px; height: 20px; }
.collection-nav:hover { background: #eef3ef; }
.collection-browser-content { min-height: 0; padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.collection-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.collection-card { position: relative; min-width: 0; min-height: 140px; padding: 5px; display: grid; grid-template-columns: 43% minmax(0, 1fr) 20px; align-items: center; gap: 15px; border: 1px solid #e2e3dd; border-radius: 12px; background: #fdfcfb; color: var(--ink); text-align: left; transition: background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.collection-card:hover { border-color: #80a58f; background: #f3f6f1; }
.collection-card:active { background: #e6eee8; }
.collection-card.selected { border-color: var(--green-dark); background: #f3f8f4; }
.collection-cover { width: 100%; height: 140px; display: grid; place-items: center; object-fit: cover; border-radius: 8px; background: #e7eee9; color: var(--green-dark); font-size: 14px; }
.collection-card-copy { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.collection-card.selected .collection-card-copy { padding-top: 22px; }
.collection-card-copy strong { font-size: 16px; line-height: 1.3; font-weight: 650; overflow-wrap: anywhere; }
.collection-card-copy small { color: #68716c; font-size: 12px; }
.collection-card-arrow svg { width: 18px; height: 18px; }
.collection-selected-badge { position: absolute; top: 14px; right: 13px; padding: 5px 10px; display: flex; align-items: center; gap: 5px; border-radius: 20px; background: var(--green-dark); color: #fff; font-size: 10px; font-weight: 600; }
.collection-selected-badge svg { width: 14px; height: 14px; }
@keyframes collectionDialogIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes collectionSheetIn { from { opacity: .5; transform: translateY(32px); } to { opacity: 1; transform: translateY(0); } }
.wallpaper-card { position: relative; width: 100%; min-width: 0; border: 1px solid #dde3e0; border-radius: 11px; background: #fff; color: var(--ink); transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.wallpaper-card:hover, .wallpaper-card:focus-visible { border-color: #80af9a; box-shadow: 0 7px 20px rgba(24, 67, 49, .09); outline: none; }
.wallpaper-card.active { border-color: var(--green-dark); background: #edf5ef; box-shadow: inset 0 0 0 1px rgba(13,101,74,.12); }
.wallpaper-card.active .wallpaper-card-media::after { content: "✓"; position: absolute; left: 6px; bottom: 6px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--green-dark); color: #fff; font-size: 11px; }
.wallpaper-card.favorite-hidden { display: none; }
.wallpaper-card-select { width: 100%; height: auto; min-width: 0; padding: 6px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left; }
.wallpaper-card-select:focus-visible { outline: 2px solid rgba(22,133,98,.48); outline-offset: -2px; }
.wallpaper-card-media { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; display: block; border-radius: 8px; background: #edf0ee; }
.wallpaper-card-media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.wallpaper-card-copy { min-width: 0; padding: 0 2px 4px; display: flex; flex-direction: column; gap: 4px; }
.wallpaper-card-copy strong { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.wallpaper-card-copy small { color: var(--muted); font-size: 10px; }
.wallpaper-favorite { position: absolute; z-index: 2; top: 11px; right: 10px; width: 29px; height: 29px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.90); color: #24332d; box-shadow: 0 2px 9px rgba(20,35,28,.13); }
.wallpaper-favorite svg { width: 18px; height: 18px; stroke-width: 1.9; }
.wallpaper-favorite:hover, .wallpaper-favorite:focus-visible { color: #de334b; background: #fff; outline: 2px solid rgba(255,255,255,.86); }
.wallpaper-favorite.active { color: var(--green-dark); }
.wallpaper-favorite.active svg { fill: var(--green-dark); stroke: var(--green-dark); }

.editor-main { min-width: 0; min-height: 0; display: grid; grid-template-rows: var(--toolbar-height) minmax(0, 1fr) var(--dock-height); }
.editor-toolbar { position: relative; z-index: 20; min-width: 0; height: var(--toolbar-height); padding: 0 13px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; border-bottom: 1px solid #d9ddda; background: rgba(255,255,255,.98); }
.toolbar-actions { min-width: 0; display: flex; justify-content: center; align-items: center; gap: 7px; }
.toolbar-button { min-height: 42px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 8px; background: transparent; color: #25322d; font-size: 11px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.catalog-edge-toggle { display: none; }
.toolbar-button:hover:not(.is-disabled), .toolbar-button:focus-visible { background: #f1f4f2; outline: none; }
.toolbar-button.is-disabled { opacity: .36; pointer-events: none; }
.toolbar-exit { padding-left: 5px; border-radius: 0; }
.toolbar-exit::after { width: 1px; height: 32px; margin-left: 9px; display: block; background: #e1e5e3; content: ""; }
.toolbar-menu { padding-right: 4px; }
.change-room { margin-left: 4px; padding: 0 15px; background: var(--green-dark); color: #fff; }
.change-room:hover, .change-room:focus-visible { background: #0a553f !important; }
.zoom-control { position: relative; }
.zoom-popover { position: absolute; z-index: 40; top: calc(100% + 8px); left: 50%; width: 270px; min-height: 58px; padding: 10px 12px; display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px auto; align-items: center; gap: 7px; border: 1px solid #d9dfdc; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(20,37,30,.16); transform: translateX(-50%); }
.zoom-popover button { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: #eef2f0; color: #35453e; font-size: 18px; }
.zoom-popover input { width: 100%; accent-color: var(--green-dark); }
.zoom-popover output { min-width: 38px; color: var(--muted); font-size: 9px; text-align: right; }
.share-control { position: relative; }
.share-popover { position: absolute; z-index: 45; top: calc(100% + 8px); left: 50%; width: 248px; padding: 7px; border: 1px solid #d9dfdc; border-radius: 12px; background: #fff; box-shadow: 0 14px 34px rgba(20,37,30,.18); transform: translateX(-50%); }
.share-option { width: 100%; min-height: 42px; padding: 8px 10px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 8px; background: transparent; color: #25322d; font-size: 11px; font-weight: 600; text-align: left; }
.share-option:hover, .share-option:focus-visible { background: #f0f5f2; color: var(--green-dark); outline: none; }
.share-option svg { flex: 0 0 20px; width: 20px; height: 20px; }
.share-popover { max-height: calc(var(--editor-viewport-height, 100dvh) - var(--toolbar-height) - 20px); overflow-y: auto; overscroll-behavior: contain; }
.share-image-preview { display: block; width: 100%; height: auto; max-height: 160px; object-fit: contain; background: #101010; }
.share-image-status { margin: 9px 5px; color: var(--muted); font-size: 12px; line-height: 1.4; }

.mobile-save-preview { position: fixed; z-index: 120; inset: 0; width: 100%; height: 100dvh; min-height: 100%; display: flex; flex-direction: column; background: #101512; color: #fff; }
.mobile-save-header { flex: 0 0 auto; min-height: 76px; padding: max(13px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 13px max(14px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid rgba(255,255,255,.14); background: rgba(16,21,18,.98); }
.mobile-save-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mobile-save-copy strong { font-size: 15px; line-height: 1.1; }
.mobile-save-copy span { max-width: 520px; color: rgba(255,255,255,.78); font-size: 10px; font-weight: 600; line-height: 1.35; }
.mobile-save-close { flex: 0 0 auto; min-height: 38px; padding: 8px 13px; border: 1px solid rgba(255,255,255,.28); border-radius: 10px; background: rgba(255,255,255,.10); color: #fff; font-size: 11px; font-weight: 750; }
.mobile-save-close:hover, .mobile-save-close:focus-visible { border-color: rgba(255,255,255,.62); background: rgba(255,255,255,.18); outline: none; }
.mobile-save-image-stage { flex: 1 1 auto; min-height: 0; padding: 14px max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); overflow: auto; display: grid; place-items: center; overscroll-behavior: contain; background: radial-gradient(circle at 50% 42%, #2b312d 0, #101512 72%); }
.mobile-save-image { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; object-fit: contain; background: #fff; box-shadow: 0 18px 54px rgba(0,0,0,.42); -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; touch-action: pan-x pan-y pinch-zoom; }

.preview-panel { position: relative; min-width: 0; min-height: 0; padding: 0; display: flex; flex-direction: column; overflow: hidden; background: #dcdcd7; }
.canvas-stage { position: relative; width: 100%; height: auto; min-height: 0; flex: 1 1 0; overflow: auto; overscroll-behavior: contain; background: #eae8e1; scrollbar-color: rgba(37,50,44,.35) transparent; }
.simulation-info { position: absolute; z-index: 16; width: 44px; height: 44px; }
.simulation-info-toggle { width: 44px; height: 44px; padding: 6px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #fff; }
.simulation-info-toggle > span { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.75); border-radius: 50%; background: rgba(23,33,39,.76); font-family: Georgia, serif; font-size: 22px; font-weight: 700; line-height: 1; }
.simulation-info-toggle:hover > span, .simulation-info-toggle[aria-expanded="true"] > span { background: #172127; }
.simulation-info-toggle:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.simulation-info-popover { position: absolute; top: 50px; left: var(--info-popover-left, 0px); width: var(--info-popover-width, 300px); max-height: var(--info-popover-height, 320px); padding: 16px 44px 16px 16px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #dce2df; border-radius: 12px; background: rgba(255,255,255,.98); color: #35443d; box-shadow: 0 8px 28px rgba(23,33,39,.2); font-size: 13px; line-height: 1.5; }
.simulation-info-popover:focus-visible { outline: 2px solid var(--green-dark); outline-offset: -3px; }
.simulation-info-close { position: absolute; top: 0; right: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #35443d; font-size: 24px; }
.simulation-info-close:hover, .simulation-info-close:focus-visible { background: #eef2f0; outline: 2px solid var(--green-dark); outline-offset: -4px; }
.simulation-disclaimer { margin: 0; }
.canvas-surface { position: relative; min-width: 100%; min-height: 100%; display: grid; place-items: center; }
.app-shell, .editor-view, .editor-main, .catalog-panel, .editor-toolbar, .tool-dock, .preview-panel, .canvas-surface, #previewCanvas, .expand-preview { transition: none !important; }
.analysis-photo { position: absolute; z-index: 1; left: 50%; top: 50%; max-width: calc(100% - 30px); max-height: calc(100% - 26px); width: auto; height: auto; display: block; object-fit: contain; opacity: .94; border-radius: 14px; transform: translate(-50%, -50%); box-shadow: 0 8px 32px rgba(0,0,0,.11); }
#previewCanvas { position: relative; z-index: 2; display: block; max-width: none; max-height: none; width: auto; height: auto; border-radius: 5px; box-shadow: 0 3px 13px rgba(36,40,30,.09); touch-action: pan-y pinch-zoom; }
.preview-transition-canvas { position: absolute; z-index: 3; left: 50%; top: 50%; max-width: none; max-height: none; width: auto; height: auto; pointer-events: none; transform: translate(-50%, -50%); }
.perimeter-effect-canvas { position: absolute; z-index: 5; left: 50%; top: 50%; max-width: none; max-height: none; width: auto; height: auto; pointer-events: none; transform: translate(-50%, -50%); }
.surface-badges { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.surface-badge { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; pointer-events: auto; cursor: pointer; box-shadow: none; }
.surface-badge::before { content: ""; width: 50%; height: 50%; border-radius: 50%; background: rgba(225, 228, 228, .78); pointer-events: none; }
.surface-badge:hover::before, .surface-badge:focus-visible::before { background: #e1e4e4; outline: 2px solid #626a6a; outline-offset: 2px; }
.surface-badge:focus-visible { outline: none; }
.surface-badges, .surface-badge { transition: none !important; }
.preview-transition-canvas.wallpaper-layer-fade-in { will-change: opacity; animation: wallpaperLayerFadeIn 1.05s cubic-bezier(.22,.72,.28,1) .03s both; }
#previewCanvas.wallpaper-movable { cursor: grab; user-select: none; }
#previewCanvas.wallpaper-enlarged { touch-action: pinch-zoom; }
.graphic-size-popover { position: absolute; z-index: 30; bottom: calc(100% + 8px); right: 12px; width: min(330px, calc(100vw - 24px)); padding: 16px; border: 1px solid #c7d5cc; border-radius: 14px; background: #fff; color: #172127; box-shadow: 0 8px 30px #142d2726; }
.graphic-size-heading, .graphic-size-slider { display: flex; align-items: center; gap: 12px; }
.graphic-size-heading { justify-content: space-between; font-weight: 700; }
.graphic-size-heading button { min-width: 44px; min-height: 44px; padding: 0; font-size: 24px; }
.graphic-size-slider { margin-top: 8px; font-size: 13px; }
.graphic-size-slider input { min-width: 0; flex: 1; height: 44px; padding: 0; accent-color: #0d654a; }
.graphic-size-slider output { min-width: 42px; font-weight: 700; text-align: right; }
.graphic-size-popover p { margin: 8px 0 12px; font-size: 13px; line-height: 1.45; }
.graphic-size-popover button { appearance: none; -webkit-appearance: none; background: #f2f5f1; color: #172127; -webkit-text-fill-color: currentColor; border: 1px solid #bdcbc1; border-radius: 8px; }
#graphicSizeReset { min-height: 44px; width: 100%; font-size: 13px; }
#graphicSizeBadge { font-size: 11px; font-variant-numeric: tabular-nums; color: #0d654a; }
#graphicSizeToggle.is-active { background: #e7f2eb; color: #0d654a; border-color: #79ae96; }
#previewCanvas.wallpaper-dragging { cursor: grabbing; }
.empty-state { color: var(--muted); font-size: 12px; text-align: center; }
.selection-hint { max-width: 100%; margin: 0; padding: 13px 19px; border-radius: 12px; background: rgba(47,59,64,.94); color: #fff; font-size: 16px; line-height: 1.4; font-weight: 650; text-align: center; }
.expand-preview { position: absolute; z-index: 9; top: 8px; left: 8px; width: 44px; height: 44px; padding: 10px; display: none; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.55); border-radius: 10px; background: rgba(23,33,39,.72); color: #fff; backdrop-filter: blur(7px); }
.expand-preview svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.expand-preview:focus-visible { outline: 3px solid #fff; outline-offset: -4px; }
.collapse-preview-icon { display: none; }
/* Only rare overflow controls use this collapsible external area.
   Ordinary selection guidance does not reduce the photograph's layout space. */
.preview-guidance { position: relative; z-index: 7; display: none; flex: 0 1 auto; flex-direction: column; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 0; max-height: 45%; padding: 8px 12px; overflow: auto; overscroll-behavior: contain; scrollbar-color: rgba(37,50,44,.35) transparent; }
.preview-guidance:has(.surface-badge-overflow:not(.hidden)) { display: flex; }
.preview-guidance:focus-visible { outline: 2px solid var(--green-dark); outline-offset: -3px; }
/* JS anchors this same wrapper to the visible photo after zoom or scrolling.
   Its measured rectangle is also an obstacle for the surface number layout. */
.preview-messages { position: absolute; z-index: 7; left: 50%; top: 73%; transform: translate(-50%, -50%); display: none; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: calc(100% - 28px); min-width: 0; overflow-wrap: anywhere; pointer-events: none; }
.preview-messages:has(> :not(.hidden)) { display: flex; }
/* Waiting and selection guidance are mutually exclusive, including the final
   texture/map preparation. display:none also silences hidden live regions. */
.canvas-stage.is-busy .preview-messages,
.canvas-stage.is-busy .wallpaper-swipe-hint { display: none !important; }
/* Preserve measured canvas geometry but do not leak masks/numbers through the
   translucent waiting card. The original analysis photograph stays visible. */
.canvas-stage.is-preparing #previewCanvas,
.canvas-stage.is-preparing #fadeCanvas,
.canvas-stage.is-preparing #perimeterEffectCanvas,
.canvas-stage.is-preparing #surfaceBadges { visibility: hidden !important; }
.preview-messages .selection-hint { position: static; width: auto; max-width: 100%; transform: none; }
.preview-messages > .status { position: static; flex: 0 0 auto; width: auto; max-width: 100%; margin: 0; padding: 8px 12px; font-size: 12px; line-height: 1.4; text-align: center; box-shadow: none; backdrop-filter: none; }
.cover-options-notice { max-width: 100%; margin: 0; padding: 9px 13px; border-radius: 10px; background: rgba(47,59,64,.94); color: #fff; font-size: 12px; line-height: 1.4; font-weight: 500; text-align: center; }
.surface-badge-overflow { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; width: 100%; min-width: 0; }
.surface-badge-overflow button { position: static; transform: none; min-width: 44px; min-height: 44px; max-width: 100%; padding: 6px 12px; border: 1px solid #9eafa4; border-radius: 8px; background: #fff; color: #243d32; font-size: 13px; line-height: 1.3; font-weight: 650; overflow-wrap: anywhere; }
.surface-badge-overflow button:hover, .surface-badge-overflow button:focus-visible { background: #e1eee5; outline: 2px solid var(--green-dark); outline-offset: -3px; }
.surface-badge-overflow button[aria-pressed="true"] { border-color: var(--green-dark); background: var(--green-dark); color: #fff; }
.wallpaper-swipe-hint { position: absolute; z-index: 7; top: calc(50% + var(--swipe-photo-half-height, 0px) - 24px); left: 50%; width: max-content; max-width: min(calc(100% - 16px), var(--swipe-photo-width, 260px)); padding: 8px 14px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff; text-align: center; pointer-events: none; transform: translate(-50%, -100%); animation: swipeHintPresence 3.2s ease both; }
.swipe-hint-motion { display: flex; flex: 0 0 68px; align-items: center; justify-content: space-between; }
.swipe-hint-arrow { font-size: 23px; font-weight: 300; line-height: 1; opacity: .38; animation: swipeHintArrowLeft 2.4s ease-in-out .32s both; }
.swipe-hint-arrow:last-child { animation-name: swipeHintArrowRight; }
.swipe-hint-hand { width: 26px; height: 26px; fill: rgba(255,255,255,.13); stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; animation: swipeHintHand 2.4s cubic-bezier(.45,0,.25,1) .32s both; }
.wallpaper-swipe-hint > strong { min-width: 0; font-size: 12px; font-weight: 550; line-height: 1.3; }
.busy-overlay { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(244,245,242,.88); text-align: center; backdrop-filter: blur(4px); }
.busy-overlay.analysis-room-scan { container-type: size; gap: 0; padding: 0; background: transparent; backdrop-filter: none; }
.busy-overlay strong { padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.88); font-size: 13px; box-shadow: 0 4px 16px rgba(22,39,31,.08); }
.busy-overlay .analysis-wait-card > span { padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.78); color: var(--muted); font-size: 10px; }
.mobile-processing-warning { display: none; }
.room-study { position: relative; width: 94px; height: 70px; overflow: hidden; border: 1px solid rgba(22,133,98,.22); border-radius: 14px; background: rgba(255,255,255,.93); box-shadow: 0 12px 34px rgba(18,50,37,.14); }
.study-wall { position: absolute; top: 11px; bottom: 12px; border-top: 2px solid #8db7a5; border-bottom: 2px solid #8db7a5; }
.study-wall-left { left: 12px; width: 36px; border-left: 2px solid #8db7a5; transform: skewY(8deg); transform-origin: right center; }
.study-wall-right { right: 12px; width: 34px; border-right: 2px solid #8db7a5; transform: skewY(-9deg); transform-origin: left center; }
.study-sofa { position: absolute; left: 29px; bottom: 15px; width: 39px; height: 15px; border: 2px solid #4e7766; border-radius: 7px 7px 3px 3px; }
.study-sofa::before { position: absolute; left: 5px; right: 5px; top: -8px; height: 10px; border: 2px solid #4e7766; border-bottom: 0; border-radius: 7px 7px 0 0; content: ""; }
.study-lamp { position: absolute; right: 18px; top: 21px; width: 2px; height: 25px; background: #4e7766; }
.study-lamp::before { position: absolute; left: -6px; top: -5px; width: 14px; height: 8px; border-radius: 8px 8px 3px 3px; background: #7eaa97; content: ""; }
.study-scan { position: absolute; z-index: 4; top: 4px; bottom: 4px; width: 22px; background: linear-gradient(90deg, transparent, rgba(30,190,139,.22), rgba(30,190,139,.62), transparent); filter: drop-shadow(0 0 7px rgba(22,133,98,.34)); animation: studyScan 2.15s cubic-bezier(.45,0,.55,1) infinite; }
.study-point { position: absolute; z-index: 5; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(22,133,98,.38); animation: studyPulse 1.55s ease-out infinite; }
.study-point-one { left: 19px; top: 19px; }
.study-point-two { right: 20px; top: 18px; animation-delay: .46s; }
.study-point-three { left: 47px; bottom: 20px; animation-delay: .88s; }
/* Decorative miniature waiting story. No progress, detection or result is implied.
   Keep the real photo stationary and uncropped; only the illustration animates. */
.analysis-photo-shade { position: absolute; z-index: 4; left: 50%; top: 50%; pointer-events: none; border-radius: 14px; transform: translate(-50%, -50%); background: rgba(29,39,32,.22); }
.analysis-wait-card { display: contents; }
.analysis-miniature { --rm-ink: #38564a; --rm-duration: 16s; display: none; width: 100%; }
.analysis-room-scan .analysis-miniature { display: block; }
.analysis-miniature .miniature-brand { display: block; width: 210px; max-width: 100%; height: auto; margin: 0 auto 5px; }
.analysis-room-scan .room-study, .analysis-room-scan #busySubtext { display: none; }
.analysis-room-scan .analysis-wait-card { position: relative; width: min(340px, calc(100% - 24px)); padding: 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 25px; background: rgba(250,248,242,.5); color: #2d4237; box-shadow: 0 18px 70px rgba(18,36,25,.21); }
/* Native-size SVG keeps the 24px corners round at every card aspect ratio.
   One constant-speed lap takes 12s; it is decoration, not progress. */
.analysis-card-glow { display: none; pointer-events: none; }
.analysis-room-scan .analysis-card-glow { display: block; position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke: #fff; }
.analysis-card-glow rect { width: calc(100% - 2px); height: calc(100% - 2px); fill: none; }
.analysis-card-glow .card-glow-track { stroke-width: 1; stroke-opacity: .24; }
.analysis-room-scan .analysis-card-glow rect:not(.card-glow-track) { --glow-offset: 0px; stroke-dasharray: 22 78; animation: card-border-orbit 12s linear infinite; }
.analysis-card-glow .card-glow-halo { stroke-width: 6; stroke-opacity: .7; filter: blur(4px); }
.analysis-card-glow .card-glow-tail { stroke-width: 2; stroke-opacity: .35; }
.analysis-room-scan .analysis-card-glow .card-glow-middle { --glow-offset: -8px; stroke-dasharray: 14 86; stroke-width: 2; stroke-opacity: .65; }
.analysis-room-scan .analysis-card-glow .card-glow-head { --glow-offset: -18px; stroke-dasharray: 4 96; stroke-width: 2.5; filter: drop-shadow(0 0 3px #fff); }
@keyframes card-border-orbit { from { stroke-dashoffset: var(--glow-offset); } to { stroke-dashoffset: calc(var(--glow-offset) - 100px); } }
.busy-overlay.analysis-room-scan strong { display: block; max-width: 235px; margin: 2px 0 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #2d4237; font-size: 16px; line-height: 1.45; font-weight: 400; letter-spacing: -.015em; box-shadow: none; }
.analysis-miniature .rm-art{position:relative;width:min(100%,max(72px,calc((100cqh - 195px)*1.304)));aspect-ratio:300/230;margin:0 auto}
    .analysis-miniature .rm-room{position:absolute;inset:0;animation:rm-scene var(--rm-duration) ease-in-out infinite}
    .analysis-miniature .rm-ground-shadow{position:absolute;left:12%;top:84%;width:78%;height:9%;background:radial-gradient(ellipse,#47684a24,transparent 70%);filter:blur(4px)}
    .analysis-miniature .rm-floor{position:absolute;left:9%;top:71%;width:80%;height:22%;background:#e8e7d8;clip-path:polygon(20% 0,100% 0,77% 100%,0 100%)}
    .analysis-miniature .rm-floor:after{content:"";position:absolute;inset:0;background:repeating-linear-gradient(0deg,transparent 0 13px,#bdbfac44 14px 15px);opacity:.5}
    .analysis-miniature .rm-side{position:absolute;left:9%;top:13%;width:18%;height:80%;background:#edeee3;clip-path:polygon(0 27%,100% 0,100% 75%,0 100%)}
    .analysis-miniature .rm-side:before{content:"";position:absolute;right:0;top:0;bottom:0;width:1.3px;background:#64807080}
    .analysis-miniature .rm-wall{position:absolute;left:27%;top:13%;width:62%;height:59%;border:1.4px solid #64807088;background:#fcfbf6;overflow:hidden;border-radius:1px}
    .analysis-miniature .rm-paper{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;animation:rm-unroll var(--rm-duration) cubic-bezier(.38,0,.2,1) infinite;background:#dae5d6}
    .analysis-miniature .rm-paper:after{content:"";position:absolute;bottom:0;left:0;right:0;height:8px;border-top:1px solid #8a9e7980;border-radius:50%;background:linear-gradient(#f4f5dd,#b3c2a8);box-shadow:0 4px 6px #2d453425;animation:rm-roll-edge var(--rm-duration) ease infinite}
    .analysis-miniature .rm-botanical{position:absolute;inset:0;background:linear-gradient(90deg,transparent 49.4%,#6e856456 49.6% 50.3%,transparent 50.5%) 0 0/40px 100%}
    .analysis-miniature .rm-sprig{position:absolute;width:24%;height:100%;top:0}
    .analysis-miniature .rm-sprig:nth-child(1){left:1%;transform:translateY(-8%)}
    .analysis-miniature .rm-sprig:nth-child(2){left:25%;transform:translateY(9%)}
    .analysis-miniature .rm-sprig:nth-child(3){left:51%;transform:translateY(-11%)}
    .analysis-miniature .rm-sprig:nth-child(4){left:76%;transform:translateY(6%)}
    .analysis-miniature .rm-sprig i{position:absolute;left:17%;width:43%;height:15%;border-radius:90% 0 90% 0;background:#859d7b68;border:1px solid #78927155;transform:rotate(-20deg)}
    .analysis-miniature .rm-sprig i:nth-child(1){top:7%}
    .analysis-miniature .rm-sprig i:nth-child(2){top:29%;left:51%;transform:rotate(70deg)}
    .analysis-miniature .rm-sprig i:nth-child(3){top:51%}
    .analysis-miniature .rm-sprig i:nth-child(4){top:73%;left:51%;transform:rotate(70deg)}
    .analysis-miniature .rm-landscape{position:absolute;inset:0;width:100%;height:100%;stroke:none;opacity:0;background:#eee4d5;animation:rm-new-style var(--rm-duration) ease-in-out infinite}
    .analysis-miniature .rm-rug{position:absolute;left:25%;top:77%;width:48%;height:14%;border:1px solid #bac2b2;border-radius:50%;background:#f4f2e7;transform:rotate(-7deg);animation:rm-rug-in var(--rm-duration) ease infinite}
    .analysis-miniature .rm-chair{position:absolute;left:39%;top:49%;width:28%;height:39%;animation:rm-chair-in var(--rm-duration) cubic-bezier(.22,.7,.27,1) infinite;color:var(--rm-ink)}
    .analysis-miniature .rm-chair-back{position:absolute;left:9%;top:0;width:81%;height:72%;border:1.6px solid currentColor;border-radius:38% 38% 12% 12%;background:#e7eada;animation:rm-chair-color var(--rm-duration) ease infinite}
    .analysis-miniature .rm-chair-back:after{content:"";position:absolute;left:18%;right:18%;top:19%;height:47%;border:1px solid #71877375;border-radius:25%;background:#f5f3e5}
    .analysis-miniature .rm-chair-seat{position:absolute;left:9%;bottom:13%;width:83%;height:25%;border:1.6px solid currentColor;border-radius:7px 7px 10px 10px;background:#d8dfca;z-index:2;animation:rm-chair-color var(--rm-duration) ease infinite}
    .analysis-miniature .rm-arm{position:absolute;width:18%;height:45%;bottom:14%;border:1.6px solid currentColor;border-radius:9px;background:#e8ecdd;z-index:3;animation:rm-chair-color var(--rm-duration) ease infinite}
    .analysis-miniature .rm-arm.left{left:0}.analysis-miniature .rm-arm.right{right:0}
    .analysis-miniature .rm-chair-leg{position:absolute;bottom:0;height:17%;width:2px;background:var(--rm-ink);left:16%;transform:rotate(9deg)}
    .analysis-miniature .rm-chair-leg.right{left:auto;right:16%;transform:rotate(-9deg)}
    .analysis-miniature .rm-lamp{position:absolute;left:74%;top:27%;width:16%;height:57%;animation:rm-lamp-in var(--rm-duration) ease infinite}
    .analysis-miniature .rm-lamp-light{position:absolute;top:-7%;left:-61%;width:230%;height:135%;background:radial-gradient(ellipse at 50% 20%,#ffeabfa0,transparent 68%);animation:rm-light-on var(--rm-duration) ease infinite}
    .analysis-miniature .rm-lamp-stem{position:absolute;left:48%;top:16%;height:81%;width:1.6px;background:var(--rm-ink)}
    .analysis-miniature .rm-lamp-base{position:absolute;left:16%;bottom:0;width:66%;height:4%;border:1.4px solid var(--rm-ink);border-radius:50%;background:#edeade}
    .analysis-miniature .rm-lamp-shade{position:absolute;left:4%;top:0;width:92%;height:26%;border:1.6px solid var(--rm-ink);border-radius:45% 45% 10% 10%;background:#f6f0dc;animation:rm-shade-on var(--rm-duration) ease infinite}
    .analysis-miniature .rm-lamp-shade:after{content:"";position:absolute;left:0;bottom:-1px;width:100%;height:12%;border:1px solid var(--rm-ink);border-radius:50%;background:#e7debd}
    .analysis-miniature .rm-plant{position:absolute;left:22%;top:57%;width:16%;height:33%;animation:rm-plant-in var(--rm-duration) cubic-bezier(.2,.7,.3,1) infinite}
    .analysis-miniature .rm-stems{position:absolute;left:49%;bottom:23%;height:68%;width:1.5px;background:var(--rm-ink)}
    .analysis-miniature .rm-stems:after{content:"";position:absolute;width:1px;height:80%;left:0;bottom:0;background:var(--rm-ink);transform:rotate(-20deg);transform-origin:bottom}
    .analysis-miniature .rm-leaf{position:absolute;width:34%;height:25%;background:#a3b49a;border:1.2px solid var(--rm-ink);border-radius:90% 0 90% 0;transform-origin:bottom;animation:rm-leaf-grow var(--rm-duration) ease infinite}
    .analysis-miniature .rm-leaf.a{left:17%;top:14%;rotate:-20deg}
    .analysis-miniature .rm-leaf.b{left:47%;top:0;rotate:65deg}
    .analysis-miniature .rm-leaf.c{left:43%;top:34%;rotate:60deg}
    .analysis-miniature .rm-leaf.d{left:10%;top:38%;rotate:-32deg}
    .analysis-miniature .rm-pot{position:absolute;left:18%;bottom:0;width:66%;height:34%;border:1.5px solid var(--rm-ink);border-radius:3px 3px 10px 10px;background:#e4d5bd}
    .analysis-miniature .rm-pot:before{content:"";position:absolute;left:-1px;right:-1px;top:-3px;height:6px;background:#f4ead9;border:1px solid var(--rm-ink);border-radius:50%}
@keyframes rm-scene{0%{opacity:0;transform:translateY(5px)}5%,90%{opacity:1;transform:translateY(0)}98%,100%{opacity:0;transform:translateY(-3px)}}
@keyframes rm-rug-in{0%,5%{opacity:0;scale:.6}11%,100%{opacity:1;scale:1}}
@keyframes rm-chair-in{0%,8%{opacity:0;transform:translateX(-48px) rotate(-8deg)}17%,100%{opacity:1;transform:translateX(0) rotate(0)}}
@keyframes rm-lamp-in{0%,16%{opacity:0;transform:translateY(-18px)}23%,100%{opacity:1;transform:translateY(0)}}
@keyframes rm-light-on{0%,23%{opacity:0}29%,100%{opacity:1}}
@keyframes rm-shade-on{0%,23%{background:#f6f0dc}29%,100%{background:#ffebba;box-shadow:0 0 14px #fff0c866}}
@keyframes rm-plant-in{0%,25%{opacity:0;transform:translateY(12px) scale(.8)}33%,100%{opacity:1;transform:translateY(0) scale(1)}}
@keyframes rm-leaf-grow{0%,29%{scale:.1;opacity:0}38%,100%{scale:1;opacity:1}}
@keyframes rm-unroll{0%,34%{height:0}48%,100%{height:100%}}
@keyframes rm-roll-edge{0%,45%{opacity:1}51%,100%{opacity:0}}
@keyframes rm-new-style{0%,62%{opacity:0;clip-path:inset(0 0 100% 0)}74%,100%{opacity:1;clip-path:inset(0)}}
@keyframes rm-chair-color{0%,62%{background:#e7eada}74%,100%{background:#ddc4ab}}
.status { position: absolute; z-index: 15; left: 14px; bottom: 14px; max-width: min(470px, calc(100% - 28px)); padding: 9px 12px; border: 1px solid rgba(255,255,255,.54); border-radius: 9px; font-size: 10px; line-height: 1.35; box-shadow: 0 7px 24px rgba(0,0,0,.14); backdrop-filter: blur(8px); }
.status.info, .status.warning { background: rgba(235,244,247,.94); color: #31586b; }
.status.success { background: rgba(234,247,240,.94); color: #17583a; }
.status.error { background: rgba(252,237,237,.96); color: var(--danger); }

.tool-dock { position: relative; z-index: 18; min-width: 0; height: var(--dock-height); padding: 7px 12px; display: flex; align-items: center; gap: 10px; border-top: 1px solid #d9ddda; background: rgba(255,255,255,.98); }
.app-version { display: block; color: #68747b; font-size: 10px; line-height: 12px; font-weight: 400; text-align: center; white-space: nowrap; }
.home-version { padding: 0 12px max(4px, env(safe-area-inset-bottom, 0px)); }
.current-graphic { min-width: 0; margin-top: 12px; padding: 10px 8px; display: grid; grid-template-columns: minmax(0,1fr) 40px; align-items: center; gap: 8px; border: 1px solid #cce2d7; border-radius: 10px; background: #f1f8f4; }
.current-graphic-variants { display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: 8px; padding: 0; min-width: 0; width: 100%; border: 0; background: transparent; color: inherit; text-align: left; }
.current-graphic-variants:disabled { opacity: 1; cursor: default; }
.current-graphic-variants:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 3px; }
.current-graphic-copy { min-width: 0; }
.current-graphic .file-chip { overflow-wrap: anywhere; white-space: normal; font-size: 12px; line-height: 1.4; }
.current-graphic-thumb { width: 48px; height: 48px; border: 1px solid #d9dfdc; border-radius: 8px; background: linear-gradient(135deg, #eef1ef, #dfe5e2); background-position: center; background-size: cover; }
.current-graphic small { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.remove-graphic { width: 40px; height: 44px; padding: 0; display: grid; place-items: center; border: 1px solid #ead8d8; border-radius: 8px; background: #fff7f7; color: #a34646; }
.remove-graphic:hover, .remove-graphic:focus-visible { border-color: #dbaaaa; background: #fdecec; outline: none; }
.remove-graphic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dock-actions { width: 100%; min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: thin; touch-action: pan-x; }
.dock-actions > * { flex-shrink: 0; }
.dock-actions > #clearSelection { order: 0; }
.dock-actions > .cover-feature { order: 1; }
.dock-actions > #showVariants { order: 2; }
.dock-actions > .graphic-transforms { order: 3; }
.dock-actions::-webkit-scrollbar { display: none; }
/* Purely visual edge cues live outside the scrolling content: no extra space,
   buttons, hit targets or changes to native swipe/momentum behavior. */
.horizontal-scroll-hints { display: none; pointer-events: none; user-select: none; }
.horizontal-scroll-hints * { pointer-events: none; }
.scroll-edge { position: absolute; top: 0; bottom: 0; width: 20px; display: none; align-items: center; justify-content: center; color: #365653; }
.scroll-edge-left { left: 0; background: linear-gradient(to right, #fff 45%, rgba(255,255,255,0)); }
.scroll-edge-right { right: 0; background: linear-gradient(to left, #fff 45%, rgba(255,255,255,0)); }
.scroll-edge svg { width: 18.2px; height: 28.6px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.horizontal-scroll-hints[data-scroll-left] .scroll-edge-left,
.horizontal-scroll-hints[data-scroll-right] .scroll-edge-right { display: flex; }
.dock-button, button.transform-button { min-height: 58px; min-width: 84px; padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #34443d; font-size: 14px; font-weight: 700; white-space: nowrap; }
.dock-button:hover, .dock-button:focus-visible, button.transform-button:hover, button.transform-button:focus-visible { border-color: #d9e1dd; background: #f4f7f5; outline: none; }
.dock-button svg { width: 18px; height: 18px; }
.dock-button > strong { min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: #e9efec; color: #4d5d56; font-size: 11px; }
.graphic-transforms { position: relative; display: flex; align-items: center; gap: 5px; padding-left: 8px; }
.graphic-transforms::before, .graphic-transforms .transform-button + .transform-button::before { content: ""; position: absolute; left: 0; top: 50%; width: 1px; height: 24px; background: #dfe3de; transform: translateY(-50%); }
.graphic-transforms .transform-button + .transform-button { position: relative; }
button.transform-button { min-width: 90px; }
button.transform-button[aria-pressed="true"] { border-color: #79ae96; background: var(--green-soft); color: var(--green-dark); }
.transform-icon { font-size: 21px; font-weight: 500; }
.picture-option { flex: 0 0 auto; }
.picture-toggle { min-height: 58px; padding: 8px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid #a9d8f2; border-radius: 8px; background: #edf8fe; color: #195d82; text-align: left; box-shadow: 0 2px 9px rgba(54,151,207,.10); }
.picture-toggle:hover, .picture-toggle:focus-visible { border-color: #69b9e5; background: #e0f3fd; outline: none; }
.dock-icon { width: 19px; height: 19px; display: grid; place-items: center; color: #53635c; font-size: 15px; }
.picture-toggle-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.picture-toggle-copy strong { font-size: 14px; white-space: nowrap; }
.picture-toggle-copy small { display: block; max-width: 160px; overflow: hidden; color: #53809a; font-size: 10px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.switch-track { flex: 0 0 32px; width: 32px; height: 18px; padding: 2px; display: block; border-radius: 999px; background: #bdc8c2; transition: background .18s ease; }
.switch-track span { width: 14px; height: 14px; display: block; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.18); transition: transform .18s ease; }
.picture-toggle[aria-checked="true"] { border-color: #409fd3; background: #dff3fd; color: #0d5278; }
.picture-toggle[aria-checked="true"] .switch-track { background: #2b91f5; }
.picture-toggle[aria-checked="true"] .switch-track span { transform: translateX(14px); }
.picture-option-alert .picture-toggle { border-color: #d94747; background: #fff0f0; color: #a51f1f; box-shadow: 0 2px 10px rgba(190,35,35,.14); }
.picture-option-alert .picture-toggle:hover, .picture-option-alert .picture-toggle:focus-visible { border-color: #bd2020; background: #ffe3e3; }
.picture-option-alert .picture-toggle-copy small { color: #a64b4b; }
.picture-option-alert .picture-toggle[aria-checked="true"] { border-color: #b71919; background: #ffdada; color: #8e1010; }
.picture-option-alert .picture-toggle[aria-checked="true"] .switch-track { background: #c92121; }
.picture-option[aria-busy="true"], .graphic-transforms[aria-busy="true"] { pointer-events: none; opacity: .7; }

.drawer-backdrop { position: absolute; z-index: 29; inset: var(--toolbar-height) 0 var(--dock-height); background: rgba(15,25,21,.20); backdrop-filter: blur(1px); }
.tools-drawer { position: absolute; z-index: 30; top: var(--toolbar-height); right: 0; bottom: var(--dock-height); width: min(350px, 92vw); padding: 20px; overflow-y: auto; border-left: 1px solid #d7dfdb; background: #fff; box-shadow: -15px 0 38px rgba(24,39,33,.13); transform: translateX(102%); visibility: hidden; transition: transform .22s ease, visibility .22s step-end; }
.tools-drawer.open { transform: translateX(0); visibility: visible; transition: transform .22s ease, visibility 0s; }
.drawer-heading { padding-bottom: 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e8ebe9; }
.drawer-heading small { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.drawer-heading h2 { margin: 2px 0 0; font-size: 19px; }
.drawer-heading button { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #eff3f1; color: #47564f; font-size: 23px; line-height: 1; }
.drawer-contact { display: flex; align-items: center; justify-content: flex-start; gap: 10px; margin: 16px 0 10px; min-height: 48px; }
.drawer-contact svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: 0 0 auto; }
.tools-drawer .tutorial-open-menu { margin: 10px 0 16px; min-height: 48px; }
.drawer-language { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-top: 16px; border-top: 1px solid #e8ebe9; }
.drawer-language > span { padding-top: 13px; font-weight: 600; }
.drawer-language #editorLanguages.language-picker { margin: 0; }
.step { padding: 17px 0; }
.step.locked { opacity: .45; pointer-events: none; }
.drawer-description { margin: 0 0 10px; color: var(--muted); font-size: 10px; }
.summary { padding: 11px 12px; border-radius: 9px; background: #eff4f1; color: #405048; font-size: 11px; line-height: 1.4; }
.surface-controls { margin-top: 11px; padding: 11px; border: 1px solid #dbe5e0; border-radius: 10px; background: #fbfcfb; }
.surface-controls-heading strong { color: #294f3f; font-size: 10px; }
.surface-type-buttons { margin-top: 8px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
button.surface-type-button { min-width: 0; padding: 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px; border: 1px solid #dce3df; border-radius: 8px; background: #fff; color: #3b4e45; font-size: 9px; font-weight: 700; }
button.surface-type-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.surface-type-button strong { min-width: 19px; height: 19px; padding: 0 4px; display: grid; place-items: center; border-radius: 999px; background: #eaf0ed; font-size: 8px; }
button.surface-type-button[aria-pressed="true"] { border-color: #70a98e; background: var(--green-soft); color: var(--green-dark); }
.auto-perspective-note { margin: 0; }
.catalog-upload { margin: 0 0 14px; padding: 12px; border: 1px solid #b9d8ca; border-radius: 12px; background: #f2faf6; }
.catalog-upload h2 { margin: 0; color: var(--green-dark); font-size: 13px; }
.catalog-upload > p { margin: 4px 0 10px; color: var(--muted); font-size: 9px; }
.catalog-upload .drop-zone.compact { min-height: 92px; padding: 11px; gap: 7px; border-color: #8fbea9; background: #fff; }
.catalog-upload .drop-zone.compact strong { font-size: 10px; }
.catalog-upload .drop-zone.compact button { width: 100%; }

.diagnostic-panel { margin-top: 8px; padding: 15px 0 4px; border-top: 2px solid #e3b85e; }
.diagnostic-heading { margin-bottom: 12px; }
.diagnostic-heading > div { display: flex; align-items: center; gap: 7px; }
.diagnostic-heading h3 { margin: 0; color: #493b20; font-size: 13px; }
.diagnostic-heading p { margin: 7px 0 0; color: #6f6248; font-size: 9px; line-height: 1.45; }
.diagnostic-badge { padding: 3px 6px; border-radius: 999px; background: #f5c95f; color: #4e3b0d; font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.diagnostic-panel details { margin-top: 8px; border: 1px solid #e5ddca; border-radius: 9px; background: #fffcf5; overflow: hidden; }
.diagnostic-panel summary { padding: 9px 10px; cursor: pointer; color: #51462f; font-size: 9px; font-weight: 850; }
.diagnostic-switches { padding: 0 9px 9px; display: grid; gap: 6px; }
.diagnostic-switches > label { padding: 7px 8px; display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 7px; align-items: start; border: 1px solid #ece5d5; border-radius: 8px; background: #fff; cursor: pointer; }
.diagnostic-switches input { width: 28px; height: 16px; margin: 1px 0 0; accent-color: #178060; }
.diagnostic-switches span { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.diagnostic-switches strong { color: #34463e; font-size: 8px; line-height: 1.25; }
.diagnostic-switches small { color: #718078; font-size: 7px; line-height: 1.3; }
.diagnostic-switches label:has(input:not(:checked)) { border-color: #e5a2a2; background: #fff5f5; }
.diagnostic-switches label:has(input:not(:checked)) strong { color: #a03333; }
.diagnostic-actions { margin-top: 10px; display: grid; gap: 6px; }
.diagnostic-status { margin: 9px 1px 0; color: #73654a; font-size: 8px; line-height: 1.4; }
.diagnostic-status.changed { color: #a03333; font-weight: 750; }

@keyframes studyScan { 0% { left: -24px; opacity: .15; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: 96px; opacity: .15; } }
@keyframes studyPulse { 0% { box-shadow: 0 0 0 0 rgba(22,133,98,.38); transform: scale(.85); } 65% { box-shadow: 0 0 0 8px rgba(22,133,98,0); transform: scale(1); } 100% { box-shadow: 0 0 0 0 rgba(22,133,98,0); transform: scale(.85); } }
@keyframes wallpaperLayerFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes coverOptionsNoticeIn { from { opacity: 0; transform: translate(-50%, -7px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes swipeHintPresence { 0% { opacity: 0; } 10%, 86% { opacity: 1; } 100% { opacity: 0; } }
@keyframes swipeHintHand { 0%, 8%, 92%, 100% { transform: translateX(-12px); } 44%, 56% { transform: translateX(12px); } }
@keyframes swipeHintArrowRight { 0%, 54%, 100% { opacity: .38; } 14%, 44% { opacity: 1; } }
@keyframes swipeHintArrowLeft { 0%, 50%, 100% { opacity: .38; } 64%, 92% { opacity: 1; } }

@media (max-width: 980px) {
  .room-page { width: min(920px, calc(100% - 28px)); padding-top: 34px; }
  .room-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor-view { grid-template-columns: 220px minmax(0, 1fr); }
  .wallpaper-card-select { gap: 6px; }
  .toolbar-button { padding: 0 8px; }
  .toolbar-button span { display: none; }
  .change-room span { display: inline; }
  .current-graphic { grid-template-columns: minmax(0,1fr) 40px; gap: 6px; padding: 8px 6px; }
  .current-graphic-variants { grid-template-columns: 40px minmax(0,1fr); gap: 6px; }
  .current-graphic-thumb { width: 40px; height: 40px; }
}

@media (max-width: 720px), (max-width: 1024px) and (max-height: 520px) and (pointer: coarse) {
  /* Fit the unchanged 58px/48px buttons plus 2px borders, with no decorative
     vertical gaps. Keep iOS notch/home-indicator protection separate. */
  :root { --toolbar-height: calc(60px + env(safe-area-inset-top, 0px)); --mobile-catalog-height: 216px; --dock-height: calc(50px + env(safe-area-inset-bottom, 0px)); }
  .room-topbar { height: calc(62px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) max(15px, env(safe-area-inset-right)) 0 max(15px, env(safe-area-inset-left)); }
  .brand-logo { width: 171px; }
  .room-topbar-actions { gap: 5px; }
  .language-switcher { padding: 2px; }
  .language-button { width: 35px; height: 28px; }
  .cloud-badge { display: none; }
  .room-page { width: calc(100% - 22px); padding: 28px 0 40px; }
  .room-page-heading { margin-bottom: 22px; }
  .room-page-heading h1 { font-size: 30px; }
  .room-page-heading > p:last-child { font-size: 12px; }
  .analysis-mode { width: 100%; }
  .room-upload-card { min-height: 174px; margin-bottom: 26px; padding: 22px 16px; }
  .room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .room-card-copy { padding: 8px 9px 9px; }

  /* Own the viewport in Home-screen mode: no stale document scroll after rotation.
     Insets protect controls once, inside the app rather than around it. */
  .editor-view { position: fixed; top: var(--editor-viewport-top, 0px); right: 0; left: 0; display: block; height: var(--editor-viewport-height, 100dvh); min-height: 0; }
  .editor-main { width: 100%; height: 100%; grid-template-rows: var(--toolbar-height) minmax(0, 1fr) var(--mobile-catalog-height) var(--dock-height); }
  .editor-toolbar { grid-row: 1; }
  .preview-panel { grid-row: 2; }
  /* Su mobile il catalogo occupa una fascia propria sopra i comandi: non
     sottrae piu spazio alla foto lateralmente e non si sovrappone al canvas. */
  .catalog-panel { position: absolute; z-index: 17; right: 0; bottom: var(--dock-height); left: 0; width: auto; height: var(--mobile-catalog-height); padding: 7px max(8px, env(safe-area-inset-right)) 7px max(8px, env(safe-area-inset-left)); overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 112px auto 44px; grid-template-rows: 44px 18px minmax(0, 1fr); align-items: stretch; gap: 6px; border: 0; border-top: 1px solid #d8dfdb; border-bottom: 1px solid #d8dfdb; border-radius: 0; background: #fff; box-shadow: 0 -5px 17px rgba(22,39,31,.10); transition: none; }
  .catalog-panel.mobile-collapsed { visibility: visible; opacity: 1; pointer-events: auto; transform: none; }
  .catalog-edge-toggle { display: none; }
  .catalog-brand { display: none; }
  /* Flatten only neutral wrappers: the original controls and their handlers
     stay mounted, but search / collections / favorites share a single row. */
  .catalog-heading { min-width: 0; padding: 0; display: contents; }
  .catalog-heading h1, .catalog-heading p { display: none; }
  .catalog-heading p.catalog-notice-error:not(.hidden) { position: fixed; z-index: 30; bottom: calc(var(--dock-height) + var(--mobile-catalog-height) + 8px); left: 8px; right: 8px; display: block; margin: 0; padding: 9px 11px; font-size: 10px; }
  .catalog-search-label { display: none; }
  .catalog-search { display: block; grid-column: 1; grid-row: 1; height: 44px; font-size: 16px; }
  .catalog-title-row { grid-column: 4; grid-row: 1; justify-content: center; }
  .favorites-toggle { width: 44px; height: 44px; }
  .favorites-toggle svg { width: 18px; height: 18px; }
  .wallpaper-catalog { grid-column: 1 / -1; grid-row: 3; min-width: 0; height: 100%; padding-bottom: 4px; display: flex; align-items: flex-start; gap: 8px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; touch-action: pan-x; }
  .horizontal-scroll-hints { display: block; z-index: 6; }
  .catalog-scroll-hints { position: relative; grid-column: 1 / -1; grid-row: 3; min-width: 0; min-height: 0; margin-bottom: 4px; }
  .catalog-scroll-hints .scroll-edge { max-height: 120px; }
  .dock-scroll-hints { position: absolute; top: 0; bottom: env(safe-area-inset-bottom, 0px); left: max(9px, env(safe-area-inset-left)); right: max(9px, env(safe-area-inset-right)); }
  .catalog-library, .catalog-navigation { display: contents; }
  .catalog-browse { grid-column: 2; grid-row: 1; height: 44px; min-height: 44px; padding: 5px 7px; gap: 4px; border-radius: 9px; }
  .collection-selector-media, .collection-selector-copy > span { display: none; }
  .collection-selector-copy { gap: 1px; }
  .collection-selector-copy small { font-size: 8px; }
  .collection-selector-copy strong { font-size: 13px; line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .catalog-browse .collection-selector-chevron { width: 14px; height: 14px; flex-basis: 14px; }
  .catalog-collection-title { grid-column: 1 / -1; grid-row: 2; padding: 0 2px; font-size: 12px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #catalogCollectionCount { font-size: 10px; }
  .collection-browser { top: auto; bottom: max(0px, calc(100dvh - var(--editor-viewport-height, 100dvh) - var(--editor-viewport-top, 0px))); width: 100%; height: fit-content; max-height: calc(var(--editor-viewport-height, 100dvh) - max(12px, env(safe-area-inset-top, 0px))); margin: 0 auto; border-radius: 20px 20px 0 0; }
  .collection-browser[open] { animation-name: collectionSheetIn; }
  .collection-sheet-handle { display: block; flex: 0 0 4px; width: 36px; margin: 10px auto 0; border-radius: 2px; background: #d0d5ce; }
  .collection-browser-header { padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); }
  .collection-browser-header h2 { font-size: 20px; }
  .collection-browser-content { padding: 0 max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .collection-grid { gap: 10px; }
  .collection-card { grid-template-columns: 41% minmax(0, 1fr) 18px; min-height: 120px; gap: 12px; }
  .collection-cover { height: 120px; }
  .collection-card-copy strong { font-size: 15px; }
  .collection-card-copy small { font-size: 11px; }
  .collection-selected-badge { top: 11px; right: 10px; font-size: 9px; padding: 5px 8px; }
  .catalog-empty { flex: 1 0 100%; padding: 13px 7px; display: grid; place-items: center; font-size: 11px; }
  .wallpaper-card { flex: 0 0 90px; width: 90px; height: auto; border-radius: 8px; scroll-snap-align: start; }
  .wallpaper-card-select { height: auto; padding: 4px; gap: 4px; border-radius: 7px; }
  .wallpaper-card-media { flex: 0 0 auto; width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: 6px; }
  .wallpaper-card-copy { flex: 0 0 auto; padding: 0 2px 1px; gap: 2px; line-height: 14px; }
  .wallpaper-card-copy strong { font-size: 11px; }
  .wallpaper-card-copy small { display: block; font-size: 10px; }
  .wallpaper-favorite { top: 6px; right: 6px; width: 34px; height: 34px; }
  .editor-toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 4fr) minmax(0, 1fr); padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); border-bottom: 2px solid #cfd7d3; background: #fff; box-shadow: 0 4px 15px rgba(22,39,31,.12); }
  .toolbar-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .toolbar-actions > div { min-width: 0; }
  .toolbar-button { width: 100%; min-width: 0; min-height: 58px; padding: 4px 2px; flex-direction: column; gap: 3px; border-radius: 10px; font-size: 10px; line-height: 12px; }
  .toolbar-button span { display: block; max-width: 100%; white-space: normal; text-align: center; }
  .toolbar-button svg { width: 22px; height: 22px; stroke-width: 1.9; }
  .toolbar-exit::after { display: none; }
  .toolbar-menu svg { order: -1; }
  .change-room { margin-left: 0; }
  .zoom-popover { position: fixed; top: calc(var(--toolbar-height) + 7px); left: 50%; width: min(280px, calc(100vw - 24px)); }
  .share-popover { position: fixed; top: calc(var(--editor-viewport-top, 0px) + var(--toolbar-height) + 7px); right: max(8px, env(safe-area-inset-right)); left: auto; width: min(280px, calc(100vw - 16px)); transform: none; }
  .share-option { min-height: 44px; font-size: 13px; }
  .share-option[data-share-action="whatsapp"], .share-notice-desktop { display: none; }
  .share-notice-mobile { display: inline; }
  .selection-hint { font-size: 13px; padding: 10px 13px; }
  .expand-preview { display: flex; }
  .wallpaper-swipe-hint { padding: 8px 12px; gap: 8px; }
  .busy-overlay.analysis-room-scan .mobile-processing-warning { position: static; max-width: 245px; margin: 8px 0 0; padding: 0; display: block; border: 0; border-radius: 0; background: transparent; color: #53665c; font-size: 10px; font-weight: 400; line-height: 1.4; }
  .busy-overlay.analysis-room-scan strong { font-size: 15px; padding: 0; }
  .analysis-room-scan .analysis-wait-card { width: min(280px, calc(100% - 24px)); padding: 14px 12px; }
  .tool-dock { grid-row: 4; padding: 0 max(9px, env(safe-area-inset-right)) env(safe-area-inset-bottom, 0px) max(9px, env(safe-area-inset-left)); align-items: flex-start; gap: 7px; border-top: 2px solid #cfd7d3; background: #fff; box-shadow: 0 -5px 17px rgba(22,39,31,.13); }
  .current-graphic { grid-column: 3; grid-row: 1; margin: 0; padding: 0; display: block; border: 0; background: transparent; }
  .current-graphic-thumb, .current-graphic-copy { display: none; }
  .current-graphic small { font-size: 9px; font-weight: 750; }
  .current-graphic .file-chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .remove-graphic { width: 44px; height: 44px; }
  .file-chip { font-size: 9px; }
  .dock-actions { gap: 6px; }
  .dock-button, button.transform-button { min-width: 80px; height: 48px; min-height: 48px; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
  .dock-actions #clearSelection { min-width: 94px; width: 94px; padding: 4px; gap: 5px; white-space: normal; line-height: 16px; }
  .dock-actions #clearSelection svg { flex: 0 0 21px; }
  .dock-actions #clearSelection span { min-width: 0; }
  .graphic-transforms { padding-left: 5px; gap: 3px; }
  button.transform-button { min-width: 0; padding: 4px; gap: 5px; }
  .dock-button svg { width: 21px; height: 21px; }
  button.transform-button { min-width: 78px; }
  .picture-toggle { height: 48px; min-height: 48px; padding: 8px 10px; border-radius: 10px; }
  .picture-toggle-copy strong { font-size: 14px; line-height: 16px; }
  .picture-toggle-copy small { max-width: 140px; font-size: 10px; line-height: 12px; }
  .switch-track { flex-basis: 28px; width: 28px; height: 16px; }
  .switch-track span { width: 12px; height: 12px; }
  .picture-toggle[aria-checked="true"] .switch-track span { transform: translateX(12px); }
  .status { left: 12px; max-width: calc(100% - 24px); font-size: 8px; }
  .drawer-backdrop, .tools-drawer { top: var(--toolbar-height); bottom: calc(var(--dock-height) + var(--mobile-catalog-height)); }
}

/* Landscape phones place the catalog beside the photo so neither is clipped.
   Thumbnails still form a horizontally scrollable strip. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 720px), (orientation: landscape) and (max-height: 520px) and (max-width: 1024px) and (pointer: coarse) {
  .collection-browser { width: min(560px, 100%); }
  .collection-card { grid-template-columns: 110px minmax(0, 1fr) 20px; min-height: 100px; }
  .collection-cover { height: 90px; }
  :root { --landscape-catalog-width: calc(280px + env(safe-area-inset-right, 0px)); }
  .editor-main { grid-template-rows: var(--toolbar-height) minmax(0, 1fr) var(--dock-height); }
  .preview-panel { margin-right: var(--landscape-catalog-width); padding-left: env(safe-area-inset-left, 0px); }
  .catalog-panel { top: var(--toolbar-height); right: 0; left: auto; width: var(--landscape-catalog-width); height: auto; padding-top: 4px; padding-bottom: 4px; padding-left: 8px; gap: 4px; grid-template-columns: minmax(0, 1fr) 96px auto 44px; grid-template-rows: 44px 18px minmax(128px, 1fr); border-left: 1px solid #d8dfdb; box-shadow: none; }
  .catalog-panel { overflow-y: auto; }
  .wallpaper-catalog { align-items: flex-start; }
  .toolbar-button { min-height: 58px; }
  .tool-dock { grid-row: 3; }
  .dock-button, button.transform-button, .picture-toggle { min-height: 48px; }
  .drawer-backdrop, .tools-drawer { bottom: var(--dock-height); }
}

/* Expanded view uses the same photograph/canvas, including on iOS. */
.editor-view.preview-expanded .preview-panel { position: fixed; z-index: 110; top: var(--editor-viewport-top, 0px); right: 0; left: 0; width: 100%; height: var(--editor-viewport-height, 100dvh); margin: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.preview-expanded .catalog-panel, .preview-expanded .editor-toolbar, .preview-expanded .tool-dock { visibility: hidden; }
.preview-expanded .expand-preview { display: flex; }
.preview-expanded .expand-preview-icon { display: none; }
.preview-expanded .collapse-preview-icon { display: block; }
.preview-expanded.has-expanded-branding .preview-panel { padding-bottom: calc(var(--expanded-brand-height, 56px) + env(safe-area-inset-bottom, 0px)); }
/* Rare external overflow controls remain below the photo-bottom branding. */
.preview-expanded.has-expanded-branding .preview-panel:has(.preview-guidance .surface-badge-overflow:not(.hidden)) { padding-bottom: env(safe-area-inset-bottom, 0px); }
.preview-expanded.has-expanded-branding .preview-guidance:has(.surface-badge-overflow:not(.hidden)) { margin-top: var(--expanded-brand-height, 56px); }
.expanded-branding { position: absolute; z-index: 8; min-height: 56px; padding: 7px 9px; display: grid; grid-template-columns: minmax(0, 20%) minmax(0, 1fr) minmax(0, 34%); align-items: center; gap: 7px 9px; background: #101010; color: #fff; pointer-events: none; }
.expanded-graphic-thumb { width: 100%; max-width: 76px; height: 42px; object-fit: contain; }
.expanded-graphic-copy { grid-column: 2; grid-row: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.expanded-graphic-copy strong, .expanded-graphic-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expanded-graphic-copy strong { font-size: 12px; line-height: 15px; }
.expanded-graphic-copy span { color: #bdbdbd; font-size: 10px; line-height: 13px; }
.expanded-brand-logo { grid-column: 3; width: 100%; max-width: 140px; height: 42px; justify-self: end; object-fit: contain; filter: brightness(0) invert(1); }
.expanded-graphic-changes { grid-column: 2 / -1; color: #dedede; font-size: 12px; line-height: 17px; overflow-wrap: anywhere; }
.expanded-branding.branding-narrow { padding: 6px; gap: 6px; grid-template-columns: minmax(0, 1fr) minmax(0, 34%); }
.branding-narrow .expanded-graphic-thumb { display: none; }
.branding-narrow .expanded-graphic-copy { grid-column: 1; }
.branding-narrow .expanded-brand-logo { grid-column: 2; }
.branding-narrow .expanded-graphic-changes { grid-column: 1 / -1; }
.branding-narrow .expanded-graphic-copy strong { font-size: 10px; }
.branding-narrow .expanded-graphic-copy span { font-size: 9px; }

@media (max-width: 420px) {
  .room-page-heading h1 { font-size: 27px; }
  .analysis-mode-card { padding: 8px 6px; }
  .analysis-mode-card strong { font-size: 9px; }
  .drop-actions { width: 100%; }
  .drop-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  /* Il cambio grafica deve restare percepibile anche quando il sistema riduce
     le animazioni; usiamo una dissolvenza breve invece di eliminarla. */
  .preview-transition-canvas.wallpaper-layer-fade-in { animation-duration: .24s !important; }
  .wallpaper-swipe-hint { opacity: 1; animation: none !important; }
  .swipe-hint-hand, .swipe-hint-arrow { animation: none !important; }
  .analysis-miniature .rm-room, .analysis-miniature .rm-room *, .analysis-miniature .rm-room *::before, .analysis-miniature .rm-room *::after { animation: none !important; opacity: 1; }
  .analysis-miniature .rm-landscape, .analysis-miniature .rm-paper::after { display: none; }
  .analysis-room-scan .analysis-card-glow rect { animation: none !important; stroke-dasharray: none; }
  .analysis-room-scan .analysis-card-glow rect:not(.card-glow-track) { display: none; }
}
.metric-summary { display: grid; gap: 7px; margin: .65rem 0; padding: 9px; border: 1px solid #ece5d5; border-radius: 10px; background: #fff; }
.metric-summary > strong { color: #294f3f; font-size: 10px; }
.metric-summary > small { color: #718078; font-size: 7px; line-height: 1.35; }
.metric-wall-row { padding: 8px; display: grid; gap: 3px; border: 1px solid #e2e8e5; border-radius: 8px; background: #f8faf9; }
.metric-wall-row.selected { border-color: #65a88a; background: #eaf6f0; box-shadow: inset 3px 0 0 #168562; }
.metric-wall-row strong { color: #263c33; font-size: 9px; }
.metric-wall-row span { display: block; color: #4e5f57; font-size: 8px; line-height: 1.35; }
.metric-wall-row em { color: #8a6424; font-size: 7px; font-style: normal; }
.metric-repeat-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin: .65rem 0; }
.metric-repeat-fields label { display: grid; gap: .3rem; font-size: .78rem; }
.metric-repeat-fields input { width: 100%; box-sizing: border-box; padding: .65rem; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; background: #fff; color: #111; }

/* Reference home, 3.8.61. All rules stay scoped away from the editor. */
.room-view { --home-u: min(.0873362445vw, 1.25px); position: relative; isolation: isolate; background: #f8f7f4; color: #111a1e; }
.room-view::before { content: ""; position: absolute; z-index: -1; inset: 0 auto 0 0; width: calc(92 * var(--home-u)); background: url('/assets/home-leaf-shadows.svg?v=3.8.61') left top / 100% auto repeat-y; pointer-events: none; opacity: .65; }
.room-view .room-topbar { position: relative; z-index: 2; height: calc(72 * var(--home-u)); min-height: 60px; padding: 0 max(calc((100% - 1431px) / 2 + 47px), calc(47 * var(--home-u))) 0 max(calc((100% - 1431px) / 2 + 78px), calc(78 * var(--home-u))); background: rgba(255,255,255,.54); border-color: #e1e0dc; }
.room-view .brand-logo { width: calc(180 * var(--home-u)); position: relative; left: calc(-16 * var(--home-u)); }
.room-view .room-topbar { padding-left: calc(max(0px, (100% - 1431.25px) / 2) + 109 * var(--home-u)); }
.room-view .language-switcher { border: 0; background: none; padding: 0; gap: 4px; }
.room-view .language-button { width: 31px; height: 32px; padding: 5px; border: 0; box-shadow: none; }
.room-view .language-button[aria-pressed="true"] { background: #eeefeb; }
.room-view .language-button:focus-visible { outline: 2px solid #225d43; }
.room-view .language-flag { width: 21px; height: 14px; }
.room-view .cloud-badge { display: flex; min-height: 25px; padding: 5px 9px; background: #edeee9; font-weight: 500; font-size: 9px; color: #16352a; gap: 6px; }
.room-view .cloud-badge > span { width: 6px; height: 6px; box-shadow: none; }
.room-page { width: min(100%, 1431.25px); padding: 0; }
.room-source { max-width: none; padding: 0; }
.home-hero { position: relative; display: flow-root; min-height: calc(465 * var(--home-u)); }
.home-intro { position: relative; z-index: 1; width: calc(490 * var(--home-u)); margin-left: calc(109 * var(--home-u)); padding: calc(48 * var(--home-u)) 0 0; }
.room-page-heading { max-width: none; margin: 0 0 calc(24 * var(--home-u)); text-align: left; }
.room-page-heading .eyebrow { margin: 0 0 calc(10 * var(--home-u)); color: #064f37; font-size: calc(12 * var(--home-u)); font-weight: 600; letter-spacing: .035em; line-height: 1.25; }
.room-page-heading h1 { margin: 0; color: #101a1e; font-family: "Times New Roman", Georgia, serif; font-size: calc(61 * var(--home-u)); font-weight: 700; line-height: .94; letter-spacing: -.055em; }
.room-page-heading h1 span { display: block; }
.room-page-heading h1 span:last-child { letter-spacing: -.035em; }
.room-page-heading > p:last-child { max-width: none; margin: calc(10 * var(--home-u)) 0 0; color: #111a1e; font-size: calc(18 * var(--home-u)); line-height: 1.32; }
.room-upload-card { position: relative; width: 100%; max-width: none; min-height: calc(195 * var(--home-u)); margin: 0; padding: calc(22 * var(--home-u)) calc(20 * var(--home-u)) calc(17 * var(--home-u)); align-items: stretch; justify-content: start; gap: 0; border: 1px dashed #aabdb1; border-radius: calc(12 * var(--home-u)); background: rgba(255,255,255,.94); box-shadow: 0 8px 22px #3831260c; text-align: left; }
.photo-drop-feedback { display: none; margin: 0; }
.room-upload-card.dragging .photo-drop-feedback { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; border-radius: inherit; background: rgba(238,247,240,.97); color: #18593f; font-size: 20px; font-weight: 650; pointer-events: none; }
.share-online-notice { padding: 9px 10px; margin: 8px 2px; background: #f0f5f1; color: #325441; border-radius: 7px; font-size: 12px; line-height: 1.4; }
.room-upload-card.dragging { outline: 3px solid #bfd9ca; border-color: #225d43; background: #f1f7f1; }
.room-upload-heading { display: flex; align-items: center; gap: calc(20 * var(--home-u)); }
.room-upload-heading > div { min-width: 0; }
.room-upload-heading h2 { margin: 0; font: 700 calc(20 * var(--home-u))/1.2 Georgia,serif; letter-spacing: -.03em; }
.room-upload-heading p { margin: calc(7 * var(--home-u)) 0 0; color: #536068; font-size: calc(12 * var(--home-u)); line-height: 1.45; }
.room-upload-icon { flex: 0 0 calc(57 * var(--home-u)); width: calc(57 * var(--home-u)); height: calc(57 * var(--home-u)); border-radius: 8px; background: #edf0eb; color: #18593f; }
.room-upload-icon svg { width: calc(29 * var(--home-u)); height: calc(29 * var(--home-u)); stroke-width: 1.4; }
.room-upload-card .drop-actions { width: 100%; margin-top: calc(20 * var(--home-u)); gap: calc(13 * var(--home-u)); }
.room-upload-card .drop-actions button { flex: 1; min-height: max(44px, calc(49 * var(--home-u))); display: flex; align-items: center; justify-content: center; gap: calc(10 * var(--home-u)); padding: 9px 5px; border-radius: 8px; font-size: max(11px, calc(13 * var(--home-u))); font-weight: 600; }
.room-upload-card .drop-actions button svg { width: 19px; height: 19px; flex: 0 0 19px; }
.room-upload-card button.primary { background: #1c5c42; border-color: #1c5c42; }
.room-upload-card button.primary:hover { background: #144c35; }
.room-upload-card button.secondary { border-color: #c9cdca; color: #11191d; }
.room-upload-formats { margin: calc(12 * var(--home-u)) 0 0; color: #59656b; text-align: center; font-size: calc(11 * var(--home-u)); line-height: 1.4; }
.home-intro .photo-loaded { margin: 14px 0 0; }
.home-intro .catalog-notice { margin: 0 0 14px; }
.home-comparison { --home-split: 50%; position: absolute; top: 0; right: 0; width: calc(585 * var(--home-u)); height: calc(522 * var(--home-u)); margin: 0; border: 0; background: none; isolation: isolate; }
.home-comparison-cut { position: absolute; inset: 0; clip-path: polygon(0 0, 100% 0, 100% 91%, 36% 100%, 0 89%); background: #e2dcd1; }
.home-comparison-scene { position: absolute; inset: 0; overflow: hidden; }
.home-room-before, .home-room-after { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-room-before { background: url('/assets/home-room-before-v2.webp?v=3.8.61') center / cover no-repeat; }
.home-room-after { clip-path: inset(0 0 0 var(--home-split)); stroke: none; }
.home-wall-artwork { mix-blend-mode: multiply; }
.home-comparison-labels { position: absolute; top: 17%; left: 24%; right: 32%; display: flex; justify-content: space-between; pointer-events: none; }
.home-comparison-labels span { padding: 5px 11px; border-radius: 5px; background: #39352c99; color: #fff; font-size: calc(13 * var(--home-u)); font-weight: 600; }
.home-comparison-labels span:last-child { background: #24563ccb; }
.home-comparison-line { position: absolute; inset: 0 auto 0 var(--home-split); width: 1px; background: #ffffffe6; pointer-events: none; }
.home-comparison-line > span { position: absolute; top: 47%; left: 50%; transform: translate(-50%,-50%); width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #fff; box-shadow: 0 2px 9px #0002; color: #172127; }
.home-comparison-line svg { width: 21px; height: 21px; }
.home-comparison-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: ew-resize; opacity: 0; touch-action: pan-y; }
.home-comparison:focus-within .home-comparison-line > span { outline: 3px solid #225d43; outline-offset: 4px; }
.home-signature { position: absolute; top: 92%; right: calc(25 * var(--home-u)); width: calc(146 * var(--home-u)); height: calc(115 * var(--home-u)); pointer-events: none; background: url('/assets/home-signature-v2.webp?v=3.8.61') center / contain no-repeat; }
.home-signature span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.home-steps { width: calc(627 * var(--home-u)); max-width: none; margin: calc(32 * var(--home-u)) 0 calc(45 * var(--home-u)) calc(109 * var(--home-u)); padding: 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; list-style: none; }
.home-steps li { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.home-steps li:not(:last-child)::after { content: ""; position: absolute; top: calc(19 * var(--home-u)); left: calc(112 * var(--home-u)); width: calc(64 * var(--home-u)); height: 1px; background: #9eaaa4; }
.home-step-number { width: calc(38 * var(--home-u)); height: calc(38 * var(--home-u)); margin-bottom: calc(8 * var(--home-u)); display: grid; place-items: center; border: 1px solid #29634e; border-radius: 50%; color: #123f2d; font-size: calc(16 * var(--home-u)); }
.home-steps strong { margin-bottom: calc(3 * var(--home-u)); font-size: calc(13 * var(--home-u)); font-weight: 600; }
.home-steps .home-step-desktop, .home-steps .home-step-mobile { color: #526069; font-size: calc(11 * var(--home-u)); line-height: 1.4; }
.home-steps .home-step-mobile { display: none; }
.room-picker { margin: 0 calc(54 * var(--home-u)) 0 calc(68 * var(--home-u)); gap: 36px; }
.room-library { scroll-margin-top: 24px; }
.room-library-heading { margin-bottom: calc(13 * var(--home-u)); display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.room-library-heading h2 { font: 400 calc(30 * var(--home-u))/1.2 Georgia,serif; letter-spacing: -.04em; }
.room-library-heading p { margin-top: 3px; color: #445058; font-size: calc(14 * var(--home-u)); line-height: 1.5; }
.room-storage-note { margin-top: 10px; color: #67736b; font-size: 11px; }
#recentRoomsGrid { grid-template-columns: repeat(5,minmax(0,1fr)); gap: calc(16 * var(--home-u)); }
.room-view button.room-card { border-radius: 7px; }
.room-view button.recent-room-card { border: 0; border-radius: 0; background: none; box-shadow: none; }
.room-view button.recent-room-card:focus-visible { outline: 2px solid #225d43; outline-offset: 3px; }
.room-view .recent-room-card .room-card-media { border-radius: 7px; aspect-ratio: 1.4; }
.room-view .room-card-media img { object-position: center; transition: transform .25s ease; }
.room-view .room-card:hover img { transform: scale(1.025); }
.room-view .recent-room-card > .room-card-meta { display: block; margin-top: 7px; color: #39474e; font-size: calc(10 * var(--home-u)); }
.room-view button.room-delete { width: max(29px, calc(29 * var(--home-u))); height: max(29px, calc(29 * var(--home-u))); top: 8px; right: 8px; box-shadow: none; }
.room-view button.room-delete svg { width: 16px; height: 16px; }
.room-resume { position: absolute; inset: 0; display: grid; place-items: center; background: #1b302644; color: #fff; font-size: 14px; opacity: 0; transition: opacity .2s ease; }
.recent-room-card:hover .room-resume, .recent-room-card:focus-visible .room-resume { opacity: 1; }
.home-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: calc(32 * var(--home-u)) calc(54 * var(--home-u)) 0 calc(68 * var(--home-u)); padding: calc(8 * var(--home-u)) 0 max(calc(15 * var(--home-u)), env(safe-area-inset-bottom)); border-top: 1px solid #dfdfd9; color: #687178; font-size: calc(11 * var(--home-u)); }
.home-footer-brand { padding-right: calc(36 * var(--home-u)); }
.home-footer img { width: calc(96 * var(--home-u)); height: auto; margin: 0 calc(-8 * var(--home-u)); }
.home-footer-brand::after { content: ""; width: 1px; height: 23px; margin-left: calc(36 * var(--home-u)); background: #dedfd9; }
.home-footer a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.home-footer nav { display: flex; gap: calc(29 * var(--home-u)); }
.home-footer a:hover { color: #225d43; text-decoration: underline; }

@media (max-width: 860px) {
  .room-view { --home-u: 1px; }
  .room-view::before { display: none; }
  .room-view .room-topbar { height: calc(56px + env(safe-area-inset-top, 0px)); min-height: 56px; padding: env(safe-area-inset-top, 0px) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); }
  .room-view .brand-logo { width: 132px; left: -11px; }
  .room-view .room-topbar { padding-left: max(calc((100% - 620px) / 2 + 10px), 30px, env(safe-area-inset-left)); }
  .room-view .room-topbar-actions { gap: 4px; }
  .room-view .language-button { width: 27px; height: 36px; }
  .room-view .language-flag { width: 18px; height: 12px; }
  .room-view .cloud-badge { display: flex; min-height: 22px; padding: 4px 7px; font-size: 8px; gap: 5px; }
  .room-view .cloud-badge > span { width: 5px; height: 5px; }
  .room-page { width: min(620px, calc(100% - 40px)); padding: 32px 0 0; }
  .home-hero { min-height: 0; }
  .home-intro { width: 100%; margin: 0; padding: 0; }
  .home-comparison { display: none; }
  .room-page-heading { margin: 0 10px 20px; }
  .room-page-heading .eyebrow { font-size: 12px; line-height: 1.25; letter-spacing: .06em; margin-bottom: 14px; }
  .room-page-heading h1 { font-size: clamp(34px, 11.9vw, 46px); line-height: .98; letter-spacing: -.055em; }
  .room-page-heading > p:last-child { margin-top: 14px; font-size: 13px; line-height: 1.42; color: #526068; }
  .home-desktop-break { display: none; }
  .room-upload-card { min-height: 236px; padding: 19px 16px 16px; border-radius: 13px; text-align: center; }
  .room-upload-heading { flex-direction: column; gap: 12px; }
  .room-upload-icon { flex-basis: 49px; width: 49px; height: 49px; }
  .room-upload-icon svg { width: 29px; height: 29px; }
  .room-upload-heading h2 { font-size: 20px; line-height: 1.25; }
  .room-upload-heading p { margin-top: 6px; font-size: 11px; line-height: 1.45; white-space: nowrap; letter-spacing: -.025em; }
  .room-upload-card .drop-actions { margin-top: 18px; gap: 10px; }
  .room-upload-card .drop-actions button { min-height: 48px; padding: 8px 5px; font-size: 11px; gap: 7px; }
  .room-upload-card .drop-actions button svg { width: 17px; height: 17px; flex-basis: 17px; }
  .room-upload-formats { margin-top: 13px; font-size: 11px; }
  .home-steps { width: 100%; max-width: none; margin: 28px 0 39px; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .home-steps li { align-items: flex-start; padding-left: 17px; }
  .home-steps li:nth-child(2) { padding-left: 25px; }
  .home-steps li:last-child { padding-left: 35px; }
  .home-step-number { width: 35px; height: 35px; font-size: 16px; margin-bottom: 8px; }
  .home-steps strong { margin-bottom: 4px; font-size: 12px; }
  .home-steps .home-step-desktop { display: none; }
  .home-steps .home-step-mobile { display: block; font-size: 10px; }
  .home-steps li:not(:last-child)::after { top: 17px; left: 70px; width: calc(100% - 62px); background: #b1bab5; }
  .room-picker { margin: 0; gap: 28px; }
  .room-library-heading { align-items: center; flex-direction: row; margin-bottom: 12px; gap: 5px; }
  .room-library-heading h2 { font-size: clamp(20px, 5.7vw, 24px); }
  .room-library-heading p { margin-top: 4px; font-size: 12px; }
  .room-grid, #recentRoomsGrid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
  .room-view .recent-room-card .room-card-media { aspect-ratio: 1.32; }
  .room-view .recent-room-card > .room-card-meta { margin-top: 7px; font-size: 10px; }
  .room-view button.room-delete { width: 32px; height: 32px; top: 6px; right: 6px; }
  .home-footer { margin: 32px 0 0; padding: 12px 0 max(22px, env(safe-area-inset-bottom)); flex-wrap: wrap; gap: 4px 12px; font-size: 10px; }
  .home-footer-brand { padding-right: 0; }
  .home-footer-brand::after { display: none; }
  .home-footer img { width: 96px; margin: 0 -8px; }
  .home-footer > span { order: 1; flex-basis: 100%; font-size: 9px; }
  .home-footer nav { gap: 15px; }
}
@media (max-width: 340px) {
  .room-view .room-topbar { padding-left: 15px; padding-right: 15px; }
  .room-page { width: calc(100% - 30px); }
  .room-page-heading { margin-left: 4px; margin-right: 4px; }
  .room-page-heading .eyebrow { font-size: 10px; }
  .room-page-heading h1 { font-size: 34px; }
  .room-upload-card { padding-left: 12px; padding-right: 12px; }
  .room-upload-heading p { font-size: 10px; white-space: normal; }
  .room-upload-card .drop-actions button { gap: 5px; font-size: 10px; }
  .home-steps li { padding-left: 10px; }
  .home-steps li:nth-child(2) { padding-left: 17px; }
  .home-steps li:last-child { padding-left: 23px; }
  .home-steps li:not(:last-child)::after { left: 57px; width: calc(100% - 52px); }
  .room-library-heading h2 { font-size: 20px; }
  .room-library-heading p { font-size: 11px; }
}

/* One article per card; variants are deliberately separate from collections. */
.wallpaper-catalog { align-content: start; align-items: start; }
.variant-count { color: var(--green-dark) !important; }
.wallpaper-card.active:not(.applied-variant) .wallpaper-card-media::after { display: none; }
.variant-count::after { content: " +"; }
.variants-expanded .variant-count::after { content: " −"; }
.wallpaper-card:not(:has([aria-expanded])) .variant-count::after { content: ""; }
.wallpaper-card.variants-expanded { grid-column: 1 / -1; }
.variants-expanded .wallpaper-card-select { flex-direction: row; align-items: center; padding-right: 38px; }
.variants-expanded .wallpaper-card-media { width: 78px; flex: 0 0 78px; }
.inline-variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; padding: 8px; border-top: 1px solid #dbe7e0; }
.inline-variants[hidden] { display: none; }
.variant-tile { position: relative; min-width: 0; }
.variant-choice { position: relative; min-width: 0; width: 100%; padding: 5px; display: flex; flex-direction: column; align-items: stretch; gap: 6px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); text-align: center; }
.variant-choice img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.variant-choice span { font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.variant-choice:hover { background: #f0f5f1; border-color: #a2bcae; }
.variant-choice:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 1px; }
.variant-choice[aria-pressed="true"] { border-color: var(--green-dark); background: #eaf3ed; }
.variant-choice[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 8px; left: 8px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--green-dark); color: #fff; font-size: 11px; }
.variant-favorite { position: absolute; top: 7px; right: 7px; z-index: 1; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid #e0e7e2; border-radius: 50%; background: rgba(255,255,255,.95); color: #24332d; box-shadow: 0 2px 7px #14231c18; }
.variant-favorite svg { width: 18px; height: 18px; }
.variant-favorite.active { color: var(--green-dark); }
.variant-favorite.active svg { fill: var(--green-dark); stroke: var(--green-dark); }
.variant-favorite:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 2px; }
.article-favorites-count { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 3px; border-radius: 10px; background: var(--green-dark); color: #fff; font-size: 9px; line-height: 1; }
.article-favorites-count[hidden] { display: none; }
.inline-variants .variant-favorite { top: 4px; right: 4px; width: 32px; height: 32px; }
.inline-variants .variant-favorite svg { width: 16px; height: 16px; }
.inline-variants .variant-choice { padding: 3px; gap: 4px; }
.inline-variants .variant-choice span { font-size: 9px; }
.inline-variants .variant-choice[aria-pressed="true"]::after { top: 5px; left: 5px; width: 15px; height: 15px; font-size: 9px; }
body.variants-open { overflow: hidden; }
.variants-dialog { width: min(660px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 1px solid #dde5df; border-radius: 22px; background: #fcfdfb; color: var(--ink); box-shadow: 0 24px 90px #182a3340; overflow: hidden; }
.variants-dialog[open] { display: flex; flex-direction: column; }
.variants-dialog::backdrop { background: rgba(20,30,26,.48); }
.variants-header { flex: 0 0 auto; display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 24px 24px 16px; }
.variants-header h2 { margin: 0; font-size: 23px; }
.variants-header p { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.variant-choices { padding: 0 20px 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#showVariants svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
@media (max-width: 720px), (max-width: 1024px) and (max-height: 520px) and (pointer: coarse) {
  .current-graphic-variants { display: none; }
  .wallpaper-card.variants-expanded { width: 224px; flex-basis: 224px; }
  .wallpaper-card .wallpaper-card-copy > small:not(.variant-count) { display: none; }
  .variants-expanded .wallpaper-card-select { padding-top: 3px; padding-bottom: 3px; }
  .variants-expanded .wallpaper-card-media { width: 40px; flex-basis: 40px; }
  .inline-variants { display: flex; overflow-x: auto; gap: 5px; padding: 4px; touch-action: pan-x; }
  .inline-variants .variant-tile { width: 76px; flex: 0 0 76px; }
  .inline-variants .variant-choice { padding: 2px; gap: 2px; }
  .inline-variants .variant-choice img { width: 48px; height: 48px; align-self: center; }
  .variant-choices .variant-favorite { width: 44px; height: 44px; }
  .inline-variants .variant-choice span { font-size: 8.5px; line-height: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .variant-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 0 12px 16px; }
  .variants-header { padding: 18px 16px 14px; }
  .variants-dialog { max-height: calc(var(--editor-viewport-height, 100dvh) - 24px); }
  .dock-actions { gap: 2px; }
  .dock-actions #clearSelection { min-width: 80px; width: 80px; font-size: 11px; }
  .dock-actions .graphic-transforms { padding-left: 2px; gap: 0; }
  .dock-actions button.transform-button { min-width: 67px; font-size: 11px; gap: 3px; }
  .dock-actions #showVariants { min-width: 66px; padding: 4px; gap: 3px; font-size: 11px; }
  #showVariants svg { width: 17px; height: 17px; }
}

/* Phone-sized touch layouts only, including landscape. Keep tablets and mouse
   layouts unchanged; shrink the button's real hit box along with its icon. */
@media (pointer: coarse) and (max-width: 520px), (pointer: coarse) and (max-width: 1024px) and (max-height: 520px) {
  .inline-variants .variant-favorite { width: 24px; height: 24px; }
  .inline-variants .variant-favorite svg { width: 12px; height: 12px; }
  .variant-choices .variant-favorite { width: 33px; height: 33px; }
  .variant-choices .variant-favorite svg { width: 13.5px; height: 13.5px; }
}

.catalog-search-tools { display: flex; min-width: 0; gap: 5px; }
.catalog-search-tools .catalog-search { flex: 1; width: 0; }
.catalog-filters-toggle { flex: 0 0 auto; border: 1px solid #dfe3de; border-radius: 9px; padding: 7px; background: #fff; color: var(--ink); font-size: 12px; }
.catalog-filters-toggle.has-active-filters { border-color: var(--green-dark); background: var(--green-dark); color: #fff; -webkit-text-fill-color: currentColor; font-weight: 650; }
.catalog-status-row { display: grid; gap: 6px; min-width: 0; }
.catalog-filter-summary { display: flex; align-items: center; gap: 6px; min-width: 0; }
.catalog-filter-summary button { -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 30px; padding: 4px 7px; border: 1px solid #d5e3dc; border-radius: 7px; background: #f0f6f2; color: var(--green-dark); -webkit-text-fill-color: currentColor; font-size: 11px; line-height: 16px; white-space: nowrap; }
.catalog-filter-summary button[hidden] { display: none; }
.catalog-filter-summary .catalog-subject-chip { flex: 0 1 auto; font-weight: 650; border-color: #a3c4b3; background: var(--green-soft); }
#catalogSubjectLabel { overflow: hidden; text-overflow: ellipsis; }
.catalog-chip-remove { flex: 0 0 auto; font-size: 16px; line-height: 16px; }
.catalog-filter-summary .catalog-sort-summary { flex: 0 0 auto; border-color: transparent; background: transparent; color: #485950; }
.catalog-filter-summary button:hover { border-color: #a3c4b3; background: #eaf5f1; }
.catalog-filter-summary button:focus-visible, .catalog-filters-toggle:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 2px; }
.catalog-filters-dialog { width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; border: 1px solid #dfe3de; border-radius: 16px; color: var(--ink); background: #fff; }
.catalog-filters-dialog::backdrop { background: rgba(20,35,28,.42); }
.catalog-filters-dialog label { display: block; margin: 16px 0 5px; }
.catalog-filters-dialog select { width: 100%; min-height: 44px; padding: 8px; border: 1px solid #bbc8bf; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
.catalog-filter-actions { display: flex; justify-content: space-between; gap: 12px; }
/* Explicit colors/appearance keep iOS submit and reset controls on the desktop palette. */
.catalog-filter-actions button { -webkit-appearance: none; appearance: none; min-height: 44px; padding: 8px 12px; border: 1px solid #bbc8bf; border-radius: 8px; background: #f2f5f1; color: var(--ink); -webkit-text-fill-color: currentColor; }
@media (max-width: 720px), (max-width: 1024px) and (max-height: 520px) and (pointer: coarse) {
  .catalog-search-tools { grid-column: 1; grid-row: 1; height: 44px; }
  .catalog-filters-toggle { min-width: 44px; }
  /* Reuse the existing 18px status row; the catalog and photo keep their height.
     The 24px touch targets extend into the two existing 6px gaps, not the cards. */
  .catalog-status-row { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: 6px; min-height: 0; }
  .catalog-status-row .catalog-collection-title { flex: 1 1 auto; }
  .catalog-filter-summary { flex: 0 1 auto; gap: 4px; }
  .catalog-filter-summary button { min-height: 24px; padding: 2px 5px; font-size: 10px; }
}

@media (max-width: 420px) {
  .catalog-panel { grid-template-columns: minmax(0, 1fr) 92px auto 44px; }
  .catalog-filters-toggle { position: relative; width: 44px; padding: 4px 2px; }
  #catalogFiltersCount:not(:empty) { position: absolute; right: -2px; top: -4px; border-radius: 8px; padding: 0 3px; font-size: 9px; background: #244e3b; color: #fff; }
}

/* Keep every pinned control while leaving room for cards on short desktops. */
@media (min-width: 721px) and (max-height: 720px) and (pointer: fine), (min-width: 1025px) and (max-height: 720px) {
  .catalog-panel { padding-top: 8px; padding-bottom: 8px; }
  .catalog-brand { min-height: 36px; padding-bottom: 6px; }
  .catalog-brand-logo { width: 140px; }
  .catalog-heading { padding: 8px 0; }
  .catalog-search-label { margin-top: 6px; }
  .current-graphic { margin-top: 8px; padding: 6px 8px; }
  .current-graphic-variants { grid-template-columns: 40px minmax(0, 1fr); }
  .current-graphic-thumb { width: 40px; height: 40px; }
  .catalog-browse { min-height: 64px; padding: 6px 12px; }
  .catalog-library { gap: 6px; }
}

/* The landscape rail is only 280px wide, including the active-design trash.
   Reserve 44px each for Search and Filters plus their 5px gap. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 720px), (orientation: landscape) and (max-height: 520px) and (max-width: 1024px) and (pointer: coarse) {
  .catalog-panel { grid-template-columns: minmax(93px, 1fr) 68px auto 44px; }
  .catalog-search-tools .catalog-search { padding-left: 26px; padding-right: 4px; background-position: 6px center; background-size: 15px; }
  .catalog-filters-toggle { width: 44px; padding: 4px 2px; font-size: 11px; }
}

/* Compact language picker: only the selected flag occupies the header. */
.room-view .room-upload-heading p { white-space: normal; }
#homeLanguages { order: 2; }
@media (max-width: 860px) {
  .room-view .cloud-badge { max-width: 68px; white-space: normal; overflow-wrap: anywhere; }
  .room-view .brand { flex-shrink: 0; }
}
