:root{color-scheme:dark;--bg:#120f19;--surface:#201a2b;--surface2:#2c2339;--border:#574767;--text:#f4ecf7;--muted:#c8b8d1;--accent:#cba0e1}*{box-sizing:border-box}html{height:100%}body{margin:0;min-height:100%;background:var(--bg);color:var(--text);font:15px/1.5 system-ui,-apple-system,Segoe UI,sans-serif}button,a{font:inherit}button{cursor:pointer}a{color:var(--text);text-decoration:none}a:focus-visible,button:focus-visible{outline:3px solid var(--accent);outline-offset:3px}.app{min-height:100dvh;display:flex;flex-direction:column}.top{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px max(16px,env(safe-area-inset-right));border-bottom:1px solid var(--border);background:#1b1524}.identity{display:flex;flex-direction:column}.eyebrow{font-size:10px;letter-spacing:.13em;font-weight:750;color:#d6b8e2}.identity strong{font-size:19px}.top-actions{display:flex;align-items:center;gap:9px}.draft{color:var(--muted);font-size:12px}.developer,.action,.primary{display:inline-flex;justify-content:center;align-items:center;border:1px solid #866b99;border-radius:10px;padding:10px 12px;background:#352742;color:#fff;font-weight:600}.workspace{flex:1;width:min(1200px,100%);margin:0 auto;padding:16px;display:grid;grid-template-columns:minmax(0,1.35fr) minmax(310px,.8fr);gap:16px;align-items:start}.stage,.tools{min-width:0;background:var(--surface);border:1px solid var(--border);border-radius:16px;overflow:hidden}.stage{padding:14px}.stage-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.stage-title h1{font-size:24px;line-height:1.1;margin:3px 0}.status{font-size:12px;color:#f5d7b5;border:1px solid #8b684a;background:#3d2a28;border-radius:30px;padding:5px 9px}.viewport{height:min(67vh,680px);min-height:350px;background:radial-gradient(circle at 50% 40%,#342842,#15111d 70%);border:1px solid #4f405e;border-radius:12px;display:grid;place-items:center;overflow:hidden}.empty{text-align:center;max-width:390px;padding:22px}.empty-icon{display:block;font-size:44px;color:#b69aca}.empty h2{font-size:17px;margin:8px 0}.empty p,.panel p,.stage-note{color:var(--muted);font-size:13px;line-height:1.55}.primary{background:#65457b;border-color:#b18bc6;margin-top:12px}.stage-note{margin:10px 2px 0}.tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border-bottom:1px solid var(--border);gap:4px;padding:8px}.tabs button{background:transparent;border:1px solid transparent;color:var(--muted);border-radius:8px;padding:10px 3px;font-size:12px;font-weight:650}.tabs button.active{background:#463154;border-color:#8c6aa1;color:#fff}.panel{padding:20px}.panel[hidden]{display:none}.panel h2{font-size:19px;margin:0 0 8px}.action{margin-top:10px}.note{margin-top:18px;border-left:3px solid #ae8bc3;background:var(--surface2);padding:12px;color:var(--muted);font-size:12px}.footer{display:flex;justify-content:space-between;gap:12px;padding:12px 18px;color:var(--muted);font-size:12px}.footer a{color:#e8d5f3}button,input,select,textarea{color:var(--text);background:var(--surface2)}@media(max-width:760px){.workspace{grid-template-columns:minmax(0,1fr);padding:10px;gap:10px}.viewport{height:42dvh;min-height:260px;max-height:430px}.stage{padding:10px}.panel{padding:15px}.draft{display:none}.developer{padding:8px 10px;font-size:12px}.top{padding:10px 12px}.stage-title h1{font-size:21px}.status{font-size:11px}.tabs button{font-size:11px}}@media(max-width:370px){.tabs button{font-size:10px}.empty{padding:12px}.empty h2{font-size:15px}.viewport{min-height:240px}}

.session-label{display:block;font-size:12px;color:var(--muted);margin:12px 0 5px}.session-select{width:100%;padding:11px;border-radius:9px;border:1px solid var(--border);background:var(--surface2);color:var(--text)}#session-status{font-size:12px;overflow-wrap:anywhere}

/* UX-04 canonical import */
.reference-grid{display:grid;grid-template-columns:1fr;gap:10px}.reference-grid input[type=file]{display:block;width:100%;padding:10px;border:1px solid var(--border);border-radius:9px;font-size:12px}.confirm{display:flex;align-items:flex-start;gap:9px;margin:14px 0;color:var(--muted);font-size:12px}.confirm input{flex-shrink:0;margin-top:3px;accent-color:#ad85ca}.reference-actions{display:flex;flex-wrap:wrap;gap:7px}.reference-actions button{border:1px solid #866b99;border-radius:8px;padding:9px;background:#352742;color:#fff;font-size:12px}.reference-gallery{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.reference-item{min-width:0;border:1px solid var(--border);border-radius:9px;overflow:hidden;background:#18141f}.reference-item img{width:100%;height:135px;object-fit:contain;display:block}.reference-item div{padding:7px;font-size:11px;overflow-wrap:anywhere;color:var(--muted)}#reference-status{font-size:12px;color:var(--muted)}

/* UX-05: real legacy renderer embedded as a persistent canvas viewport */
.viewport{position:relative;display:block}.viewport iframe{display:block;width:100%;height:100%;border:0;background:#17121f}.render-loading{position:absolute;inset:0;display:grid;place-items:center;padding:20px;background:#17121f;color:var(--muted);text-align:center}.render-loading[hidden]{display:none}.view-toolbar{display:flex;align-items:center;justify-content:center;gap:7px;flex-wrap:wrap;padding:10px 0}.view-toolbar button{border:1px solid var(--border);border-radius:8px;padding:7px 11px;background:var(--surface2);color:var(--text)}.view-toolbar label{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}.view-toolbar input{width:110px;accent-color:var(--accent)}

/* UX-06 real geometry editing */
.shape-controls{display:grid;gap:15px;margin:18px 0}.shape-control{display:grid;gap:7px;padding:12px;background:#2c2339;border:1px solid #574767;border-radius:10px}.shape-control-row{display:flex;justify-content:space-between;gap:12px;color:#f4ecf7;font-size:13px}.shape-control output{font-variant-numeric:tabular-nums;color:#dec0ec}.shape-control input[type=range]{width:100%;accent-color:#cba0e1;min-height:24px}.shape-control input:disabled{opacity:.35}#shape-status{min-height:2.5em}#shape-reset:disabled{opacity:.45;cursor:not-allowed}

/* UX-07 controlled candidate review */
.revision-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:12px}.revision-actions button{background:#463154;border:1px solid #9779a9;border-radius:9px;padding:10px;color:#fff;font-weight:650}.revision-actions button:disabled{opacity:.4;cursor:not-allowed}.revision-actions #shape-undo{grid-column:1/-1}

/* UX-08 real renderer frame comparison */
.compare-pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:12px}.compare-pair figure{margin:0;min-width:0}.compare-image,.compare-overlay{background:#16111d;border:1px solid var(--border);border-radius:9px;overflow:hidden;display:grid;place-items:center}.compare-image{height:180px}.compare-image img{width:100%;height:100%;object-fit:contain}.compare-pair figcaption{font-size:11px;color:var(--muted);margin:5px 0}.compare-overlay{position:relative;height:220px;margin-top:9px}.compare-overlay img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}.compare-overlay img[hidden],.compare-image img[hidden]{display:none}#compare-opacity{width:100%;accent-color:var(--accent)}#compare-defects{width:100%;border:1px solid var(--border);border-radius:8px;padding:10px;resize:vertical}#compare-gate{font-size:12px;color:#f5d7b5}

/* UX-11: prevent ADA geometry from being mistaken for an unconnected character. */
.profile-warning{position:absolute;inset:0;z-index:3;display:grid;place-items:center;padding:24px;background:rgba(18,15,25,.97);color:#fff;text-align:center;font-weight:650;line-height:1.6}.profile-warning[hidden]{display:none}
.tabs [role=tab]:focus-visible{outline:3px solid #e4b9ff;outline-offset:-2px}

/* UX-12 mobile touch and overflow stabilization */
html,body{max-width:100%;overflow-x:clip}button,select,input[type=file]{min-height:44px}input[type=range]{min-height:44px;touch-action:pan-y}button:disabled{cursor:not-allowed}.reference-actions button,.revision-actions button,.view-toolbar button{min-height:44px}.panel input[type=text],.panel textarea{max-width:100%;width:100%;padding:11px;border:1px solid var(--border);border-radius:9px}.top-actions{min-width:0}.status{max-width:50%;text-align:center}.panel{overflow-wrap:anywhere}@media(max-width:760px){.workspace{display:flex;flex-direction:column}.stage,.tools{width:100%}.stage{position:relative}.viewport{height:clamp(240px,38dvh,390px)}.tabs{position:sticky;top:0;z-index:5;background:var(--surface)}.reference-actions button{flex:1 1 125px}.compare-image{height:150px}.view-toolbar{gap:5px}.view-toolbar button{padding:8px 9px}}@media(max-width:390px){.top{gap:6px}.identity strong{font-size:16px}.developer{font-size:11px}.status{font-size:10px}.panel{padding:12px}.compare-pair{gap:5px}}

/* UX-12 mobile touch and overflow stabilization */
html,body{max-width:100%;overflow-x:clip}button,select,input[type=file]{min-height:44px}input[type=range]{min-height:44px;touch-action:pan-y}button:disabled{cursor:not-allowed}.reference-actions button,.revision-actions button,.view-toolbar button{min-height:44px}.panel input[type=text],.panel textarea{max-width:100%;width:100%;padding:11px;border:1px solid var(--border);border-radius:9px}.top-actions{min-width:0}.status{max-width:50%;text-align:center}.panel{overflow-wrap:anywhere}@media(max-width:760px){.workspace{display:flex;flex-direction:column}.stage,.tools{width:100%}.stage{position:relative}.viewport{height:clamp(240px,38dvh,390px)}.tabs{position:sticky;top:0;z-index:5;background:var(--surface)}.reference-actions button{flex:1 1 125px}.compare-image{height:150px}.view-toolbar{gap:5px}.view-toolbar button{padding:8px 9px}}@media(max-width:390px){.top{gap:6px}.identity strong{font-size:16px}.developer{font-size:11px}.status{font-size:10px}.panel{padding:12px}.compare-pair{gap:5px}}

.morph-landmarks{margin-top:20px;padding-top:16px;border-top:1px solid #665374}.morph-landmarks h3{margin:0 0 10px}.morph-landmarks .reference-actions{flex-wrap:wrap}#trace-canvas{touch-action:none;cursor:crosshair}

.morph-align{margin:20px 0;padding:16px;border:1px solid #665374;border-radius:14px;background:#21192a}.morph-align h3{margin:0 0 8px}.morph-align-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:12px 0}.morph-align-controls label{display:flex;flex-direction:column;font-size:12px;color:#dfcce7;gap:5px}.morph-align-controls input{width:100%;accent-color:#cf9fe2}.morph-align-stage{background:#15101d;border:1px solid #665374;border-radius:10px;overflow:hidden}.morph-align-stage canvas{display:block;width:100%;height:auto;max-height:520px;object-fit:contain}@media(max-width:440px){.morph-align-controls{grid-template-columns:1fr}.morph-align{padding:11px}}

.morph-fit{margin:20px 0;padding:16px;border:1px solid #665374;border-radius:14px;background:#21192a}.morph-fit h3{margin:0 0 8px}.fit-results p{font-family:monospace;color:#e9d9f0;margin:5px 0}.morph-fit button:disabled{opacity:.45}

/* MORPH-12 mobile acceptance */
#morph12-results{overflow-x:auto;max-width:100%}.morph12-table{width:100%;border-collapse:collapse;font-size:12px}.morph12-table th,.morph12-table td{padding:8px;border-bottom:1px solid #555;text-align:left;vertical-align:top;overflow-wrap:anywhere}.morph12-table td:last-child{min-width:180px}#panel-morph12 textarea{width:100%;box-sizing:border-box}#panel-morph12 input[type=checkbox]{width:20px;height:20px;vertical-align:middle}

/* UX-01: five-stage workflow, existing renderer and data unchanged */
.tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px;padding:8px;position:sticky;top:0;z-index:10;background:#201a2b;border-bottom:1px solid #574767}.tabs button{min-width:0;min-height:48px;white-space:normal;line-height:1.2;font-size:12px;padding:8px 5px}.ux-step-hint{margin:0;padding:10px 14px;color:#d5c3df;font-size:13px;background:#251d31;border-bottom:1px solid #574767}.ux-detail{margin:14px 0;padding:12px;border:1px solid #574767;border-radius:12px;background:#251d31}.ux-detail summary{cursor:pointer;font-weight:700;padding:6px}.ux-detail .ux-advanced-content{padding:8px 0}.ux-developer{margin:14px}.ux-developer>.morph-workspace{margin-top:16px}.panel[hidden]{display:none!important}.morph-workspace{max-width:100%;overflow-wrap:anywhere}@media(max-width:700px){.workspace{display:flex;flex-direction:column}.stage{position:relative}.tabs{grid-template-columns:repeat(5,minmax(0,1fr));top:0}.tabs button{font-size:11px;padding:7px 3px}.ux-step-hint{font-size:12px}}

/* UX-02: persistent live editing, no cloned renderer and no geometry state changes. */
.ux02-edit-bar{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}.ux02-edit-bar button{flex:1;min-height:44px;border:1px solid #84639b;background:#352742;border-radius:9px;color:#f4ecf7;padding:7px 9px;font-size:12px;font-weight:650}.ux02-edit-bar button[aria-pressed=true]{background:#65457b}.stage{position:sticky;top:10px}.ux02-secondary-note{display:none}.stage #creator-render-status{font-size:11px;margin:5px 2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.stage .view-toolbar{padding:5px 0}.stage .view-toolbar button{min-height:40px}.stage .view-toolbar input{width:76px}
@media(max-width:760px){.workspace{display:block;padding:8px}.stage{position:sticky;top:0;z-index:20;padding:8px;border-radius:0 0 13px 13px;box-shadow:0 10px 25px #100c17cc}.tools{margin-top:9px}.stage-title{margin-bottom:5px}.stage-title h1{font-size:17px}.stage .status{font-size:10px;padding:3px 6px}.stage .viewport{height:clamp(145px,27dvh,280px);min-height:0;max-height:none}.stage .view-toolbar{gap:4px;padding:4px 0}.stage .view-toolbar button{padding:5px 8px;min-height:36px;font-size:11px}.stage .view-toolbar label{font-size:10px}.stage .view-toolbar input{width:65px;min-height:34px}.stage #creator-render-status{margin:2px;font-size:10px}.ux02-edit-bar{margin-top:3px;gap:5px}.ux02-edit-bar button{min-height:37px;padding:4px 6px;font-size:11px}.tabs{position:relative;top:auto;z-index:1}.stage.ux02-expanded .viewport{height:clamp(220px,43dvh,430px)}.stage.ux02-expanded .ux02-edit-bar button#ux02-compact{background:#65457b}}
@media(max-width:390px){.stage .view-toolbar label{display:none}.stage .viewport{height:24dvh}.stage.ux02-expanded .viewport{height:40dvh}}

/* UX-03: mobile-first reference fitting workflow */
.ux03-guide{padding:16px;margin:16px 0;border:1px solid #665177;border-radius:16px;background:#241c2f}.ux03-guide h3{margin:0 0 8px}.ux03-guide p{line-height:1.5}.ux03-directions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.ux03-directions button{min-width:0;padding:12px 4px;border:1px solid #705982;border-radius:9px;background:#30243e;color:#f8efff;min-height:44px}.ux03-directions button.active{background:#674279;border-color:#e1b9fc}.ux03-preview{display:flex;align-items:center;justify-content:center;min-height:180px;max-height:340px;background:#16101e;border:1px solid #564364;border-radius:12px;overflow:hidden}.ux03-preview img{object-fit:contain;max-height:340px;max-width:100%;width:auto}.ux03-warning{color:#d8bfdc;font-size:.9rem}.reference-item.ux03-selected{outline:3px solid #d7a6ef;outline-offset:2px}.reference-item{cursor:pointer}@media(max-width:420px){.ux03-guide{padding:12px;margin:12px 0}.ux03-directions button{font-size:.85rem}}
