/* The memory workshop uses the same purpose, preview and one-tool surface
   boundary as the other workshops. Native image/canvas pixels stay intact. */
@layer savorip-memory {
 body.smg-mounted{background:var(--sv-bg,#0b1425)!important;color:var(--sv-text,#f8f5eb)!important}
 body.smg-mounted #memory27[data-smg-mounted]{max-width:none!important;width:100%!important;min-width:0!important;margin:0!important;padding:0!important;background:transparent!important}
 body.smg-mounted #smgMemoryStudio{--sws-card-width:154px;--sws-card-height:88px;--sws-right:20px;--sws-width:450px;--smg-dock:120px;position:relative;min-width:0;color:var(--sws-ink,#f8f5eb);font:400 14px/1.5 system-ui,-apple-system,"Segoe UI","Malgun Gothic",sans-serif}
 body.smg-mounted #smgMemoryStudio *{box-sizing:border-box;min-width:0}
 body.smg-mounted #smgMemoryStudio :is(button,input,select,textarea){font:inherit}
 body.smg-mounted #smgMemoryStudio button{cursor:pointer;-webkit-tap-highlight-color:transparent}
 body.smg-mounted #smgMemoryStudio button:disabled{opacity:.45;cursor:default}
 body.smg-mounted #smgMemoryStudio :is(button,a,input,select,textarea):focus-visible{outline:3px solid var(--sws-gold,#e6c77f)!important;outline-offset:3px}
 body.smg-mounted #smgMemoryStudio [hidden],body.smg-mounted #memory27[data-smg-mounted] [hidden]{display:none!important}
 /* Keep native controllers and their nodes mounted. Only the new card layer
    exposes a native workspace, inside its dedicated active surface. */
 body.smg-mounted #memory27[data-smg-mounted] :is(.m27-toolbar,.m27-hero,#m27Steps,#m27Status,#ms-nav,#ms-heading,#ms-status,.ms-pager,#ms-unavailable,#ms-finish-note){display:none!important}
 body.smg-mounted #memory27[data-smg-mounted]>:not(#smgMemoryStudio){display:none!important}
 body.smg-mounted #memory27[data-smg-mounted] :is(#m27Stage,#ms-drawing,#ms-world,#ms-gallery):not([data-sws-active-root]),body.smg-mounted #creationQueue26:not([data-sws-active-root]){display:none!important}
 body.smg-mounted :is(#savorip-glossary-global-nav,.sv38-footer,.savorip-global-back,.savorip-global-backbar){display:none!important}
 body.smg-mounted #smgMemoryStudio .smg-gateway{display:flex;flex-direction:column;gap:14px;min-height:calc(var(--sws-viewport,100dvh) - var(--sws-top,76px));padding:25px 0 16px;background:var(--sws-bg,#0b1425)}
 body.smg-mounted #smgMemoryStudio .smg-gateway>header{flex:0 0 auto;text-align:center;padding:0 22px}
 body.smg-mounted #smgMemoryStudio .smg-gateway small{font-size:11px;color:var(--sws-muted,#bcc8d6)}
 body.smg-mounted #smgMemoryStudio .smg-gateway h1{margin:5px 0;font-size:clamp(26px,3.5vw,37px);line-height:1.25;letter-spacing:-.035em;color:var(--sws-ink,#f8f5eb)}
 body.smg-mounted #smgMemoryStudio .smg-gateway>header p{margin:6px 0 0;color:var(--sws-muted,#bcc8d6);font-size:13px}
 body.smg-mounted #smgMemoryStudio .smg-purpose-rail{display:flex;flex:1;min-height:0;gap:16px;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:none;padding:7px max(24px,calc((100% - 1000px)/2));scroll-padding-inline:max(24px,calc((100% - 1000px)/2))}
 body.smg-mounted #smgMemoryStudio .smg-purpose-rail::-webkit-scrollbar{display:none}
 body.smg-mounted #smgMemoryStudio .smg-purpose-card{display:flex;flex:0 0 300px;flex-direction:column;min-height:0;max-height:480px;gap:9px;padding:15px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:25px;background:linear-gradient(135deg,rgba(255,255,255,.09),rgba(255,255,255,.025)),rgba(17,31,52,.52);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);box-shadow:inset 0 1px rgba(255,255,255,.22),0 10px 32px rgba(0,0,0,.15);scroll-snap-align:center}
 body.smg-mounted #smgMemoryStudio .smg-purpose-card>small{align-self:flex-start;padding:3px 8px;border-radius:20px;background:rgba(255,255,255,.055);font-size:10px}
 body.smg-mounted #smgMemoryStudio .smg-purpose-image{display:flex;flex:1;min-height:100px;height:285px;align-items:center;justify-content:center}
 body.smg-mounted #smgMemoryStudio .smg-purpose-image img{display:block;width:100%;height:100%;object-fit:contain}
 body.smg-mounted #smgMemoryStudio .smg-purpose-card h2{margin:0;text-align:center;color:var(--sws-ink,#f8f5eb);font-size:21px;line-height:1.3;word-break:keep-all}
 body.smg-mounted #smgMemoryStudio :is(.smg-purpose-card>button,.smg-gate-links>button,.smg-gate-nav>button){display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:44px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:12px;padding:10px 12px;background:rgba(255,255,255,.045);color:var(--sws-ink,#f8f5eb);font-size:13px;font-weight:600}
 body.smg-mounted #smgMemoryStudio .smg-gate-nav{display:flex;flex:0 0 auto;align-items:center;justify-content:center;gap:16px;color:var(--sws-muted,#bcc8d6);font-size:11px}
 body.smg-mounted #smgMemoryStudio .smg-gate-nav>button{justify-content:center;width:36px;padding:4px;font-size:18px}
 body.smg-mounted #smgMemoryStudio .smg-gate-links{display:flex;justify-content:center;gap:10px;padding:0 18px;overflow-x:auto}
 body.smg-mounted #smgMemoryStudio .smg-gate-links:empty{display:none}
 body.smg-mounted #smgMemoryStudio .smg-gate-links>button{flex:0 0 auto;min-height:40px;font-size:12px}
 body.smg-mounted #smgMemoryStudio .smg-work{position:relative;width:min(1100px,100%);min-height:calc(var(--sws-viewport,100dvh) - var(--sws-top,76px));margin:auto;padding:0 20px calc(var(--smg-dock) + 20px)}
 body.smg-mounted #smgMemoryStudio .smg-top{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:47px}
 body.smg-mounted #smgMemoryStudio .smg-top>button{min-height:44px;border:0;background:transparent;padding:5px 0;color:var(--sws-muted,#bcc8d6);font-size:12px}
 body.smg-mounted #smgMemoryStudio .smg-top>small{font-size:11px;color:var(--sws-muted,#bcc8d6)}
 body.smg-mounted #smgMemoryStudio .smg-work-heading{padding:3px 0 9px}
 body.smg-mounted #smgMemoryStudio .smg-work-heading>small{font-size:10px;color:var(--sws-muted,#bcc8d6)}
 body.smg-mounted #smgMemoryStudio .smg-work-heading h1{margin:2px 0;font-size:21px;line-height:1.3;color:var(--sws-ink,#f8f5eb)}
 body.smg-mounted #smgMemoryStudio .smg-preview{position:relative;display:flex;align-items:center;justify-content:center;min-height:170px;height:min(48dvh,430px);margin:auto;border:1px solid rgba(255,255,255,.09);border-radius:23px;background:radial-gradient(ellipse at 50% 70%,rgba(230,199,127,.09),transparent 65%)}
 body.smg-mounted #smgMemoryStudio .smg-preview>img{width:100%;height:100%;object-fit:contain;padding:13px}
 body.smg-mounted #smgMemoryStudio .smg-preview>span{position:absolute;top:12px;left:12px;padding:3px 8px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:18px;background:rgba(11,20,37,.6);color:var(--sws-muted,#bcc8d6);font-size:10px}
 body.smg-mounted #smgMemoryStudio .smg-selection{display:grid;grid-template-columns:38px minmax(0,1fr) auto;align-items:center;gap:10px;margin:10px 0;padding:8px 10px;border:1px solid rgba(255,255,255,.12);border-radius:13px;background:rgba(255,255,255,.025)}
 body.smg-mounted #smgMemoryStudio .smg-selection>img{display:block;width:38px;height:38px;object-fit:contain;border-radius:5px}
 body.smg-mounted #smgMemoryStudio .smg-selection>span{font-size:12px;line-height:1.35;overflow-wrap:anywhere;color:var(--sws-ink,#f8f5eb)}
 body.smg-mounted #smgMemoryStudio .smg-selection>button{min-height:44px;padding:4px 7px;border:0;background:transparent;color:var(--sws-gold,#e6c77f);font-size:11px}
 body.smg-mounted #smgMemoryStudio .smg-source-choice{position:relative;width:min(440px,100%);margin:-45px auto 14px;padding:16px;border:1px solid rgba(255,255,255,.35);border-radius:22px;background:linear-gradient(140deg,rgba(255,255,255,.1),rgba(255,255,255,.025)),rgba(17,31,52,.68);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);box-shadow:inset 0 1px rgba(255,255,255,.18)}
 body.smg-mounted #smgMemoryStudio .smg-source-choice h2{margin:0 0 12px;font-size:16px;line-height:1.4}
 body.smg-mounted #smgMemoryStudio .smg-source-choice>div{display:grid;grid-template-columns:1fr 1fr;gap:9px}
 body.smg-mounted #smgMemoryStudio .smg-source-choice button{display:flex;align-items:flex-start;flex-direction:column;gap:10px;min-height:86px;width:100%;padding:12px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:13px;background:rgba(255,255,255,.025);color:var(--sws-ink,#f8f5eb);text-align:left;font-size:13px}
 body.smg-mounted #smgMemoryStudio .smg-source-choice button>svg{width:27px;height:27px;color:var(--sws-gold,#e6c77f)}
 body.smg-mounted #smgMemoryStudio .smg-source-choice .sgs-tool-icon{display:block;width:28px;height:28px;color:var(--sws-gold,#e6c77f)}
 body.smg-mounted #smgMemoryStudio .smg-source-choice .sgs-tool-icon svg{display:block;width:100%;height:100%}
 body.smg-mounted #smgMemoryStudio .smg-source-choice>button{min-height:44px;margin-top:9px;border:0;background:transparent;justify-content:center;gap:0}
 body.smg-mounted #smgMemoryStudio :is(.smg-instruction,.smg-status){margin:12px auto;font-size:12px;line-height:1.5;color:var(--sws-muted,#bcc8d6)}
 body.smg-mounted #smgMemoryStudio .smg-status{max-width:1060px;padding:0 20px}
 body.smg-mounted #smgMemoryStudio :is(.smg-instruction,.smg-status):empty{display:none}
 body.smg-mounted #smgMemoryStudio .smg-completion{padding:12px 0}
 body.smg-mounted #smgMemoryStudio .smg-completion h2{font-size:16px;margin:0 0 5px}
 body.smg-mounted #smgMemoryStudio .smg-completion p{font-size:12px;margin:0;color:var(--sws-muted,#bcc8d6)}
 body.smg-mounted #smgMemoryStudio .smg-completion>button{min-height:44px;margin-top:12px;padding:9px 14px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:12px;background:rgba(255,255,255,.04);color:var(--sws-ink,#f8f5eb)}
 body.smg-mounted #smgMemoryStudio .smg-tool-dock{position:fixed;z-index:90;left:0;right:0;bottom:0;padding:10px max(16px,calc((100vw - 1100px)/2)) calc(8px + env(safe-area-inset-bottom));background:linear-gradient(0deg,rgba(11,20,37,.98),rgba(11,20,37,.87) 75%,transparent)}
 body.smg-mounted #smgMemoryStudio .smg-tools{display:flex;gap:10px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scrollbar-width:none;padding:3px 2px 5px}
 body.smg-mounted #smgMemoryStudio .smg-tools::-webkit-scrollbar{display:none}
 body.smg-mounted #smgMemoryStudio .smg-tool-dock>small{display:block;text-align:center;font-size:10px;line-height:1.4;letter-spacing:.08em;color:var(--sws-muted,#bcc8d6)}
 body.smg-mounted #smgMemoryStudio[data-smg-scene="1"] .smg-tool-dock{display:none!important}
 body.smg-mounted #smgMemoryStudio[data-smg-mode=gate]{position:fixed;inset:var(--sws-top,76px) 0 0;z-index:100;overflow:auto;background:var(--sws-bg,#0b1425)}
 body.smg-mounted #smgMemoryStudio[data-smg-mode=gate] .smg-gateway{height:100%;min-height:0}
 body.smg-mounted #smgMemoryStudio .smg-blocked{max-width:520px;margin:25px auto;padding:22px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:20px;background:var(--sws-panel,#111f34)}
 body.smg-mounted #smgMemoryStudio .smg-blocked button{min-height:44px;padding:9px 13px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:12px;background:var(--sws-gold,#e6c77f);color:var(--sws-bg,#0b1425)}
 body.smg-mounted #smgMemoryRecovery{position:fixed;z-index:1200;inset:var(--smg-recovery-top,54px) 0 0;display:grid;place-content:center;gap:16px;padding:24px;background:var(--sv-bg,#0b1425);color:var(--sv-text,#f8f5eb);text-align:center}
 body.smg-mounted #smgMemoryRecovery[hidden]{display:none!important}
 body.smg-mounted #smgMemoryRecovery>p{max-width:480px;margin:0;font:400 15px/1.6 system-ui,sans-serif;color:var(--sv-text,#f8f5eb)}
 body.smg-mounted #smgMemoryRecovery>button{min-height:44px;justify-self:center;padding:10px 18px;border:1px solid var(--sv-edge,rgba(230,199,127,.3));border-radius:12px;background:var(--sv-gold,#e6c77f);color:var(--sv-bg,#0b1425);font:600 14px/1.4 system-ui,sans-serif}
 /* The whole native stage is the portal root. Its existing delegation stays
    inside #memory27, and native render() can replace its children safely. */
 body.smg-mounted #smgMemoryStudio .sws-native-host>[data-sws-active-root]{display:block!important;max-width:none!important;min-width:0!important;margin:0!important;padding:14px!important;background:transparent!important;color:var(--sws-ink,#f8f5eb)!important;border:0!important;border-radius:0!important;box-shadow:none!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host>[hidden]{display:none!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host :is(input:not([type=checkbox]):not([type=color]),select,textarea,button){max-width:100%;min-height:44px;border-color:var(--sws-edge,rgba(230,199,127,.3))!important;color:var(--sws-ink,#f8f5eb)!important;background-color:var(--sws-panel,#111f34)!important;font-size:13px!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host :is(p,small,figcaption,.m27-note){color:var(--sws-muted,#bcc8d6)!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m28-source-head{display:none!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m32-source-actions{display:flex;gap:8px;flex-wrap:wrap}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m32-ip-categories{display:flex;gap:8px;overflow-x:auto;padding:8px 0;scrollbar-width:none}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m32-ip-category{--sws-control-padding:8px;flex:0 0 104px!important;padding:8px!important;border-radius:13px!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m32-category-photos{height:55px!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m27-art-grid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;grid-template-rows:none!important;grid-auto-flow:row!important;grid-auto-columns:auto!important;grid-auto-rows:auto!important;gap:10px!important;width:100%!important;overflow:visible!important;max-height:none!important;scroll-snap-type:none!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m27-art-grid>.m27-card{--sws-control-padding:4px;--sws-control-size:11px;width:auto!important;min-width:0!important;min-height:0!important;max-width:100%!important;flex-basis:auto!important;padding:4px!important;border-radius:10px!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m27-art-grid>.m27-card>img{width:100%!important;height:120px!important;min-height:0!important;object-fit:contain!important;background:transparent!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m27-art-grid>.m27-card>strong{display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;white-space:normal!important;font-size:11px!important;line-height:1.3!important;min-height:30px!important;color:var(--sws-ink,#f8f5eb)!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .m27-art-grid>.m27-card>span{display:none!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .cq26-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .cq26-card{--sws-control-padding:9px;padding:9px!important;border-radius:15px!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .cq26-card-art{height:135px!important;min-height:0!important;background:rgba(255,255,255,.025)!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .cq26-card-art>img{height:100%!important;object-fit:contain!important;background:transparent!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .cq26-board>header .cq26-eyebrow{display:none!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .cq26-board>header h2{font-size:18px!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host .cq26-board>header p{font-size:12px!important}
 body.smg-mounted.sv3-scene-expanded #smgMemoryStudio .sws-surface{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;filter:none!important;transform:none!important;overflow:visible!important}
 /* Native confirmation and result dialogs remain native modal owners. Their
    material follows the same cards without replacing any consent controls. */
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog){width:min(900px,calc(100vw - 20px))!important;max-height:calc(100dvh - 20px)!important;border:1px solid var(--sv-edge,rgba(230,199,127,.3))!important;border-radius:22px!important;background:linear-gradient(135deg,rgba(255,255,255,.08),rgba(255,255,255,.02)),rgba(17,31,52,.82)!important;color:var(--sv-text,#f8f5eb)!important;box-shadow:inset 0 1px rgba(255,255,255,.2),0 18px 70px rgba(0,0,0,.35)!important;backdrop-filter:blur(22px)!important;-webkit-backdrop-filter:blur(22px)!important;color-scheme:dark}
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog)::backdrop{background:rgba(4,12,25,.58)!important}
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog)>header{background:rgba(17,31,52,.94)!important;color:var(--sv-text,#f8f5eb)!important;border-bottom:1px solid var(--sv-edge,rgba(230,199,127,.3))!important;padding:12px 16px!important}
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog) :is(h2,h3,strong,b,label){color:var(--sv-text,#f8f5eb)!important}
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog) :is(p,small,figcaption){color:var(--sv-muted,#bcc8d6)!important}
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog) :is(button,a.m27-primary,input:not([type=checkbox]):not([type=color]),textarea,select){min-height:44px!important;border:1px solid var(--sv-edge,rgba(230,199,127,.3))!important;border-radius:11px!important;background:rgba(11,20,37,.55)!important;color:var(--sv-text,#f8f5eb)!important;font:inherit!important}
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog) :is(button.m27-primary,button.cq26-primary,a.m27-primary){background:var(--sv-gold,#e6c77f)!important;color:var(--sv-bg,#0b1425)!important;font-weight:650!important}
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog) :is(.m28-actiondock,.f23-actions,.cq26-actions){background:rgba(17,31,52,.94)!important}
 body.smg-mounted :is(dialog.m27-dialog,dialog.cq26-dialog) [aria-pressed=true]{border-color:var(--sv-gold,#e6c77f)!important;box-shadow:inset 0 0 0 1px var(--sv-gold,#e6c77f)!important}
 @media(min-width:1001px){body.smg-mounted #smgMemoryStudio .smg-work{padding-inline:30px}body.smg-mounted #smgMemoryStudio .smg-preview{max-width:620px}}
 @media(max-width:1000px){body.smg-mounted #smgMemoryStudio{--sws-top:54px;--sws-card-width:145px;--sws-card-height:86px;--smg-dock:121px}body.smg-mounted #smgMemoryStudio .smg-gateway{gap:10px;padding:16px 0 11px}body.smg-mounted #smgMemoryStudio .smg-gateway h1{font-size:25px}body.smg-mounted #smgMemoryStudio .smg-purpose-rail{gap:12px;padding-inline:18px;scroll-padding-inline:18px}body.smg-mounted #smgMemoryStudio .smg-purpose-card{flex-basis:calc(100vw - 66px);padding:13px;border-radius:23px}body.smg-mounted #smgMemoryStudio .smg-purpose-image{height:auto;flex:1}body.smg-mounted #smgMemoryStudio .smg-purpose-card h2{font-size:20px}body.smg-mounted #smgMemoryStudio .smg-work{padding-inline:15px}body.smg-mounted #smgMemoryStudio .smg-work-heading h1{font-size:18px}body.smg-mounted #smgMemoryStudio .smg-preview{height:34dvh;min-height:165px}body.smg-mounted #smgMemoryStudio .smg-source-choice{margin-top:-25px;padding:13px}body.smg-mounted #smgMemoryStudio .smg-top>small{font-size:10px}body.smg-mounted #smgMemoryStudio .smg-top>button{font-size:11px}body.smg-mounted #smgMemoryStudio .smg-tool-dock{padding-inline:13px}}
 @media(max-height:620px) and (max-width:760px){body.smg-mounted #smgMemoryStudio .smg-gateway{gap:8px;padding-top:12px}body.smg-mounted #smgMemoryStudio .smg-gateway h1{font-size:23px}body.smg-mounted #smgMemoryStudio .smg-gateway>header p{font-size:12px}body.smg-mounted #smgMemoryStudio .smg-purpose-card{gap:6px}body.smg-mounted #smgMemoryStudio .smg-purpose-image{min-height:90px}body.smg-mounted #smgMemoryStudio .smg-preview{height:30dvh}}
 @media(prefers-reduced-motion:reduce){body.smg-mounted #smgMemoryStudio *{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
}

/* Memory completion: show the next choice in the workspace, while native
   actions retain their own price, consent and storage behavior. */
@layer savorip-memory {
 body.smg-mounted #smgMemoryStudio .smg-progress{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;list-style:none;width:min(640px,100%);margin:0 auto 10px;padding:0}
 body.smg-mounted #smgMemoryStudio .smg-gateway>.smg-progress{flex:0 0 auto;padding:0 18px;margin-bottom:0}
 body.smg-mounted #smgMemoryStudio .smg-progress button{display:flex;align-items:center;justify-content:center;gap:5px;width:100%;min-height:44px;padding:6px 4px;border:1px solid rgba(255,255,255,.16);border-radius:10px;background:rgba(255,255,255,.025);color:var(--sws-muted,#bcc8d6);font-size:12px;line-height:1.25;word-break:keep-all}
 body.smg-mounted #smgMemoryStudio .smg-progress button>span{font-size:10px;font-weight:700}
 body.smg-mounted #smgMemoryStudio .smg-progress button>strong{font-weight:600}
 body.smg-mounted #smgMemoryStudio .smg-progress button:disabled{opacity:.65}
 body.smg-mounted #smgMemoryStudio .smg-progress button[aria-current=step]{border-color:var(--sws-gold,#e6c77f);background:rgba(230,199,127,.13);color:var(--sws-ink,#f8f5eb);opacity:1}
 body.smg-mounted #smgMemoryStudio .smg-progress li[data-smg-done=true] button{color:var(--sws-gold,#e6c77f)}
 body.smg-mounted #smgMemoryStudio .smg-preview-pair{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;width:100%;max-width:820px;margin:0 auto}
 body.smg-mounted #smgMemoryStudio .smg-preview-pair[data-has-source=true]{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}
 body.smg-mounted #smgMemoryStudio .smg-preview-pair>.smg-preview{width:100%;margin:0;max-width:none;min-height:0}
 body.smg-mounted #smgMemoryStudio .smg-preview-pair[data-has-source=true]>.smg-preview{height:auto;min-height:250px}
 body.smg-mounted #smgMemoryStudio .smg-preview-pair[data-has-source=true]>.smg-preview>img{position:absolute;inset:0;padding:40px 16px 16px}
 body.smg-mounted #smgMemoryStudio .smg-preview>span{color:var(--sws-ink,#f8f5eb);font-size:11px}
 body.smg-mounted #smgMemoryStudio .smg-selection{display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;gap:8px;margin:0;padding:12px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:23px;background:linear-gradient(135deg,rgba(255,255,255,.08),rgba(255,255,255,.02)),rgba(17,31,52,.52)}
 body.smg-mounted #smgMemoryStudio .smg-selection>small{color:var(--sws-muted,#bcc8d6);font-size:11px}
 body.smg-mounted #smgMemoryStudio .smg-selection>img{display:block;width:100%;height:180px;object-fit:contain;border-radius:6px}
 body.smg-mounted #smgMemoryStudio .smg-selection>figcaption{font-size:13px;line-height:1.4;overflow-wrap:anywhere;color:var(--sws-ink,#f8f5eb)}
 body.smg-mounted #smgMemoryStudio .smg-selection>button{align-self:flex-start;min-height:44px;padding:5px 9px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:9px;background:rgba(255,255,255,.035);font-size:12px;color:var(--sws-gold,#e6c77f)}
 body.smg-mounted #smgMemoryStudio .smg-example-note{width:min(820px,100%);margin:9px auto;color:var(--sws-muted,#bcc8d6);font-size:12px;line-height:1.5}
 body.smg-mounted #smgMemoryStudio .smg-source-choice{margin:12px auto;background:linear-gradient(140deg,rgba(255,255,255,.1),rgba(255,255,255,.025)),rgba(17,31,52,.8)}
 body.smg-mounted #smgMemoryStudio .smg-primary-actions{display:flex;flex-wrap:wrap;gap:9px;margin:12px 0}
 body.smg-mounted #smgMemoryStudio .smg-primary-actions:empty{display:none}
 body.smg-mounted #smgMemoryStudio .smg-primary-actions>button{flex:1 1 160px;min-height:48px;padding:11px 14px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:13px;background:rgba(255,255,255,.055);color:var(--sws-ink,#f8f5eb);font-size:14px;font-weight:650;line-height:1.4}
 body.smg-mounted #smgMemoryStudio .smg-primary-actions>.smg-primary{flex-basis:100%;border-color:var(--sws-gold,#e6c77f);background:var(--sws-gold,#e6c77f);color:var(--sws-bg,#0b1425)}
 body.smg-mounted #smgMemoryStudio .smg-pending{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:14px 0;padding:14px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:15px;background:rgba(255,255,255,.035)}
 body.smg-mounted #smgMemoryStudio .smg-pending>div{flex:1 1 160px}
 body.smg-mounted #smgMemoryStudio .smg-pending strong{font-size:13px;color:var(--sws-ink,#f8f5eb)}
 body.smg-mounted #smgMemoryStudio .smg-pending p{margin:4px 0 0;color:var(--sws-muted,#bcc8d6);font-size:12px}
 body.smg-mounted #smgMemoryStudio .smg-pending>button{min-height:44px;padding:9px 11px;border:1px solid var(--sws-edge,rgba(230,199,127,.3));border-radius:10px;background:rgba(255,255,255,.04);color:var(--sws-gold,#e6c77f);font-size:12px}
 body.smg-mounted #smgMemoryStudio .smg-gateway{padding-bottom:calc(14px + env(safe-area-inset-bottom));overflow-y:auto}
 body.smg-mounted #smgMemoryStudio[data-smg-mode=gate] .smg-gateway{min-height:465px}
 body.smg-mounted #smgMemoryStudio .smg-purpose-image{min-height:110px}
 body.smg-mounted #smgMemoryStudio .smg-gate-nav>button{width:44px;min-width:44px}
 @media(min-width:1001px){
  body.smg-mounted #smgMemoryStudio .smg-work-heading{text-align:center}
  body.smg-mounted #smgMemoryStudio :is(.smg-primary-actions,.smg-completion,.smg-instruction,.smg-pending){max-width:820px;margin-inline:auto}
  body.smg-mounted #smgMemoryStudio .smg-primary-actions>.smg-primary{flex-basis:250px}
 }
 @media(max-width:700px){
  body.smg-mounted #smgMemoryStudio .smg-work{padding-inline:12px;padding-bottom:14px;min-height:0}
  body.smg-mounted #smgMemoryStudio .smg-tool-dock{position:relative;left:auto;right:auto;bottom:auto;margin-top:8px;padding-top:12px;border-top:1px solid rgba(255,255,255,.12)}
  body.smg-mounted #smgMemoryStudio .smg-top{min-height:44px;gap:9px}
  body.smg-mounted #smgMemoryStudio .smg-progress{margin-bottom:8px;gap:4px}
  body.smg-mounted #smgMemoryStudio .smg-progress button{font-size:11px;gap:4px}
  body.smg-mounted #smgMemoryStudio .smg-work-heading{padding:0 0 7px}
  body.smg-mounted #smgMemoryStudio .smg-work-heading h1{font-size:18px}
  body.smg-mounted #smgMemoryStudio .smg-preview-pair{gap:8px}
  body.smg-mounted #smgMemoryStudio .smg-preview-pair>.smg-preview{height:240px;min-height:0}
  body.smg-mounted #smgMemoryStudio[data-smg-step="1"] .smg-preview-pair>.smg-preview{height:160px}
  body.smg-mounted #smgMemoryStudio .smg-preview-pair[data-has-source=true]>.smg-preview{height:auto;min-height:0;border-radius:15px}
  body.smg-mounted #smgMemoryStudio .smg-preview-pair[data-has-source=true]>.smg-preview>img{padding:35px 7px 8px}
  body.smg-mounted #smgMemoryStudio .smg-preview>span{top:9px;left:8px;padding:3px 6px;font-size:10px;max-width:calc(100% - 16px)}
  body.smg-mounted #smgMemoryStudio .smg-selection{padding:8px;gap:5px;border-radius:15px}
  body.smg-mounted #smgMemoryStudio .smg-selection>small{font-size:10px}
  body.smg-mounted #smgMemoryStudio .smg-selection>img{height:115px}
  body.smg-mounted #smgMemoryStudio .smg-selection>figcaption{font-size:11px;line-height:1.35}
  body.smg-mounted #smgMemoryStudio .smg-selection>button{width:100%;font-size:11px}
  body.smg-mounted #smgMemoryStudio .smg-primary-actions>button{flex-basis:130px;font-size:13px}
  body.smg-mounted #smgMemoryStudio .smg-primary-actions>.smg-primary{flex-basis:100%}
  body.smg-mounted #smgMemoryStudio .sws-native-host .m27-art-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.smg-mounted #smgMemoryStudio .sws-native-host .m27-art-grid>.m27-card>img{height:112px!important}
 }
}

/* The shared surface uses important declarations in its own layer. Keep
   these narrowly scoped overrides in that same layer so they can take effect. */
@layer savorip-studio-cards {
 body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind]:not([hidden]){left:max(14px,calc((100vw - 1120px)/2))!important;right:max(14px,calc((100vw - 1120px)/2))!important;width:auto!important;bottom:calc(8px + env(safe-area-inset-bottom))!important;max-height:calc(var(--sws-viewport,100dvh) - var(--sws-top,76px) - 24px - env(safe-area-inset-bottom))!important}
 body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind] .sws-native-host{padding:14px!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host>[data-sws-active-root]{padding:0!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host :is(label,legend,summary){color:var(--sws-ink,#f8f5eb)!important;background:transparent!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host select option{color:#f8f5eb!important;background:#111f34!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host :is(input,textarea)::placeholder{color:#bcc8d6!important;opacity:1!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host :is(.s29-scene-strip span,.s29-source-grid b,.s29-selected>p){color:var(--sws-ink,#f8f5eb)!important}
 body.smg-mounted #smgMemoryStudio .sws-native-host :is(.s29-hint,.s29-source-grid small){color:var(--sws-muted,#bcc8d6)!important}
 body.smg-mounted #smgMemoryStudio #ms-world>h2,body.smg-mounted #smgMemoryStudio #ms-world-native>.s29-inline>header{display:none!important}
 body.smg-mounted #smgMemoryStudio #ms-world-native>.s29-inline{padding:0!important;border:0!important;background:transparent!important}
 body.smg-mounted #smgMemoryStudio #ms-world-native .s29-workspace{display:grid!important;grid-template-columns:230px minmax(0,1fr)!important;gap:18px!important;align-items:start!important}
 body.smg-mounted #smgMemoryStudio #ms-world-native .s29-main{width:100%!important;max-width:none!important}
 body.smg-mounted #smgMemoryStudio #ms-world-native .s29-stage{width:100%!important;min-height:0!important;max-height:none!important;aspect-ratio:3/2!important}
 body.smg-mounted #smgMemoryStudio #ms-world-native .s29-stage .s29-object{min-height:0!important;padding:0!important;border:1px solid transparent!important;border-radius:3px!important;background:transparent!important;box-shadow:none!important;line-height:0!important}
 body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind=letters] .m28-stage-title{display:none!important}
 body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind=letters] .m28-create-view{display:grid!important;grid-template-columns:minmax(0,1.1fr) minmax(260px,1fr)!important;gap:22px!important}
 body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind=letters] .m28-letter-preview{width:100%!important;height:clamp(260px,45dvh,430px)!important}
 body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind=letters] .m28-create-tools textarea{width:100%!important;min-height:92px!important}
 @media(max-width:760px){
  body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind]:not([hidden]){left:0!important;right:0!important;top:var(--sws-top,54px)!important;bottom:0!important;border-radius:15px 15px 0 0!important;max-height:calc(var(--sws-viewport,100dvh) - var(--sws-top,54px))!important;padding-bottom:env(safe-area-inset-bottom)!important}
  body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind] .sws-native-host{padding:12px!important}
  body.smg-mounted #smgMemoryStudio #ms-world-native .s29-workspace{display:flex!important;flex-direction:column!important;gap:14px!important}
  body.smg-mounted #smgMemoryStudio #ms-world-native .s29-main{order:0!important}
  body.smg-mounted #smgMemoryStudio #ms-world-native .s29-library{order:1!important;width:100%!important}
  body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind=letters] .m28-create-view{grid-template-columns:minmax(0,1fr)!important;gap:12px!important}
  body.smg-mounted #smgMemoryStudio .sws-surface[data-smg-kind=letters] .m28-letter-preview{height:240px!important}
  body.smg-mounted #smgMemoryStudio .ms-gallery-layout{display:block!important}
  body.smg-mounted #smgMemoryStudio .ms-gallery-stage:not(:fullscreen){height:clamp(250px,52dvh,430px)!important;min-height:250px!important}
 }
}

@media(max-width:760px){
/* V51: the full photo, product name and native action own their card height. */
@layer savorip-memory {
 body.smg-mounted #smgMemoryStudio[data-smg-mode=gate] .smg-gateway{
  height:auto!important;min-height:100%!important;max-height:none!important;
  overflow:visible!important;gap:12px!important;padding-bottom:max(18px,env(safe-area-inset-bottom))!important
 }
 body.smg-mounted #smgMemoryStudio .smg-purpose-rail{
  flex:0 0 auto!important;align-items:stretch!important;height:auto!important;
  min-height:0!important;max-height:none!important;overflow-x:auto!important;overflow-y:hidden!important;
  padding-block:8px!important
 }
 body.smg-mounted #smgMemoryStudio .smg-purpose-card{
  display:grid!important;grid-template-rows:auto auto minmax(28px,auto) auto!important;
  align-content:start!important;height:auto!important;min-height:0!important;
  max-height:none!important;gap:10px!important;overflow:hidden!important
 }
 body.smg-mounted #smgMemoryStudio .smg-purpose-image{
  display:flex!important;flex:none!important;width:100%!important;height:240px!important;
  min-height:0!important;max-height:none!important;overflow:hidden!important
 }
 body.smg-mounted #smgMemoryStudio .smg-purpose-image>img{
  display:block!important;width:100%!important;height:100%!important;min-height:0!important;
  max-width:100%!important;max-height:100%!important;object-fit:contain!important;object-position:center!important;
  transform:none!important;margin:0!important;padding:0!important
 }
 body.smg-mounted #smgMemoryStudio .smg-purpose-card>h2{
  min-height:28px!important;height:auto!important;max-height:none!important;margin:0!important;
  padding:0!important;font-size:21px!important;line-height:1.35!important;overflow-wrap:anywhere!important
 }
 body.smg-mounted #smgMemoryStudio .smg-purpose-card>button{
  min-height:48px!important;height:auto!important;max-height:none!important;align-self:end!important;
  white-space:normal!important;font-size:16px!important;line-height:1.4!important
 }
 body.smg-mounted #smgMemoryStudio .smg-gateway>:is(.smg-gate-nav,.smg-gate-links,.sv47-choice-actions){flex:0 0 auto!important}
 @media(max-width:760px){
  body.smg-mounted #smgMemoryStudio .smg-gateway{gap:10px!important;padding-top:12px!important}
  body.smg-mounted #smgMemoryStudio .smg-gateway>header{padding-inline:14px!important}
  body.smg-mounted #smgMemoryStudio .smg-gateway h1{font-size:25px!important;line-height:1.3!important;margin:8px 0!important}
  body.smg-mounted #smgMemoryStudio .smg-gateway>header p{font-size:16px!important;line-height:1.5!important}
  body.smg-mounted #smgMemoryStudio .smg-purpose-card{flex-basis:calc(100vw - 50px)!important;width:calc(100vw - 50px)!important;padding:13px!important}
  body.smg-mounted #smgMemoryStudio .smg-purpose-image{height:clamp(170px,31svh,260px)!important}
  body.smg-mounted #smgMemoryStudio .smg-purpose-card>h2{font-size:21px!important}
  body.smg-mounted #smgMemoryStudio .smg-gate-nav{padding-inline:12px!important;gap:10px!important;font-size:14px!important}
  body.smg-mounted #smgMemoryStudio .smg-gate-links{display:flex!important;flex-wrap:wrap!important;overflow:visible!important}
  body.smg-mounted #smgMemoryStudio .smg-gate-links>button{flex:1 1 130px!important;font-size:14px!important;min-height:44px!important}
  body.smg-mounted #smgMemoryStudio .smg-progress button{font-size:14px!important;min-height:44px!important}
  body.smg-mounted #smgMemoryStudio .smg-top{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;align-items:center!important;gap:8px!important;padding:8px 12px!important}
  body.smg-mounted #smgMemoryStudio .smg-top>small{min-width:0!important;font-size:13px!important;text-align:center!important;overflow-wrap:anywhere!important}
  body.smg-mounted #smgMemoryStudio .smg-top>button,body.smg-mounted .sv47-navigation>button{min-height:44px!important;height:auto!important;padding:8px 11px!important;font-size:14px!important;line-height:1.3!important}
  body.smg-mounted dialog.m27-dialog>header{gap:8px!important;padding:10px!important}
  body.smg-mounted dialog.m27-dialog>header>h2{flex:1!important;min-width:0!important;font-size:18px!important;line-height:1.35!important;overflow-wrap:anywhere!important}
  body.smg-mounted dialog.m27-dialog>header>button{flex:none!important;min-height:44px!important;padding:8px!important;font-size:14px!important}
  /* Native design options remain their original buttons and keep their handlers. */
  body.smg-mounted dialog.m27-dialog .m28-edit-look .m27-options{
   display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;
   gap:9px!important;margin:0 0 22px!important;padding:10px!important;
   border:1px solid rgba(190,205,225,.25);border-radius:15px;background:rgba(10,22,39,.38)
  }
  body.smg-mounted dialog.m27-dialog .m28-edit-look .m27-options>button{
   display:flex!important;flex-direction:column!important;align-items:stretch!important;
   justify-content:flex-start!important;gap:9px!important;padding:9px!important;
   min-width:0!important;width:100%!important;min-height:112px!important;height:auto!important;
   font-size:16px!important;line-height:1.45!important;white-space:normal!important;
   overflow-wrap:anywhere!important;text-align:center!important
  }
  body.smg-mounted dialog.m27-dialog .m28-edit-look .m27-options>button:before{
   content:'';display:block!important;flex:none;width:100%!important;height:54px!important;
   margin:0!important;border:1px solid rgba(220,230,245,.4);border-radius:9px!important;
   background:linear-gradient(135deg,#e4bf83 0 33%,#73a9c6 33% 66%,#e7adbb 66%);
   box-sizing:border-box
  }
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=look][data-value=soft]:before{background:radial-gradient(ellipse at 30% 40%,#f6d7d7,transparent 60%),linear-gradient(135deg,#e2d5ed,#b8d8da)}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=look][data-value=bold]:before{background:linear-gradient(145deg,#f5c447 0 30%,#1a4283 30% 70%,#e8794b 70%)}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=look][data-value=dream]:before{background:radial-gradient(circle at 25% 30%,#fff8cb 0 3px,transparent 4px),radial-gradient(circle at 70% 60%,#fff8cb 0 4px,transparent 5px),linear-gradient(135deg,#496294,#c4a5d9)}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=palette_choice][data-value=ice]:before{background:linear-gradient(110deg,#b6e7ed 0 33%,#65b9cf 33% 66%,#33769c 66%)}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=palette_choice][data-value=berry]:before{background:linear-gradient(110deg,#ffe1df 0 33%,#eeadbd 33% 66%,#bd6e95 66%)}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=palette_choice][data-value=ink]:before{background:linear-gradient(110deg,#8998ad 0 33%,#4c627d 33% 66%,#243650 66%)}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=interpretation][data-value=kindred]:before{background:radial-gradient(ellipse at 50% 58%,#e4bf83 0 20%,transparent 22%),linear-gradient(135deg,#bed7df,#759ab1)}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=interpretation][data-value=daring]:before{background:linear-gradient(35deg,transparent 40%,#efb97f 40% 57%,transparent 57%),linear-gradient(135deg,#8a9bcc,#d5b7da)}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=composition]:before{border:6px solid #c3d3df!important;background:linear-gradient(90deg,transparent 8%,#d5b16b 8% 92%,transparent 92%),#526d86}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [data-option=composition][data-value=focus]:before{background:radial-gradient(circle at center,#d5b16b 0 15px,transparent 16px),#526d86}
  body.smg-mounted dialog.m27-dialog .m28-edit-look [aria-pressed=true]{outline:2px solid var(--sv-gold,#e6c77f);outline-offset:1px}
  body.smg-mounted dialog.m27-dialog .m28-edit-look h3{font-size:18px!important;line-height:1.4!important;margin:16px 0 9px!important}
 }
}

}
