.composer-page {padding-top:clamp(7.45rem,8.5vw,8.4rem)}
.composer-page .product-head {margin-bottom:1.55rem}
.composer-page .product-wrap {width:min(1390px,calc(100% - clamp(2rem,7.5vw,8rem)))}
.workbench {border:1px solid #31313c;border-radius:18px;background:var(--surface);color:var(--white);box-shadow:0 10px 32px #2b2b3e19}
.project-bar,.canvas-bar,.run-bar,.reading-head {display:flex;align-items:center;justify-content:space-between;gap:1rem}
.project-bar {padding:1rem 1.3rem;border-bottom:1px solid var(--line)}
.project-name,.project-tools,.run-action,.shots-group,.qubit-control {display:flex;align-items:center;gap:.65rem}
.project-icon {width:40px;height:40px;display:grid;place-items:center;background:#2f2f41;border:1px solid #444564;color:var(--accent);border-radius:11px}
.project-name .instrument-label {font-size:.62rem}
.project-name h2 {font-size:1.5rem;line-height:1.15;letter-spacing:-.035em;overflow-wrap:anywhere}
.project-tools {gap:.3rem}
.tool-divider {height:19px;width:1px;background:var(--line);margin:0 .4rem}
[data-tip] {position:relative}
[data-tip]:hover:after,[data-tip]:focus-visible:after {content:attr(data-tip);position:absolute;z-index:8;background:var(--surface);color:var(--muted);box-shadow:0 3px 15px #0003;border:1px solid var(--line);padding:.42rem .65rem;border-radius:6px;top:calc(100% + 5px);left:50%;transform:translateX(-50%);font:400 .75rem/1.35 var(--body);white-space:nowrap;pointer-events:none}
.bench-body {display:grid;grid-template-columns:166px minmax(0,1fr) 185px;min-height:223px}
.library,.inspector {padding:1.1rem 1rem;background:#23232a}
.library {border-right:1px solid var(--line)}
.inspector {border-left:1px solid var(--line)}
.library h3,.inspector h3 {font:400 .66rem/1.5 var(--mono);letter-spacing:.09em;margin-bottom:.8rem}
#palette {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.palette-gate {display:grid;place-items:center;position:relative;min-height:39px;touch-action:none;user-select:none;-webkit-user-select:none;border-radius:7px;border:1px solid #4c4c5d;background:#2f2f39;color:#dcdce9;font:400 1.05rem var(--mono)}
.palette-gate[data-g="H"] {background:#292a41;color:var(--accent);border-color:#555687}
.palette-gate[data-g="M"] {grid-column:span 3;display:flex;justify-content:center;gap:.45rem;font:.8rem var(--body)}
.palette-gate:hover,.palette-gate[aria-pressed=true] {background:#3b3b4d;box-shadow:inset 0 0 0 1px var(--accent)}
.canvas-panel {min-width:0;background:#1b1b20;display:flex;flex-direction:column}
.canvas-bar {padding:.6rem 1rem;background:#212129;border-bottom:1px solid #363641}
.canvas-bar h3 {font-family:var(--body);font-size:.9rem;letter-spacing:-.01em}
.qubit-control {gap:.35rem;font:.72rem var(--mono);color:#c9c9d8}
.qubit-control button {width:28px;min-height:28px;border-radius:6px;background:#282832}
#canvas {min-width:0}
#canvas-hint {font-size:.76rem;color:#b1b1c2;padding:.5rem 1rem .85rem;margin-top:auto}
.inspector h4 {font-size:1.1rem}
.inspector dl {display:grid;gap:.62rem;margin:.8rem 0}
.inspector dl>div,.state-reading dl>div {display:flex;justify-content:space-between;align-items:center;gap:.7rem}
.inspector dt,.inspect-note {font-size:.76rem;color:#aeaebd}
.inspector dd {font:.8rem var(--mono)}
.inspector .small-button {margin:.25rem .2rem 0 0}
.inspector p {font-size:.8rem;color:var(--muted);margin:.6rem 0}
.run-bar {background:#23232c;padding:.75rem 1.2rem;border-top:1px solid var(--line);border-radius:0 0 18px 18px}
.run-bar .button {min-height:43px;padding:.48rem 1.05rem}
.run-bar .button .icon {width:15px}
.run-bar kbd {font:.65rem var(--mono);border:1px solid #55579d;padding:.12rem .3rem;border-radius:4px}
#timing {color:var(--muted);font:.68rem var(--mono)}
.results-grid {display:grid;grid-template-columns:minmax(0,1.6fr) minmax(280px,.85fr);gap:1rem;margin-top:1.2rem}
.results-grid>.paper-panel {min-width:0;padding:1.25rem 1.45rem;border-radius:16px}
.reading-head {margin-bottom:1.2rem;align-items:center}
.reading-head h2 {font-size:clamp(1.65rem,2.4vw,2.25rem)}
.reading-head .product-kicker {font-size:.64rem;margin-bottom:.3rem}
.read-switch {border-color:var(--line);background:var(--surface)}
.read-switch button {color:var(--subtle);min-height:27px;font-size:.72rem}
.read-switch button[aria-pressed=true] {color:var(--white);background:#2d2d3e}
.read-switch button:hover:not([aria-pressed=true]) {color:var(--white);background:var(--lift)}
.explanation {padding-top:.75rem;margin-top:.85rem;border-top:1px solid var(--line);color:var(--subtle);font-size:.8rem}
.explanation:empty {display:none}
.state-reading {display:grid;grid-template-columns:minmax(100px,1.1fr) minmax(80px,.95fr);align-items:center;gap:.9rem}
.state-reading .sphere {width:100%;max-height:153px;display:block;font-family:var(--mono)}
.state-reading dl {font:.75rem var(--mono);color:var(--accent-hover)}
.state-reading dl>div {border-bottom:1px solid var(--line);padding:.18rem 0}
.state-reading p {color:var(--subtle);font-size:.73rem;line-height:1.4;margin-top:.55rem}
#sphere-qubit {background:var(--lift);color:var(--white);border-color:var(--line);font-family:var(--mono)}
.drag-ghost {position:fixed;pointer-events:none;z-index:30;transform:translate(-50%,-65%) rotate(-4deg);width:43px;height:43px;background:var(--accent);color:var(--ink);border-radius:8px;display:grid;place-items:center;box-shadow:0 6px 15px #0004;font:1.2rem var(--mono)}
.gate-dropped .gate-face,.gate-dropped .control-dot,.gate-dropped .target-dot {animation:drop-gate .2s var(--ease)}
@keyframes drop-gate {0%{transform:scale(1.18)} 68%{transform:scale(.95)} 100%{transform:scale(1)}}
.template-sheet {width:min(690px,calc(100% - 2rem))}
.template-list {display:grid;grid-template-columns:1fr 1fr;gap:.55rem}
.template-list button,.file-list button {text-align:left;border:1px solid var(--line);border-radius:10px;background:#272730;padding:.8rem .9rem}
.template-list button:hover,.file-list button:hover {border-color:var(--accent);background:#2d2d3e}
.template-list strong,.template-list small,.template-list em {display:block}
.template-list strong {font:550 1.05rem var(--heading)}
.template-list small {font:.78rem/1.45 var(--body);color:var(--muted);margin:.35rem 0}
.template-list em {font:normal .7rem/1.45 var(--mono);color:var(--accent)}
.file-list {display:grid;gap:.5rem}
.file-list button {display:flex;align-items:center;gap:.7rem}
.angle-options {display:flex;flex-wrap:wrap;gap:.4rem;margin-top:1rem}
.product-sheet input[type=range] {width:100%;accent-color:var(--accent)}
@media(max-width:1100px) {.bench-body {grid-template-columns:138px minmax(0,1fr) 155px}.library,.inspector{padding:.9rem .7rem}.results-grid {grid-template-columns:minmax(0,1.42fr) minmax(250px,.85fr)}}
@media(max-width:850px) {.bench-body{grid-template-columns:123px minmax(0,1fr)}.inspector {grid-column:1/-1;border-left:0;border-top:1px solid var(--line);display:flex;align-items:center;gap:1rem;padding:.6rem 1rem}.inspector h3 {margin:0}.inspector #inspect,.inspector dl {display:flex;align-items:center;flex-wrap:wrap;gap:.7rem;margin:0}.inspector dl>div{gap:.3rem}.inspector p {display:none}.inspector h4 {font-size:.87rem}.results-grid>.paper-panel {padding:1rem}.results-grid {grid-template-columns:minmax(0,1.4fr) minmax(213px,.8fr)}.reading-head {flex-wrap:wrap;gap:.6rem}}
@media(max-width:600px) {
 .composer-page {padding-top:6.5rem}.composer-page .product-wrap {width:calc(100% - 1.6rem)}.composer-page .product-head {gap:.85rem;margin-bottom:1rem;padding-inline:.15rem}.composer-page .product-head h1 {font-size:3.25rem}.composer-page .product-kicker {margin-bottom:.36rem}
 .project-bar {padding:.7rem .65rem;gap:.45rem}.project-tools {gap:3px}.project-name {gap:.45rem}.project-icon {display:none}.project-name h2{font-size:1.13rem}.project-name .instrument-label {font-size:.56rem}.project-tools .small-button {padding:.35rem .45rem}.project-tools .icon-button {width:30px}.tool-divider{display:none}
 .bench-body {display:flex;flex-direction:column;min-height:auto}.canvas-bar {padding:.55rem .7rem}.wire-grid {--cell:49px;--row:50px}#canvas-hint {padding:.4rem .7rem .7rem}
 .library {position:fixed;z-index:9;left:8px;right:8px;bottom:max(8px,env(safe-area-inset-bottom));border:1px solid #57586c;border-radius:16px;padding:5px 7px 7px;background:#23232bfa;box-shadow:0 5px 24px #0004}.library h3 {font-size:.58rem;margin:0 0 3px 2px}.library #palette {grid-template-columns:repeat(7,1fr);gap:4px}.palette-gate,.palette-gate[data-g="M"] {display:grid;grid-column:auto;min-height:37px}.palette-gate[data-g="M"] span {display:none}.palette-gate[data-tip]:after {bottom:calc(100% + 7px);top:auto;white-space:normal;min-width:90px}.palette-gate:first-child:after {left:0;transform:none}.palette-gate:last-child:after {right:0;left:auto;transform:none}
 body:has(.composer-page) .footer {padding-bottom:6rem}body:has(.composer-page) .toast {bottom:5.3rem}
 .inspector {gap:.45rem;align-items:flex-start;flex-direction:column;padding:.65rem .75rem}.inspector h3 {font-size:.58rem}.inspector #inspect,.inspector dl {gap:.55rem}
 .run-bar {align-items:stretch;flex-direction:column;gap:.6rem;padding:.7rem}.shots-group {justify-content:space-between;gap:.25rem}.shots-group .pill-switch button {padding:.25rem .45rem;font-size:.71rem}.run-action {flex-direction:row-reverse;justify-content:space-between}.run-action .button {min-width:107px}.run-bar kbd {display:none}
 .results-grid {grid-template-columns:minmax(0,1fr);margin-top:.85rem}.reading-head {align-items:start}.state-reading {grid-template-columns:1fr 1fr}.template-list {grid-template-columns:1fr}
}

.composer-page .project-name .instrument-label {font-size:.68rem}
.composer-page .reading-head h2 {letter-spacing:-.035em}
.palette-gate[data-g=CX] {font-size:.92rem}
@media(min-width:851px){.library h3,.inspector h3 {font-size:.72rem}.state-reading dl {font-size:.8rem}}
@media(max-width:600px) {
 .project-tools .icon-button,.qubit-control .icon-button {min-width:44px;min-height:44px}
 .project-tools .small-button,.library .palette-gate,.run-bar .button,.inspector button,.shots-group button,.read-switch button,#sphere-qubit,.composer-page .product-head .button,.angle-options button {min-height:44px}
 .shots-group button,.inspector button {min-width:44px}
 .project-tools {flex:none}
 .project-name {min-width:0}
 .project-name .instrument-label {font-size:.62rem}
 .reading-head,.shots-group {flex-wrap:wrap}
 .library #palette {gap:3px}
}
@media(max-width:600px) {
 .project-name .instrument-label {display:none}
 .project-name h2 {line-height:1.2}
 .inspector:not(:has(#remove-gate)) {display:none}
}
#canvas-hint.empty-canvas {margin:.35rem .8rem .8rem;border:1px dashed #575872;border-radius:8px;padding:.65rem .8rem;color:#cecedf;background:#21212d}

.composer-page {padding-top:clamp(6.4rem,7.4vw,7rem)}
.composer-page .product-head {align-items:center;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;gap:1.25rem;margin-bottom:1rem}
.composer-page .product-head h1 {font-size:clamp(2.2rem,3vw,3rem);line-height:1.1}
.composer-page .product-head .project-name {border-left:1px solid var(--line);padding-left:1.25rem}
.composer-page .product-head .actions {margin-left:auto}
.product-head .project-name .instrument-label {color:var(--subtle)}
.project-name h2 {font-size:1.15rem;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
.project-name>div {min-width:0}
.project-icon {width:36px;height:36px}
.project-bar {padding:.45rem .9rem}
.project-bar .product-kicker {color:var(--muted);margin:0;font-size:.68rem}
.project-tools button,.qubit-control button,.run-bar button,.read-switch button,.inspector button,#sphere-qubit,.palette-gate,.angle-options button {min-height:44px;min-width:44px}
.bench-body {grid-template-columns:180px minmax(0,1fr) 185px}
#canvas {position:relative;isolation:isolate}
#canvas .circuit-scroll {max-height:262px;scroll-padding:30px 0 0 45px}
#canvas.more-columns:after {content:"";position:absolute;inset:0 0 0 auto;width:26px;background:linear-gradient(to right,transparent,#0f0f17f2);pointer-events:none;z-index:5}
.distribution-panel .hist-scale,.distribution-panel .hist-track {height:128px}
.distribution-panel .hist-bar {max-width:150px}
@media(max-width:850px) {.bench-body {grid-template-columns:121px minmax(0,1fr)}.library #palette {grid-template-columns:repeat(2,minmax(44px,1fr))}.palette-gate[data-g=M] {grid-column:1/-1}}
@media(max-width:650px) {
 .composer-page {padding-top:5.2rem}
 .composer-page .product-head {gap:.6rem .8rem}
 .composer-page .product-head h1 {font-size:2rem}
 .composer-page .product-head .project-name {flex:1;padding-left:.8rem}
 .composer-page .product-head .actions {width:100%;margin:0;gap:.55rem}
 .composer-page .product-head .button {min-height:44px}
 .project-bar .product-kicker {font-size:.62rem;max-width:10ch;line-height:1.35}
 .project-bar .product-kicker svg {display:none}
}
@media(max-width:600px) {
 .composer-page {--dock-space:calc(82px + env(safe-area-inset-bottom));padding-bottom:var(--dock-space)}
 html:has(.composer-page) {scroll-padding-bottom:calc(82px + env(safe-area-inset-bottom))}
 .library #palette {grid-template-columns:repeat(7,minmax(0,1fr));gap:3px}
 .library .palette-gate {min-width:0}
 .library .palette-gate[data-g=M] {grid-column:auto}
 .project-bar {padding:.45rem .6rem}
 .project-name h2 {font-size:1.03rem}
 .shots-group {flex-wrap:nowrap}
 .run-action {flex-direction:row}
 .run-action #run-circuit {margin-left:auto}
 #canvas .circuit-scroll {max-height:207px}
 .reading-head {align-items:center}
}
@media(max-width:600px) {
 html:has(.composer-page) {height:100%;overflow:hidden}
 body:has(.composer-page) {--dock-space:calc(82px + env(safe-area-inset-bottom));position:relative;overflow-y:auto;height:calc(100dvh - var(--dock-space));background:var(--paper);scroll-padding-bottom:12px}
 body:has(.composer-page)>#toast {top:12px;bottom:auto;width:max-content}
}
.run-bar .button {min-height:44px}

#canvas.previous-columns:before {content:"";position:absolute;inset:0 auto 0 44px;width:16px;background:linear-gradient(to right,#13131bc9,transparent);pointer-events:none;z-index:5}
.composer-page .product-head .project-name {min-width:0;flex:1}

/* Custom number and range controls inside Composer sheets (no native spinners or default slider look). */
.product-sheet input[type=number] {appearance:textfield;-moz-appearance:textfield;font-variant-numeric:tabular-nums}
.product-sheet input[type=number]::-webkit-inner-spin-button,.product-sheet input[type=number]::-webkit-outer-spin-button {-webkit-appearance:none;margin:0}
.product-sheet input[type=range] {-webkit-appearance:none;appearance:none;height:32px;background:transparent;cursor:pointer}
.product-sheet input[type=range]::-webkit-slider-runnable-track {height:4px;border-radius:4px;background:var(--line)}
.product-sheet input[type=range]::-webkit-slider-thumb {-webkit-appearance:none;width:22px;height:22px;margin-top:-9px;border-radius:50%;background:var(--accent);border:3px solid var(--studio);box-shadow:0 0 0 1px var(--accent)}
.product-sheet input[type=range]::-moz-range-track {height:4px;border-radius:4px;background:var(--line)}
.product-sheet input[type=range]::-moz-range-thumb {width:18px;height:18px;border-radius:50%;background:var(--accent);border:3px solid var(--studio)}
.product-sheet input[type=range]:focus-visible {outline:2px solid var(--accent);outline-offset:4px;border-radius:6px}

/* Legibility floor on phones: no running text under 12px. */
@media (max-width: 600px) {
  .footer-base, .state-reading p, .read-switch button, .shots-group .pill-switch button { font-size:12px; }
  .reading-head .product-kicker, .project-bar .product-kicker { font-size:12px; letter-spacing:.05em; }
}
