dialog:has(.oe) {
  width: min(1150px, 97vw);
  max-height: 95dvh;
}
.oe {
  color: var(--ink, #eee9e6);
}
.oe .oe-intro {
  margin: 0 0 12px;
  color: var(--gold, #c8ac83);
}
.oe-intro span {
  color: var(--muted, #aaa4b1);
}
.oe .oe-start {
  margin: 0 0 18px;
  color: #ded2e9;
  font-size: 14px;
  line-height: 1.5;
}
.oe-dot-key {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 2px solid #fff0c9;
  border-radius: 50%;
  background: #e9c894;
}
.oe-bench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.36fr);
  gap: 16px;
  align-items: start;
}
.oe-canvas-col,
.oe-field,
.oe-controls {
  min-width: 0;
}
.oe-canvas {
  position: relative;
  border: 1px solid var(--line, #38313f);
  border-radius: 8px;
  overflow: hidden;
  background: #131218;
}
.oe-stage {
  display: block;
  width: 100%;
  height: clamp(260px, 59dvh, 720px);
  touch-action: none;
  cursor: crosshair;
}
.oe-stage:focus-visible {
  outline: 2px solid var(--lav, #c0a9e7);
  outline-offset: -3px;
}
.oe-ink {
  fill: #cfb18a;
  pointer-events: none;
}
.oe-ghost,
.oe-edge,
.oe-hit path {
  fill: none;
  vector-effect: non-scaling-stroke;
}
.oe-edge {
  stroke: #ceb4f4;
  stroke-width: 1.2;
  pointer-events: none;
}
.oe-ghost {
  stroke: #72b4b0;
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
  visibility: hidden;
  pointer-events: none;
}
.oe-visible {
  visibility: visible;
}
.oe-hit path {
  stroke: transparent;
  stroke-width: 15;
  pointer-events: stroke;
}
.oe-points circle {
  fill: #d7c2f2;
  stroke: #302039;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  cursor: grab;
}
.oe-points .oe-active {
  fill: #e9c894;
  stroke: #fff1d0;
  stroke-width: 2;
}
.oe-scale {
  position: absolute;
  bottom: 8px;
  right: 9px;
  padding: 2px 6px;
  background: #17151de8;
  border: 1px solid #423849;
  color: #ddc4a2;
  font: 10px/1.4 var(--mono, monospace);
  border-radius: 3px;
  pointer-events: none;
}
.oe-controls,
.oe-field {
  display: grid;
  gap: 6px;
}
.oe-controls {
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line, #44384b);
  border-radius: 8px;
  background: #1c1822;
}
.oe-field {
  font: 500 12px/1.4 var(--sans, system-ui);
  color: #ded4e7;
}
.oe button,
.oe select,
.oe input[type="number"] {
  min-width: 0;
  min-height: 44px;
  border-radius: 7px;
  border: 1px solid #5b4d68;
}
.oe input[type="number"],
.oe select {
  width: 100%;
  padding: 9px;
  color: var(--ink, #eee9e6);
  background: var(--field, #121117);
  font: 16px/1.3 var(--sans, system-ui);
  font-variant-numeric: tabular-nums;
}
.oe button {
  padding: 9px 11px;
  background: #302938;
  color: #f1eaf7;
  font:
    550 13px/1.35 system-ui,
    sans-serif;
  cursor: pointer;
}
.oe button:hover:not(:disabled) {
  border-color: var(--gold, #c8ac83);
}
.oe button:disabled {
  opacity: 0.42;
  cursor: default;
}
.oe button:focus-visible,
.oe input:focus-visible,
.oe select:focus-visible {
  outline: 2px solid var(--lav, #c0a9e7);
  outline-offset: 1px;
}
.oe button.primary {
  color: #211927;
  background: var(--lav, #c0a9e7);
  border-color: var(--lav, #c0a9e7);
  font-weight: 650;
}
.oe-step,
.oe-tools,
.oe-footer {
  display: flex;
  align-items: center;
  gap: 6px;
}
.oe-coords,
.oe-local,
.oe-nudge {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.oe-nudge {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.oe-step button,
.oe-nudge button {
  min-width: 44px;
  padding: 3px;
  font-size: 22px;
}
.oe-tools {
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 10px;
}
.oe-tools button span, .oe-local button span {
  margin-right: 4px;
  font-size: 17px;
}
.oe-after-canvas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.oe-ghost-toggle {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 44px;
  color: #d2c6dc;
  font-size: 12px;
  cursor: pointer;
}
.oe-ghost-toggle input {
  width: 19px;
  height: 19px;
  accent-color: var(--lav, #c0a9e7);
}
.oe-control-title h3 {
  margin: 0 0 5px;
  color: #ecdeef;
  font: 600 16px/1.3 var(--sans, system-ui);
}
.oe-control-title output {
  color: var(--gold, #c8ac83);
  font: 12px/1.4 var(--sans, system-ui);
}
.oe-resets {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line, #44384b);
}
.oe .oe-keyboard-tip {
  margin: 0;
  color: #b6a8c1;
  font-size: 12px;
  line-height: 1.5;
}
.oe .oe-guide {
  margin: 11px 0;
  color: var(--muted, #aaa4b1);
  font-size: 12px;
}
.oe-footer {
  border-top: 1px solid var(--line, #38313f);
  padding: 16px 0 2px;
  flex-wrap: wrap;
}
.oe-footer output {
  flex: 1 1 130px;
  font: 13px/1.5 var(--sans, system-ui);
  color: var(--gold, #c8ac83);
}
.oe-footer button {
  padding: 10px 18px;
}
.oe-footer button.primary {
  min-width: 165px;
  font-size: 14px;
}
.oe-tools button[data-choice="fit"] {
  color: #eddefc;
  border-color: #9a80b4;
  background: #40304f;
}
@media (max-width: 640px) {
  .oe-bench {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .oe-stage {
    height: clamp(240px, 48dvh, 500px);
  }
  .oe-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
    align-items: end;
  }
  .oe-control-title, .oe-coords, .oe-resets,
  .oe-controls > .oe-field:has(.oe-nudge), .oe-keyboard-tip {
    grid-column: 1 / -1;
  }
  .oe-step {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 3px;
  }
  .oe-step button {
    min-width: 44px;
  }
  .oe-step input {
    padding: 5px 2px;
    text-align: center;
  }
  .oe-resets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .oe-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .oe-tools button { padding-inline: 6px; }
  .oe-footer output { flex-basis: 100%; }
  .oe-footer button { flex: 1; }
  .oe-footer button.primary { min-width: 0; }
}
@media (max-width: 400px) {
  .oe-controls > .oe-field {
    grid-column: 1 / -1;
  }
}
