/* Shared layout across narrow phones, tablets, landscape and safe-area screens. */
html{scroll-padding-bottom:calc(90px + env(safe-area-inset-bottom,0px))}
#customer,.design-home,.stage,.intro,.header-right{min-width:0}
.design-home{overflow-x:clip}
.header{padding-left:max(18px,env(safe-area-inset-left,0px));padding-right:max(18px,env(safe-area-inset-right,0px))}
.header .brand{flex-shrink:0}.header .wallet{white-space:nowrap}
dialog{max-height:calc(100dvh - 24px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));overscroll-behavior:contain;scroll-padding-block:18px}
dialog input,dialog select,dialog textarea{min-width:0;max-width:100%}
dialog button,.magic-ref-actions .text-button{min-height:44px}
.magic-result-actions,.magic-ref-actions,.checkout{flex-wrap:wrap}
.image-save-actions>*{min-width:120px}
@media(max-width:740px){
 body{padding-bottom:calc(82px + env(safe-area-inset-bottom,0px))}
 #customer{padding-left:max(18px,env(safe-area-inset-left,0px));padding-right:max(18px,env(safe-area-inset-right,0px))}
 .header nav{position:fixed;display:flex;top:auto;bottom:0;left:0;right:0;justify-content:space-around;align-items:center;background:#fffdf7;border-top:1px solid var(--line);z-index:30;padding:8px 12px;gap:8px;height:calc(70px + env(safe-area-inset-bottom,0px));padding-bottom:calc(8px + env(safe-area-inset-bottom,0px))}
 .header nav a{min-height:44px;display:flex;align-items:center;justify-content:center}
 #toast{bottom:calc(86px + env(safe-area-inset-bottom,0px))}
 .design-home .play-choices button{min-height:44px}
 .design-home .comparison,.design-home .draw-art,.design-home .word-art{height:auto;aspect-ratio:7/9;max-height:560px}
 .design-home .word-art{min-height:330px}
 .magic-dialog{width:calc(100% - 24px);padding:20px}
 dialog input,dialog select,dialog textarea,dialog textarea#magic-note{font-size:16px}
 dialog input[type=file]{font-size:13px}
 .magic-dialog .checkout{gap:8px}
 .magic-dialog .checkout button{flex:1;min-width:140px}
 .magic-upload img{height:auto;max-height:32dvh;object-fit:contain}
 .magic-ref-preview{height:auto;max-height:26dvh;object-fit:contain}
}
@media(max-width:360px){
 .header{gap:6px;padding-left:12px;padding-right:12px}
 .header .brand{gap:7px;font-size:15px}.header .brand small{font-size:7px;letter-spacing:1.5px;white-space:nowrap}
 .header .brand-icon{flex:0 0 32px;width:32px;height:32px;font-size:28px;line-height:28px}
 .header .header-right{gap:4px}.header .wallet{font-size:10px;padding:8px 6px;min-height:44px}
 .header .more-link{font-size:9px!important}
 .header nav a{padding:8px 14px;font-size:13px}
 .design-home .edition{letter-spacing:.3px;font-size:6px}.design-home .edition>div{gap:8px}
 .design-home .english-note{right:6px;font-size:19px;max-width:66px}
 .design-home .play-choices{gap:3px}.design-home .play-choices button{padding:9px 6px;font-size:10px}
 .magic-card strong{font-size:16px}.magic-card>span:not(.magic-icon){font-size:11px}
 .magic-dialog{padding:17px}.magic-dialog h2{font-size:25px}
 .design-home .frame-caption{flex-wrap:wrap;gap:4px;font-size:10px}
}
@media(max-height:520px) and (orientation:landscape) and (max-width:1100px){
 .design-home .hero{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px;align-items:center;padding:20px 0}
 .design-home .intro{display:block}.design-home .intro h1{font-size:clamp(32px,5vw,46px)}
 .design-home .english-note{position:static;font-size:21px;margin:6px 0;max-width:none;white-space:nowrap;transform:none}
 .design-home .intro-copy{margin:12px 0}.design-home .play-choices{display:flex;gap:3px;margin:12px 0}
 .design-home .play-choices button{font-size:10px;padding:8px 5px}
 .design-home .comparison,.design-home .draw-art,.design-home .word-art{height:clamp(210px,64dvh,330px);aspect-ratio:auto}
 .design-home .word-art{min-height:0;padding:20px}.design-home .word-art>p{font-size:22px;margin:0 0 12px}
 .design-home .quote-mark{font-size:48px;margin-top:14px}
 dialog,.magic-dialog{max-height:calc(100dvh - 16px);margin:8px auto;padding:16px 22px}
 .magic-upload img,.magic-ref-preview{max-height:140px}
}
@media(max-width:1100px){dialog input,dialog select,dialog textarea,dialog textarea#magic-note{font-size:16px}}

/* The fourth play occupies the existing hero; no additional entry section. */
.design-home .hero{grid-template-columns:minmax(0,1fr) minmax(0,1.1fr)}
.design-home .play-choices{max-width:100%;gap:4px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin;padding:4px 3px 7px}
.design-home .play-choices button{flex:0 0 auto;min-height:44px;padding:9px 10px}
.design-home .play-choices button[aria-selected=true]{background:var(--green);border-color:var(--green);color:var(--foam)}
.design-home .play-choices button:focus-visible{outline-offset:-3px}
.design-home .wear-home-demo{display:grid;grid-template-columns:minmax(0,.32fr) 22px minmax(0,1fr);align-items:center;gap:8px;height:480px;padding:20px 16px;background:#e8e5dc}
.design-home .wear-home-demo figure{margin:0;min-width:0;min-height:0}
.design-home .wear-home-demo img{display:block;width:100%;object-fit:cover;object-position:50% 0;user-select:none;border-radius:4px}
.design-home .wear-home-person img{height:auto;aspect-ratio:3/4}
.design-home .wear-home-result{height:100%;display:flex;flex-direction:column}
.design-home .wear-home-result img{flex:1;min-height:0;height:0}
.design-home .wear-home-demo figcaption{padding-top:8px;font-size:11px;color:var(--ink);text-align:center}
.design-home .wear-home-arrow{font-size:20px;color:var(--green);text-align:center}
.design-home .wear-home-panel .frame-caption{flex-wrap:wrap;gap:6px}
@media(min-width:741px){
 .design-home .hero{padding-top:12px;padding-bottom:32px}
 .design-home .intro{padding-top:0}
 .design-home .intro-copy{margin-bottom:18px}
 .design-home .english-note{margin:20px 0;line-height:1.15}
 .design-home .comparison,.design-home .draw-art,.design-home .word-art,.design-home .wear-home-demo{height:clamp(350px,58dvh,480px)}
}
@media(max-width:740px){
 .design-home .hero{grid-template-columns:minmax(0,1fr)}
 .design-home .play-choices{display:flex;width:100%;margin-bottom:12px}
 .design-home .play-choices button{font-size:12px;padding:9px 10px}
 .design-home .wear-home-demo{height:clamp(290px,48dvh,460px);grid-template-columns:minmax(0,.3fr) 16px minmax(0,1fr);gap:5px;padding:14px 10px}
 .design-home .wear-home-panel .frame-caption{padding:12px;font-size:12px}
}
@media(max-height:520px) and (orientation:landscape) and (max-width:1100px){
 .design-home .hero{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
 .design-home .wear-home-demo{height:clamp(210px,64dvh,330px)}
}
@media(prefers-reduced-motion:reduce){.design-home .play-choices button{transition:none}}

/* One navigation reservation; the visible viewport also accounts for keyboards. */
:root{--cafe-visible-height:100vh;--cafe-visible-top:0px;--cafe-nav-space:0px;--cafe-page-end:24px}
@supports(height:100dvh){:root{--cafe-visible-height:100dvh}}
html{scrollbar-gutter:stable;overscroll-behavior-y:none;scroll-padding-bottom:calc(var(--cafe-nav-space) + var(--cafe-page-end))}
html body{min-height:var(--cafe-visible-height);padding-bottom:var(--cafe-nav-space)}
body #customer{padding-bottom:var(--cafe-page-end)}
body #customer>[data-screen]{padding-bottom:0}
body #toast{bottom:calc(var(--cafe-nav-space) + 16px)}
body dialog:not(#work-preview){position:fixed;inset:auto 0 auto 0;top:calc(var(--cafe-visible-top) + var(--cafe-visible-height)/2);margin:0 auto;transform:translateY(-50%);max-width:calc(100vw - 24px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px));max-height:calc(var(--cafe-visible-height) - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));overscroll-behavior:contain}
@media(max-width:740px){
 :root{--cafe-nav-space:calc(70px + env(safe-area-inset-bottom,0px));--cafe-page-end:16px}
 body>.header>nav{height:var(--cafe-nav-space);padding-bottom:calc(8px + env(safe-area-inset-bottom,0px))}
}
