.graph-studio{position:relative;isolation:isolate;height:calc(100dvh - 118px);min-height:360px;display:grid;grid-template-columns:300px minmax(0,1fr);grid-template-areas:"panel stage";background:#fff;overflow:hidden}
.graph-panel{grid-area:panel;padding:24px 18px;overflow:auto;border-right:1px solid #e8e8e8;overscroll-behavior:contain;scrollbar-width:thin;min-width:0}
.graph-panel header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:20px}.graph-panel h2{font-size:19px;letter-spacing:-.4px;margin:0;font-weight:550}.graph-panel-actions{display:flex;align-items:center;gap:5px}.graph-panel header button{width:34px;height:34px;border:1px solid #e2e2e2;border-radius:8px;font-size:24px;line-height:1}
.graph-row{border-bottom:1px solid #ebebeb;padding:0 0 16px;margin-bottom:16px}.graph-row-top{display:flex;gap:7px;align-items:center;margin-bottom:9px}.graph-row-top select{border:0;background:#fff;color:#777;font-size:11px;min-width:0;flex:1;padding:5px 0}.graph-row-top input[type=color]{width:19px;height:23px;padding:0;border:0;background:none;cursor:pointer}.graph-row-top input[type=color]::-webkit-color-swatch-wrapper{padding:3px 0}.graph-row-top input[type=color]::-webkit-color-swatch{border-radius:50%;border:0}.graph-row-top button{color:#999;width:27px;height:27px;font-size:19px}.graph-visible{border:1.5px solid var(--curve-color);border-radius:50%;background:var(--curve-color);width:14px!important;height:14px!important;flex:none;margin-right:2px}.graph-visible[aria-pressed=false]{background:transparent}
.graph-expression{display:flex;align-items:center;gap:7px;margin:7px 0}.graph-expression>span{font-family:Georgia,serif;font-style:italic;font-size:17px;color:#555;white-space:nowrap;min-width:29px}.graph-expression input{width:100%;min-width:0;border:1px solid #e1e1e1;background:#fafafa;border-radius:7px;padding:11px 10px;color:#222;font:16px Georgia,serif;height:43px;outline:none}.graph-expression input:focus{background:#fff;border-color:#888;box-shadow:0 0 0 2px #00000004}.graph-expression input[aria-invalid=true]{border-color:#b87575}
.graph-domain{display:flex;align-items:center;gap:6px;margin:10px 0 0;color:#999;font-size:11px}.graph-domain input{width:70px;min-width:0;background:#fafafa;border:1px solid #e4e4e4;border-radius:5px;padding:6px;color:#555;font-size:11px}.graph-error{font-size:11px;line-height:1.6;color:#a35454;margin:8px 0 0}.graph-error:empty{display:none}.graph-row.graph-hidden .graph-expression{opacity:.45}
.graph-examples{padding-top:3px}.graph-examples h3{font-size:11px;color:#888;font-weight:500;margin:0 0 10px}.graph-examples>div{display:flex;gap:6px;flex-wrap:wrap}.graph-examples button{padding:7px 9px;border:1px solid #e6e6e6;border-radius:6px;font:13px Georgia,serif;color:#666;background:#fff}.graph-examples button:hover{border-color:#999;color:#222}
.graph-stage{grid-area:stage;position:relative;overflow:hidden;min-width:0;background:#fff}.graph-canvas{width:100%;height:100%;display:block;touch-action:none;cursor:grab;outline:none;user-select:none}.graph-canvas:active{cursor:grabbing}.graph-plot-actions{position:absolute;top:15px;right:18px;display:flex;gap:6px}.graph-plot-actions button{font-size:11px;padding:8px 10px;background:#fffffff0;border:1px solid #e5e5e5;border-radius:7px;color:#777}.graph-plot-actions button[aria-pressed=false]{color:#aaa;background:#fafafa}.graph-bottom{position:absolute;bottom:18px;left:20px;right:18px;display:flex;justify-content:space-between;align-items:center;gap:12px;pointer-events:none}.graph-bottom button{pointer-events:auto;background:#ffffffed;border-radius:6px;color:#777;min-width:30px;height:30px;font-size:18px}.graph-history,.graph-zoom{display:flex;gap:4px;align-items:center}.graph-zoom output{font-size:10px;color:#999;min-width:45px;text-align:center;background:#fff;padding:5px}.graph-trace-label{position:absolute;top:17px;left:18px;pointer-events:none;color:#555;background:#ffffffec;padding:7px 9px;border:1px solid #eee;border-radius:6px;font:12px ui-monospace,monospace;max-width:calc(100% - 200px)}.graph-panel button:disabled,.graph-bottom button:disabled{opacity:.3;cursor:default}.graph-panel button:focus-visible,.graph-stage button:focus-visible{outline:2px solid #333;outline-offset:3px}
@media(max-width:900px){.graph-studio{grid-template-columns:255px minmax(0,1fr)}.graph-panel{padding:20px 14px}}
@media(max-width:700px){.workspace-tabs{padding:0 12px;overflow-x:auto;flex:none}.workspace-tabs button{white-space:nowrap}.graph-studio{height:calc(100dvh - 105px);grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);grid-template-areas:"stage";min-height:0}.graph-panel{padding:12px 15px}.graph-panel header{margin-bottom:8px}.graph-panel h2{font-size:16px}.graph-panel header button{width:28px;height:28px;font-size:21px}.graph-row{margin-bottom:12px;padding-bottom:12px}.graph-expression input{font-size:16px}.graph-row-top{margin-bottom:4px}.graph-plot-actions{top:10px;right:10px;gap:4px}.graph-plot-actions button{padding:7px;font-size:10px}.graph-trace-label{left:10px;top:10px;font-size:10px;max-width:calc(100% - 175px)}.graph-bottom{bottom:10px;left:10px;right:10px}}

.graph-visible{border:0;background:transparent;width:19px!important;height:23px!important;margin-right:0}.graph-visible[aria-pressed=false]{opacity:.3}.graph-visible svg{width:17px;height:17px;fill:none;stroke:var(--curve-color);stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}

@media(max-width:700px){.graph-panel header{position:sticky;top:-12px;z-index:2;background:#fff;padding:6px 0;margin-top:-6px}}

.graph-row {
  padding: 10px 11px 9px;
  border: 1px solid #e2e7ef;
  border-inline-start: 3px solid var(--curve-color);
  border-radius: 10px;
  background: #f8faff;
  margin-bottom: 10px;
}
.graph-row-top { margin-bottom: 6px; }
.graph-row-top select {
  appearance: none;
  min-height: 32px;
  padding: 0 24px 0 9px;
  border: 1px solid #dbe2ed;
  border-radius: 6px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23535d6e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 6px center / 13px 13px;
  color: #475569;
  font-size: 12px;
  cursor: pointer;
}
.graph-row-top select:focus-visible { outline: 2px solid var(--curve-color); outline-offset: 1px; }
.graph-row-top input[type=color] { width: 24px; height: 28px; }
.graph-row-top [data-action=delete] { flex: none; border-radius: 6px; color: #687386; }
.graph-expression > span { color: var(--curve-color); }
.graph-expression input { background: #fff; border-color: #dbe2ed; }
.graph-expression input:focus { border-color: var(--curve-color); }
.graph-expression input[aria-invalid=true] { border-color: #b44747; }
.graph-canvas > * { pointer-events: none; }
.graph-panel-toggle, .graph-panel-scrim, #graphPanelClose { display: none; }
#graphHelp { font-size: 16px; color: #606060; }
.graph-tools {
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  gap: 3px;
  padding: 6px;
}
.graph-tools .tool { position: relative; flex: none; padding: 0; }
.graph-tools .icon { width: 19px; height: 19px; }
.graph-plot-actions #graphGrid[aria-pressed=true] {
  background: #f2f6ff;
  border-color: #bfcef2;
  color: #264fa0;
}
.graph-tools [data-graph-tool=erase-whole]::after {
  content: "×";
  position: absolute;
  right: 3px;
  bottom: 2px;
  font: 700 11px/1 system-ui, sans-serif;
}
.graph-canvas:is([data-graph-tool=marker],[data-graph-tool=pen],[data-graph-tool=hatch],[data-graph-tool^=erase-]) { cursor: crosshair; }
.graph-trace-label { top: 57px; left: 18px; max-width: calc(100% - 36px); }
@media (max-width: 700px) {
  .graph-panel {
    position: absolute;
    z-index: 12;
    grid-area: auto;
    inset: 0 auto 0 0;
    width: min(300px, calc(100% - 36px));
    padding-left: max(15px, env(safe-area-inset-left));
    padding-bottom: max(15px, env(safe-area-inset-bottom));
    background: #fff;
    visibility: hidden;
    box-shadow: 8px 0 30px #30303019;
  }
  .graph-panel-open .graph-panel { visibility: visible; }
  .graph-panel-open .graph-panel-scrim {
    display: block;
    position: absolute;
    z-index: 11;
    inset: 0;
    background: #25252525;
  }
  #graphPanelClose { display: inline-block; font-size: 18px; }
  .graph-panel-toggle {
    display: block;
    position: absolute;
    top: 10px;
    left: max(10px, env(safe-area-inset-left));
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid #e3e3e3;
    border-radius: 7px;
    background: #fff;
    color: #333;
    font-size: 12px;
  }
  .graph-tools { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 37px); padding: 4px; }
  .graph-bottom { bottom: max(10px, env(safe-area-inset-bottom)); }
  .graph-tools .tool { width: 40px; height: 40px; }
  .graph-row-top select { font-size: 16px; }
  .graph-trace-label { top: 54px; left: 10px; max-width: calc(100% - 20px); }
}
@media (forced-colors: active) {
  .graph-row-top select { appearance: auto; background-image: none; padding-inline-end: 6px; }
}


.graph-hatch-options {
  position: absolute;
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 94px);
  left: 50%;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 7px 10px;
  transform: translateX(-50%);
  background: #ffffffed;
  color: #395b96;
  border: 1px solid #cddbf5;
  border-radius: 7px;
  font-size: 11px;
  text-align: center;
}
.graph-hatch-options p { margin: 0 0 4px; }
.graph-hatch-options > div { display: flex; align-items: start; justify-content: center; flex-wrap: wrap; gap: 4px 9px; }
.graph-hatch-options :is(button,summary) { padding: 4px 5px; color: #264fa0; cursor: pointer; }
.graph-hatch-options label { display: inline-flex; align-items: center; gap: 4px; margin: 4px; }
.graph-hatch-options input { width: 65px; padding: 3px 5px; border: 1px solid #cddbf5; border-radius: 4px; }
@media (max-width: 700px) { .graph-hatch-options input { font-size: 16px; } }

.graph-parameter {
  position: absolute;
  top: 87px;
  right: 14px;
  width: min(245px, calc(100% - 28px));
  padding: 7px 10px;
  border: 1px solid #dbe2ed;
  border-radius: 8px;
  background: #fff;
  color: #3d4656;
  font-size: 12px;
}
.graph-parameter:not([open]) { width: auto; }
.graph-parameter summary { cursor: pointer; }
.graph-parameter-controls { display: grid; gap: 6px; margin-top: 6px; }
.graph-parameter-controls select { min-width: 0; padding: 4px; border: 1px solid #dbe2ed; border-radius: 5px; background: #fff; color: inherit; }
.graph-parameter-controls input { width: 100%; margin: 0; accent-color: var(--curve-color, #2563eb); }
.graph-parameter-controls output { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (pointer: coarse) {
  .graph-parameter-controls input { min-height: 28px; }
}

.graph-coefficients { display: grid; gap: 6px; }
.graph-coefficients label { display: grid; gap: 2px; }
.graph-coefficients span { font-variant-numeric: tabular-nums; }
