:root{--bg:#f6f8fc;--card:#fff;--text:#172033;--muted:#68748a;--line:#dfe5ef;--blue:#2563eb;--blue2:#eaf1ff;--shadow:0 14px 40px rgba(25,42,78,.09);--label-band:78px;font-family:Inter,system-ui,-apple-system,Segoe UI,Arial,sans-serif;color:var(--text)}
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);line-height:1.55}button,input,select{font:inherit}.container{width:min(1220px,calc(100% - 32px));margin:auto}.header{position:sticky;top:0;z-index:20;background:rgba(255,255,255,.9);backdrop-filter:blur(16px);border-bottom:1px solid var(--line)}.header__inner{height:68px;display:flex;align-items:center;justify-content:space-between}.brand{font-size:21px;font-weight:850;color:var(--text);text-decoration:none}.brand span{display:inline-grid;place-items:center;width:34px;height:34px;background:var(--blue);color:#fff;border-radius:10px}.header nav{display:flex;gap:24px}.header nav a{color:var(--muted);text-decoration:none}.hero{padding:72px 0 58px;background:radial-gradient(circle at 80% 10%,#dbeafe,transparent 35%),linear-gradient(#fff,var(--bg))}.hero__grid{display:grid;grid-template-columns:1.25fr .75fr;gap:60px;align-items:center}.eyebrow{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.1em;color:var(--blue)}h1{font-size:clamp(40px,6vw,68px);line-height:1.02;letter-spacing:-.045em;margin:14px 0 22px;max-width:850px}h2{font-size:clamp(30px,4vw,44px);line-height:1.1;margin:8px 0}.hero p{font-size:20px;color:var(--muted);max-width:720px}.actions{display:flex;gap:10px;flex-wrap:wrap}.btn{border:0;border-radius:12px;padding:11px 16px;font-weight:750;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}.primary{background:var(--blue);color:#fff}.secondary{background:var(--blue2);color:#1747a6}.ghost{background:#fff;color:var(--muted);border:1px solid var(--line)}.hero-art{height:320px;position:relative;border-radius:30px;background:linear-gradient(140deg,#fff,#eaf1ff);box-shadow:var(--shadow);overflow:hidden}.hero-art:before{content:"";position:absolute;left:35px;bottom:25px;width:4px;height:250px;background:repeating-linear-gradient(to bottom,#9fb2d3 0 2px,transparent 2px 20px)}.hero-art i,.hero-art b,.hero-art em{position:absolute;bottom:25px;width:68px;border-radius:40px 40px 16px 16px;background:#2563eb}.hero-art i{height:220px;left:105px}.hero-art b{height:175px;left:190px;background:#ef5b5b}.hero-art em{height:120px;left:275px;background:#14a36d}.app{padding:64px 0}.section-title,.panel-head,.workspace-head{display:flex;align-items:center;justify-content:space-between;gap:20px}.layout{display:grid;grid-template-columns:330px minmax(0,1fr);gap:22px;margin-top:26px}.sidebar{display:grid;gap:16px;align-content:start}.panel,.workspace,.result{background:var(--card);border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow)}.panel{padding:18px}.panel h3,.result h3{margin:0 0 14px}.panel output{background:var(--blue2);color:var(--blue);padding:4px 9px;border-radius:999px;font-size:13px}.editors{display:grid;gap:12px}.editor{padding:13px;border:1px solid var(--line);border-radius:14px;background:#fbfcff}.editor-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.remove{border:0;background:#feecec;color:#b42318;width:30px;height:30px;border-radius:9px;cursor:pointer}.editor-grid{display:grid;grid-template-columns:1fr 90px;gap:9px}.field{display:grid;gap:6px;margin-top:12px}.field span{font-size:13px;font-weight:700;color:var(--muted)}input,select{width:100%;border:1px solid #ccd5e3;border-radius:10px;padding:9px;background:#fff}.check{display:flex;align-items:center;gap:9px;margin-top:14px}.check input{width:auto}.presets{display:grid;grid-template-columns:1fr 1fr;gap:8px}.preset{border:1px solid var(--line);background:#fff;border-radius:11px;padding:10px;cursor:pointer}.workspace{padding:18px;min-width:0}.workspace-head{margin-bottom:14px}.workspace-head>div:first-child{display:grid}.workspace-head span{color:var(--muted);font-size:13px}
.scene-card{display:grid;grid-template-columns:58px minmax(0,1fr);height:580px;border:1px solid var(--line);border-radius:16px;overflow:hidden;background:#fcfdff}.scale{position:relative;background:#f7f9fd;border-right:1px solid var(--line)}.tick{position:absolute;right:8px;font-size:11px;color:var(--muted);transform:translateY(50%)}.tick:after{content:"";position:absolute;right:-9px;top:50%;width:7px;border-top:1px solid #aebbd0}.scene{position:relative;overflow-x:auto;overflow-y:hidden}.grid-lines{position:absolute;inset:0;pointer-events:none}.grid-lines[hidden]{display:none}.grid-line{position:absolute;left:0;right:0;border-top:1px solid rgba(103,123,157,.14)}.ground{position:absolute;z-index:2;left:0;right:0;bottom:var(--label-band);border-top:2px solid #7d8da7}.figures{position:absolute;z-index:3;left:26px;right:26px;top:18px;bottom:var(--label-band);display:flex;align-items:stretch;justify-content:center;gap:24px;min-width:max-content;overflow:visible}.figures.compact{gap:4px}.figure{width:112px;height:100%;display:flex;align-items:flex-end;justify-content:center;position:relative;flex:0 0 112px}.shape-wrap{width:108px;max-height:100%;display:flex;align-items:flex-end;justify-content:center;position:relative;overflow:visible}.shape-host{display:block;width:100%;height:100%;overflow:visible;pointer-events:none;line-height:0}.shape-svg{display:block;width:100%;height:100%;max-width:none;overflow:visible;transform-origin:center bottom}.shape-missing{display:grid;place-items:center;width:78px;height:100%;min-height:52px;border:1px dashed #c7d2e4;border-radius:12px;color:#8a96aa;font-size:11px;text-align:center;background:#f7f9fd}.shape-missing[hidden]{display:none}.label{position:absolute;top:calc(100% + 10px);left:50%;transform:translateX(-50%);width:112px;text-align:center;line-height:1.25}.label strong,.label span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.label strong{font-size:14px;color:var(--text)}.label span{font-size:12px;color:var(--muted);margin-top:3px}.empty{position:absolute;z-index:4;inset:0 0 var(--label-band) 0;display:grid;place-content:center;text-align:center;color:var(--muted);background:rgba(252,253,255,.94)}.empty[hidden]{display:none!important}.empty>div{font-size:46px}.empty h3{color:var(--text);margin:8px}.empty p{margin:0 0 16px}
.results{display:grid;grid-template-columns:2fr repeat(4,1fr);gap:12px;margin-top:14px}.result{padding:16px}.summary{grid-row:span 1}.summary p{margin:6px 0}.stat{display:grid;align-content:center}.stat span{font-size:12px;color:var(--muted)}.stat strong{font-size:21px}.content{padding:70px 0}.content.alt{background:#fff}.features{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:26px}.features article{background:#fff;padding:22px;border:1px solid var(--line);border-radius:16px}.features b{font-size:20px}.features p{color:var(--muted)}details{background:var(--bg);padding:16px;border-radius:12px;margin-top:10px}summary{font-weight:800;cursor:pointer}footer{padding:28px 0;color:var(--muted)}.toast{position:fixed;right:20px;bottom:20px;background:#172033;color:#fff;padding:12px 16px;border-radius:12px;opacity:0;transform:translateY(10px);pointer-events:none;transition:.2s}.toast.show{opacity:1;transform:none}@media(max-width:980px){.hero__grid{grid-template-columns:1fr}.hero-art{display:none}.layout{grid-template-columns:1fr}.results{grid-template-columns:repeat(2,1fr)}.summary{grid-column:1/-1}.scene-card{height:520px}}@media(max-width:640px){:root{--label-band:72px}.header nav{display:none}.section-title,.workspace-head{align-items:flex-start;flex-direction:column}.layout{margin-top:18px}.scene-card{grid-template-columns:45px 1fr;height:480px}.features{grid-template-columns:1fr}.results{grid-template-columns:1fr}.hero{padding-top:44px}h1{font-size:42px}.figure{width:92px;flex-basis:92px}.shape-wrap{width:88px}.label{width:88px}.label strong{font-size:12px}}

.skip-link{position:fixed;left:12px;top:12px;z-index:100;transform:translateY(-160%);background:#172033;color:#fff;padding:10px 14px;border-radius:10px}.skip-link:focus{transform:none}.privacy-note,.section-lead{font-size:14px!important;color:var(--muted);max-width:760px}.section-lead{margin:8px 0 0}.field small{font-size:11px;color:var(--muted);line-height:1.35}.input-row{display:grid;grid-template-columns:minmax(0,1fr) 88px;gap:8px;align-items:center}.height-range{padding:0;accent-color:var(--blue);min-height:40px}.field-error{min-height:16px;color:#b42318;font-size:11px;line-height:1.3}.field.invalid input{border-color:#d92d20;box-shadow:0 0 0 3px rgba(217,45,32,.1)}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid rgba(37,99,235,.3);outline-offset:2px}.prose-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(260px,.7fr);gap:28px;align-items:start}.prose-grid p,.narrow p{color:var(--muted)}.formula,.example-card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:20px}.formula{display:grid;gap:8px;margin:24px 0}.formula code{white-space:normal;font-size:16px;color:#1747a6;background:var(--blue2);padding:12px;border-radius:10px}.example-card{box-shadow:var(--shadow)}.example-card h3{margin-top:0}.narrow{max-width:900px}.footer-inner{display:flex;justify-content:space-between;gap:20px}.footer-inner a{color:var(--blue)}.noscript{position:fixed;inset:auto 16px 16px;background:#7a271a;color:#fff;padding:14px;border-radius:12px;z-index:100}.editor input[type=number]{font-variant-numeric:tabular-nums}.result strong{font-variant-numeric:tabular-nums}
@media(max-width:760px){.prose-grid{grid-template-columns:1fr}.input-row{grid-template-columns:1fr 84px}.workspace-head .actions{width:100%}.workspace-head .actions .btn{flex:1 1 140px}.footer-inner{flex-direction:column}.section-title .actions{width:100%}.section-title .actions .btn{flex:1 1 130px}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}*,*:before,*:after{transition:none!important;animation:none!important}}

.hub-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-top:26px}.hub-card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:22px;box-shadow:var(--shadow)}.hub-card h3{margin:0 0 10px;font-size:22px}.hub-card p{color:var(--muted);margin:0 0 18px}.hub-card a{font-weight:800;color:var(--blue);text-decoration:none}.breadcrumb{display:flex;gap:8px;flex-wrap:wrap;font-size:14px;color:var(--muted);margin-bottom:18px}.breadcrumb a{color:var(--blue)}.article-hero{padding:54px 0 32px;background:linear-gradient(#fff,var(--bg))}.article-hero h1{font-size:clamp(38px,5vw,58px)}.article-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:28px;align-items:start}.article-body{background:#fff;border:1px solid var(--line);border-radius:18px;padding:clamp(22px,4vw,42px);box-shadow:var(--shadow)}.article-body h2{font-size:30px;margin-top:42px}.article-body h2:first-child{margin-top:0}.article-body h3{font-size:21px;margin-top:28px}.article-body p,.article-body li{color:#4f5d73}.article-body ul,.article-body ol{padding-left:22px}.article-body li+li{margin-top:8px}.side-card{position:sticky;top:88px;background:#fff;border:1px solid var(--line);border-radius:18px;padding:20px;box-shadow:var(--shadow)}.side-card h2{font-size:22px;margin-top:0}.side-card p{color:var(--muted)}.mini-example{background:var(--blue2);border-radius:14px;padding:18px;margin:22px 0}.mini-example strong{display:block;font-size:20px;margin-bottom:5px}.note-box{border-left:4px solid var(--blue);background:#f7f9ff;padding:16px 18px;border-radius:0 12px 12px 0;margin:22px 0}.related-links{display:grid;gap:10px}.related-links a{color:var(--blue);font-weight:700}.article-footer-cta{margin-top:36px;padding:24px;border-radius:16px;background:#172033;color:#fff}.article-footer-cta p{color:#d6deeb}.article-footer-cta .btn{background:#fff;color:#172033}@media(max-width:900px){.hub-grid{grid-template-columns:1fr}.article-layout{grid-template-columns:1fr}.side-card{position:static}}


/* Mobile-first workspace flow: scene before participant cards. Desktop layout is unchanged. */
.mobile-add-btn,.mobile-manage-actions{display:none}
@media(max-width:980px){
  .section-title>.actions{display:none}
  .layout{display:flex;flex-direction:column}
  .workspace{order:1;display:flex;flex-direction:column}
  .sidebar{order:2}
  .mobile-add-btn{display:inline-flex;order:1;width:100%;min-height:50px;margin:0 0 14px}
  .workspace-head{display:contents}
  .workspace-head>div:first-child{order:0;margin-bottom:12px}
  .workspace-head>.actions{order:4;margin-top:14px;width:100%}
  .workspace-head>.actions .btn{flex:1 1 140px}
  .scene-card{order:2}
  .results{order:3}
  .mobile-manage-actions{display:flex;order:5;gap:10px;margin-top:14px}
  .mobile-manage-actions .btn{flex:1 1 0;min-height:46px}
  .sidebar>.panel:first-child{order:0}
  .sidebar>.panel:nth-child(2){order:1}
  .sidebar>.panel:nth-child(3){order:2}
}
@media(max-width:640px){
  .workspace{padding:14px}
  .workspace-head>.actions{display:grid;grid-template-columns:1fr 1fr}
  .workspace-head>.actions .btn:last-child{grid-column:1/-1}
  .editor{padding:14px}
  .editor-grid{grid-template-columns:1fr}
  .input-row{grid-template-columns:minmax(0,1fr) 86px}
}

/* Mobile participant controls and modal editor. Desktop workspace stays unchanged. */
.mobile-participant-actions{display:none}
.participant-modal[hidden]{display:none}
.participant-modal{position:fixed;inset:0;z-index:1000;display:grid;align-items:end}
.participant-modal__backdrop{position:absolute;inset:0;background:rgba(15,23,42,.52);backdrop-filter:blur(3px)}
.participant-modal__panel{position:relative;z-index:1;width:min(680px,100%);max-height:min(86dvh,760px);margin:0 auto;background:#fff;border-radius:22px 22px 0 0;box-shadow:0 -18px 60px rgba(15,23,42,.24);display:flex;flex-direction:column;overflow:hidden}
.participant-modal__head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 18px 12px;border-bottom:1px solid var(--line)}
.participant-modal__head h2{font-size:24px;margin:0}
.participant-modal__close{width:42px;height:42px;border:0;border-radius:12px;background:var(--bg);color:var(--text);font-size:28px;line-height:1;cursor:pointer}
.participant-modal__body{padding:16px 18px calc(18px + env(safe-area-inset-bottom));overflow:auto;overscroll-behavior:contain}
.modal-form{display:grid;gap:14px}
.modal-form .field{margin:0}
.modal-form__actions{display:flex;gap:10px;margin-top:4px}
.modal-form__actions .btn{flex:1;min-height:48px}
.modal-edit-list{display:grid;gap:12px}
.modal-editor{border:1px solid var(--line);border-radius:16px;padding:14px;background:#fbfcff}
.modal-editor__head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.modal-editor__head strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.modal-editor__grid{display:grid;grid-template-columns:minmax(0,1fr) 92px;gap:10px}
.modal-editor__grid .field{margin-top:8px}
.modal-editor__grid .wide{grid-column:1/-1}
.modal-editor__remove{border:0;background:#feecec;color:#b42318;border-radius:10px;padding:8px 12px;font-weight:750;cursor:pointer}
.modal-empty{padding:26px 10px;text-align:center;color:var(--muted)}
body.modal-open{overflow:hidden;touch-action:none}

@media(max-width:980px){
  .mobile-add-btn{display:none!important}
  .mobile-participant-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;order:1;margin:0 0 14px}
  .mobile-participant-actions .btn{min-height:50px}
  .mobile-participant-actions .btn[hidden]{display:none}
  .mobile-participant-actions .btn:only-child{grid-column:1/-1}
  .sidebar>.panel:first-child{display:none}
}
@media(min-width:981px){.participant-modal{display:none!important}}
@media(max-width:520px){
  .participant-modal__panel{max-height:91dvh}
  .participant-modal__head{padding:16px 14px 10px}
  .participant-modal__body{padding:14px 14px calc(14px + env(safe-area-inset-bottom))}
  .modal-editor__grid{grid-template-columns:1fr 86px}
}
@media(max-width:980px){.mobile-participant-actions:has(#mobileEditBtn[hidden]) #mobileAddBtn{grid-column:1/-1}}

/* Demo scene: visual prompt only; geometry and zero-line alignment stay unchanged. */
.figures.is-demo{opacity:.72;filter:saturate(.85);pointer-events:none}
.empty{background:transparent;pointer-events:none;padding:0 14px 14px;place-content:end center}
.empty>div{font-size:inherit}
.empty .demo-prompt{pointer-events:auto;display:flex;align-items:center;justify-content:center;gap:10px;max-width:560px;padding:9px 10px 9px 12px;border:1px solid rgba(204,213,227,.95);border-radius:14px;background:rgba(255,255,255,.96);box-shadow:0 8px 24px rgba(25,42,78,.13)}
.empty .demo-badge{display:inline-flex;flex:0 0 auto;padding:4px 8px;border-radius:999px;background:var(--blue2);color:var(--blue);font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.05em}
.empty .demo-prompt p{margin:0;font-size:12px;line-height:1.35;color:var(--muted);white-space:nowrap}
.empty .demo-prompt .btn{flex:0 0 auto;min-height:38px;padding:9px 13px;font-size:13px;line-height:1.15}
@media(max-width:640px){
  .empty{padding:0 8px 10px}
  .empty .demo-prompt{max-width:300px;display:grid;grid-template-columns:auto 1fr;gap:5px 8px;padding:8px 9px}
  .empty .demo-prompt p{white-space:normal;text-align:left;font-size:11px}
  .empty .demo-prompt .btn{grid-column:1/-1;width:100%;min-height:40px}
}
