@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap');
*{box-sizing:border-box}body{margin:0;background:#120d19;color:#fff;font-family:'DM Sans','Noto Sans Thai',sans-serif}button{font:inherit;cursor:pointer}.stage{height:100svh;min-height:540px;position:relative;overflow:hidden;touch-action:pan-y}.backdrop,.veil{position:absolute;inset:0}.backdrop{background-position:center 37%;background-size:cover;transition:opacity .3s,transform 1s;transform:scale(1.025)}.veil{background:linear-gradient(90deg,rgba(18,10,26,.57),transparent 32%,transparent 67%,rgba(18,10,26,.55)),linear-gradient(0deg,rgba(14,8,20,.88),transparent 48%,rgba(14,8,20,.28));pointer-events:none}header{position:absolute;top:0;left:0;right:0;display:flex;align-items:center;justify-content:space-between;padding:28px 40px;z-index:2}.brand{text-decoration:none;color:white;font-size:23px;font-weight:700;letter-spacing:.02em}.brand span{color:#e3c9fb}.brand small{display:block;font-size:8px;letter-spacing:.25em;font-weight:500;margin-top:2px}.profile,.nav{border:1px solid #ffffff8c;background:#211a2d55;color:white;border-radius:50%;width:48px;height:48px;font-size:27px;backdrop-filter:blur(12px)}.profile:hover,.nav:hover{background:#ffffff40}.hero{position:absolute;bottom:12%;left:50%;transform:translateX(-50%);text-align:center;width:min(80%,640px);text-shadow:0 2px 20px #13091e}.eyebrow{font-size:12px;letter-spacing:.2em;color:#f4ddff;display:flex;align-items:center;justify-content:center;gap:12px}.eyebrow span{width:28px;height:1px;background:#e9d3ff}.hero h1{font-size:clamp(42px,6vw,78px);line-height:1.1;margin:13px 0;font-weight:600}.hero p{font-size:16px;margin:0 0 23px;color:#fff}.primary{border:0;border-radius:999px;background:#fff;color:#25162f;min-height:54px;padding:0 34px;font-weight:700;box-shadow:0 5px 40px #d9abf48c}.primary:hover{background:#f2e5ff}.pagination{display:flex;justify-content:center;gap:7px;margin-top:20px}.pagination i{width:7px;height:7px;background:#ffffff78;border-radius:8px}.pagination i.active{width:24px;background:#fff}.nav{position:absolute;top:48%;font-size:36px;line-height:0;z-index:2}.prev{left:16%}.next{right:16%}.swipe{position:absolute;bottom:22px;left:50%;transform:translateX(-50%);background:none;border:0;color:white;font-size:12px;white-space:nowrap}.swipe span{display:block;font-size:27px;line-height:20px}.rail{position:absolute;top:18%;bottom:16%;width:84px;overflow:hidden;z-index:1}.rail.left{left:38px}.rail.right{right:38px}.rail p{font-size:10px;text-align:center;color:#fffe;margin:0 0 12px}.rail-items{display:flex;flex-direction:column;gap:10px;animation:float 18s ease-in-out infinite alternate}.rail.right .rail-items{animation-direction:alternate-reverse}.rail button{padding:0;border:1px solid #ffffff82;border-radius:12px;overflow:hidden;height:104px;flex:none;background:#24182a}.rail img{height:100%;width:100%;object-fit:cover}.rail button:hover{border:2px solid white;transform:scale(1.03)}@keyframes float{to{transform:translateY(-80px)}}dialog{border:0;padding:0;background:transparent;color:white;max-width:min(92vw,460px);width:100%;max-height:90vh}dialog::backdrop{background:#100919b8;backdrop-filter:blur(8px)}.sheet{position:relative;background:linear-gradient(160deg,#392a43ed,#17111dee);border:1px solid #ffffff35;border-radius:26px;padding:30px;text-align:center;box-shadow:0 20px 80px #0008}.sheet h2{margin:10px 0;font-size:26px}.sheet p{color:#e4d9e9;font-size:14px;line-height:1.6}.close{position:absolute;right:18px;top:12px;background:none;border:0;color:#fff;font-size:28px}.sparkle{font-size:32px;color:#e1beff}.social,.secondary{width:100%;border:1px solid #ffffff50;border-radius:12px;background:#ffffff14;color:white;padding:14px;margin-top:10px;font-weight:600}.social:disabled{opacity:.45;cursor:not-allowed}.link{background:none;border:0;color:white;text-decoration:underline;display:block;margin:20px auto 8px}.notice{display:block;margin-top:14px;color:#d6c4de;font-size:12px}.handle{width:42px;height:4px;background:#bca0cd;border-radius:8px;margin:0 auto 20px}.drop{border:1px dashed #c4a8dc;border-radius:16px;padding:20px;display:flex;flex-direction:column;gap:5px;cursor:pointer;background:#ffffff09}.drop span{font-size:30px}.drop small{color:#d4c2de}.sheet>.primary{width:100%;margin-top:18px}.sheet>.primary:disabled{opacity:.45;cursor:not-allowed}.chosen{display:flex;align-items:center;gap:12px;text-align:left;margin-top:14px;overflow:hidden}.chosen img{width:50px;height:50px;object-fit:cover;border-radius:8px}.example-image{width:100%;max-height:42vh;object-fit:cover;border-radius:14px}@media(max-width:600px){header{padding:20px}.brand{font-size:18px}.profile{width:40px;height:40px;font-size:23px}.rail{top:18%;bottom:29%;width:47px}.rail.left{left:10px}.rail.right{right:10px}.rail p{display:none}.rail button{height:65px;border-radius:8px}.rail-items{gap:7px}.nav{width:38px;height:38px;font-size:30px;top:43%}.prev{left:65px}.next{right:65px}.hero{bottom:13%;width:76%}.hero h1{font-size:40px}.hero p{font-size:14px}.swipe{bottom:20px}dialog{max-width:100%;width:100%;margin:auto 0 0;max-height:92vh}.sheet{border-radius:24px 24px 0 0;padding:28px 24px calc(24px + env(safe-area-inset-bottom))}.example-image{max-height:35vh}}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}

[hidden]{display:none!important}
@media(min-width:900px){.backdrop{background-size:auto 100%;background-repeat:no-repeat;background-color:#26182a;isolation:isolate}.backdrop::before{content:'';position:absolute;inset:-30px;background-image:inherit;background-size:cover;background-position:center 35%;filter:blur(24px) brightness(.55);z-index:-1}}
.works-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;max-height:45vh;overflow:auto}.works-grid button{padding:0;border:0;background:#ffffff12;border-radius:10px;overflow:hidden;aspect-ratio:3/4}.works-grid img{width:100%;height:100%;object-fit:cover}

.preview-badge{position:absolute;z-index:4;top:30px;left:50%;transform:translateX(-50%);border:1px solid #ffffff55;border-radius:999px;padding:6px 12px;background:#17101bbb;backdrop-filter:blur(10px);font-size:12px;white-space:nowrap}@media(max-width:600px){.preview-badge{top:78px;font-size:11px}}
@media(min-width:900px){.backdrop::after{content:'';position:absolute;inset:0;background-image:inherit;background-size:auto 100%;background-position:center;background-repeat:no-repeat;z-index:0}}
/* Full-screen flows keep the same immersive canvas as the template feed. */
dialog{position:fixed;inset:0;margin:0;width:100%;max-width:none;height:100dvh;max-height:none;overflow:auto}
dialog::backdrop{background:#100919;backdrop-filter:none}
dialog .sheet{box-sizing:border-box;width:100%;min-height:100dvh;border:0;border-radius:0;padding:max(70px,env(safe-area-inset-top)) 24px max(34px,env(safe-area-inset-bottom));display:flex;flex-direction:column;align-items:center;justify-content:center;background:radial-gradient(ellipse at 50% 15%,#553763,#18101f 65%);box-shadow:none}
dialog .sheet>*:not(.close){width:min(100%,440px);flex-shrink:0}
dialog .sheet>.close{position:fixed;z-index:2;top:max(18px,env(safe-area-inset-top));right:max(20px,env(safe-area-inset-right));width:46px;height:46px;border:1px solid #ffffff66;border-radius:50%;background:#1d142c88;font-size:28px}
dialog .sheet>.handle{width:42px;position:absolute;top:26px}
dialog .sheet>.example-image{max-height:45dvh;object-fit:contain}
dialog .sheet>.works-grid{display:grid}
#upload .sheet{background:linear-gradient(180deg,#160e20b8,#160d22eb 65%),var(--template-image) center/cover no-repeat;animation:screen-up .45s cubic-bezier(.2,.7,.2,1) both}
#upload .drop{min-height:170px;justify-content:center;background:#ffffff12;backdrop-filter:blur(12px)}
#upload .drop span{font-size:40px;font-weight:300;color:#ebd8ff}
#upload .upload-kicker{font-size:13px;letter-spacing:.18em;color:#e7c9f9}
#upload .secondary{min-height:54px}
#upload .chosen{background:#ffffff16;border-radius:12px;padding:8px}
@keyframes screen-up{from{transform:translateY(100%)}to{transform:translateY(0)}}
@media(max-width:600px){dialog .sheet{padding-left:22px;padding-right:22px}dialog .sheet h2{font-size:28px}#upload .drop{min-height:180px}}
@media(prefers-reduced-motion:reduce){#upload .sheet{animation:none}}
.stage{height:100dvh;min-height:0}
#upload::backdrop{background:transparent}
#upload .sheet{will-change:transform}
dialog .sheet>.handle{position:absolute;top:max(5px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:88px;height:48px;margin:0;padding:0;border:0;background:transparent;border-radius:24px;display:grid;place-items:center;touch-action:none}
.handle span{display:block;width:42px;height:4px;border-radius:99px;background:#ddc6ec}
.handle:focus-visible{outline:2px solid white;outline-offset:2px}
/* Image-led welcome screen */
#welcome .welcome-screen{padding:0;display:block;background:#130d1b;text-align:left}
#welcome .welcome-layout{width:100%;min-height:100dvh;display:grid;grid-template-columns:minmax(0,1.08fr) minmax(420px,.92fr)}
.welcome-art{position:relative;min-height:100dvh;background:linear-gradient(180deg,#190f2910 34%,#150d22d9 100%),url('/images/thai-together.webp') center 38%/cover no-repeat;overflow:hidden}
.welcome-art::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent 60%,#130d1b99);pointer-events:none}
.welcome-art-copy{position:absolute;z-index:1;left:8%;bottom:19%;color:white;text-shadow:0 2px 18px #1c102b}
.welcome-art-copy span{font-size:11px;letter-spacing:.25em;color:#f2d8fb;display:block;margin-bottom:10px}
.welcome-art-copy strong{font-size:clamp(24px,3vw,42px);font-weight:600}
.welcome-art-strip{position:absolute;z-index:1;bottom:6%;left:8%;display:flex;gap:10px}
.welcome-art-strip img{width:58px;height:72px;object-fit:cover;border:1px solid #ffffffa0;border-radius:10px;box-shadow:0 4px 18px #130c25a0}
.welcome-content{min-height:100dvh;display:flex;flex-direction:column;justify-content:center;width:min(100%,480px);padding:88px 34px 52px;margin:auto}
.welcome-brand{color:#ead6fc;font-size:15px;font-weight:600;letter-spacing:.04em;margin-bottom:48px}
.welcome-eyebrow{font-size:13px;letter-spacing:.1em;color:#dcb9f3}
#welcome .welcome-intro h2{font-size:clamp(38px,4vw,54px);line-height:1.18;margin:14px 0 18px;font-weight:700;letter-spacing:-.035em}
.welcome-intro h2 em{font-style:normal;color:#e3c5fb}
#welcome .welcome-intro p{font-size:15px;line-height:1.7;color:#e0d2e5;margin:0 0 30px}
.welcome-actions .social{display:flex;align-items:center;justify-content:center;gap:12px;min-height:54px;border-radius:999px;margin:0 0 12px;font-size:15px}
.welcome-actions .login-google{background:white;border:1px solid white;color:#201929}.welcome-actions .login-facebook{background:#ffffff0f;border:1px solid #e1cfee99;color:#fff}
.welcome-actions .social:disabled{opacity:.65;cursor:not-allowed}.welcome-actions svg{width:22px;height:22px;flex:none}.facebook-icon{width:23px;height:23px;border-radius:50%;display:grid;place-items:end center;background:#1877f2;color:white;font-family:Arial,sans-serif;font-size:21px;font-weight:bold;line-height:21px}
#welcome .notice{margin:4px 0 0;color:#c5b2cf;font-size:12px;line-height:1.45}
.welcome-divider{display:flex;align-items:center;gap:12px;color:#bdadc5;font-size:12px;margin:22px 0 10px}.welcome-divider span{height:1px;background:#ffffff33;flex:1}
#welcome .guest-button{width:100%;min-height:48px;margin:0;text-decoration:none;border:1px solid #ffffff77;border-radius:999px;font-weight:600;color:#fff;background:#ffffff0a}.guest-button span{margin-left:8px}
#welcome .welcome-guest-note{margin:12px 0 0;text-align:center;color:#c9b9d1;font-size:12px;line-height:1.5}
#welcome .close{background:#1b112b80}
@media(max-width:700px){#welcome .welcome-layout{display:block;position:relative;min-height:100dvh}.welcome-art{position:absolute;inset:0;min-height:100%;background-position:center top}.welcome-art::after{background:linear-gradient(180deg,#180d2210 0%,#180d2240 25%,#180d22dd 52%,#130d1b 76%)}.welcome-art-copy,.welcome-art-strip{display:none}.welcome-content{position:relative;z-index:1;justify-content:flex-end;min-height:100dvh;padding:80px 26px max(25px,env(safe-area-inset-bottom));max-width:480px}.welcome-brand{position:absolute;top:max(26px,env(safe-area-inset-top));left:26px;margin:0;text-shadow:0 2px 16px #160b20}.welcome-eyebrow{font-size:12px}#welcome .welcome-intro h2{font-size:40px;margin:9px 0 12px}#welcome .welcome-intro p{font-size:14px;line-height:1.55;margin-bottom:18px}.welcome-actions .social{min-height:51px;margin-bottom:10px}.welcome-divider{margin:16px 0 8px}.welcome-art{background-position:center 20%}}
@media(max-height:700px) and (max-width:700px){.welcome-content{padding-top:72px}.welcome-brand{top:18px}#welcome .welcome-intro h2{font-size:32px}#welcome .welcome-intro p{margin-bottom:10px}.welcome-divider{margin:9px 0 5px}}
@media(min-width:701px){.welcome-art{background-position:center top}}
/* Result strips scroll independently and offer buttons in both directions. */
.rail{display:flex;flex-direction:column;overflow:visible;min-height:0}
.rail-items,.rail.right .rail-items{animation:none;overflow-y:auto;overflow-x:hidden;min-height:0;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:none;scroll-snap-type:y proximity;scroll-behavior:smooth}
.rail-items::-webkit-scrollbar{display:none}.rail-items button{width:100%;scroll-snap-align:start}
.rail .rail-control{flex:none;width:100%;height:32px;border:0;background:#1d142b80;color:white;font-size:24px;line-height:24px;border-radius:8px;margin:2px 0;backdrop-filter:blur(8px)}
.rail .rail-control:focus-visible{outline:2px solid white}
@media(max-width:600px){.rail .rail-control{height:30px;font-size:21px;line-height:22px}}
.auth-challenge{margin:0 auto 12px;min-height:65px;display:flex;justify-content:center}
.edit-label{text-align:left;color:#e5d7ec;font-size:14px;margin-top:10px}
#edit-instruction{width:min(100%,440px);margin-top:8px;resize:vertical;border:1px solid #d4b9e788;border-radius:14px;padding:14px;background:#ffffff14;color:white;font:inherit;min-height:130px}
#edit-instruction::placeholder{color:#ccbbd5}
#result .secondary:disabled{opacity:.45;cursor:not-allowed}
.plan-card,.payment-details{width:min(100%,440px);text-align:left;padding:20px;border:1px solid #d5bde450;border-radius:18px;background:#ffffff0b;margin:8px 0}
.plan-card.featured{border-color:#e7caff99;background:#bd86d218}.plan-card>div{display:flex;justify-content:space-between;gap:12px;font-size:17px}.plan-card>div span{font-weight:700;color:#edd8ff}.plan-card small{display:block;line-height:1.55;color:#e1d3e7;margin-top:8px}.plan-card .secondary:disabled{opacity:.55;cursor:not-allowed}.payment-details{text-align:center;display:grid;gap:5px}.payment-details small{color:#dac8e4}.payment-details strong{font-size:23px}.payment-slip{margin-top:14px}

/* Immersive result strips and template browsing. */
.header-actions{display:flex;align-items:center;gap:10px}
.browse{border:1px solid #ffffff80;border-radius:999px;background:#211a2d80;color:white;padding:10px 16px;font-size:14px;backdrop-filter:blur(12px)}
.browse:focus-visible,.template-card:focus-visible{outline:2px solid white;outline-offset:3px}
.hero .public-count{font-size:12px;color:#f1dffb;margin:-12px 0 18px}
.rail-items,.rail.right .rail-items{scroll-behavior:auto;scroll-snap-type:none;mask-image:linear-gradient(to bottom,transparent,black 12%,black 88%,transparent);-webkit-mask-image:linear-gradient(to bottom,transparent,black 12%,black 88%,transparent)}
.stage{touch-action:none}
#upload .sheet{background-position:center,center 37%;touch-action:pan-y}
#template-list .template-list-sheet{justify-content:flex-start;padding-top:max(80px,env(safe-area-inset-top));overflow:auto}
#template-search{width:min(100%,640px);border:1px solid #ffffff66;background:#ffffff12;border-radius:999px;padding:15px 20px;color:white;font:inherit;outline:none;margin:12px 0 22px}
#template-search:focus{border-color:#efd6ff}
#template-search::placeholder{color:#d6c6dc}
dialog .sheet>.template-grid{width:min(100%,760px);display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;padding-bottom:30px}
.template-card{position:relative;overflow:hidden;aspect-ratio:3/4;padding:0;border:1px solid #ffffff55;border-radius:16px;background:#33223d;color:#fff;text-align:left}
.template-card img{width:100%;height:100%;object-fit:cover;transition:transform .3s}
.template-card:hover img{transform:scale(1.04)}
.template-card span{position:absolute;inset:auto 0 0;padding:40px 14px 14px;background:linear-gradient(transparent,#160b20e8);font-weight:700}
@media(max-width:600px){.browse{padding:8px 12px;font-size:12px}.hero .public-count{font-size:11px;margin:-10px 0 15px}dialog .sheet>.template-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.template-card{border-radius:12px}.template-card span{font-size:13px}}
/* Keep both full-screen panels in one viewport while dragging. */
#upload{overflow:hidden}
#upload .sheet{position:absolute;inset:0;height:100%;min-height:0;overflow-y:auto;animation:none;overscroll-behavior:contain}
#upload .sheet>.close{position:absolute}
.stage{will-change:transform}
.payment-details img{display:block;width:min(190px,100%);margin:0 auto 12px;background:white;border-radius:12px}
.rail-items button{transform:translate3d(0,var(--rail-fraction,0px),0);will-change:transform}
/* A non-modal drag surface keeps the pointer active until the gesture settles. */
#upload[open]{z-index:10}
