:root{--bg:#f7f4ed;--paper:#fffdf8;--ink:#293c30;--muted:#7a7165;--line:#e4ded3;--green:#263e30;--green2:#405b49;--red:#842d32;--blush:#f4e8e4;--gold:#b69a60;--r:14px;--serif:"Cormorant Garamond","Noto Serif Thai",Georgia,serif;--sans:"IBM Plex Sans Thai",system-ui,-apple-system,sans-serif}
*{box-sizing:border-box}html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 var(--sans);-webkit-tap-highlight-color:transparent}
body::before{content:"";position:fixed;inset:0;pointer-events:none;background:radial-gradient(900px 420px at 15% -10%,#fff9ec,transparent),radial-gradient(700px 400px at 100% 100%,#efe6d6,transparent);z-index:-1}
h1,h2{font-family:var(--serif);font-weight:500;margin:0;letter-spacing:.01em}
header{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:16px max(5%,16px);border-bottom:1px solid var(--line);background:#f7f4edcc;backdrop-filter:blur(8px)}
.brand{display:flex;align-items:center;gap:12px;min-width:0}.brand img{width:40px;height:40px;border-radius:10px;box-shadow:0 2px 8px #263e3030}
h1{font-size:30px;line-height:1}h1 b{color:var(--red)}
.eyebrow{display:block;font-size:10px;letter-spacing:.22em;text-transform:uppercase;color:var(--gold);font-weight:600;margin-bottom:2px}
main{max-width:1500px;margin:auto;padding:16px 24px 20px;display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:24px;align-items:start}
.stage{display:flex;flex-direction:column;align-items:center;gap:10px;min-width:0}
canvas{width:min(100%,780px,calc((100dvh - 128px)*.75));height:auto;display:block;border-radius:4px;touch-action:none;cursor:grab;box-shadow:0 1px 2px #392c2518,0 14px 40px -8px #392c2540}canvas:active{cursor:grabbing}
.hint{font-size:12px;color:var(--muted);text-align:center;margin:0}
button,input,textarea,select{font:inherit;color:inherit;border:1px solid #ded8cc;border-radius:10px;background:var(--paper);padding:10px 12px;transition:border-color .15s,background .15s,transform .1s,box-shadow .15s}
button{cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px}button:active{transform:scale(.96)}
button:hover{border-color:var(--red);background:var(--blush)}
:focus-visible{outline:2px solid var(--red);outline-offset:2px}
input:focus,textarea:focus,select:focus{outline:none;border-color:var(--red);box-shadow:0 0 0 3px #842d3220}
input,textarea,select{width:100%}textarea{resize:vertical;min-height:84px}
svg.i{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}.actions button{padding:8px 14px;font-size:13px}
.primary{background:var(--green);color:#fff;border-color:var(--green);flex:1;font-weight:500}.primary:hover{background:var(--green2);border-color:var(--green2)}
.tray{width:100%;background:var(--paper);border:1px solid var(--line);border-radius:var(--r);padding:10px 12px 8px}
.tray-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:6px}.tray h2{font-size:19px;font-style:italic}.tray small{font-size:11px;color:var(--muted)}
.palette{display:flex;gap:8px;overflow-x:auto;padding:4px 2px 8px;scroll-snap-type:x proximity;scrollbar-width:thin}
.palette button{flex:0 0 68px;height:68px;padding:6px;scroll-snap-align:start;background:#fbf7ee}.palette img{width:100%;height:100%;object-fit:contain;pointer-events:none}
aside{background:var(--paper);border:1px solid var(--line);border-radius:var(--r);padding:22px;box-shadow:0 8px 30px -14px #392c2530}
aside section+section{margin-top:22px;padding-top:22px;border-top:1px solid var(--line)}
aside h2{font-size:26px;margin-bottom:4px}
label{display:block;margin:16px 0 6px;font-size:12px;font-weight:600;color:var(--ink)}
input[type=range]{padding:0;border:0;background:none;accent-color:var(--red);height:28px}
.swatches{display:flex;flex-wrap:wrap;gap:8px}.swatches button{width:32px;height:32px;padding:0;border-radius:50%;box-shadow:inset 0 0 0 1px #0000001a}.swatches button.active{outline:2px solid var(--red);outline-offset:2px}
#customColor{height:40px;padding:3px;cursor:pointer}
#status{font-size:12px;color:var(--muted);margin:10px 0 0;text-align:center}
.music{padding:8px 14px;font-size:13px;border-radius:999px}.hbtns{display:flex;gap:8px}#sfx{padding:8px 11px;font-size:15px;line-height:1}
footer{text-align:center;padding:22px;color:#887e70;font:italic 17px var(--serif)}
@media(max-width:380px){.music span{display:none}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}

@media(min-width:761px){header{padding:10px max(3%,16px)}
.stage{position:sticky;top:10px;display:grid;grid-template-columns:156px minmax(0,1fr);column-gap:20px;row-gap:8px;align-items:start;justify-items:center}
.stage>canvas{grid-column:2;grid-row:1/3}.stage>.hint{grid-column:2;grid-row:3;margin:0}
.stage>.actions{grid-column:1;grid-row:1;flex-direction:column;flex-wrap:nowrap;width:100%}.stage>.actions button{width:100%;justify-content:flex-start}
.stage>.tray{grid-column:1;grid-row:2/4}
.palette{display:grid;grid-template-columns:repeat(2,1fr);overflow-y:auto;overflow-x:hidden;max-height:calc(100dvh - 330px);padding:2px}.palette button{flex:none;height:auto;aspect-ratio:1}
aside{position:sticky;top:10px;max-height:calc(100dvh - 20px);overflow:auto}}
@media(min-width:761px) and (max-width:1000px){main{grid-template-columns:minmax(0,1fr) 270px;gap:14px;padding:12px}.stage{grid-template-columns:128px minmax(0,1fr);column-gap:12px}}
@media(max-width:760px){header{padding:10px 14px}h1{font-size:24px}.brand img{width:32px;height:32px}.eyebrow{display:none}
main{display:flex;flex-direction:column;padding:0 12px 16px;gap:14px}
.stage{position:sticky;top:0;z-index:5;width:calc(100% + 24px);margin:0 -12px;padding:6px 12px 6px;background:#f7f4eef2;backdrop-filter:blur(8px);border-bottom:1px solid var(--line);gap:5px}
canvas{width:min(100%,calc(46dvh*.75))}.hint{display:none}.actions button{padding:6px 10px;font-size:12px}
.tray{padding:5px 8px 1px;border-radius:12px}.tray-head{display:none}.palette{padding:2px 0 6px}.palette button{flex-basis:50px;height:50px;padding:4px}
aside{padding:18px}}
@media(min-width:761px){.tray-head small{display:none}.tray h2{font-size:18px;line-height:1.1;margin-bottom:2px}.tray-head{margin-bottom:8px}}
