/* Additions only. Base layout, Night colors and controls are the existing site's. */
.demo-worlds-launch{position:fixed;z-index:4;top:calc(105px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);min-height:38px;padding:8px 16px;border:1px solid var(--line);border-radius:22px;background:var(--panel);color:var(--ink);font-size:11px;white-space:nowrap;backdrop-filter:blur(12px)}
.demo-worlds-launch span{margin-left:9px;color:var(--muted)}
.demo-worlds-launch:hover{border-color:var(--muted)}
.panel-open .demo-worlds-launch,.in-draw .demo-worlds-launch{display:none}
#sparkPanel.lspace-editor.lspace-showcase{width:420px}
#sparkPanel.lspace-editor.lspace-showcase #sparkTitle{max-width:340px}
#sparkPanel.lspace-editor.lspace-showcase .demo-lead{margin:10px 0 12px;font-size:12px;line-height:1.6}
.lspace-showcase .demo-scene-wrap{margin-top:8px}
.demo-customize{margin-top:16px;border-top:1px solid var(--line);padding-top:8px}
.demo-customize>summary{min-height:44px;display:flex;align-items:center;cursor:pointer;color:var(--ink);font-size:12px;gap:8px}
.demo-customize>summary::before{content:'+';font-size:18px;color:var(--muted)}
.demo-customize[open]>summary::before{content:'−'}
.demo-customize>summary::-webkit-details-marker{display:none}
.demo-customize .demo-form{padding-top:8px}
.demo-play-guide{font-size:10px;color:var(--muted);margin:0 0 8px}
.demo-play-guide summary{padding:6px 0;cursor:pointer}
#sparkContent .demo-play-guide p{font-size:11px;margin:3px 0 10px}
.demo-worlds-next{font-size:11px;color:var(--ink);min-height:36px;padding:0;text-decoration:underline;text-underline-offset:4px;text-decoration-color:var(--line)}
.demo-world-card{display:flex;align-items:center;gap:13px;width:100%;padding:10px 8px 10px 0;margin:10px 0;text-align:left;border:1px solid var(--line);border-radius:12px;background:color-mix(in srgb,var(--bg) 65%,transparent);color:var(--ink)}
.demo-world-card:hover{border-color:var(--muted);background:color-mix(in srgb,var(--ice) 8%,var(--bg))}
.demo-world-card canvas{display:block;flex:0 0 82px;width:82px;height:82px}
.demo-world-card strong{display:block;margin-bottom:7px;font-size:14px;font-weight:400}
.demo-world-card span span{display:block;font-size:11px;line-height:1.6;color:var(--muted)}
.demo-world-card:focus-visible,.demo-worlds-launch:focus-visible,.demo-worlds-next:focus-visible,.demo-customize>summary:focus-visible{outline:2px solid var(--ice);outline-offset:3px}
.demo-language{display:inline-flex;align-items:center;min-height:44px;padding:0 10px;color:var(--muted);font-size:11px;letter-spacing:.04em}
.demo-stamp{position:fixed;z-index:3;left:50%;top:calc(76px + env(safe-area-inset-top));transform:translateX(-50%);font-size:9px;letter-spacing:.14em;color:var(--muted);pointer-events:none;white-space:nowrap;opacity:.75}
.demo-stamp span{letter-spacing:.02em;opacity:.65}.in-draw .demo-stamp{display:none}
#sparkPanel.lspace-editor{width:350px;max-height:calc(100dvh - 145px);scrollbar-width:thin;scrollbar-color:var(--muted) transparent}
#sparkTitle{overflow-wrap:anywhere;max-width:265px}
#sparkContent .demo-lead{margin:15px 0 16px}
.demo-form{margin:0}.demo-form label{margin:0 0 8px!important;color:var(--ink)!important;font-size:12px!important}
.demo-prompt-row{display:flex;gap:7px;align-items:stretch}
#sparkContent #changePrompt{min-width:0;flex:1;width:0;padding:12px;font-size:12px;background:color-mix(in srgb,var(--bg) 75%,transparent);color:var(--ink)}
#sparkContent #changePrompt::placeholder{color:var(--muted);opacity:.75}
.demo-apply{flex:0 0 auto;padding:0 13px;border:1px solid var(--line);background:color-mix(in srgb,var(--ice) 13%,transparent);border-radius:9px;font-size:12px;color:var(--ink)}
.demo-suggestions{margin-top:12px}
.demo-ideas-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;color:var(--muted);font-size:11px}
.demo-ideas-more{min-height:44px;padding:0 4px;color:var(--ice);font-size:11px;text-decoration:underline;text-underline-offset:3px;text-decoration-color:var(--line)}
.demo-ideas-list{display:grid;gap:6px}
.demo-idea{width:100%;min-height:44px;padding:9px 12px;border:1px solid var(--line);border-radius:9px;text-align:left;font-size:12px;line-height:1.4;color:var(--ink);background:color-mix(in srgb,var(--bg) 45%,transparent)}
.demo-idea:hover{border-color:var(--muted);background:color-mix(in srgb,var(--ice) 8%,transparent)}
.demo-idea:focus-visible,.demo-ideas-more:focus-visible{outline:2px solid var(--ice);outline-offset:3px}
.demo-idea:disabled,.demo-ideas-more:disabled{opacity:.45}
#sparkContent .demo-ideas-help{margin:8px 0 0;font-size:10px;line-height:1.5;color:var(--muted)}
.demo-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.demo-chip{min-height:32px;padding:6px 10px;border:1px solid var(--line);border-radius:16px;color:var(--muted);font-size:10px;line-height:1.3}
.demo-chip:hover{background:color-mix(in srgb,var(--ice) 8%,transparent);color:var(--ink)}
#sparkContent .demo-status{font-size:11px;line-height:1.6;min-height:35px;margin:11px 0 9px;color:var(--muted)}
#sparkContent .demo-status.is-error{color:#dfb693}
.demo-features{display:flex;flex-wrap:wrap;gap:6px;min-height:0;margin:0 0 13px}
.demo-features:empty{display:none}.demo-features span{font-size:9px;color:var(--ice);background:color-mix(in srgb,var(--ice) 9%,transparent);padding:4px 7px;border-radius:4px}
.demo-editor-actions{display:flex;align-items:center;justify-content:space-between;gap:9px;margin:5px 0 12px}
.demo-undo{min-height:40px;font-size:11px;padding:0;color:var(--muted)}
.demo-back{min-height:40px;font-size:11px;padding:8px 12px;border-radius:9px;border:1px solid var(--line);color:var(--ink)}
.demo-details{border-top:1px solid var(--line);padding-top:9px;font-size:11px;color:var(--muted)}
.demo-details summary{padding:6px 0;cursor:pointer;min-height:30px}.demo-details summary:focus-visible{outline:1px solid var(--ice);outline-offset:3px}
.demo-details input{color:var(--ink)!important;background:var(--bg)!important}
.demo-history{padding-left:17px;line-height:1.65;font-size:11px;margin:15px 0 0;overflow-wrap:anywhere}.demo-history li{padding:3px 0}
#sparkContent .demo-disclosure{font-size:9px!important;line-height:1.5;margin:13px 0 0!important;color:var(--muted)!important;opacity:.65}
.home-about p:last-child{margin-bottom:0}
.demo-scene-wrap{margin:14px 0 0;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#080c13}
.demo-scene{display:block;width:100%;height:320px;border:0}
.demo-scene-wrap:first-child{margin-top:0}
.demo-scene-tools{margin-top:12px;padding:8px 0;background:var(--panel);border-bottom:1px solid var(--line)}
.demo-scene-hint{display:block;font-size:10px;line-height:1.5;color:var(--muted);margin-bottom:5px}
.demo-scene-buttons{display:flex;gap:6px;flex-wrap:wrap}
.demo-scene-control{min-height:44px;padding:7px 11px;border:1px solid var(--line);border-radius:8px;color:var(--ink);font-size:11px}
.demo-scene-control[aria-pressed=true]{background:color-mix(in srgb,var(--ice) 16%,transparent);border-color:var(--muted)}
.demo-scene-control:focus-visible{outline:2px solid var(--ice);outline-offset:2px}
#sparkContent .demo-scene-status{font-size:11px;line-height:1.5;color:var(--muted);margin:7px 0}
.demo-scene-status:empty{display:none}
#sparkContent #changePrompt{resize:vertical;border:1px solid var(--line);border-radius:9px;line-height:1.5;font-family:inherit}
.demo-apply{align-self:stretch}.demo-apply:disabled{opacity:.55;cursor:wait}
.demo-chip:disabled{opacity:.45}
.demo-details pre{max-height:220px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;font-size:10px;line-height:1.5}
#sparkContent .demo-usage{font-size:10px;line-height:1.6;overflow-wrap:anywhere}
.demo-history p{font-size:10px;color:var(--muted);margin:4px 0 10px}
@media(max-width:640px){
 .demo-worlds-launch{top:calc(87px + env(safe-area-inset-top));font-size:10px;min-height:36px}
 #sparkPanel.lspace-editor.lspace-showcase{width:auto;max-height:78dvh;padding:18px}
 #sparkPanel.lspace-editor.lspace-showcase #sparkTitle{max-width:calc(100vw - 100px)}
 .demo-world-card canvas{flex-basis:70px;width:70px;height:70px}
 .demo-stamp{top:calc(63px + env(safe-area-inset-top));font-size:8px}
 .demo-language{padding:0 7px;font-size:10px}
 #sparkPanel.lspace-editor{width:auto;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));max-height:72dvh;padding:20px}
 #sparkContent .demo-lead{margin:12px 0}.demo-suggestions{margin-top:10px}.demo-chip{min-height:32px;padding:6px 9px}
 #sparkContent #changePrompt{font-size:16px;padding:10px;letter-spacing:-.03em}.demo-apply{padding:0 11px}
 .demo-editor-actions{margin-bottom:7px}#sparkContent .demo-disclosure{margin-top:9px!important}
 #sparkPanel.lspace-editor:has(.demo-scene) {
   max-height:min(max(72dvh, 480px), calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
   padding:12px 16px;
 }
 #sparkPanel.lspace-editor:has(.demo-scene) > .panel-top { margin-bottom:6px; }
}
@media(max-width:359px){#sparkPanel.lspace-editor{padding:17px}.demo-chip{font-size:9px;padding:5px 8px}.demo-language{padding:0 3px}}
@media(min-width:540px) and (max-height:500px) and (orientation:landscape){
 #sparkPanel.lspace-editor{top:80px;bottom:12px;left:auto;right:12px;width:320px;max-height:calc(100dvh - 92px)}.demo-stamp{display:none}
}
@media(min-width:480px) and (max-height:500px) and (orientation:landscape){
 /* Keep the title beside the canvas on short screens so the last row is playable. */
 #sparkPanel.lspace-editor:has(.demo-scene) {
   top:calc(6px + env(safe-area-inset-top)); bottom:calc(6px + env(safe-area-inset-bottom));
   left:auto; right:calc(12px + env(safe-area-inset-right));
   width:min(600px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
   max-height:none; padding:6px 12px;
   display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 3fr); gap:12px;
 }
 #sparkPanel.lspace-editor:has(.demo-scene) > .panel-top {
   flex-direction:column; align-items:flex-start; justify-content:flex-start; margin:0;
 }
 #sparkPanel.lspace-editor:has(.demo-scene) > .panel-top > div { flex:none; }
}
@media(min-width:480px) and (max-height:374px) and (orientation:landscape){
 .demo-scene { zoom:.85; }
}


/* Shared events are a separate layer: no editor or local-save styles change. */
.demo-shared{margin:24px 0 12px;padding:18px 0;border-top:1px solid var(--line,rgba(169,207,238,.2));text-align:left}
.demo-shared h3{font-size:16px;line-height:1.4;margin:0 0 8px}.demo-shared h4{font-size:13px;margin:18px 0 8px}
.demo-shared-note,.demo-shared-status{font-size:12px;line-height:1.6;overflow-wrap:anywhere}.demo-shared-note{opacity:.72}.demo-shared-status{color:var(--ink,#cbd7e5)}
.demo-shared-controls{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;margin:14px 0}
.demo-shared-controls label{display:grid;gap:6px;font-size:12px;min-width:0}.demo-shared-controls select{box-sizing:border-box;width:100%;min-width:0;min-height:42px;border:1px solid rgba(169,207,238,.25);border-radius:9px;padding:8px;background:var(--panel,#101622);color:var(--ink,#cbd7e5);font:inherit}
.demo-shared-controls>button{grid-column:1/-1}.demo-shared-button{display:block;max-width:100%;min-height:42px;padding:10px 14px;border:1px solid rgba(169,207,238,.3);border-radius:10px;background:transparent;color:inherit;font:inherit;font-size:13px;line-height:1.5;text-align:left;cursor:pointer;overflow-wrap:anywhere;margin:6px 0}
.demo-shared-button:focus-visible{outline:2px solid #a9cfee;outline-offset:3px}.demo-shared-button:disabled{opacity:.45;cursor:default}
.demo-shared-event,.demo-shared-request{padding:12px;border:1px solid rgba(169,207,238,.18);border-radius:12px;margin:8px 0}.demo-shared-event p,.demo-shared-request p{font-size:13px;line-height:1.6;margin:0 0 8px;overflow-wrap:anywhere}
.demo-shared [hidden]{display:none!important}
@media(max-width:360px){.demo-shared-controls{grid-template-columns:minmax(0,1fr)}}

.demo-entry-actions{flex-wrap:wrap;justify-content:center;width:max-content}
#sparkContent .demo-motion-toggle{display:flex;align-items:center;gap:.65rem;min-height:40px;cursor:pointer}
#sparkContent .demo-motion-toggle input[type="checkbox"]{box-sizing:border-box;flex:none;width:18px;height:18px;min-height:18px;padding:0;margin:0;accent-color:var(--accent,#a9cfee)}

#drawMotionOption{position:fixed;z-index:6;top:145px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:8px;width:max-content;max-width:calc(100% - 38px);font-size:11px;color:var(--draw-hint,#b1bdd4);padding:6px 10px;border-radius:12px;background:var(--panel-bg,#101725)}
#drawMotionOption[hidden]{display:none}
#drawMotionOption input{accent-color:var(--accent,#a9cfee);width:16px;height:16px;flex:none}
@media(max-height:520px) and (min-width:600px){#drawMotionOption{top:76px;font-size:10px;padding:4px 8px}}

.demo-garden-bed{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.demo-garden-plant{width:100%;margin:0;padding:8px;text-align:center;font-size:12px;border-color:rgba(155,197,170,.25)}
.demo-plant-art{display:block;position:relative;height:92px;overflow:hidden;margin:0 auto 8px;max-width:96px;border-bottom:1px solid rgba(155,197,170,.4)}
.demo-plant-stem{position:absolute;bottom:0;left:50%;height:var(--stem-height);width:2px;background:#94bca4}
.demo-plant-stem:before,.demo-plant-stem:after{content:"";position:absolute;width:18px;height:9px;background:#759d85;border-radius:90% 0;bottom:12px;right:0;transform:rotate(24deg)}
.demo-plant-stem:after{right:auto;left:2px;bottom:23px;transform:rotate(-30deg) scaleX(-1)}
.demo-plant-flower{position:absolute;bottom:calc(var(--stem-height) - 4px);left:calc(50% - 8px);height:16px;width:16px;border-radius:50%;background:var(--petal);box-shadow:9px 1px 0 -3px var(--petal),-9px 1px 0 -3px var(--petal),0 -8px 0 -3px var(--petal),0 8px 0 -3px var(--petal)}
@media(max-width:420px){.demo-garden-bed{grid-template-columns:repeat(2,minmax(0,1fr))}}

.rhythm-panel{display:grid;gap:10px;margin-block:12px}
.rhythm-controls{display:flex;flex-wrap:wrap;gap:6px}
.rhythm-carry{position:fixed;inset-inline-start:max(12px,env(safe-area-inset-left));inset-block-start:calc(132px + env(safe-area-inset-top));z-index:7;width:max-content;max-width:min(252px,calc(100vw - 24px));color:var(--ink);pointer-events:none}
.rhythm-carry-strip{display:flex;align-items:center;gap:2px;width:fit-content;max-width:100%;padding:2px;border-radius:27px;border:1px solid var(--line);background:var(--panel);backdrop-filter:blur(14px);pointer-events:auto}
.rhythm-carry .demo-scene-control{min-width:44px;min-height:44px;border-radius:22px}
.rhythm-carry .rhythm-note-control,.rhythm-carry .rhythm-dismiss{flex:none;border:0;padding:0;width:44px;height:44px}
.rhythm-note{position:relative;display:inline-grid;place-items:center;width:31px;height:31px;border-radius:50%;background:color-mix(in srgb,var(--ice) 9%,transparent);color:var(--ice);font:22px/1 system-ui;transition:transform .15s,background .15s}
.rhythm-note.beat{transform:scale(1.12);background:color-mix(in srgb,var(--ice) 28%,transparent)}
.rhythm-note-control[aria-pressed=false] .rhythm-note::after{content:"";position:absolute;width:15px;height:1px;background:currentColor;transform:rotate(-46deg);box-shadow:0 1px var(--panel)}
.rhythm-carry .rhythm-dismiss{font:21px/1 system-ui;color:var(--muted)}
.rhythm-carry-center{min-width:0;max-width:152px}
.rhythm-carry strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:550}
.rhythm-carry .rhythm-keep{display:grid;align-content:center;gap:2px;max-width:100%;padding:3px 12px;line-height:1.2;color:var(--ice);border-color:var(--line);text-align:start}
.rhythm-keep strong{color:var(--muted);font-size:10px}
.rhythm-carry p,.rhythm-carry .rhythm-notice{display:block;margin:4px 0 0;padding:2px 9px;width:fit-content;max-width:100%;border-radius:9px;background:var(--panel);color:var(--muted);font-size:11px;line-height:1.4}
.rhythm-notice{color:var(--muted);font-size:12px;line-height:1.4}
.rhythm-carry:has(.rhythm-notice:not(:empty)) p,.rhythm-carry[hidden],.rhythm-carry [hidden],.rhythm-controls [hidden],.rhythm-notice:empty,.rhythm-carry .rhythm-notice:empty{display:none}
@media(prefers-reduced-motion:reduce){.rhythm-note,.rhythm-note.beat{transition:none;transform:none}}
@media(max-height:480px) and (min-width:600px){.rhythm-carry{inset-block-start:calc(78px + env(safe-area-inset-top))}}
.rhythm-steps{display:grid;grid-template-columns:repeat(16,minmax(0,1fr));gap:3px;max-width:280px}
.rhythm-steps i{height:7px;border-radius:3px;background:var(--line)}
.rhythm-steps i.hit{background:var(--muted)}
.rhythm-steps i.playing{outline:1px solid var(--ice);outline-offset:1px}
.rhythm-steps i.hit.playing{background:var(--ice)}
