/* The editor's own furniture. Everything shared with the site is in
   site.css; this is the layout of one page and the things only it has. */
html,body{height:100%;overflow:hidden}
[hidden]{display:none !important}  /* a display rule on a class must not undo `hidden` */
body{display:grid;font-family:var(--sans);font-size:14px;line-height:1.4;
     grid-template-rows:auto 1fr auto;
     grid-template-columns:212px 1fr 264px;
     grid-template-areas:"top top top" "files stage palette" "findings findings findings"}

/* the top bar: groups with a caption each, so a button reads in context */
#ed-top{grid-area:top;display:flex;align-items:center;gap:4px 14px;padding:6px 12px;
        border-bottom:1px solid var(--rule);background:var(--panel);flex-wrap:wrap}
#ed-top button,#ed-top .btn{padding:5px 11px;font-size:13px}
.ed-group{display:flex;align-items:center;gap:5px}
.ed-group-file{margin-right:auto}
.ed-cap{font-size:10.5px;font-weight:600;letter-spacing:.09em;text-transform:uppercase;
        color:var(--ink-3);margin-right:2px}
.ed-name{font-weight:600;max-width:30vw;overflow:hidden;text-overflow:ellipsis;
         border-color:transparent;background:var(--tint)}
.ed-name:hover{border-color:var(--accent)}
.ed-help-btn{width:30px;height:30px;padding:0 !important;border-radius:50%;font-weight:600;
             font-size:15px !important}
.ed-help-btn[aria-expanded="true"]{border-color:var(--accent);color:var(--accent)}
.ed-narrow-only{display:none}

/* the two side panels */
#ed-files-panel,#ed-palette{overflow-y:auto;background:var(--paper);padding:10px 10px 24px}
#ed-palette{padding-bottom:10px}
#ed-files-panel{grid-area:files;border-right:1px solid var(--rule)}
#ed-palette{grid-area:palette;border-left:1px solid var(--rule)}
.ed-panel-head{display:flex;justify-content:space-between;align-items:center;margin:2px 4px 8px}
/* Fit the new control inside the existing heading row without moving the palette. */
#ed-sketch{padding:0 8px;font-size:12px;line-height:14px}
.ed-panel-head h2{margin:0;font-size:12px;font-weight:600;letter-spacing:.08em;
                  text-transform:uppercase;color:var(--ink-2)}
.ed-panel-actions{display:flex;gap:5px;flex-wrap:wrap;margin:0 0 10px}
.ed-panel-actions button,.ed-panel-actions .btn{padding:5px 10px;font-size:12.5px;display:inline-block}
#ed-files,#ed-examples{list-style:none;margin:0;padding:0}
#ed-files li{display:flex;align-items:center;gap:4px;padding:7px 6px 7px 10px;border-radius:8px;
             cursor:pointer;border:1px solid transparent}
#ed-files li:hover{background:var(--tint)}
#ed-files li.ed-current{border-color:var(--accent);background:var(--panel)}
#ed-files li .ed-fname{flex:1;min-width:0;font-weight:500;overflow:hidden;text-overflow:ellipsis;
                       white-space:nowrap;font-size:13px}
#ed-files li small{color:var(--ink-3);white-space:nowrap;font-size:11px}
#ed-files li .ed-more{padding:2px 7px;font-size:13px;line-height:1;border-color:transparent}
#ed-files li .ed-more:hover{border-color:var(--accent)}
#ed-examples{margin:0 0 10px;padding:6px;background:var(--panel);border:1px solid var(--rule);
             border-radius:8px}
#ed-examples li{padding:5px 8px;border-radius:6px;cursor:pointer;font-size:12.5px;line-height:1.35}
#ed-examples li:hover{background:var(--tint);color:var(--accent)}
.ed-hint{font-size:12px;color:var(--ink-3);margin:14px 4px 0;line-height:1.45}

/* Shared network card primitives; component-library sizing is below. */
#ed-palette h3{font-size:10.5px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;
               color:var(--accent);margin:8px 3px 4px;line-height:1.25}
/* four across, because every group but one has four symbols in it: at
   three the odd one takes a row of its own and the panel needs scrolling */
.ed-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}
.ed-card{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:1px;
         padding:4px 2px 3px;border-radius:7px;background:var(--panel);border:1px solid var(--rule);
         cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;
         white-space:normal;line-height:1.1}
.ed-card svg{width:100%;height:30px;pointer-events:none}
.ed-card span{font-size:10px;color:var(--ink-2);text-align:center;hyphens:auto}
.ed-card[aria-pressed="true"]{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent) inset}
.ed-card:hover{border-color:var(--accent)}

/* the stage */
#ed-stage{grid-area:stage;position:relative;overflow:hidden;background:var(--paper);
          touch-action:none;user-select:none;-webkit-user-select:none}
#ed-drawing text{pointer-events:none}
#ed-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;cursor:default}
#ed-canvas.ed-pan{cursor:grabbing}
#ed-canvas.ed-place{cursor:crosshair}
#ed-canvas.ed-connect{cursor:crosshair}
#ed-hits rect{fill:transparent;stroke:none;pointer-events:all}
#ed-hits rect[data-element="wire"]{cursor:pointer}
#ed-hits rect[data-element="node"],#ed-hits rect[data-element="symbol"],
#ed-hits rect[data-element="ground"]{cursor:move}
#ed-canvas.ed-connect #ed-hits rect[data-role="node"]{cursor:crosshair}
#ed-hits rect.ed-hover{stroke:var(--accent);stroke-opacity:.45;stroke-width:1.5px;
                       vector-effect:non-scaling-stroke}
#ed-hits rect.ed-from{stroke:var(--accent);stroke-width:2px;vector-effect:non-scaling-stroke;
                      fill:var(--accent);fill-opacity:.12}
#ed-hits rect.ed-flash{animation:ed-flash 1.2s ease-out}
@keyframes ed-flash{0%{fill:var(--accent);fill-opacity:.35}100%{fill-opacity:0}}
#ed-ui .ed-sel{fill:none;stroke:var(--accent);stroke-width:1.5px;stroke-dasharray:4 3;
               vector-effect:non-scaling-stroke;pointer-events:none}
#ed-ui .ed-rubber{fill:none;stroke:var(--accent);stroke-width:2px;stroke-dasharray:6 4;
                  vector-effect:non-scaling-stroke;pointer-events:none}
#ed-ui .ed-via{fill:var(--panel);stroke:var(--accent);stroke-width:1.5px;
               vector-effect:non-scaling-stroke;cursor:move;pointer-events:all}

/* an end joined to nothing, and the nodes it could be joined to. Red is the
   editor's error red, because the reader reads red as something to see to,
   which is exactly what a loose end is. */
#ed-ui .ed-loose{fill:#b4442c;stroke:var(--paper);stroke-width:1.5px;
                 vector-effect:non-scaling-stroke;cursor:crosshair;pointer-events:all}
#ed-ui .ed-loose:focus{outline:none;stroke:var(--accent);stroke-width:2.5px}
#ed-ui .ed-loose-ring{fill:none;stroke:#b4442c;stroke-opacity:.45;stroke-width:1.5px;
                      vector-effect:non-scaling-stroke;pointer-events:none}
#ed-hits rect.ed-target{stroke:#b4442c;stroke-width:2px;vector-effect:non-scaling-stroke;
                        fill:#b4442c;fill-opacity:.12;cursor:crosshair}

/* the line a dragged node has landed on, and the route a dragged box would
   take if it were let go here */
#ed-ui .ed-guide{fill:none;stroke:var(--accent);stroke-opacity:.5;stroke-width:1px;
                 stroke-dasharray:3 4;vector-effect:non-scaling-stroke;pointer-events:none}
#ed-ui .ed-ghost{fill:none;stroke:var(--accent);stroke-opacity:.5;stroke-width:2px;
                 stroke-dasharray:5 4;vector-effect:non-scaling-stroke;pointer-events:none}

/* what mode the drawing is in, said out loud */
.ed-mode{position:absolute;top:10px;left:50%;transform:translateX(-50%);z-index:4;
         background:var(--accent);color:#fff;padding:6px 14px;border-radius:999px;
         font-size:13px;font-weight:500;box-shadow:0 4px 16px rgba(0,0,0,.18);
         display:flex;gap:10px;align-items:center;max-width:90%}
.ed-mode button{padding:2px 9px;font-size:12px;background:transparent;color:#fff;border-color:#fff8}
.ed-mode button:hover{color:#fff;border-color:#fff}

/* overlays on the stage */
.ed-loading{position:absolute;inset:0;display:grid;place-items:center;
            background:color-mix(in srgb,var(--paper) 72%,transparent);z-index:5}
.ed-loading .card{padding:18px 22px;max-width:36ch}
.ed-loading p{margin:0 0 6px;font-size:14px}
.ed-loading p:last-child{margin:0;color:var(--ink-2)}
.ed-empty{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none;z-index:2}
.ed-empty div{max-width:40ch}
.ed-empty p{color:var(--ink-3);font-size:14.5px;margin:0 0 8px;line-height:1.5}
.ed-empty p b{color:var(--accent);margin-right:6px}
.ed-quick{position:absolute;z-index:6;width:min(300px,80vw)}
.ed-quick input{width:100%;font:inherit;font-size:14px;padding:8px 10px;border-radius:8px;
                border:1px solid var(--accent);background:var(--panel);color:var(--ink);
                outline:none;box-shadow:0 6px 24px rgba(0,0,0,.14)}
.ed-quick ul{list-style:none;margin:4px 0 0;padding:4px;background:var(--panel);
             border:1px solid var(--rule);border-radius:8px;box-shadow:0 6px 24px rgba(0,0,0,.14)}
.ed-quick li{padding:6px 8px;border-radius:6px;cursor:pointer;display:flex;gap:8px;
             align-items:baseline}
.ed-quick li b{font-weight:600}
.ed-quick li small{color:var(--ink-3)}
.ed-quick li[aria-selected="true"],.ed-quick li:hover{background:var(--tint);color:var(--accent)}

.ed-popover{position:absolute;z-index:7;width:min(320px,calc(100vw - 24px));
            padding:12px 14px 10px;box-shadow:0 10px 30px rgba(0,0,0,.18);
            max-height:min(70vh,560px);overflow-y:auto}
.ed-popover h4{margin:0 0 8px;font-size:12px;letter-spacing:.06em;text-transform:uppercase;
               color:var(--accent);display:flex;justify-content:space-between;align-items:center}
.ed-popover h4 code{font-size:11px;text-transform:none;letter-spacing:0}
.ed-popover label{display:grid;grid-template-columns:96px 1fr;gap:8px;align-items:center;
                  margin:0 0 6px;font-size:13px;color:var(--ink-2)}
.ed-popover input,.ed-popover select{font:inherit;font-size:13px;padding:5px 8px;
   border:1px solid var(--rule);border-radius:6px;background:var(--paper);color:var(--ink);
   min-width:0;width:100%}
.ed-popover input:focus,.ed-popover select:focus{border-color:var(--accent);outline:none}
.ed-popover .ed-row{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.ed-popover .ed-row button{padding:5px 11px;font-size:12.5px}
.ed-popover .ed-danger{color:#b4442c;border-color:#b4442c}
.ed-popover .ed-error{margin:8px 0 0;font-size:12.5px;color:#b4442c;white-space:pre-wrap}
.ed-popover details{margin-top:6px}
.ed-popover summary{cursor:pointer;font-size:12.5px;color:var(--ink-3);margin-bottom:6px}
.ed-popover .ed-vias{list-style:none;margin:0;padding:0;font-family:var(--mono);font-size:12px}
.ed-popover .ed-vias li{display:flex;gap:6px;align-items:center;margin-bottom:4px}
.ed-popover .ed-vias button{padding:2px 8px;font-size:11px}

.ed-menu{position:absolute;z-index:8;padding:6px;box-shadow:0 10px 30px rgba(0,0,0,.18);
         min-width:220px}
.ed-menu button{display:block;width:100%;text-align:left;border:0;border-radius:6px;
                padding:8px 10px;background:none;font-size:13.5px}
.ed-menu button:hover{background:var(--tint)}
.ed-menu hr{border:0;border-top:1px solid var(--rule);margin:4px 0}
.ed-menu .ed-danger{color:#b4442c}
.ed-toast{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);z-index:8;
          background:var(--ink);color:var(--paper);padding:8px 14px;border-radius:999px;
          font-size:13px;box-shadow:0 6px 24px rgba(0,0,0,.2);max-width:80vw}
.ed-present-label{position:absolute;left:18px;bottom:14px;z-index:3;font-size:14px;
                  color:var(--ink-3);pointer-events:none}

/* the help panel */
.ed-help{position:absolute;top:10px;right:10px;z-index:9;width:min(460px,calc(100% - 20px));
         max-height:calc(100% - 20px);overflow-y:auto;padding:14px 18px 16px;
         box-shadow:0 12px 36px rgba(0,0,0,.2);font-size:13.5px;line-height:1.5}
.ed-help ol{margin:0 0 12px;padding-left:20px}
.ed-help ol li{margin-bottom:6px}
.ed-help dl{margin:0;display:grid;grid-template-columns:auto 1fr;gap:4px 12px}
.ed-help dt{font-weight:600;white-space:nowrap}
.ed-help dd{margin:0;color:var(--ink-2)}
.ed-help code{font-size:.9em}

/* findings */
#ed-findings{grid-area:findings;border-top:1px solid var(--rule);background:var(--panel);
             max-height:40vh;display:flex;flex-direction:column}
.ed-findings-bar{display:flex;align-items:center;gap:4px}
.ed-findings-summary{border:0;border-radius:0;background:none;text-align:left;
                     padding:8px 14px;font-size:13px;flex:1;min-width:0;display:flex;gap:10px;
                     justify-content:space-between;align-items:baseline}
.ed-findings-summary:hover{color:var(--ink)}
.ed-findings-more{color:var(--ink-3)}
/* the first finding, so a warning is legible before the list is opened */
.ed-first{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
          color:var(--ink-2);margin-left:10px;text-align:left}
/* the check that produces the findings sits with them, not in the top bar */
.ed-check,.ed-popover label.ed-check{display:flex;align-items:center;gap:7px;cursor:pointer;
      font-size:13px;line-height:1.3}
.ed-popover label.ed-check{margin:2px 0 10px}
.ed-popover label.ed-check input{width:15px !important;flex:none}
.ed-check input{width:15px;height:15px;accent-color:var(--accent);margin:0;cursor:pointer}
.ed-physics-check{padding:6px 14px 6px 10px;white-space:nowrap;border-left:1px solid var(--rule)}
.ed-said{margin:0;padding:0 14px 8px;font-size:12.5px;color:var(--ink-2);max-width:none}
#ed-findings-list{list-style:none;margin:0;padding:0 14px 10px;overflow-y:auto;font-size:13px}
#ed-findings-list li{padding:6px 8px;border-radius:6px;cursor:pointer;display:grid;
                     grid-template-columns:auto 1fr;gap:8px;margin-bottom:2px}
#ed-findings-list li:hover{background:var(--tint)}
#ed-findings-list li .ed-code{font-family:var(--mono);font-size:12px;white-space:nowrap}
#ed-findings-list li .ed-remedy{color:var(--ink-2);display:block;margin-top:2px}
.ed-sev-error .ed-code{color:#b4442c}
.ed-sev-warning .ed-code{color:#b0751c}
.ed-sev-note .ed-code{color:var(--ink-3)}
.ed-count-error{color:#b4442c;font-weight:600}
.ed-count-warning{color:#b0751c;font-weight:600}

/* an angle: never a blank box, and two buttons that turn it in 45s */
.ed-rot .ed-rot-c{display:flex;align-items:center;gap:3px}
.ed-rot input{width:56px !important;text-align:center}
.ed-rot button{padding:3px 8px !important;font-size:13px !important;line-height:1.1}
.ed-rot .ed-rot-reset{font-size:11.5px !important;padding:3px 7px !important;color:var(--ink-3)}

/* the tour: a card beside whatever the step is about, over the whole page */
.ed-tour{position:fixed;z-index:11;width:min(276px,calc(100vw - 20px));padding:12px 14px 10px;
         box-shadow:0 12px 36px rgba(0,0,0,.22);font-size:13.5px;line-height:1.45}
.ed-tour p{margin:0 0 8px;max-width:none}
.ed-tour .ed-tour-n{font-size:10.5px;font-weight:600;letter-spacing:.09em;
                    text-transform:uppercase;color:var(--accent);margin-bottom:5px}
.ed-tour .ed-row{margin:0}
.ed-tour button{padding:4px 12px;font-size:12.5px}
.ed-tour-done button{border-color:var(--accent);color:var(--accent)}
.ed-tour-offer{display:flex;align-items:center;gap:10px;margin:0 0 12px !important;
               color:var(--ink-2);max-width:none}
.ed-tour-offer button{border-color:var(--accent);color:var(--accent);white-space:nowrap}
/* what the step is pointing at */
.ed-tour-mark{outline:2px solid var(--accent);outline-offset:2px;border-radius:8px;
              animation:ed-pulse 1.6s ease-in-out infinite}
rect.ed-tour-mark{fill:var(--accent);fill-opacity:.14}
@keyframes ed-pulse{50%{outline-color:transparent}}
@media (prefers-reduced-motion:reduce){.ed-tour-mark{animation:none}}

/* present mode */
body.ed-present{grid-template-columns:1fr;grid-template-rows:1fr;grid-template-areas:"stage"}
body.ed-present #ed-top,body.ed-present #ed-palette,body.ed-present #ed-findings,
body.ed-present #ed-files-panel{display:none}
body.ed-present #ed-paper{fill:none}
body.ed-present #ed-hits,body.ed-present #ed-ui,body.ed-present #ed-mode{display:none}
body.ed-present #ed-tour{display:none}

/* small screens: files become an overlay, the palette a strip above the findings */
@media (max-width:820px){
  body{grid-template-columns:1fr;grid-template-rows:auto 1fr auto auto;
       grid-template-areas:"top" "stage" "palette" "findings"}
  .ed-narrow-only{display:inline-block}
  .ed-wide-only{display:none}
  .ed-cap{display:none}
  .ed-name{max-width:36vw}
  /* one row: the pills used to wrap to four and take a quarter of a phone.
     Delete joins the overflow menu; it is also on every element's card. */
  #ed-top{flex-wrap:nowrap;gap:4px;padding:6px 8px;overflow:hidden}
  #ed-top button{padding:5px 8px}
  #ed-delete{display:none}
  .ed-group-file{min-width:0}
  .ed-findings-bar{flex-wrap:wrap}
  .ed-physics-check{border-left:0;padding:2px 14px 8px;font-size:12.5px}
  .ed-findings-summary{flex-basis:100%}
  .ed-first{display:none}
  #ed-files-panel{position:fixed;top:0;left:0;bottom:0;width:min(340px,92vw);z-index:9;
                  background:var(--panel);border-right:1px solid var(--rule);
                  box-shadow:0 0 40px rgba(0,0,0,.2);display:none}
  #ed-files-panel.ed-open{display:block}
  #ed-palette{border-left:0;border-top:1px solid var(--rule);overflow-x:auto;overflow-y:hidden;
              display:flex;gap:6px;padding:8px;max-height:96px;align-items:flex-start}
  #ed-palette h3,#ed-palette .ed-panel-head,#ed-palette .ed-hint{display:none}
  .ed-cards{display:flex;gap:6px}
  .ed-card{min-width:74px}
  .ed-help{right:6px;left:6px;width:auto}
}

/* Native controls and scrolling follow the editor's existing palette. */
:root{color-scheme:light;scrollbar-color:var(--ink-3) var(--panel)}
:root[data-theme="dark"]{color-scheme:dark}
@media(prefers-color-scheme:dark){:root:not([data-theme="light"]){color-scheme:dark}}
*{scrollbar-color:var(--ink-3) var(--panel);scrollbar-width:thin}
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-track{background:var(--panel)}
*::-webkit-scrollbar-thumb{background:var(--ink-3);border:2px solid var(--panel);border-radius:8px}
#ed-component-tools{display:contents}
body.ed-solving #ed-palette{overflow:hidden;padding:10px;min-height:0}
@media(min-width:821px){body.ed-solving{grid-template-columns:212px minmax(0,1fr) clamp(340px,32vw,440px)}}
#ed-solve-panel{height:100%;min-height:0;display:flex;flex-direction:column;font-size:13px}
#ed-solve-panel .ed-panel-head{flex-shrink:0}
#ed-solve-panel button{font-size:12px;padding:5px 8px}
.ed-solve-actions{display:flex;gap:6px;padding:6px 0 10px;flex-shrink:0;border-bottom:1px solid var(--rule)}
.ed-solve-body{overflow:auto;min-height:0;padding:0 3px 12px}
#ed-solve-panel p{font-size:12.5px;line-height:1.4;margin:8px 0;overflow-wrap:anywhere}
#ed-solve-panel .ed-hint{margin:10px 0}
#ed-solve-panel details{margin:10px 0}
#ed-solve-panel summary{cursor:pointer;color:var(--ink-2);font-size:12px}
#ed-solve-panel label{display:flex;align-items:center;justify-content:space-between;gap:6px;margin:8px 0}
#ed-solve-panel input:not([type="checkbox"]),#ed-solve-panel select{font:inherit;min-width:0;width:65%;padding:5px;border:1px solid var(--rule);border-radius:6px;background:var(--paper);color:var(--ink)}
#ed-solve-panel input[type="checkbox"]{accent-color:var(--accent)}
.ed-value-editor{padding:8px;border:1px solid var(--accent);border-radius:6px;margin:10px 0}
.ed-value-list{display:flex;flex-direction:column;gap:4px}
#ed-solve-panel .ed-value-list button{text-align:left;border-radius:6px;background:var(--panel)}
.ed-value-list span,.ed-value-list small{display:block;overflow-wrap:anywhere}
.ed-value-list small{color:var(--ink-3)}
.ed-value-list button[aria-pressed="true"]{border-color:var(--accent)}
#ed-solve-panel .ed-value-link{display:block;border:0;text-align:left;color:var(--accent);background:none}
.ed-physics-marks{cursor:pointer}
/* Solve colors express state, never decoration. */
:root{--solve-good:#21633b;--solve-action:#21633b;--solve-action-ink:#fff;--solve-unknown:#245db0;--solve-override:#7043a0;--solve-error:#a52e28}
:root[data-theme="dark"]{--solve-good:#86c99b;--solve-action:#86c99b;--solve-action-ink:#102117;--solve-unknown:#89b4fa;--solve-override:#c4a7e7;--solve-error:#f09282}
@media(prefers-color-scheme:dark){:root:not([data-theme="light"]){--solve-good:#86c99b;--solve-action:#86c99b;--solve-action-ink:#102117;--solve-unknown:#89b4fa;--solve-override:#c4a7e7;--solve-error:#f09282}}
.ed-physics-outline{fill:transparent;stroke:none}
.ed-physics-selected{fill:transparent;stroke:var(--ink);stroke-dasharray:none}
.ed-physics-badge{fill:var(--panel);stroke:var(--rule)}
.ed-physics-marks text{fill:var(--ink-2);font-family:var(--sans);pointer-events:none}
.ed-physics-marks [data-state="unknown"] text{fill:var(--solve-unknown)}
.ed-physics-marks [data-state="override"] text{fill:var(--solve-override)}
.ed-physics-marks [data-state="missing"] text{fill:var(--solve-error)}
.ed-physics-marks [data-state="calculated"] text{fill:var(--solve-good)}
.ed-physics-marks [data-state="unknown"] rect{stroke:var(--solve-unknown)}
.ed-physics-marks [data-state="override"] rect{stroke:var(--solve-override)}
.ed-physics-marks [data-state="missing"] rect{stroke:var(--solve-error)}
.ed-physics-marks [data-state="calculated"] rect{stroke:var(--solve-good)}
.ed-solve-status{padding:10px;border:1px solid var(--rule);border-radius:6px;margin:8px 0;flex-shrink:0;max-height:35%;overflow:auto}
.ed-solve-status strong{font-size:16px}
.ed-solve-success{color:var(--solve-good)}
.ed-physics-error{color:var(--solve-error)}
#ed-solve-panel .ed-solve-status button{padding:0;border:0;background:none;color:var(--ink-2);text-decoration:underline;text-underline-offset:3px}
#ed-solve-panel h3,.ed-solve-float h3{color:var(--ink);margin:0;font-size:13px;letter-spacing:0;text-transform:none}
#ed-solve-panel .ed-solve-primary{min-height:44px;flex:1;width:100%;font-weight:600;font-size:15px;background:var(--solve-action);color:var(--solve-action-ink);border:0;border-radius:8px}
#ed-solve-panel .ed-solve-primary:disabled{background:var(--panel);color:var(--ink-3);border:1px solid var(--rule)}
.ed-solve-actions{flex-wrap:wrap}
#ed-solve-panel [data-physics-apply]{width:100%;min-height:36px}
#ed-solve-panel [data-session-commit]{background:var(--accent);color:var(--paper);font-weight:600}
#ed-solve-panel .ed-value-editor{border-color:var(--rule)}
.ed-solve-float{position:fixed;z-index:45;background:var(--panel);color:var(--ink);border:1px solid var(--rule);border-radius:10px;padding:12px;box-shadow:0 8px 26px #0003;overflow:auto;font:13px/1.4 var(--sans);box-sizing:border-box}
.ed-solve-float .ed-panel-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.ed-solve-float p{margin:10px 0;color:var(--ink-2)}
.ed-solve-float .ed-physics-error{color:var(--solve-error)}
.ed-solve-float .ed-solve-success{color:var(--solve-good)}
.ed-solve-float button{font:inherit;padding:5px 8px;border:1px solid var(--rule);border-radius:6px;color:var(--ink);background:var(--paper)}
.ed-solve-float label{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:10px 0}
.ed-solve-float input,.ed-solve-float select{font:inherit;width:65%;min-width:0;border:1px solid var(--rule);border-radius:6px;background:var(--paper);color:var(--ink);padding:7px}
.ed-solve-float [aria-invalid="true"]{border-color:var(--solve-error)}
.ed-value-modes{display:flex;gap:4px}
.ed-value-modes button{flex:1}
.ed-value-modes [aria-pressed="true"]{border-color:var(--ink)}
.ed-value-modes [data-physics-mode="unknown"][aria-pressed="true"]{color:var(--solve-unknown);border-color:currentColor}
.ed-value-modes [data-physics-mode="override"][aria-pressed="true"]{color:var(--solve-override);border-color:currentColor}
.ed-solve-float button:disabled{opacity:.45;cursor:not-allowed}
.ed-solve-float :focus-visible,.ed-solve-toolbar :focus-visible,#ed-solve-panel :focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.ed-solve-toolbar{position:fixed;z-index:40;display:flex;gap:6px;font-size:12px}
.ed-solve-toolbar button{background:var(--panel);color:var(--ink);border:1px solid var(--rule);padding:5px 10px;border-radius:6px}
.ed-solve-tip{position:absolute;top:36px;left:0;width:230px;padding:10px;background:var(--panel);color:var(--ink-2);border:1px solid var(--rule);border-radius:6px}
.ed-solve-float table{width:100%;border-collapse:collapse;font-size:12px;text-align:left}
.ed-solve-float td,.ed-solve-float th{padding:6px 3px;border-bottom:1px solid var(--rule)}
.ed-solve-float td button{background:none;border:0;text-align:left;padding:0}
.ed-solve-float [data-state="unknown"]{color:var(--solve-unknown)}
.ed-solve-float [data-state="override"]{color:var(--solve-override)}
.ed-solve-float [data-state="missing"]{color:var(--solve-error)}
.ed-solve-float [data-state="calculated"]{color:var(--solve-good)}
#ed-solve-close{width:min(340px,calc(100vw - 24px));height:fit-content;inset:80px 16px auto auto;margin:0}
#ed-solve-close::backdrop{background:#0002}
.ed-close-actions{display:flex;gap:8px;justify-content:flex-end}
#ed-solve-close [data-session-discard]{color:var(--solve-error)}
@media(max-width:820px){
  body.ed-solving #ed-palette{display:block;height:50vh;max-height:50vh;overflow:hidden}
  body.ed-solving #ed-palette .ed-panel-head,body.ed-solving #ed-palette h3,body.ed-solving #ed-palette .ed-hint{display:flex}
}

#ed-examples li small{display:block;color:var(--ink-3);margin-top:3px}
#ed-examples li button{font:inherit;text-align:left;border:0;padding:0;background:none}
#ed-examples ul{padding-left:8px;list-style:none}
#ed-examples summary{cursor:pointer;padding:5px 0}

.ed-solve-label[data-state="unknown"] text{fill:var(--solve-unknown)}
.ed-solve-label[data-state="override"] text{fill:var(--solve-override)}
.ed-solve-label[data-state="calculated"] text{fill:var(--solve-good)}

#ed-solve-panel .ed-answer strong{color:var(--solve-good)}
#ed-solve-panel .ed-solve-message{color:var(--solve-error)}

#ed-solve-panel .ed-choose-unknown{color:var(--solve-unknown);font-weight:600}
.ed-solve-toolbar [data-label-warning]{max-width:220px;background:var(--panel);padding:5px;border:1px solid var(--rule)}
.ed-solve-toolbar{max-width:calc(100vw - 24px);flex-wrap:wrap}

/* Component library: readable discovery without changing the drawing vocabulary. */
body:not(.ed-solving){grid-template-columns:212px 1fr 320px}
body.ed-components-collapsed:not(.ed-solving){grid-template-columns:212px 1fr 0}
body.ed-components-collapsed:not(.ed-solving) #ed-palette{display:none}
#ed-component-tools .ed-panel-head{position:sticky;top:0;background:var(--paper);z-index:1;padding:5px 0}
#ed-component-tools .ed-panel-head button{font-size:12px}
.ed-component-search{display:flex;gap:5px;margin-bottom:8px}
.ed-component-search input{width:100%;min-width:0}
.ed-component-categories{display:flex;gap:4px;margin-bottom:10px}
.ed-component-categories button{flex:1;padding:6px 3px;font-size:12px}
.ed-component-categories [aria-pressed=true]{background:var(--tint);border-color:var(--ink-3)}
#ed-component-tools h3{color:var(--ink-2);margin:14px 0 7px}
#ed-component-tools .ed-cards{display:grid;grid-template-columns:1fr;gap:5px}
.ed-component-row{display:flex;align-items:stretch;gap:3px;min-width:0}
#ed-component-tools .ed-card{flex:1;min-width:0;display:flex;flex-direction:row;align-items:center;gap:10px;padding:7px 8px;min-height:48px}
#ed-component-tools .ed-card svg{width:65px;flex-shrink:0;height:36px}
#ed-component-tools .ed-card span{font-size:13px;text-align:left;hyphens:none}
.ed-shape-card{flex:1;text-align:left;min-height:44px;font-size:13px}
.ed-component-help{width:26px;padding:0;color:var(--ink-3);border-color:transparent;background:transparent}
#ed-component-note,#ed-component-guidance,#ed-component-empty{font-size:12px;color:var(--ink-2);padding:8px;border:1px solid var(--rule);border-radius:6px}
#ed-component-guidance{position:sticky;bottom:0;background:var(--paper)}
.ed-relationships{border:1px solid var(--rule);border-radius:6px;margin:10px 0;padding:8px;max-height:200px;overflow:auto}
.ed-relationships input[type=search]{width:100%;margin-bottom:5px}
.ed-relationships label{display:flex;align-items:center;gap:8px;padding:4px}
.ed-relationships input[type=checkbox]{width:auto}
.ed-relationships small{display:block;color:var(--ink-3)}
[aria-invalid=true]{border-color:var(--danger,#d06d59)!important}
.ed-popover{max-width:calc(100vw - 16px);max-height:calc(100dvh - 90px);overflow:auto}
@media(max-width:820px){
 body:not(.ed-solving),body.ed-components-collapsed:not(.ed-solving){grid-template-columns:1fr}
 body:not(.ed-solving) #ed-palette{display:none}
 body.ed-components-open:not(.ed-solving) #ed-palette{display:block;position:fixed;z-index:10;left:0;right:0;bottom:0;height:65dvh;max-height:65dvh;overflow-y:auto;border-top:1px solid var(--rule);padding:12px;background:var(--paper)}
 #ed-component-tools .ed-panel-head{display:flex}
 #ed-component-tools h3{display:block}
 #ed-component-tools .ed-card{min-width:0}
}

.ed-component-controls{position:sticky;top:-10px;z-index:2;background:var(--paper);padding:5px 0}
#ed-component-tools .ed-panel-head{position:static}
.ed-component-search input,.ed-relationships input[type=search]{font:inherit;font-size:13px;padding:8px 10px;border:1px solid var(--rule);border-radius:8px;background:var(--panel);color:var(--ink)}
.ed-component-search input:focus-visible,.ed-relationships input:focus-visible{outline:2px solid var(--ink-3);outline-offset:1px}
.ed-component-categories [aria-pressed=true]{color:var(--ink)}

.ed-shape-card[aria-pressed=true]{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent) inset}

.ed-component-row{display:grid;grid-template-columns:minmax(0,1fr) 26px}
.ed-component-definition{grid-column:1 / -1;margin:0 0 5px;padding:8px 10px;font-size:13px;line-height:1.45;color:var(--ink-2);background:var(--panel);border:1px solid var(--rule);border-radius:7px}

#ed-empty-start{pointer-events:auto}
#ed-tour{width:min(340px,calc(100vw - 16px));max-height:calc(100dvh - 32px);overflow:auto}
#ed-tour h3{margin:0 0 10px;font-size:16px;color:var(--ink)}
#ed-tour .ed-row{flex-wrap:wrap}
.ed-tour-mark{animation:none}

/* Presentation owns the entire grid, including while a Solve session is open. */
body.ed-present,body.ed-present:not(.ed-solving),body.ed-present.ed-solving {
  grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);
  grid-template-areas:"stage";
}
body.ed-present #ed-stage{grid-area:stage;min-width:0;min-height:0;width:100%;height:100dvh}
body.ed-present #ed-analysis-panel,body.ed-present #ed-solve-toolbar,body.ed-present #ed-solve-values,
body.ed-present #ed-files,body.ed-present #ed-component-tools,body.ed-present #ed-findings{display:none!important}
#ed-findings{position:relative;height:38px;box-sizing:border-box;min-height:38px}
#ed-findings-list{position:absolute;bottom:100%;left:0;right:0;max-height:min(40dvh,320px);overflow:auto;background:var(--panel);border:1px solid var(--rule);z-index:12}
#ed-findings-list li[role=button]{cursor:pointer}
#ed-findings-list li:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}

body:not(.ed-present){--left-column:var(--files-width,280px);--right-column:320px;grid-template-columns:var(--left-column) minmax(0,1fr) var(--right-column)}
body.ed-solving:not(.ed-present){--right-column:clamp(340px,32vw,440px)}
body.ed-components-collapsed:not(.ed-solving):not(.ed-present){--right-column:0px;grid-template-columns:var(--left-column) minmax(0,1fr) var(--right-column)}
body.ed-files-collapsed:not(.ed-present),body.ed-files-overlay:not(.ed-present){--left-column:0px}
body.ed-files-collapsed #ed-files-panel{display:none}
#ed-files-panel{position:relative;min-width:0;width:var(--files-width,280px);box-sizing:border-box}
#ed-files li{display:grid;grid-template-columns:minmax(0,1fr) 28px;gap:4px;align-items:start}
#ed-files .ed-fname{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;grid-column:1;line-height:1.4}
#ed-files li small{grid-column:1;grid-row:2}
#ed-files li .ed-more{grid-column:2;grid-row:1 / 3}
.ed-files-resizer{position:absolute;right:0;top:0;bottom:0;width:6px;cursor:ew-resize;touch-action:none}
#ed-files-reopen{position:fixed;left:5px;top:70px;z-index:20;writing-mode:vertical-rl}
body.ed-files-overlay #ed-files-panel{position:fixed;left:0;top:64px;bottom:0;z-index:25;background:var(--paper);box-shadow:5px 0 20px #0003;display:none}
body.ed-files-overlay #ed-files-panel.ed-open{display:block}
body.ed-files-overlay #ed-files-toggle{display:inline-flex}
body.ed-present #ed-files-panel,body.ed-present #ed-files-reopen{display:none!important}
body.ed-present .ed-solve-float,body.ed-present .ed-solve-toolbar,body.ed-present #ed-solve-panel{display:none!important}
#ed-popover{max-height:calc(100dvh - 100px);overflow:auto}
#ed-popover h4{position:sticky;top:0;background:var(--panel);z-index:1}
.ed-common-controls>summary{pointer-events:none;list-style:none;font-weight:600}
#ed-top{display:flex;align-items:center;gap:12px;flex-wrap:nowrap}
#ed-top>[hidden]{display:none!important}
.ed-primary,.ed-menu-categories{display:flex;gap:6px;align-items:center;min-width:0}
.ed-primary{flex:1}.ed-primary #ed-file{max-width:360px;min-width:60px;margin-right:auto}
.ed-category-menu{position:fixed;z-index:60;max-height:calc(100dvh - 90px);overflow:auto;min-width:220px;max-width:calc(100vw - 16px);padding:8px}
.ed-category-menu button,.ed-category-menu label{display:block;text-align:left;width:100%;box-sizing:border-box;margin:3px 0}
.ed-mobile-menu{display:none}
#ed-export-dialog{width:min(680px,calc(100vw - 48px));max-height:calc(100dvh - 48px);overflow:auto;background:var(--panel);color:var(--ink);border:1px solid var(--rule);border-radius:12px;padding:20px}
#ed-export-dialog label{display:flex;justify-content:space-between;gap:12px;margin:10px 0}
#ed-export-dialog [data-export-preview] img{display:block;max-width:100%;max-height:45dvh;margin:auto}
#ed-export-dialog::backdrop{background:#0006}
.ed-mini-picker{position:fixed;z-index:100;width:min(340px,calc(100vw - 32px));max-height:calc(100dvh - 100px);overflow:auto;padding:12px}
.ed-mini-picker button{margin:3px;min-width:30px}.ed-mini-picker input{width:100%;box-sizing:border-box}
.ed-mini-picker h4{margin:10px 0 4px}.ed-mini-picker p{font-size:12px}
.ed-picker-button{padding:3px 6px!important;min-width:26px}
.ed-field-picker{display:flex;align-items:center;gap:3px;min-width:0}
.ed-field-picker>input,.ed-field-picker>select{min-width:0;width:100%;flex:1}
.ed-control-help{padding:2px 6px!important;min-width:20px;font-size:12px}
.ed-drop-hint{position:fixed;z-index:80;pointer-events:none;padding:8px 12px;max-width:280px;font-size:13px}
.ed-conflict-review{max-width:min(580px,calc(100vw - 32px));max-height:80dvh;overflow:auto;background:var(--panel);color:var(--ink);border:1px solid var(--rule);border-radius:12px;padding:20px}
.ed-conflict-review label{display:flex;gap:12px;margin:10px 0;align-items:center}
.ed-example-menu{position:fixed;z-index:65;width:min(400px,calc(100vw - 32px));max-height:calc(100dvh - 100px);overflow:auto;background:var(--panel);border:1px solid var(--rule);padding:12px;box-sizing:border-box}
#ed-components-reopen{display:none;position:fixed;right:5px;top:70px;z-index:20;writing-mode:vertical-rl}
body.ed-components-collapsed:not(.ed-present) #ed-components-reopen{display:block}
@media(max-width:759px){
  .ed-mobile-menu{display:block;position:relative}
  .ed-mobile-menu>.ed-menu-categories{position:absolute;top:100%;left:0;background:var(--panel);z-index:60;padding:8px;flex-direction:column}
  .ed-primary{gap:3px}.ed-primary #ed-file{max-width:130px}.ed-primary button{padding:5px;font-size:12px}
  body:not(.ed-present),body.ed-components-collapsed:not(.ed-solving):not(.ed-present){grid-template-columns:minmax(0,1fr);grid-template-areas:"top" "stage" "findings";grid-template-rows:auto minmax(0,1fr) 38px}
  #ed-palette{position:fixed;right:0;top:60px;bottom:38px;width:min(320px,calc(100vw - 24px));z-index:24}
}

/* Editor UI system: navigation, content controls, and overlays. */
body{--editor-right:360px;grid-template-columns:var(--files-width,212px) minmax(0,1fr) var(--editor-right)}
button,.btn,input,select{border-radius:6px!important}
button,.btn{min-height:32px;box-sizing:border-box}
.card,dialog{border-radius:8px!important}
#ed-top button{display:inline-flex;align-items:center;justify-content:center}
#ed-undo,#ed-redo{width:32px;padding:5px}
.ed-menu-categories>button{border:0;background:transparent;border-radius:4px!important;font-weight:500}
.ed-menu-categories>button:hover,.ed-menu-categories>button[aria-expanded=true]{background:var(--tint);color:var(--accent)}
.ed-category-menu [role^=menuitem]{border:0;background:transparent;border-radius:4px!important;min-height:32px;padding:6px 10px;text-align:left}
.ed-category-menu [role=menuitemcheckbox]::before{content:' ';display:inline-block;width:18px}
.ed-category-menu [aria-checked=true]::before{content:'✓'}
#ed-stage{display:flex;flex-direction:column;min-width:0;min-height:0}
#ed-canvas-header{height:36px;min-height:36px;display:flex;align-items:center;justify-content:space-between;padding:0 8px;border-bottom:1px solid var(--rule);background:var(--panel)}
#ed-canvas{position:relative;flex:1;min-height:0;height:0;width:100%}
#ed-files-reopen,#ed-components-reopen{position:static!important;writing-mode:horizontal-tb!important;z-index:auto!important;margin:0;font-size:12px}
#ed-components-reopen{margin-left:auto}
#ed-palette{width:auto!important;min-width:0;padding:0;display:flex;flex-direction:column;overflow:hidden}
#ed-panel-views{display:flex;gap:3px;padding:6px;border-bottom:1px solid var(--rule);flex-shrink:0}
#ed-panel-views button{flex:1;font-size:12px;padding:4px;border:0;background:transparent}
#ed-panel-views [aria-pressed=true],[data-inspector-tabs] [aria-pressed=true]{background:var(--tint);color:var(--accent)}
#ed-component-tools,#ed-solve-panel{min-height:0;overflow:auto;padding:10px;flex:1}
#ed-popover.ed-docked{position:static!important;inset:auto!important;box-sizing:border-box;width:100%;max-width:100%;max-height:none;height:100%;min-height:0;padding:0;border:0;box-shadow:none;display:flex;flex-direction:column;overflow:hidden}
.ed-inspector-head{padding:12px;display:flex;align-items:flex-start;gap:8px;border-bottom:1px solid var(--rule);flex-shrink:0}
#ed-popover .ed-inspector-head h4{position:static;font-size:15px;color:var(--ink);letter-spacing:0;text-transform:none;display:block;overflow-wrap:anywhere;flex:1;margin:0}
.ed-inspector-head h4 small,.ed-inspector-head h4 code{display:block;font:12px/1.4 var(--sans);color:var(--ink-2);margin-top:4px}
.ed-inspector-head button{width:32px;flex-shrink:0}
[data-inspector-tabs]{display:flex;padding:6px;gap:3px;border-bottom:1px solid var(--rule);flex-shrink:0}
[data-inspector-tabs] button{flex:1;padding:4px;font-size:12px;border:0;background:transparent}
[data-inspector-section]{overflow-y:auto;overflow-x:hidden;min-height:0;padding:12px;flex:1}
.ed-docked label{grid-template-columns:88px minmax(0,1fr);gap:8px;margin-bottom:10px}
.ed-field-picker{display:flex;min-width:0;gap:4px;align-items:center}
.ed-field-picker input,.ed-field-picker select{flex:1;min-width:0}
.ed-field-picker button{flex:0 0 30px;width:30px;padding:4px;font-size:13px}
.ed-docked input,.ed-docked select{box-sizing:border-box;min-height:32px}
.ed-docked .ed-rot-c{display:grid;grid-template-columns:30px minmax(36px,1fr) 30px;gap:4px;min-width:0}
.ed-docked .ed-rot-reset{grid-column:1/-1}
.ed-docked [data-inspector-section]>button{margin:3px;padding:5px 8px;font-size:12px}
.ed-docked .ed-section-help{display:block;margin:0 0 10px auto;padding:2px 7px;color:var(--ink-2);background:transparent}
.ed-section-explanation{font-size:12px;line-height:1.5;padding:8px;background:var(--tint);margin-bottom:10px}
.ed-inspector-footer{padding:10px 12px;border-top:1px solid var(--rule);flex-shrink:0}
.ed-inspector-footer [data-group-actions]{margin:0 0 8px}
.ed-help-dialog{width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 40px);overflow:auto;box-sizing:border-box;border:1px solid var(--rule);background:var(--panel);color:var(--ink);padding:20px}
.ed-help-dialog::backdrop{background:#0006}
.ed-help-dialog h2{font-size:20px;margin:0 0 14px}.ed-help-dialog h3{font-size:14px;margin:14px 0 4px}
.ed-help-dialog p{font-size:13px;line-height:1.5;margin:5px 0 12px}
.ed-help-dialog p:has(kbd){display:flex;justify-content:space-between;gap:12px}
kbd{font:12px var(--mono);padding:2px 5px;border:1px solid var(--rule);border-radius:4px}
#ed-hits rect.ed-hover,#ed-hits rect.ed-flash{stroke:none;fill:transparent;animation:none}
.ed-hover-ink{stroke:var(--accent);stroke-opacity:.55;stroke-width:3;vector-effect:non-scaling-stroke;pointer-events:none}
#ed-findings{height:38px;display:flex;align-items:center;gap:10px;padding:0 10px;font-size:12px}
.ed-findings-bar{flex:1;min-width:0;display:flex;flex-wrap:nowrap}
#ed-findings-count{display:flex;gap:12px;align-items:center;min-width:0}
#ed-findings-toggle{min-width:0;flex:1;overflow:hidden;font-size:12px}
.ed-first{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#ed-findings-count>span:not(.ed-first){white-space:nowrap}
.ed-findings-more{display:none}
#ed-all-issues{flex-shrink:0;font-size:12px;padding:4px 8px}
#ed-physics-said{margin:0;font-size:11px;white-space:nowrap;color:var(--ink-2)}
#ed-findings-list{max-height:40dvh;margin:0;padding:8px}
#ed-findings-list li.ed-issue{display:block;padding:0;cursor:default}
.ed-issue>button{width:100%;text-align:left;border:0;background:transparent;padding:8px}
.ed-issue-detail{padding:4px 12px 12px;font-size:13px}.ed-issue-detail p{margin:8px 0}
body.ed-present #ed-canvas-header{display:none}
@media(max-width:1100px){
 body{grid-template-columns:minmax(0,1fr);grid-template-areas:'top' 'stage' 'findings'}
 #ed-files-panel{position:fixed;left:0;top:80px;bottom:38px;z-index:24;background:var(--panel)}
 #ed-palette{position:fixed;right:0;top:80px;bottom:38px;width:360px!important;z-index:24;background:var(--panel);border-left:1px solid var(--rule)}
 body[data-panel-view=Properties] #ed-palette{top:auto;left:0;width:100%!important;height:65dvh;border-top:1px solid var(--rule)}
}
@media(pointer:coarse){button,.btn,input,select{min-height:44px!important}}
body:not(.ed-present):not(.ed-components-collapsed){--right-column:360px}
body.ed-solving:not(.ed-present){--right-column:360px}
body.ed-present #ed-panel-views,body.ed-present #ed-popover{display:none!important}
#ed-palette #ed-popover.ed-docked{flex:1}
body.ed-files-overlay #ed-files-reopen{display:inline-flex!important}
body:not(.ed-present) .ed-menu-categories button:focus-visible{outline:2px solid var(--accent)}
@media(max-width:1100px){
 body:not(.ed-present){grid-template-columns:minmax(0,1fr)!important}
 #ed-files-panel{display:none}
 #ed-files-panel.ed-open{display:block}
 #ed-files-reopen{display:inline-flex!important}
}
#ed-findings{flex-direction:row}
#ed-findings-count{width:100%}
#ed-component-tools{padding:12px!important}
#ed-popover.ed-docked>[data-leave]{flex-shrink:0}
body:not([data-panel-view=Solve]) .ed-solve-float,body:not([data-panel-view=Solve]) .ed-solve-toolbar,body:not([data-panel-view=Solve]) .ed-physics-marks{display:none!important}
.ed-endpoint-control{display:flex;flex-direction:column;gap:4px;min-width:0}.ed-endpoint-control button{align-self:flex-end;font-size:11px;padding:3px 6px}
[data-group-leave]{flex-shrink:0;padding:10px;background:var(--tint);font-size:12px}

/* Shared overlay order; modal dialogs use the browser top layer. */
:root{--ed-layer-panel:20;--ed-layer-overlay:30;--ed-layer-menu:60;--ed-layer-popover:70}
#ed-findings-list{z-index:var(--ed-layer-overlay)}
.ed-category-menu{z-index:var(--ed-layer-menu)}
.ed-mini-picker{z-index:var(--ed-layer-popover)}
.ed-docked .ed-rot input{width:100%!important}
@media(max-width:760px){
 body:not(.ed-present),body.ed-components-collapsed:not(.ed-solving):not(.ed-present){grid-template-rows:auto minmax(0,1fr) 88px}
 #ed-top{overflow:visible}
 .ed-mobile-menu>summary{min-height:32px;padding:5px 8px;box-sizing:border-box;border:1px solid var(--rule);border-radius:6px}
 #ed-findings{height:88px;min-height:88px;padding-bottom:22px}
 #ed-findings-count{display:grid;grid-template-columns:repeat(3,max-content);gap:4px 8px;font-size:11px}
 #ed-findings-count .ed-first{display:block;grid-column:1/-1;text-align:left;max-width:calc(100vw - 140px)}
 #ed-physics-said{display:block;position:absolute;bottom:4px;left:10px}
 #ed-palette,#ed-files-panel{bottom:88px!important}
}

.ed-docked .ed-vias li{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:4px;margin:6px 0}
.ed-docked .ed-vias input{min-width:0;width:100%}
@media(max-width:1100px){
 body:not(.ed-present){grid-template-rows:auto minmax(0,1fr) var(--ed-status-height,38px)}
 body:not(.ed-present) #ed-palette,body.ed-components-open:not(.ed-present) #ed-palette,body.ed-solving:not(.ed-present) #ed-palette{display:flex;position:fixed;left:auto;right:0;top:80px;bottom:var(--ed-status-height,38px);height:auto;max-height:none;padding:0;align-items:stretch;overflow:hidden}
 body.ed-components-collapsed:not(.ed-solving):not(.ed-present) #ed-palette{display:none}
 body[data-panel-view=Properties]:not(.ed-present) #ed-palette,body.ed-components-open[data-panel-view=Properties]:not(.ed-present) #ed-palette{left:0;top:auto;height:65dvh}
 #ed-top{overflow:visible}
}
@media(max-width:760px){body{--ed-status-height:88px}}

/* The library owns its scroll box; display:contents loses it inside the dock. */
#ed-component-tools{display:block;flex:1 1 0;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}
#ed-component-tools .ed-card{min-height:76px;gap:12px;padding:8px}
#ed-component-tools .ed-card svg{width:104px;height:58px}
#ed-component-tools .ed-card span{flex:1;min-width:0}
#ed-canvas:focus{outline:none}
body.ed-keyboard-navigation #ed-canvas:focus-visible{outline:1px solid var(--accent);outline-offset:-1px}
#ed-edit-actions{display:flex;gap:4px;align-items:center;border-left:1px solid var(--rule);padding-left:6px;flex-shrink:0}
#ed-top .ed-icon-button,#ed-top #ed-delete{display:inline-flex;width:32px;height:32px;min-width:32px;padding:5px}
#ed-example-section{margin-top:24px;padding-top:12px;border-top:1px solid var(--rule)}
#ed-open-example{width:100%;text-align:left;border:0;background:transparent;font-weight:600}
#ed-open-example::before{content:'▸ ';font-size:11px}
#ed-open-example[aria-expanded=true]::before{content:'▾ '}
#ed-examples li{margin:6px 0 12px;padding:0}
#ed-examples li>button{display:block;width:100%;white-space:normal;text-align:left;padding:8px;font-size:12px}
#ed-examples small{display:block;padding:4px 8px;color:var(--ink-2);font-size:11px}
.ed-help-dialog:has(.ed-dialog-close){padding-top:22px}
.ed-help-dialog:has(.ed-dialog-close) h2{padding-right:38px}
.ed-dialog-close{position:absolute;top:10px;right:10px;width:32px;height:32px;padding:0;font-size:22px;line-height:1;color:var(--ink);background:var(--tint);border:1px solid var(--rule)}
.ed-dialog-heading{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:12px;background:var(--panel);padding-bottom:8px}
.ed-help-dialog .ed-dialog-heading h2{padding:0;margin:0}
.ed-dialog-heading .ed-dialog-close{position:static;flex-shrink:0}
@media(pointer:coarse){.ed-dialog-close,#ed-top .ed-icon-button{min-width:44px}}
@media(max-width:760px){
 #ed-top{align-items:flex-start}
 .ed-primary{flex-wrap:wrap}
 .ed-primary #ed-file{flex:1;max-width:none}
 #ed-edit-actions{order:2;flex-basis:100%;justify-content:flex-end;border-left:0;padding:4px 0 0}
}
@media(max-width:1100px){
 body:not(.ed-present) #ed-palette,body.ed-components-open:not(.ed-present) #ed-palette,body.ed-solving:not(.ed-present) #ed-palette{top:calc(var(--ed-toolbar-height,45px) + 36px)}
 body.ed-files-overlay #ed-files-panel,#ed-files-panel{top:calc(var(--ed-toolbar-height,45px) + 36px)}
 body[data-panel-view=Properties]:not(.ed-present) #ed-palette,body.ed-components-open[data-panel-view=Properties]:not(.ed-present) #ed-palette{top:auto}
}

.ed-assignment-dialog {box-sizing:border-box;width:min(620px,calc(100vw - 32px));max-height:85vh;overflow:auto;padding:24px;border:1px solid var(--ink-3);border-radius:12px;background:var(--panel);color:var(--ink);}
.ed-assignment-dialog::backdrop {background:rgba(0,0,0,.35);}
.ed-assignment-dialog details {margin:16px 0;padding:12px 0;border-top:1px solid var(--ink-3,#aaa);}
.ed-assignment-dialog label {display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:10px 0;align-items:center;}
.ed-assignment-dialog input,.ed-assignment-dialog select {min-width:0;max-width:100%;padding:7px;}
.ed-assignment-dialog button {margin:5px;padding:8px;}
.ed-assignment-dialog [role=alert] {color:#b43725;}
