/* ==========================================================================
   XingShu Quant (星枢量化) — Unified Curve Hover Pill, Viewport Zoom & Brush v3.0
   Shared 1:1 across EA Control (/admin), Developer H5 (/h5) & Storefront (/portal)
   ========================================================================== */

[data-xsc-stage] {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  cursor: crosshair;
}

[data-xsc-stage].is-xsc-zoomed {
  cursor: grab;
}

[data-xsc-stage].is-xsc-panning,
[data-xsc-stage].is-xsc-panning * {
  cursor: grabbing !important;
}

.is-xsc-hovering [data-xsc-axis="y"] {
  opacity: 0.22;
  transition: opacity 0.14s ease;
}

.xsc-box-select {
  position: absolute;
  top: 10px;
  bottom: 24px;
  z-index: 7;
  display: none;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.18), rgba(52, 211, 153, 0.08));
  border-left: 1.5px solid rgba(56, 189, 248, 0.90);
  border-right: 1.5px solid rgba(52, 211, 153, 0.90);
  border-top: 1px dashed rgba(56, 189, 248, 0.42);
  border-bottom: 1px dashed rgba(52, 211, 153, 0.42);
  border-radius: 4px;
}

.xsc-stage-toolbar {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  border-radius: 7px;
  background: rgba(12, 13, 17, 0.90);
  border: 1px solid rgba(63, 63, 75, 0.65);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.48);
  pointer-events: auto;
}

.xsc-st-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #a1a1aa;
  border-radius: 5px;
  padding: 2px 6px;
  min-width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.xsc-st-btn:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.42);
  color: #f4f4f5;
}

.xsc-st-btn.is-reset {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.32);
  background: rgba(56, 189, 248, 0.10);
  padding: 2px 7px;
}

.xsc-st-btn.hidden {
  display: none !important;
}

.xsc-hover-pill {
  position: absolute;
  top: 9px;
  left: 56px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 7px;
  background: rgba(12, 13, 18, 0.94);
  border: 1px solid rgba(63, 70, 90, 0.72);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.62);
  font-family: var(--xs-font-mono, "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  line-height: 1.3;
  color: #a1a1aa;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 72px);
  opacity: 0;
  transform: translate3d(0, -2px, 0);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.xsc-hover-pill.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.xsc-hover-pill.align-right {
  left: auto;
  right: 14px;
  top: 35px;
}

.xsc-hover-pill.is-compact {
  top: 4px;
  left: 40px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  max-width: calc(100% - 108px);
}

.xsc-hover-pill.is-compact.align-right {
  left: auto;
  right: 8px;
  top: 25px;
}

.xsc-hover-pill .xsc-hp-time { color: #a1a1aa; }
.xsc-hover-pill .xsc-hp-sep { color: #52525b; }
.xsc-hover-pill .xsc-hp-val { font-weight: 700; color: #f4f4f5; }
.xsc-hover-pill .xsc-hp-val.pos { color: #34d399; }
.xsc-hover-pill .xsc-hp-val.neg { color: #fb7185; }
.xsc-hover-pill .xsc-hp-sub { color: #94a3b8; font-size: 10.5px; font-weight: 500; }

/* Unified Draggable Timeline Scrubber / Detail Navigator */
.xsc-brush-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
  user-select: none;
  -webkit-user-select: none;
}

.xsc-brush-track {
  position: relative;
  height: 28px;
  border-radius: 7px;
  background: #09090b;
  border: 1px solid #242630;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}

.xsc-brush-mini-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.xsc-brush-mask {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(5, 6, 9, 0.74);
  pointer-events: none;
}
.xsc-brush-mask.is-left { left: 0; }
.xsc-brush-mask.is-right { right: 0; }

.xsc-brush-win {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(52, 211, 153, 0.13));
  border-top: 1.5px solid rgba(56, 189, 248, 0.58);
  border-bottom: 1.5px solid rgba(52, 211, 153, 0.58);
  cursor: grab;
  touch-action: none;
}
.xsc-brush-win:active {
  cursor: grabbing;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.19), rgba(52, 211, 153, 0.20));
}

.xsc-brush-handle {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 22px;
  margin-left: -11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 3;
  touch-action: none;
}
.xsc-brush-handle::before {
  content: "";
  width: 8px;
  height: 18px;
  border-radius: 4px;
  background: #161820;
  border: 1px solid rgba(56, 189, 248, 0.78);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  transition: background 0.14s, border-color 0.14s, transform 0.14s;
}
.xsc-brush-handle::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 8px;
  background: #7dd3fc;
  border-radius: 1px;
  pointer-events: none;
}
.xsc-brush-handle:hover::before,
.xsc-brush-handle.is-dragging::before {
  background: #232734;
  border-color: #34d399;
  transform: scaleY(1.1);
}

.xsc-brush-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 18px;
  font-size: 11px;
  color: #71717a;
}

.xsc-brush-span {
  font-family: var(--xs-font-mono, "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace);
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  font-size: 10.5px;
}

.xsc-brush-reset {
  border: 1px solid rgba(56, 189, 248, 0.36);
  background: rgba(56, 189, 248, 0.11);
  color: #7dd3fc;
  border-radius: 5px;
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.45;
  transition: background 0.14s, color 0.14s;
}
.xsc-brush-reset:hover {
  background: rgba(56, 189, 248, 0.22);
  color: #f4f4f5;
}
.xsc-brush-reset.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .xsc-hover-pill {
    left: 8px;
    top: 6px;
    font-size: 10.5px;
    padding: 3px 8px;
    max-width: calc(100% - 16px);
  }
  .xsc-hover-pill.align-right {
    right: 8px;
    top: 34px;
  }
  .xsc-hover-pill.is-compact {
    left: 6px;
    top: 3px;
    max-width: calc(100% - 12px);
  }
  .xsc-brush-track {
    height: 32px;
  }
  .xsc-brush-handle {
    width: 30px;
    margin-left: -15px;
  }
  .xsc-st-btn {
    min-width: 26px;
    height: 24px;
  }
}


/* Compact Card-Level Zoom Toolbar (subtle on hover, persistent when zoomed) */
.xsc-stage-toolbar.is-compact-tb {
  top: 4px;
  right: 6px;
  padding: 1px 3px;
  gap: 2px;
  border-radius: 6px;
  background: rgba(11, 12, 16, 0.86);
  border-color: rgba(63, 68, 84, 0.55);
  opacity: 0;
  transition: opacity 0.16s ease;
}
[data-xsc-stage]:hover > .xsc-stage-toolbar.is-compact-tb,
[data-xsc-stage].is-xsc-zoomed > .xsc-stage-toolbar.is-compact-tb {
  opacity: 1;
}
.xsc-stage-toolbar.is-compact-tb .xsc-st-btn {
  min-width: 19px;
  height: 18px;
  padding: 0 4px;
  font-size: 10px;
}
