/* V4 release overrides. Loaded after the original styles via higher specificity. */
body .helper,body .section p,body .field label,body .question,body .flowcard,body .check,body .role-btn small{font-size:14px;line-height:1.5}
body .input,body .textarea,body .select{font-size:16px}
body label{display:block;margin:12px 0 6px;font-size:14px}
body button{min-height:44px}
body button:disabled{opacity:.4;cursor:not-allowed}
body :focus-visible{outline:3px solid #aebaff;outline-offset:3px}
body .topbar{padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}
body .back-mark{font-size:25px;line-height:0;vertical-align:-2px;color:#aeb8c8}
body .app:not(.play-mode) #modeBadge{display:none}
body .creator-context{display:flex;min-width:0;flex-direction:column;padding-left:14px;margin-left:4px;border-left:1px solid var(--line)}
body .creator-context small{font-size:10px;font-weight:850;letter-spacing:.09em;color:#7f8a9a}
body .creator-context strong{max-width:min(34vw,360px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}
body #saveBtn{min-height:34px;border:0;background:transparent;padding:0 8px;color:#8995a6;font-size:12px;cursor:default}
body #saveBtn:before{content:'●';margin-right:6px;font-size:8px;color:#667282}
body #saveBtn[data-save-state="saved"]:before{color:#55dc8d}
body #saveBtn[data-save-state="pending"]:before,body #saveBtn[data-save-state="saving"]:before{color:#ffc75a}
body #saveBtn[data-save-state="error"]:before{color:#ff6c79}
body .stagehead{display:none}
body .stage{min-height:760px}
body .side{position:relative;min-height:760px}
body .inspector-head{height:68px;display:flex;align-items:center;gap:12px;padding:12px 14px;border-bottom:1px solid var(--line);background:linear-gradient(180deg,rgba(37,46,59,.72),rgba(21,26,34,.25))}
body .inspector-head>div{display:flex;min-width:0;flex-direction:column}
body .inspector-head small,body .asset-library-head small{font-size:10px;font-weight:950;letter-spacing:.14em;color:#8797ff}
body .inspector-head strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:16px}
body .inspector-head button{margin-left:auto;flex:0 0 auto;border:1px solid rgba(112,132,255,.42);border-radius:11px;background:#273358;padding:0 11px;font-size:12px;font-weight:900}
body .tabs{grid-template-columns:repeat(3,1fr);padding:7px 9px}
body .tab{display:flex;align-items:center;justify-content:center;gap:5px;min-height:42px;background:transparent;color:#8995a5}
body .tab span{display:grid;width:20px;height:20px;place-items:center;border-radius:50%;background:#252d39;font-size:10px}
body .tab.active{background:#28345a;color:#fff;box-shadow:inset 0 0 0 1px rgba(112,132,255,.36)}
body .tab.active span{background:#6479ff}
body .panel{max-height:calc(760px - 126px)}
body .object-mode-switch{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:0 0 14px;padding:4px;border:1px solid var(--line);border-radius:12px;background:#10151d}
body .object-mode-switch button{border:0;border-radius:9px;background:transparent;color:#8995a5;font-size:12px;font-weight:900}
body .object-mode-switch button.active{background:#2a3555;color:#fff;box-shadow:0 2px 10px rgba(0,0,0,.24)}
body .behavior-sentence{margin:0 0 16px;padding:13px;border:1px solid rgba(112,132,255,.35);border-radius:14px;background:linear-gradient(145deg,rgba(86,111,255,.16),rgba(17,22,30,.9))}
body .behavior-sentence small{display:block;margin-bottom:5px;color:#95a4ff;font-size:10px;font-weight:950;letter-spacing:.08em}
body .behavior-sentence p{margin:0;color:#edf0ff;font-size:13px;font-weight:800;line-height:1.55}
body .sentence-step{display:flex;align-items:center;gap:9px;margin:16px 0 8px}
body .sentence-step>span{display:grid;flex:0 0 27px;width:27px;height:27px;place-items:center;border-radius:9px;background:#5b70f5;font-size:12px;font-weight:950}
body .sentence-step>div{display:flex;flex-direction:column}
body .sentence-step small{color:#8995a5;font-size:10px;font-weight:800}
body .sentence-step strong{font-size:13px}
body .asset-library{position:absolute;z-index:90;inset:0;display:none;flex-direction:column;padding:16px;background:#151a22;overflow-y:auto;overscroll-behavior:contain}
body .side.asset-tray-open .asset-library{display:flex}
body .asset-library-head{display:flex;align-items:flex-start;gap:12px;margin-bottom:14px}
body .asset-library-head>div{min-width:0}
body .asset-library-head h2{margin:4px 0 3px;font-size:19px;letter-spacing:-.035em}
body .asset-library-head p{margin:0;color:#929dac;font-size:12px}
body .asset-library-head button{margin-left:auto;flex:0 0 44px;width:44px;border:1px solid var(--line);border-radius:12px;background:#252d39;font-weight:900}
body .asset-count-row{display:flex;align-items:center;justify-content:space-between;margin:10px 2px 8px;font-size:12px}
body .asset-count-row .asset-count{float:none}
body .asset-library .asset-filters{flex:0 0 auto;padding-bottom:3px}
body .asset-library .asset-grid{grid-template-columns:repeat(3,minmax(0,1fr));padding-bottom:18px}
body .asset-library .asset-card{min-height:70px;transition:transform .12s ease,border-color .12s ease,background .12s ease}
body .asset-library .asset-card:active{transform:scale(.96);border-color:#7184ff;background:#29355a}
body .sheet{max-height:90dvh;overflow:auto}
body .sheet p{white-space:pre-wrap;font-size:16px}
body .toast{max-width:calc(100vw - 24px);width:max-content;border-radius:14px;font-size:14px}
body .play-mode .workspace{grid-template-columns:1fr}
body .play-mode .stage{min-height:0}
body .play-mode .viewport{height:calc(100dvh - 80px);min-height:360px}
body .slot.empty{visibility:visible}
body .stars{display:none}
html[data-player] .editor-only{display:none!important}
body [hidden]{display:none!important}
@media(max-width:480px){body .topbar:has(#publishBtn:not([hidden])) .brand{font-size:12px}body .topbar:has(#publishBtn:not([hidden])) .topbtn{padding:0 8px;font-size:13px}}
@media(max-width:900px){
 body .app{--mobile-sheet-height:min(43dvh,540px);height:100dvh;overflow:hidden}
 body .topbar{height:calc(58px + env(safe-area-inset-top));gap:6px}
 body .brand{font-size:15px}
 body .creator-context{display:none}
 body .inspector-head{display:none}
 body .topbtn{padding:0 10px}
 body .workspace{height:calc(100dvh - 58px - env(safe-area-inset-top));display:flex;flex-direction:column}
 body .stage{flex:1;min-height:180px}
 body .viewport{height:100%;min-height:180px}
 body .side{height:var(--mobile-sheet-height);min-height:0;display:flex;flex-direction:column}
 body .tabs{flex-shrink:0}
 body .panel{overflow:auto;padding-bottom:calc(24px + env(safe-area-inset-bottom))}
 body .side.asset-tray-open{height:min(76dvh,620px)}
 body .asset-library{position:absolute;inset:0;height:auto;padding:18px 14px calc(20px + env(safe-area-inset-bottom));border-radius:24px 24px 0 0;box-shadow:0 -24px 70px rgba(0,0,0,.58)}
 body .asset-library .asset-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
 body .hint{top:8px;left:8px;padding:8px;font-size:12px;max-width:70%}
 body .viewport-actions{left:8px;right:8px;bottom:8px}
 body .play-mode .viewport{height:100%;min-height:0}
 body .play-mode .stage{flex:1}
}
@media(max-width:430px){body .gesture-list{gap:5px}body .gesture-list li{padding:10px 4px;font-size:11px}}

/* Runtime viewport mode wins over the portrait-oriented mobile overrides above. */
body .app[data-viewport-mode="mobile-landscape"]{--landscape-panel:clamp(270px,33vw,360px)}
body .app[data-viewport-mode="mobile-landscape"] .topbar{height:calc(50px + env(safe-area-inset-top));padding:env(safe-area-inset-top) max(10px,env(safe-area-inset-right)) 0 max(10px,env(safe-area-inset-left));gap:7px}
body .app[data-viewport-mode="mobile-landscape"] .workspace{display:grid;grid-template-columns:minmax(0,1fr) var(--landscape-panel);flex-direction:initial;gap:0;height:calc(100dvh - 50px - env(safe-area-inset-top));padding:0}
body .app[data-viewport-mode="mobile-landscape"].play-mode .workspace{grid-template-columns:1fr}
body .app[data-viewport-mode="mobile-landscape"] .stage{height:100%;min-width:0;min-height:0}
body .app[data-viewport-mode="mobile-landscape"] .viewport{height:100%;min-height:0}
body .app[data-viewport-mode="mobile-landscape"] .side{position:relative;inset:auto;z-index:20;width:auto;height:100%;min-height:0;display:flex;flex-direction:column;border:0;border-left:1px solid var(--line);border-radius:0;box-shadow:-14px 0 38px rgba(0,0,0,.24);transform:none!important;transition:none;will-change:auto}
body .app[data-viewport-mode="mobile-landscape"] .inspector-head{display:flex;height:54px;flex:0 0 54px;padding:8px 10px}
body .app[data-viewport-mode="mobile-landscape"] .mobile-sheet-toggle{display:none}
body .app[data-viewport-mode="mobile-landscape"] .side.sheet-collapsed .tabs,body .app[data-viewport-mode="mobile-landscape"] .side.sheet-collapsed .panel{visibility:visible;pointer-events:auto}
body .app[data-viewport-mode="mobile-landscape"] .tabs{height:48px;flex-shrink:0;padding:5px}
body .app[data-viewport-mode="mobile-landscape"] .tab{min-height:38px;font-size:11px}
body .app[data-viewport-mode="mobile-landscape"] .panel.active{height:calc(100% - 102px);max-height:none;overflow:auto;padding:12px max(12px,env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom))}
body .app[data-viewport-mode="mobile-landscape"] .asset-library{position:absolute;inset:0;width:auto;height:auto;padding:14px max(14px,env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom));border:0;border-radius:0;box-shadow:none}
body .app[data-viewport-mode="mobile-landscape"] .asset-library .asset-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
body .app[data-viewport-mode="mobile-landscape"] .viewport-actions,body .app[data-viewport-mode="mobile-landscape"].sheet-open .viewport-actions.editor-only{bottom:calc(10px + env(safe-area-inset-bottom))}
body .app[data-viewport-mode="mobile-landscape"] .modal{align-items:center;padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
body .app[data-viewport-mode="mobile-landscape"] .sheet{width:min(460px,78vw);max-height:calc(100dvh - 24px);border-radius:20px;padding:16px}

/* Player is a separate full-screen surface, not an editor state. */
body .app.play-mode{height:100dvh;min-height:0;overflow:hidden;background:#080c12}
body .play-mode .topbar{position:fixed;z-index:80;inset:0 0 auto;height:auto;min-height:64px;padding:max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));border:0;background:linear-gradient(180deg,rgba(4,7,11,.82),rgba(4,7,11,0));backdrop-filter:none;pointer-events:none}
body .play-mode .topbar .brand,body .play-mode #modeBadge{display:none}
body .play-mode .play-identity{min-width:0;max-width:min(54vw,520px);flex-direction:column;padding:8px 12px;border:1px solid rgba(255,255,255,.12);border-radius:13px;background:rgba(9,13,19,.7);box-shadow:0 8px 28px rgba(0,0,0,.24);backdrop-filter:blur(12px);pointer-events:auto}
body .play-mode .play-identity small{color:#91a1ff;font-size:9px;font-weight:950;letter-spacing:.13em}
body .play-mode .play-identity strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;letter-spacing:-.025em}
body .play-mode .play-menu-btn{width:auto;min-width:44px;height:44px;padding:0 12px;border:1px solid rgba(255,255,255,.13);border-radius:13px;background:rgba(9,13,19,.7);font-size:12px;box-shadow:0 8px 28px rgba(0,0,0,.24);backdrop-filter:blur(12px);pointer-events:auto}
body .play-mode .workspace{display:block;width:100%;max-width:none;height:100dvh;padding:0;margin:0}
body .play-mode .stage{width:100%;height:100dvh;min-height:0;border:0;border-radius:0;background:#0b1119;box-shadow:none}
body .play-mode .viewport{width:100%;height:100dvh;min-height:0}
body .play-mode .room-progress{display:none}
body .play-mode .play-focus{position:absolute;z-index:4;left:50%;top:50%;width:22px;height:22px;align-items:center;justify-content:center;transform:translate(-50%,-50%);pointer-events:none;opacity:.46}
body .play-mode .play-focus:before,body .play-mode .play-focus:after{content:'';position:absolute;background:rgba(255,255,255,.62)}
body .play-mode .play-focus:before{width:1px;height:22px}
body .play-mode .play-focus:after{width:22px;height:1px}
body .play-mode .play-focus i{width:4px;height:4px;border-radius:50%;background:#fff;box-shadow:0 0 8px rgba(255,255,255,.7)}
body .play-mode #playHint{z-index:9;left:50%;right:auto;top:auto;bottom:106px;width:max-content;max-width:min(620px,calc(100vw - 28px));min-height:0;padding:9px 14px;transform:translateX(-50%);border-color:rgba(255,255,255,.11);border-radius:999px;background:rgba(8,12,18,.76);color:#eef2f8;text-align:center;font-size:12px;line-height:1.45;box-shadow:0 10px 32px rgba(0,0,0,.3)}
body .play-mode .viewport-actions.play-hud{left:50%;right:auto;bottom:max(14px,env(safe-area-inset-bottom));width:min(760px,calc(100vw - 28px));min-height:76px;align-items:center;gap:8px;padding:9px 10px;transform:translateX(-50%);border:1px solid rgba(255,255,255,.12);border-radius:20px;background:linear-gradient(135deg,rgba(18,24,33,.94),rgba(9,13,19,.9));box-shadow:0 18px 48px rgba(0,0,0,.42);backdrop-filter:blur(18px)}
body .play-mode .inventory-wrap{display:flex;min-width:0;flex-direction:column;gap:4px}
body .play-mode .inventory-wrap>small{padding-left:2px;color:#7f8b9c;font-size:9px;font-weight:950;letter-spacing:.1em}
body .play-mode .inventory{max-width:390px;gap:6px}
body .play-mode .slot{width:44px;height:44px;min-height:44px;flex-basis:44px;border-color:rgba(255,255,255,.12);background:#202733}
body .play-mode .play-action{display:flex;min-width:90px;min-height:52px;align-items:center;justify-content:center;gap:5px;border-radius:14px;background:#252d3a;font-size:13px}
body .play-mode #scanBtn{background:linear-gradient(135deg,#526bf1,#6659e9);border:0}
body .play-mode .toast{bottom:108px}
body .play-mode .modal{align-items:center;padding:max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
body .play-mode .sheet{width:min(460px,calc(100vw - 28px));max-height:calc(100dvh - 28px);border-radius:22px;padding:20px}
body .app[data-viewport-mode="mobile-landscape"].play-mode .workspace,body .app[data-viewport-mode="mobile-landscape"].play-mode .stage,body .app[data-viewport-mode="mobile-landscape"].play-mode .viewport{height:100dvh}

@media(max-width:640px){
 body .play-mode .play-identity{max-width:48vw}
 body .play-mode .play-menu-btn span{display:none}
 body .play-mode .play-menu-btn{padding:0;width:44px}
 body .play-mode .viewport-actions.play-hud{width:calc(100vw - 16px);min-height:68px;padding:7px 8px;border-radius:17px}
 body .play-mode .inventory{max-width:calc(100vw - 196px)}
 body .play-mode .play-action{min-width:78px;min-height:48px}
 body .play-mode #playHint{bottom:94px}
}
@media(max-height:500px) and (pointer:coarse){
 body .play-mode .topbar{padding-top:max(6px,env(safe-area-inset-top))}
 body .play-mode .play-identity{padding:6px 10px}
 body .play-mode .play-menu-btn{height:40px}
 body .play-mode .viewport-actions.play-hud{bottom:max(7px,env(safe-area-inset-bottom));min-height:60px;padding:6px 8px}
 body .play-mode .inventory-wrap>small{display:none}
 body .play-mode .slot{width:42px;height:42px;min-height:42px;flex-basis:42px}
 body .play-mode .play-action{min-height:44px}
 body .play-mode #playHint{bottom:76px;padding:7px 12px}
 body .play-mode .toast{bottom:76px}
}
