.es-case-chart {
  min-width: 0;
}

.es-chart-figure {
  margin: 0;
}

.es-chart-display {
  overflow: hidden;
  border: 1px solid var(--line, #d4dfdb);
  border-radius: 10px;
  background: #ffffff;
}

.es-chart-graphic {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  background: #ffffff;
}

.es-chart-layer.is-off {
  visibility: hidden;
}

.es-chart-layer.is-off :is(.es-chart-mask, .es-chart-mask-edge, .es-chart-mask-label, .es-chart-mask-sub) {
  visibility: visible;
}

:root[data-theme="dark"] .es-chart-mask { fill: var(--surface-subtle); }
:root[data-theme="dark"] :is(.es-chart-display, .es-chart-graphic) { background: var(--surface); }
:root[data-theme="dark"] :is(.es-chart-mask-label, .es-chart-mask-sub, .es-chart-k) { fill: var(--ink); }
:root[data-theme="dark"] :is(.es-chart-legend, .es-chart-error, .es-chart-loading) { background: var(--surface-subtle); }
:root[data-theme="dark"][data-eyecare="1"] .es-chart-crop image { filter: brightness(.78); }

.es-chart-boundary {
  stroke: #0f5c82;
  stroke-width: 1.75;
  stroke-dasharray: 7 4;
}

.es-chart-boundary.es-chart-secondary {
  stroke: #9c5321;
  stroke-dasharray: 4 3;
}

.es-chart-boundary.es-chart-invalid {
  stroke: #c0392b;
  stroke-width: 1.9;
  stroke-dasharray: 3 3;
}

.es-chart-boundary.es-chart-target {
  stroke: #1b7a58;
  stroke-dasharray: 6 3;
}

.es-chart-boundary.es-chart-line-active {
  stroke-width: 2.9;
  stroke-dasharray: none;
}

.es-chart-boundary-label {
  fill: #0d4b6a;
  stroke: #ffffff;
  stroke-width: 4;
  paint-order: stroke fill;
  font: 700 11.5px "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.es-chart-boundary-label.es-chart-secondary { fill: #7f4118; }
.es-chart-boundary-label.es-chart-invalid { fill: #a3261a; }
.es-chart-boundary-label.es-chart-target { fill: #156246; }
.es-chart-boundary-label.es-chart-line-active { font-size: 12.5px; }

.es-chart-candle,
.es-chart-point {
  fill: none;
  stroke: #176188;
  stroke-width: 1.15;
}

.es-chart-cursor {
  fill: rgba(217, 130, 43, 0.22);
  stroke: rgba(196, 108, 22, 0.72);
  stroke-width: 1.1;
}

.es-chart-tick {
  stroke: #6e8896;
  stroke-width: 1;
}

.es-chart-candle.es-chart-selected,
.es-chart-point.es-chart-selected,
.es-chart-tick.es-chart-selected {
  stroke: #b55b14;
  stroke-width: 2;
}

.es-chart-k {
  text-anchor: middle;
  fill: #20495d;
  font: 700 11px "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  cursor: pointer;
}

.es-chart-k:hover { fill: #0f5c82; }

.es-chart-k.es-chart-selected {
  fill: #a64a0a;
  font-size: 13px;
}

/* 停点遮罩与揭晓分界线 */
.es-chart-mask {
  fill: #f3f6f5;
  opacity: 1;
}

.es-chart-mask-edge {
  stroke: #24685e;
  stroke-width: 1.65;
  stroke-dasharray: 5 3;
}

.es-chart-mask-label {
  fill: #1f534b;
  font: 700 13px "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  text-anchor: middle;
}

.es-chart-mask-label-end { text-anchor: end; }

.es-chart-mask-sub {
  fill: #5a736e;
  font: 500 11px "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  text-anchor: middle;
}

.es-chart-revealed-edge {
  stroke: #5b7b76;
  stroke-width: 1.35;
  stroke-dasharray: 4 3;
}

.es-chart-revealed-tag {
  fill: #245c53;
  stroke: #ffffff;
  stroke-width: 3.5;
  paint-order: stroke fill;
  font: 700 11px "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.es-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 8px;
  padding: 6px 10px;
  background: #f6f9f8;
  border: 1px solid #e0e8e5;
  border-radius: 7px;
  font-size: 12px;
  color: #465d63;
}

.es-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.es-legend-swatch {
  display: inline-block;
  width: 15px;
  height: 0;
  border-top: 2px dashed #0f5c82;
}

.es-legend-swatch.is-secondary { border-top-color: #9c5321; }
.es-legend-swatch.is-invalid { border-top: 2px dotted #c0392b; }
.es-legend-swatch.is-target { border-top-color: #1b7a58; }

.es-legend-swatch.is-mask {
  height: 11px;
  border: 1px dashed #24685e;
  background: #eef3f1;
  border-radius: 2px;
}

.es-legend-swatch.is-divider {
  width: 0;
  height: 12px;
  border-top: 0;
  border-left: 2px dashed #5b7b76;
}

.es-legend-hint {
  color: #6b7f85;
  margin-left: auto;
}

.es-chart-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 6px 8px;
  margin: 8px 0 0;
}

.es-case-chart .es-chart-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
  color: #42595e;
}

.es-case-chart .es-chart-controls input {
  width: auto;
  height: auto;
  margin: 0;
  accent-color: #1d645b;
}

.es-case-chart .es-chart-controls select,
.es-case-chart .es-chart-controls button {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 7px;
}

.es-case-chart .es-chart-status {
  min-height: 1.25em;
  margin: 5px 0 0;
  line-height: 1.4;
}

/* 全屏高清触控灯箱（支持双指捏合缩放 + 横屏自适应 + 零变形） */
.es-chart-dialog {
  box-sizing: border-box;
  width: min(1140px, calc(100vw - 24px));
  height: min(90dvh, 840px);
  max-width: 100vw;
  max-height: 100dvh;
  padding: 14px 16px;
  border: 1px solid #304744;
  border-radius: 12px;
  background: #132220;
  color: #edf4f2;
}

.es-chart-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.es-chart-dialog::backdrop {
  background: rgba(10, 22, 20, 0.78);
}

.es-chart-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.es-dialog-title {
  font-size: 15px;
  line-height: 1.35;
  color: #ffffff;
}

.es-chart-dialog .es-chart-close,
.es-chart-dialog .es-dialog-toolbar button,
.es-chart-dialog .es-dialog-toolbar select {
  background: #1d3532;
  border-color: #365753;
  color: #eef5f3;
}

.es-chart-dialog .es-dialog-toolbar button:hover {
  background: #284b46;
  border-color: #62988e;
  color: #ffffff;
}

.es-chart-dialog .es-dialog-toolbar label {
  color: #cde0dc;
}

.es-dialog-toolbar {
  margin: 0;
}

.es-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.es-chart-zoom-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #0d1817;
  border: 1px solid #2b4542;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  cursor: zoom-in;
}

.es-chart-zoom-viewport.is-zoomed {
  cursor: grab;
}

.es-chart-zoom-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.es-chart-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.es-chart-dialog .es-chart-legend {
  margin: 0;
  background: #1a2f2d;
  border-color: #2f4e4a;
  color: #cde0dc;
}

.es-chart-dialog .es-legend-hint {
  color: #9cbab4;
}

.es-dialog-links {
  margin: 0;
  color: #9cbab4;
}

.es-dialog-links a {
  color: #8fd9c8;
}

.es-chart-error,
.es-chart-loading {
  border: 1px solid var(--line, #d4dfdb);
  border-radius: 10px;
  background: #ffffff;
  padding: 1rem;
  margin: 0;
}

.es-case-chart > .es-chart-loading {
  aspect-ratio: 520 / 342;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 手机竖屏清晰大字号与全屏贴边灯箱 */
@media (max-width: 640px) {
  .es-chart-boundary-label {
    font-size: 13px;
  }
  .es-chart-k {
    font-size: 12.5px;
  }
  .es-chart-k.es-chart-selected {
    font-size: 14.5px;
  }
  .es-chart-mask-label {
    font-size: 14px;
  }
  .es-chart-mask-sub {
    font-size: 11.5px;
  }
  .es-legend-hint {
    margin-left: 0;
    width: 100%;
  }
  .es-chart-dialog {
    width: 100vw;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .es-dialog-title {
    font-size: 13.5px;
  }
}
