/* Task-first layout; theme variables keep all four existing themes usable. */
[hidden]{display:none!important}
.wrap{max-width:1100px;margin:auto;padding:18px 18px 112px}
.top{position:relative;margin-bottom:24px;padding:0;background:none;border:0;box-shadow:none}
.top-shell{padding:0;gap:16px;align-items:center}
.brand-block{min-width:0}.brand{font-size:21px}.brand-mark{width:32px;height:32px;flex:0 0 32px}
.sub{font-size:12px;max-width:440px;margin-top:4px}.top-actions{gap:8px}.top-actions .btn{min-height:42px}
.top-actions .theme-trigger{width:42px;padding:10px}.theme-trigger-label{display:none}.top-actions .create-trigger{font-size:13px}
.ux-page-head{margin:18px 0 22px}.ux-page-head h1,.ux-welcome h1{font-size:clamp(28px,5vw,42px);line-height:1.12;letter-spacing:-.02em;margin:10px 0 14px}
.ux-page-head p,.ux-welcome>p{color:var(--txt2);max-width:580px;margin:0;line-height:1.6}
.ux-eyebrow{font-size:12px;letter-spacing:.12em;text-transform:uppercase;font-weight:750;color:var(--accent)}
.ux-welcome{max-width:780px;margin:12px auto 0}.ux-goals{display:grid;gap:12px;margin:26px 0 18px}
.ux-goal{width:100%;text-align:left;color:var(--txt);border:1px solid var(--line);border-radius:18px;background:var(--surface);padding:18px;display:flex;align-items:center;gap:16px;cursor:pointer;font:inherit;transition:border-color .15s,background .15s}
.ux-goal:hover,.ux-goal.selected{border-color:var(--accent);background:var(--accent-glow)}
.ux-goal>span:first-child{font-size:26px;min-width:32px}.ux-goal>span:nth-child(2){flex:1;min-width:0}.ux-goal b{font-size:16px;display:block}.ux-goal small{display:block;color:var(--txt2);margin-top:4px;font-size:12px}.ux-goal i{font-style:normal;color:var(--accent)}
.ux-footnote{font-size:12px!important;color:var(--txt3)!important;line-height:1.6;margin-top:16px!important}
.ux-home-head{display:flex;justify-content:space-between;align-items:center;gap:12px}.ux-home-head h1{font-size:32px}.ux-home-head .btn{flex-shrink:0}
.ux-bot-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr));gap:16px}
.ux-bot{margin:0;padding:20px;min-width:0}.ux-bot .bot-main{min-width:0}.ux-bot .bot-main>div:last-child{min-width:0}.ux-bot .bot-name{margin:0;font-size:19px;overflow-wrap:anywhere}
.ux-handle{font-size:12px;color:var(--txt3);text-decoration:none;overflow-wrap:anywhere}.ux-bot-scope{font-size:12px;color:var(--txt2);margin:16px 0;overflow-wrap:anywhere}
.ux-card-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}.ux-card-actions .btn{white-space:normal;min-height:46px;line-height:1.3;padding:10px;font-size:13px}
.ux-card-footer{display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--line);padding-top:14px;margin-top:16px;gap:10px}.ux-card-footer>span{font-size:12px;color:var(--txt3)}
.ux-activity{border:1px solid var(--line);border-radius:18px;margin-top:24px;background:var(--surface-soft)}.ux-activity>summary{padding:16px;font-size:13px;cursor:pointer;color:var(--txt2)}.ux-activity .hero{margin:0;border:0;background:none;box-shadow:none;padding:16px}.ux-activity .hero-copy>.hero-kicker,.ux-activity .hero-copy>.hero-title,.ux-activity .hero-copy>.hero-desc,.ux-activity .hero-copy>.text-help{display:none}
.ux-game-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,265px),1fr));gap:14px;margin:16px 0}.ux-game{border:1px solid var(--line);background:var(--surface);border-radius:18px;padding:20px;display:flex;flex-direction:column;align-items:flex-start;min-width:0}.ux-game-icon{font-size:27px}.ux-game h3{font-size:19px;margin:10px 0 8px}.ux-game p{font-size:13px;color:var(--txt2);line-height:1.55;margin:0 0 12px;flex:1}.ux-game small{color:var(--txt3);font-size:12px;margin-bottom:16px}.ux-game .btn{width:100%;min-height:42px}.ux-game-agent{max-width:440px}
.tabs{max-width:680px;grid-template-columns:repeat(4,minmax(0,1fr))}.tabs.admin{grid-template-columns:repeat(4,minmax(0,1fr))}.tabs .tab{font-size:12px;min-width:0;padding:12px 8px}.tabs.admin .tab{padding:12px 5px;font-size:12px}
#modal .sheet{display:flex;flex-direction:column;max-height:calc(var(--visible-height,100dvh) - var(--input-tools-height,0px) - 24px)}
#modal .sheet-body{flex:1;min-height:0;overflow-y:auto;padding-bottom:20px}
.ux-wizard-progress{display:flex;justify-content:space-between;align-items:center;padding:8px 20px;gap:8px;border-bottom:1px solid var(--line);font-size:12px;color:var(--accent);flex-shrink:0}
.ux-wizard-progress .btn{font-size:12px;padding:7px;background:none;border-color:transparent;min-height:36px;color:var(--txt3)}
.ux-wizard-footer{display:flex;gap:10px;padding:12px 20px max(12px,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--surface-strong);flex-shrink:0}.ux-wizard-footer>.btn{flex:1;min-height:46px}
.ux-wizard-goals h2{font-size:26px;line-height:1.2;margin:10px 0}.ux-wizard-goals .ux-goal{margin-top:12px;padding:16px}.ux-wizard-goals p{font-size:13px}
#modal [data-create-step="2"] .step-title{margin-top:0}#modal .step-title>div{min-width:0}
.ux-editor-nav{display:flex;gap:6px;padding:10px 16px;overflow-x:auto;border-bottom:1px solid var(--line);flex-shrink:0;scrollbar-width:none}
.ux-editor-nav button{font:inherit;font-size:12px;white-space:nowrap;padding:10px 12px;min-height:40px;border:1px solid transparent;background:var(--surface-soft);color:var(--txt2);border-radius:11px;cursor:pointer}.ux-editor-nav button.selected{background:var(--accent-glow);border-color:var(--accent);color:var(--txt)}
#editModal .sheet-body{padding-top:14px}.ux-editor-intro h2{font-size:21px;line-height:1.2;margin:6px 0 14px}.ux-dirty{font-size:12px;color:var(--txt3);margin:0;padding:6px 20px;text-align:center;border-top:1px solid var(--line);background:var(--surface-strong);flex-shrink:0}.edit-sticky-actions{border-top:0}
#ux-editor-game-back{margin-bottom:14px}#editModal .control-details[open]{margin-top:12px}
.ux-setup-name{font-weight:700;font-size:19px;margin:0 0 20px}.ux-setup-name span{display:block;font-weight:400;font-size:12px;color:var(--txt3)}
.ux-checklist{counter-reset:steps;padding:0;list-style:none;margin:0}.ux-checklist>li{counter-increment:steps;position:relative;padding:0 0 24px 36px}.ux-checklist>li:before{content:counter(steps);position:absolute;left:0;top:0;width:24px;height:24px;display:grid;place-items:center;border:1px solid var(--line2);border-radius:50%;font-size:12px;color:var(--txt2)}.ux-checklist>li.done:before{content:'✓';background:var(--accent);color:var(--on-accent);border:0}.ux-checklist b{display:block;font-size:15px}.ux-checklist span,.ux-checklist small{display:block;font-size:12px;color:var(--txt2);margin:6px 0 12px;line-height:1.5}.ux-checklist small{color:var(--txt3);font-size:12px}.ux-checklist .btn{white-space:normal;font-size:12px;min-height:40px}
.ux-party-intro{font-size:15px;line-height:1.5;padding:4px 0 12px}.ux-party-summary{font-size:12px;color:var(--txt2);padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--surface-soft);margin:12px 0}.ux-party-rules{margin:12px 0}.ux-party-empty{border:1px dashed var(--accent);padding:16px;border-radius:14px;margin:12px 0}.ux-party-empty p{font-size:13px;color:var(--txt2)}.ux-party-extra{margin:16px 0}.ux-party-extra>summary{cursor:pointer;padding:12px;border:1px solid var(--line);border-radius:12px;font-size:13px}.ux-party-extra>.details-body{padding:12px 0}
@media(min-width:760px){.ux-goals{grid-template-columns:1fr}.ux-welcome{padding:20px 30px}.ux-welcome h1{font-size:28px;font-weight:650}.ux-wizard-goals{max-width:570px;margin:auto}}
@media(max-width:600px){.wrap{padding:16px 14px 110px}.top-shell{display:flex!important;flex-direction:row!important;align-items:center}.top-actions{display:flex!important;flex:0 0 auto;width:auto!important;border:0;padding:0;background:none}.top-actions .create-trigger{display:none}.brand{font-size:19px}.brand-mark{width:29px;height:29px;flex-basis:29px}.brand-block .sub{font-size:12px;line-height:1.4;max-width:270px}.top{margin-bottom:26px}.ux-welcome h1{font-size:28px;font-weight:650}.ux-welcome>p{font-size:14px}.ux-goals{margin-top:22px;gap:10px}.ux-goal{padding:16px;gap:12px}.ux-home-head{align-items:flex-start}.ux-home-head h1{font-size:28px}.ux-home-head p{font-size:12px}.ux-home-head>.btn{max-width:108px;white-space:normal;font-size:12px}.ux-bot{padding:16px}.ux-bot .pill{font-size:12px}.ux-editor-nav{padding:8px 12px;gap:5px}.ux-editor-nav button{padding:9px 10px;font-size:12px}.ux-wizard-progress{padding:6px 16px}.ux-wizard-footer{padding:10px 16px max(10px,env(safe-area-inset-bottom))}.ux-game-grid{grid-template-columns:1fr}.ux-game{padding:18px}.ux-checklist>li{padding-left:32px}.tabs{bottom:max(10px,env(safe-area-inset-bottom))}}
@media(prefers-reduced-motion:reduce){.ux-goal{transition:none}}


/* Studio finish. Shared tokens and controls across every factory surface. */
body[data-theme]{background:var(--bg0);font-family:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;letter-spacing:0}
body[data-theme]:before,body[data-theme]:after{display:none}
.ux-icon{display:block;width:22px;height:22px;flex-shrink:0}
body[data-theme] .top-shell{background:none;border:0;box-shadow:none;backdrop-filter:none;padding:0}
.top{padding-bottom:22px;border-bottom:1px solid var(--line);margin-bottom:30px}
.brand-row{gap:10px}
body[data-theme] .brand{font-family:inherit;font-size:19px;font-weight:650;letter-spacing:-.02em;background:none;-webkit-text-fill-color:var(--txt);text-shadow:none}
body[data-theme] .brand-mark{width:44px;height:44px;flex-basis:44px;border:1px solid var(--line2);border-radius:11px;background:var(--accent-glow);color:var(--accent);display:grid;place-items:center;box-shadow:none}
.brand-mark:before,.brand-mark:after{display:none}.brand-mark .ux-icon{width:22px;height:22px}
.sub{color:var(--txt3);font-size:12px;line-height:1.5;margin-top:7px}
body[data-theme] .btn{font-family:inherit;font-weight:600;border-radius:11px;background:var(--accent);color:var(--on-accent);box-shadow:none;text-shadow:none;transition:background .16s,border-color .16s,transform .16s;animation:none}
body[data-theme] .btn:before{display:none}
body[data-theme] .btn.ghost,body[data-theme] .btn.dark,body[data-theme] .btn.icon{background:var(--surface-soft);color:var(--txt2);border-color:var(--line2);box-shadow:none}
body[data-theme] .btn.bad{background:var(--bad);color:#190708;border-color:transparent}
body[data-theme] .btn:disabled,body[data-theme] .btn.busy{background:var(--bg3);color:var(--txt3);border-color:var(--line);opacity:.6}
body[data-theme] .btn:not(:disabled):not(.busy):hover{filter:brightness(1.08)}
body[data-theme] .btn:active{transform:translateY(1px)}
body[data-theme] .sheet-close{width:36px;height:36px;min-height:36px;padding:0;border-radius:50%;border:1px solid var(--line);background:var(--surface-soft);font-size:24px;line-height:1;color:var(--txt2);flex-shrink:0}
body[data-theme] .top-actions .theme-trigger{width:40px;height:40px;min-height:40px;border-radius:12px;padding:0!important}
.ux-eyebrow{font-size:12px;letter-spacing:.13em;font-weight:650;color:var(--accent)}
.ux-welcome{max-width:720px;margin-top:0}
.ux-welcome h1{font-weight:650;letter-spacing:-.055em;line-height:1.08;margin:14px 0 16px}
.ux-welcome>p{color:var(--txt2);line-height:1.65;max-width:480px}
.ux-goals{gap:12px;margin:28px 0 20px}
.ux-goal{border-radius:16px;padding:19px 20px;gap:16px;background:var(--surface);border-color:var(--line);box-shadow:0 2px 3px #00000008}
.ux-goal>span:first-child{width:46px;height:46px;min-width:46px;display:grid;place-items:center;background:var(--accent-glow);color:var(--accent);border:1px solid color-mix(in srgb,var(--accent) 14%,transparent);border-radius:13px}
.ux-goal[data-goal="character"]>span:first-child{background:var(--accent-glow);color:var(--accent);border-color:var(--line)}
.ux-goal[data-goal="protect"]>span:first-child{background:var(--accent-glow);color:var(--accent);border-color:var(--line)}
.ux-goal .ux-icon{width:24px;height:24px}
.ux-goal b{font-size:15px;font-weight:600;letter-spacing:-.015em}.ux-goal small{font-size:12px;font-weight:400;line-height:1.45;color:var(--txt3);margin-top:5px}
.ux-goal i{font-size:20px;color:var(--txt3)}
.ux-goal.selected{box-shadow:0 0 0 1px var(--accent)}
.ux-footnote{max-width:540px;font-size:12px!important;line-height:1.7}
.ux-page-head h1{font-weight:650;letter-spacing:-.045em}.ux-home-head{margin-bottom:26px}
body[data-theme] .card,body[data-theme] .bot-card,body[data-theme] .stat{background:var(--surface);border:1px solid var(--line);border-radius:18px;box-shadow:0 4px 16px #00000008}
body[data-theme] .card:hover,body[data-theme] .bot-card:hover{border-color:var(--line2);box-shadow:0 4px 16px #00000008;transform:none}
.ux-bot .bot-name{font-size:18px;font-weight:600;letter-spacing:-.025em;line-height:1.3}
body[data-theme] .avatar{width:44px;height:44px;min-width:44px;border-radius:13px;background:var(--accent-glow);border:1px solid color-mix(in srgb,var(--accent) 16%,transparent);color:var(--accent);box-shadow:none}
.ux-handle{display:inline-block;margin-top:4px;font-size:12px}.ux-bot .pill{font-size:12px;padding:4px 8px;border-radius:7px;font-weight:500;white-space:normal;text-align:center}
.ux-bot .bot-head{gap:10px;align-items:flex-start}.ux-bot .bot-main{gap:12px}
.ux-bot-scope{line-height:1.5;margin:18px 0;color:var(--txt3)}
.ux-card-actions .btn{font-size:12px;font-weight:600;min-height:44px}
.ux-card-footer{padding-top:10px;margin-top:18px}.ux-card-footer>span{font-variant-numeric:tabular-nums}
.ux-activity{background:transparent;border-radius:14px}.ux-activity>summary{font-size:12px;padding:16px 18px}
.ux-game-grid{gap:16px;margin-top:22px}.ux-game{padding:16px;border-radius:18px;border-color:var(--line);overflow:hidden;background:var(--surface);--game-color:var(--accent)}
.ux-game[data-game-kind="letters"]{--game-color:#a6c5e9}.ux-game[data-game-kind="hunger"]{--game-color:#a7ccb0}.ux-game[data-game-kind="frontier"]{--game-color:#bcb0ea}.ux-game[data-game-kind="gavno"]{--game-color:#e4b3ad}
.ux-game-cover{width:100%;height:66px;border-radius:11px;position:relative;display:flex;align-items:center;justify-content:space-between;padding:20px;margin-bottom:7px;background:radial-gradient(circle at 88% 10%,color-mix(in srgb,var(--game-color) 12%,transparent),transparent 60%),color-mix(in srgb,var(--game-color) 5%,var(--bg1));border:1px solid color-mix(in srgb,var(--game-color) 9%,transparent);overflow:hidden;color:var(--game-color)}
.ux-game-cover:after{content:'';width:150px;height:150px;position:absolute;right:-35px;top:-56px;border:1px solid color-mix(in srgb,var(--game-color) 13%,transparent);border-radius:50%;box-shadow:0 0 0 18px color-mix(in srgb,var(--game-color) 3%,transparent),0 0 0 38px color-mix(in srgb,var(--game-color) 2%,transparent);pointer-events:none}
.ux-game-icon .ux-icon{width:42px;height:42px;stroke-width:1.2}.ux-game-type{align-self:flex-end;font-size:12px;font-weight:500;letter-spacing:.04em;z-index:1}
.ux-game h3{font-size:19px;font-weight:600;margin:10px 0 9px;letter-spacing:-.03em}.ux-game p{font-size:14px;line-height:1.65;color:var(--txt2);margin-bottom:14px}.ux-game small{font-size:12px;color:var(--txt3);margin-bottom:18px}
body[data-theme] .ux-game .btn{background:var(--surface-soft);border:1px solid var(--line2);color:var(--txt);min-height:42px;justify-content:space-between;padding:10px 14px;font-size:12px}
.ux-game .btn:after{content:'↗';font-size:17px;color:var(--game-color)}
body[data-theme] .tabs{background:var(--nav-bg);border:1px solid var(--line2);border-radius:18px;padding:6px;gap:4px;box-shadow:var(--shadow-md)}
body[data-theme] .tab{flex-direction:column;gap:5px;border-radius:12px;padding:8px 4px;min-height:54px;font-size:12px;font-weight:500;color:var(--txt3)}
body[data-theme] .tab:before{display:none}.tab .ux-icon{width:20px;height:20px}
body[data-theme] .tab.active{background:var(--accent-glow);border:1px solid transparent;color:var(--accent);box-shadow:none}
body[data-theme] .tab:hover{border-color:transparent;background:var(--surface-soft)}
body[data-theme] .tab.active:hover{background:var(--accent-glow)}
body[data-theme] .sheet{background:var(--surface-strong);border:1px solid var(--line2);box-shadow:0 24px 100px #0008;border-radius:22px 22px 0 0}
body[data-theme] .sheet-head{background:var(--surface-strong);padding:20px;border-color:var(--line);align-items:center}
.sheet-head b{font-size:17px;font-weight:600;letter-spacing:-.025em}.sheet-head .hint{font-size:12px;line-height:1.5;max-width:420px}
.sheet-body{padding:20px}
.ux-editor-nav{padding:10px 16px;gap:4px;border-color:var(--line)}
.ux-editor-nav button{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:9px 8px;font-size:12px;font-weight:500;border-radius:10px;background:transparent;min-width:54px;color:var(--txt3)}
.ux-editor-nav button .ux-icon{width:19px;height:19px}.ux-editor-nav button.selected{border-color:transparent;background:var(--accent-glow);color:var(--accent)}
#editModal .sheet-body{padding:20px}.ux-editor-intro h2{font-size:22px;font-weight:600;letter-spacing:-.02em}
body[data-theme] input:not([type="checkbox"]):not([type="range"]),body[data-theme] select,body[data-theme] textarea{background:var(--bg0);border:1px solid var(--line2);border-radius:10px;color:var(--txt);box-shadow:none;font-family:inherit;font-weight:400}
body[data-theme] input:focus,body[data-theme] select:focus,body[data-theme] textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow)}
body[data-theme] input::placeholder,body[data-theme] textarea::placeholder{color:var(--txt3);opacity:.8}
.label{font-size:14px;font-weight:500;letter-spacing:0}.label .field-help,.field-help{font-size:12px;line-height:1.55}
body[data-theme] .smart-details{border-color:var(--line);border-radius:13px;background:transparent;box-shadow:none}
.smart-details>summary{padding:15px;font-weight:500}.control-details>summary span{font-size:15px;font-weight:600}.control-details>summary small{font-size:12px;font-weight:400;color:var(--txt3)}
.details-body{padding:16px}.helper-note,.ready-note{background:var(--accent-glow);border:1px solid color-mix(in srgb,var(--accent) 12%,transparent);border-radius:12px;color:var(--txt2);font-size:12px;line-height:1.65;box-shadow:none}
body[data-theme] .switch{background:var(--surface-soft);border-color:var(--line);border-radius:12px}.switch b{font-size:13px;font-weight:500}.switch .hint{font-size:12px}
.ux-wizard-progress{padding:8px 20px;background:var(--surface-soft);font-size:12px}.ux-wizard-progress .btn{font-size:12px}
.ux-wizard-goals h2{font-size:28px;letter-spacing:-.04em;font-weight:600}.ux-wizard-goals .ux-goal{padding:16px}
.ux-dirty{font-size:12px;color:var(--txt3);padding:7px 16px;background:var(--surface-strong)}
body[data-theme] .edit-sticky-actions,body[data-theme] .ux-wizard-footer{background:var(--surface-strong);box-shadow:none;padding:12px 20px max(12px,env(safe-area-inset-bottom))}
.ux-checklist>li{padding-left:42px;padding-bottom:28px}.ux-checklist>li:before{width:28px;height:28px;background:var(--surface);font-size:12px;z-index:1}.ux-checklist>li:not(:last-child):after{content:'';position:absolute;left:14px;top:34px;bottom:7px;width:1px;background:var(--line2)}
.ux-checklist b{font-size:14px;font-weight:600}.ux-checklist span{font-size:12px;color:var(--txt2)}.ux-setup-name{font-size:22px;letter-spacing:-.02em}
.ux-party-intro{font-size:14px;font-weight:500}.ux-party-summary{border-color:var(--line);color:var(--txt2);background:var(--surface-soft);font-size:12px;line-height:1.6;padding:12px 14px}
.ux-party-extra>summary{padding:13px 14px;font-size:12px;font-weight:500;color:var(--txt2);background:var(--surface-soft)}
.ux-party-rules>summary{font-size:12px;color:var(--txt2);cursor:pointer;padding:8px 0}
.party-card{background:var(--surface);border-color:var(--line);border-radius:13px}.party-meta{color:var(--txt3);font-size:12px}.party-selected{outline-color:var(--accent);outline-width:1px}
body[data-theme] [data-party-action="preset"]{background:var(--surface-soft);color:var(--txt2);border:1px solid var(--line2);font-size:12px}
body[data-theme] [data-party-action="preset"].party-selected{background:var(--accent-glow);color:var(--accent);border-color:var(--accent)}
body[data-theme] :is(button,a,summary):focus-visible{outline:2px solid var(--accent);outline-offset:3px}
@media(min-width:760px){
 .wrap{padding-top:30px}.top{padding-bottom:24px;margin-bottom:36px}.ux-welcome{padding:22px 30px}.ux-welcome h1{font-size:28px;font-weight:650}.ux-goals{margin-top:32px}.ux-goal{padding:21px 24px}.ux-goal b{font-size:16px}
 body[data-theme] .modal .sheet{border-radius:22px}.ux-game-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr))}
}
@media(max-width:600px){
 .wrap{padding:20px 18px 112px}.top{margin-bottom:28px;padding-bottom:20px}.brand-block .sub{display:none}.ux-welcome h1{font-size:28px;font-weight:650}.ux-welcome>p{font-size:15px}
 .ux-goals{margin-top:24px;gap:10px}.ux-goal{padding:16px;gap:13px}.ux-goal>span:first-child{width:40px;height:40px;min-width:40px;border-radius:11px}.ux-goal small{font-size:12px}.ux-goal b{font-size:15px}.ux-goal i{font-size:18px}
 .ux-home-head h1{font-size:30px}.ux-bot{padding:18px}.ux-home-head>.btn{font-size:12px;max-width:100px}.ux-game{padding:16px}.ux-game-cover{height:66px}
 body[data-theme] .tabs.admin .tab{font-size:12px;padding:8px 2px}.ux-editor-nav{padding:8px 12px}.ux-editor-nav button{min-width:48px;padding:8px 5px;font-size:12px}
 body[data-theme] .sheet-head{padding:17px 18px}.sheet-body,#editModal .sheet-body{padding:18px}.ux-wizard-progress{padding:7px 18px}
}
@media(max-width:350px){.wrap{padding-left:14px;padding-right:14px}.brand-block .sub{max-width:220px}.ux-goal{gap:10px;padding:14px}.ux-goal b{font-size:15px}.ux-goal small{font-size:12px}.ux-welcome h1{font-size:28px;font-weight:650}.ux-bot .bot-head{flex-wrap:wrap}}
/* Keep keyboard layouts compact: these must win over the decorative spacing above. */
@media(max-height:460px){body[data-theme] .sheet-head{padding:6px 12px}}
@media(prefers-reduced-motion:reduce){body[data-theme] *,body[data-theme] *:before,body[data-theme] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
/* Final alignment pass; no decorative overlays in the compact header. */
.top-shell:before,.top-shell:after,.top:after{display:none}
.sub{margin-left:46px}.ux-bot .bot-main{display:flex;align-items:center}
#modal [data-create-step="2"],#modal [data-create-step="3"].form-section{border-top:0;margin-top:0;padding-top:0}
#modal .form-section+.form-section[data-create-step="3"]{margin-top:18px}
:is(#party-owner,#letters-owner) .party-actions:has([data-party-action="preset"]){gap:7px}
body[data-theme] :is(#party-owner,#letters-owner) .party-actions>[data-party-action="preset"]{min-width:0;flex:1 1 0;padding:10px 5px;font-size:12px;min-height:42px;white-space:nowrap}
@media(max-width:350px){.ux-bot .bot-main{align-items:flex-start}.ux-bot .bot-name{font-size:16px}}
body[data-theme] .top-actions .theme-trigger{width:40px!important;min-width:40px;flex:0 0 40px}

/* Activation: a small, real preview before connecting a Telegram bot. */
.ux-demo-entry{margin:16px 0}.ux-demo-entry .btn{font-size:12px;min-height:44px;white-space:normal;text-align:left}
.demo-dialogue{display:flex;flex-direction:column;gap:10px;margin:18px 0}.demo-bubble{max-width:95%;border:1px solid var(--line);border-radius:14px;padding:12px 14px;font-size:14px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.demo-bubble.user{align-self:flex-end;background:var(--accent-glow)}.demo-bubble.assistant{align-self:flex-start;background:var(--surface)}
#demoModal .sheet{max-width:600px}#demoModal textarea{min-height:84px}#demoModal .ux-wizard-footer{display:flex}#demo-quota{font-variant-numeric:tabular-nums}
.ux-cost{border:1px solid var(--line);background:var(--surface-soft);border-radius:12px;padding:12px 14px;margin:14px 0;font-size:12px;color:var(--txt2)}.ux-cost summary{cursor:pointer;font-weight:600}.ux-cost p{line-height:1.6;margin:12px 0 0}
.activation-counts{margin:16px 0}.activation-counts>div{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px solid var(--line)}.activation-counts dt{font-size:13px;color:var(--txt2)}.activation-counts dd{margin:0;font-size:20px;font-weight:600;font-variant-numeric:tabular-nums}

/* Public template feedback: earned in the demo, never an extra modal. */
.persona-rating{font-size:13px;font-weight:600;letter-spacing:.02em;padding:10px 0;color:var(--txt2);opacity:.85}
.demo-rating{margin:14px 0;padding:14px;border:1px solid var(--line);border-radius:16px;background:var(--surface-soft)}
.demo-rating p{margin:0 0 8px}.demo-rating p:last-child{margin-bottom:0}
.demo-rating-actions{display:flex;gap:10px;margin:12px 0}
.demo-rating-actions .btn{min-height:44px;min-width:76px;font-size:18px;display:inline-flex;gap:10px;align-items:center;justify-content:center}
body[data-theme] .demo-rating-actions .btn[aria-pressed="true"]{background:var(--accent);color:var(--on-accent);border-color:var(--accent);box-shadow:inset 0 0 0 2px currentColor}
.demo-rating [hidden]{display:none!important}

.persona-trial{margin:8px 0 14px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface-soft);min-width:0}
.persona-trial [hidden]{display:none!important}
.persona-trial .label{margin-top:0}.persona-trial textarea{min-height:76px;width:100%}
.persona-demo-starter>.btn{width:100%;min-height:44px}
.persona-demo-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13px;margin-bottom:10px}
.persona-demo-heading .btn{min-height:44px}
.persona-trial .demo-inline-body{padding:0;overflow:visible;flex:none}
.demo-inline-body>label:has(#demo-persona),.demo-inline-body>#demo-description{display:none}
.persona-trial .demo-bubble{max-width:100%;overflow-wrap:anywhere;font-size:13px}
.persona-trial .demo-rating{padding:10px}.persona-trial #demo-send{min-height:44px;width:100%}
.persona-card:has(.persona-demo-panel:not([hidden])){grid-column:1 / -1}


.persona-template-picker{display:grid;gap:12px;min-width:0;margin:18px 0}
.persona-template-picker>.label{margin:0;font-weight:600}.persona-template-picker>select{min-width:0;width:100%;max-width:100%;font-size:16px;margin:0;text-overflow:ellipsis}
.persona-template-picker>.btn{width:100%;min-height:48px;white-space:normal;line-height:1.4;padding:12px 16px}
.persona-template-picker>.field-help{margin:0;overflow-wrap:anywhere;line-height:1.5}
#e-template-select{padding-right:42px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' fill='none' stroke='%23b5c5bf' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;background-size:16px}

/* Quiet, compact agent cards; keep every action a 44px touch target. */
.ux-home-head{align-items:center;margin:12px 0 18px;gap:10px}
.ux-home-head h1{font-size:26px;line-height:1.2;margin:0;font-weight:600;letter-spacing:-.02em}
body[data-theme] .ux-home-head>.btn{min-height:44px;max-width:none;padding:8px 10px;white-space:nowrap;font-size:12px;font-weight:500;border-radius:10px;background:transparent;border-color:var(--line);color:var(--txt2);box-shadow:none}
.ux-bot-grid{gap:12px}
body[data-theme] .bot-card.ux-bot{padding:14px;margin:0;border-radius:14px;background:var(--surface);box-shadow:none;border-color:var(--line)}
body[data-theme] .bot-card.ux-bot:hover{box-shadow:none;transform:none}
.ux-bot::before,.ux-bot::after{display:none}
.ux-bot .bot-head{gap:8px;flex-wrap:nowrap;align-items:center}
.ux-bot .bot-main{gap:10px;align-items:center}
body[data-theme] .ux-bot .avatar{width:36px;height:36px;min-width:36px;border-radius:10px;font-size:12px}
.ux-bot .bot-name{font-size:17px;line-height:1.35;font-weight:600;white-space:normal;overflow-wrap:anywhere}
.ux-bot .ux-handle{font-size:12px;margin-top:2px}

.ux-bot-scope{font-size:12px;line-height:1.45;margin:10px 0 0}
.ux-bot .ux-card-actions{gap:8px;margin:12px 0}
body[data-theme] .ux-bot .ux-card-actions .btn{min-height:44px;padding:8px;font-size:12px;font-weight:500;line-height:1.25;border-radius:10px;background:transparent;color:var(--txt2);border-color:var(--line);box-shadow:none;text-shadow:none}
body[data-theme] .ux-bot .ux-card-actions .ux-game-action{background:color-mix(in srgb,var(--accent) 7%,transparent);color:var(--accent);border-color:color-mix(in srgb,var(--accent) 18%,transparent)}
.ux-bot .btn::before{display:none}
.ux-bot .mp-usage{margin:0}
.ux-bot .mp-usage-label{display:none}
.ux-bot .mp-usage-label b{font-size:12px;font-weight:500}
body[data-theme] .ux-bot .mp-usage .usage{height:4px;margin:6px 0}
.ux-bot .usage-bar{box-shadow:none}
.ux-bot .mp-usage-caption{display:none}
.ux-bot .mp-usage-caption>span:first-child{display:none}
.ux-bot .ux-card-footer{border:0;margin:2px 0 -4px;padding:0;min-height:44px}
.ux-bot .ux-card-footer .btn{min-height:44px;min-width:100px;font-weight:600;font-size:14px;padding:10px 18px;background:var(--accent)!important;color:var(--on-accent)!important;border:0!important}
.ux-bot .ux-card-footer>span{font-size:12px;color:var(--txt2)}
@media(max-width:350px){.ux-home-head h1{font-size:23px}.ux-home-head>.btn{font-size:12px!important}.ux-bot .bot-name{font-size:16px}.ux-bot .pill{max-width:70px}}

/* Navigation and cards: a single primary action; mobile sections use native selection. */
.ux-bot-status{font-size:13px;color:var(--txt2);margin:10px 0 14px;overflow-wrap:anywhere}.ux-bot-status.needs-attention{color:var(--bad)}
body[data-theme] .ux-bot .err-text{font-size:13px;color:var(--bad)}
body[data-theme] .ux-editor-nav button{font-size:13px;min-height:44px;flex-direction:row;gap:8px;white-space:nowrap}
.ux-editor-intro h2{font-size:18px;margin:0 0 12px}.ux-editor-intro .ux-card-actions{grid-template-columns:1fr;margin-bottom:22px}
.ux-more-list{display:grid;gap:0;border:1px solid var(--line);border-radius:16px;background:var(--surface);overflow:hidden;max-width:680px}
.ux-more-list>:is(button,a){display:flex;align-items:center;justify-content:space-between;gap:16px;text-align:left;padding:20px;border:0;border-bottom:1px solid var(--line);background:transparent;color:var(--txt);font:inherit;cursor:pointer;min-height:72px}
.ux-more-list>:is(button,a):last-child{border-bottom:0}.ux-more-list>:is(button,a):hover{background:var(--surface-soft)}.ux-more-list b{display:block;font-size:15px;font-weight:600}.ux-more-list small{display:block;margin-top:4px;color:var(--txt2);font-size:13px}
.ux-demo-entry .btn{background:transparent!important;border:0!important;padding:8px 0;color:var(--accent)!important;font-weight:500}
body[data-theme] .smart-details>.details-body{padding:16px 0}
/* A disclosure remains a complete card: no edge-to-edge text or cut-off borders. */
body[data-theme] .control-details{border:1px solid var(--line);border-radius:14px;min-width:0}
body[data-theme] .control-details>summary{padding:14px 16px;grid-template-columns:minmax(0,1fr) 16px;column-gap:12px;row-gap:4px;min-width:0}
body[data-theme] .control-details>summary>span{grid-column:1;grid-row:1;min-width:0;line-height:1.4;overflow-wrap:anywhere}
body[data-theme] .control-details>summary>small{grid-column:1;grid-row:2;text-align:left;max-width:none;min-width:0;line-height:1.45;overflow-wrap:anywhere}
body[data-theme] .control-details>summary:after{grid-column:2;grid-row:1 / span 2;align-self:center}
body[data-theme] .control-details>.details-body{padding:16px}
body[data-theme] .helper-note{background:var(--surface-soft);color:var(--txt2);border-color:var(--line)}
body[data-theme] input:not([type=checkbox]):not([type=range]),body[data-theme] textarea,body[data-theme] select{font-size:16px;line-height:1.5}
body[data-theme] .btn{min-height:44px;font-size:14px}
body[data-theme] .sheet-close{min-height:44px;min-width:44px;font-size:24px}
body[data-theme] .tab{font-size:12px;min-height:54px}body[data-theme] .tabs{animation:none}
body[data-theme] .sheet-head .hint{display:none}
body[data-theme] .toast{background:var(--surface);color:var(--txt);box-shadow:var(--shadow-md)}
body[data-theme] .card:after,body[data-theme] .bot-card:after,body[data-theme] .stat:after{display:none}
body[data-theme] .ux-game{--game-color:var(--accent)}
body[data-theme] .ux-home-head>.btn{font-size:13px}
@media(max-width:759px){.ux-welcome h1{font-size:28px;font-weight:650}.ux-home-head h1{font-size:26px}}

body[data-theme] .smart-details:is(.ux-character-tuning,.ux-introduction)>.details-body{padding:16px}
.ux-character-tuning>.details-body>.hint,.ux-introduction>.details-body>.hint{margin:0 0 12px}

/* A quiet, aligned secondary route below the two setup actions. */
.ux-setup-settings{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:44px;margin:0;padding:10px 16px;border:0;border-radius:10px;background:transparent;color:var(--txt2);font:inherit;font-size:14px;font-weight:500;line-height:1.4;cursor:pointer;box-sizing:border-box}
.ux-setup-settings:hover{background:var(--surface-soft);color:var(--txt)}
.ux-setup-settings:active{background:var(--accent-glow)}

/* Visible editor tabs at every width; one stable row, independently scrollable. */
body[data-theme] .ux-editor-nav{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;gap:6px;padding:10px 12px;max-width:100%;box-sizing:border-box;scroll-padding-inline:12px;overscroll-behavior-x:contain;touch-action:pan-x;-webkit-overflow-scrolling:touch}
body[data-theme] .ux-editor-nav button{flex:0 0 auto;min-width:max-content;min-height:44px;padding:10px 12px;font-size:14px;line-height:1.3;gap:7px}
body[data-theme] .ux-editor-nav button.selected{background:var(--accent-glow);color:var(--accent);border-color:color-mix(in srgb,var(--accent) 25%,transparent)}
.ux-editor-nav button .ux-icon{flex-shrink:0}

/* Destructive action stays separate from opening/configuring an agent. */
.ux-bot .bot-head{align-items:flex-start;gap:8px}
.ux-bot .bot-main{min-width:0;flex:1}
.ux-bot .bot-name{overflow-wrap:anywhere}
.ux-delete-agent{flex:0 0 44px;width:44px;height:44px;display:grid;place-items:center;border:0;border-radius:12px;background:transparent;color:var(--txt3);cursor:pointer}
.ux-delete-agent:hover,.ux-delete-agent:focus-visible{color:var(--bad);background:var(--surface-soft)}
.ux-delete-agent:focus-visible{outline:2px solid var(--bad);outline-offset:2px}
.ux-delete-agent .ux-icon{width:21px;height:21px}
.ux-delete-dialog{width:min(460px,calc(100vw - 24px));box-sizing:border-box}
.ux-delete-dialog header h2{font-size:20px;overflow-wrap:anywhere}
.ux-delete-dialog .cx-dialog-body{line-height:1.55;overflow-wrap:anywhere}
.ux-delete-dialog ul{padding-left:22px;display:grid;gap:10px}
.ux-delete-dialog footer{display:grid;grid-template-columns:1fr;gap:10px}
.ux-delete-dialog footer .btn{width:100%;min-height:48px;white-space:normal;text-align:center}
.ux-delete-dialog .ux-delete-confirm{background:#b52d43;color:#fff;border:1px solid #b52d43;text-shadow:none}
.ux-delete-dialog .ux-delete-confirm:hover{background:#972238}
.ux-delete-error{color:var(--bad)}
body[data-theme] dialog.ux-delete-dialog>footer{display:grid;grid-template-columns:1fr;gap:10px}
body[data-theme] dialog.ux-delete-dialog .ux-delete-confirm{background:#b52d43;color:#fff;border-color:#b52d43}
body[data-theme] dialog.ux-delete-dialog .ux-delete-confirm:disabled{background:var(--bg3);color:var(--txt3);border-color:var(--line)}

/* Primary navigation: agents, games, news, exchange, more. */
body[data-theme] .tabs{grid-template-columns:repeat(5,minmax(0,1fr))}
body[data-theme] .tabs .tab{padding:8px 1px;min-width:0}
body[data-theme] .tabs .tab>span{white-space:nowrap}
@media(max-width:380px){body[data-theme] .tabs{left:8px;right:8px;padding:4px;gap:2px}}

/* Keep the theme control on the shared right edge of the page. */
body[data-theme] .top-actions{margin-left:auto;align-self:flex-start;padding:0;border:0;background:none;box-shadow:none}
body[data-theme] .top-actions .theme-trigger{order:1;width:44px!important;min-width:44px;height:44px;min-height:44px;flex:0 0 44px}
body[data-theme] .top-shell{border-radius:0}

/* Equal header anchors; title centered between them on compact screens. */
body[data-theme] .top-shell .brand-mark,body[data-theme] .top-shell .theme-trigger{box-sizing:border-box;border-radius:12px;padding:0!important}
@media(max-width:600px){
 body[data-theme] .top-shell{gap:12px}
 body[data-theme] .brand-block{flex:1;min-width:0}
 body[data-theme] .brand-row{gap:12px}
 body[data-theme] .brand{flex:1;min-width:0;text-align:center;white-space:nowrap}
}

/* A capability overview, not a choice of mutually exclusive bot roles. */
.ux-agent-capabilities{margin:0 0 24px}
.ux-agent-capabilities h2{font-size:22px;line-height:1.3;margin:0 0 16px}
.ux-agent-capabilities ul{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 12px;list-style:none;padding:0;margin:0}
.ux-agent-capabilities li{display:flex;align-items:flex-start;gap:9px;min-width:0}
.ux-agent-capabilities .ux-icon{width:20px;height:20px;color:var(--accent);margin-top:1px}
.ux-agent-capabilities li span{min-width:0}
.ux-agent-capabilities b{display:block;font-size:13px;line-height:1.4;font-weight:600}
.ux-agent-capabilities small{display:block;font-size:11px;line-height:1.5;color:var(--txt3);margin-top:3px}
.ux-agent-capabilities p{font-size:12px;line-height:1.5;color:var(--txt3);margin:16px 0 0;padding-bottom:20px;border-bottom:1px solid var(--line)}

#demoModal .demo-intro{font-size:13px;line-height:1.45;color:var(--txt2);margin-top:6px;max-width:430px}body[data-theme] #demoModal .sheet-head .demo-intro{display:block}
#demo-complete[hidden],#demo-rating[hidden],#demo-form[hidden]{display:none!important}.demo-complete h3{margin-top:0}.demo-complete .party-actions{display:flex;flex-wrap:wrap;gap:10px}.demo-complete .btn{flex:1 1 150px}

.editor-save-status{margin:0;padding:10px 20px;font-size:13px;line-height:1.45;overflow-wrap:anywhere}.editor-save-status[hidden]{display:none!important}

#feedbackModal [hidden]{display:none!important}#feedback-history{margin-top:24px;border-top:1px solid var(--line);padding-top:12px}#feedback-history-list{font-size:13px;color:var(--txt2)}#feedbackModal textarea{width:100%;box-sizing:border-box}#feedback-number{font-size:20px;font-weight:700}

/* The canonical factory remains reachable from every tab and child-bot entry. */
.brand[data-factory-home]{color:inherit;text-decoration:none}
[data-factory-home]:focus-visible{outline:2px solid var(--accent);outline-offset:4px}
.ux-more-list>a{text-decoration:none}
.factory-origin{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;margin:-8px 0 20px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;font-size:13px;line-height:1.45;color:var(--txt2);background:var(--surface)}
.factory-origin[hidden]{display:none!important}
.factory-origin a{color:var(--accent);font-weight:600;white-space:nowrap}

.factory-referral-link{display:inline;border:0;background:none;padding:0;min-height:0;color:var(--accent);font:inherit;font-weight:600;text-decoration:underline;cursor:pointer}
.factory-referral-link:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
#info-referrals{scroll-margin-top:20px}

/* Personal assistant: one scenario, progressive access controls. */
.personal-controls{display:grid;gap:12px;min-width:0}.personal-controls [hidden]{display:none!important}.personal-controls .label{margin:0 0 12px}.personal-controls select,.personal-controls textarea,.personal-controls input{width:100%;min-width:0;box-sizing:border-box}.personal-limits,.personal-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.personal-actions{margin:0 0 16px}.personal-actions .btn{display:flex;align-items:center;justify-content:center;text-align:center;min-height:48px;white-space:normal}.personal-controls .hint{font-size:13px;line-height:1.5}.ux-editor-nav [hidden]{display:none!important}
@media(max-width:350px){.personal-actions{grid-template-columns:1fr}}

.personal-group-tools{padding:10px 0;border:0;background:none;color:var(--muted,#a9abb9);font:inherit;font-size:13px;text-align:left;cursor:pointer}.personal-group-tools[hidden],.ux-editor-intro[hidden]{display:none!important}.personal-actions>a:nth-child(3){grid-column:1/-1}

/* Scenario form: native iOS menus never contain compatibility-only options. */
.personal-scenario-host{margin:0 0 22px}
.personal-controls{gap:16px}.personal-scenario{display:grid;gap:10px}.personal-caption{color:var(--txt2);font-size:14px;line-height:1.4}
.personal-mode-switch{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding:4px;border:1px solid var(--line);border-radius:14px;background:var(--bg0);gap:4px}
.personal-mode-switch button{min-height:52px;padding:8px;line-height:1.3;border:0;border-radius:10px;background:transparent;color:var(--txt2);font:inherit;font-size:15px;font-weight:600;cursor:pointer;box-shadow:none}
.personal-mode-switch button[aria-pressed=true]{background:var(--accent);color:var(--btn-text,#15182a)}
.personal-controls .label{display:block;margin:0;color:var(--txt2);font-size:14px;line-height:1.45}
.personal-controls [data-personal-extra]{display:grid;gap:16px}
.personal-controls .hint{margin:0;padding:0;border:0;line-height:1.5;color:var(--txt3);font-size:12px}
body[data-theme] .personal-options{margin:0;border:1px solid var(--line);border-radius:14px;overflow:hidden}
body[data-theme] .personal-options>summary{padding:14px 16px;font-size:14px}
body[data-theme] .personal-options>.details-body{display:grid;gap:14px;padding:16px;border:0}
.personal-controls [data-guest-controls]{display:grid;gap:10px}
.personal-controls textarea{min-height:76px;height:76px;resize:vertical}
.personal-controls .personal-limits{gap:12px}.personal-limits .label{font-size:12px}
/* Floating help cards are not bottom sheets: keep all four corners rounded. */
body[data-theme] .modal:is(.info-modal,.theme-modal) .sheet{border-radius:22px;overflow:hidden}

/* More: one aligned menu without a redundant page heading. */
#morePanel{width:100%;max-width:680px;margin-inline:auto}
#morePanel .ux-more-list{width:100%}
#morePanel .ux-more-list>:is(button,a)>span:first-child{min-width:0}
#morePanel .ux-more-list>:is(button,a)>span[aria-hidden]{flex:0 0 20px;text-align:center}
#morePanel .ux-more-list>:is(button,a):has(+[hidden]:last-child){border-bottom:0}

/* Promo action matches the adjacent 44px theme control; no crowded emoji. */
body[data-theme] #promoStoryTrigger{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:44px;min-width:44px;height:44px;min-height:44px;flex:0 0 44px;padding:0;gap:0;border-radius:12px;font-size:18px;line-height:1;font-weight:800;letter-spacing:0;font-variant-numeric:tabular-nums}
body[data-theme="bubble"] #promoStoryTrigger{border-radius:50%}
body[data-theme] .top-actions{align-self:center}
