/* Pattern Universe modal visual upgrade: independent schematic/candle simulator */
#modal-card {
  width: min(1380px, 96vw);
  max-height: min(92vh, 980px);
}

#modal-inner {
  grid-template-columns: minmax(340px, 0.82fr) minmax(560px, 1.42fr);
}

.modal-right {
  padding: 12px;
  background:
    radial-gradient(circle at 20% 18%, rgba(0, 245, 255, 0.13), transparent 34%),
    radial-gradient(circle at 84% 72%, rgba(255, 45, 117, 0.10), transparent 32%),
    linear-gradient(135deg, rgba(5, 12, 30, 0.96), rgba(5, 7, 20, 0.97));
}

#modal-viewport {
  min-height: 520px;
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 245, 255, 0.11), transparent 38%),
    linear-gradient(135deg, rgba(2, 7, 18, 0.98), rgba(6, 8, 25, 0.96));
}

.modal-mode-toggle {
  z-index: 80;
  right: 18px;
  top: 16px;
  background: rgba(3, 9, 22, 0.76);
  border-color: rgba(53, 247, 255, 0.24);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.modal-mode-toggle button.active {
  background: linear-gradient(135deg, rgba(53, 247, 255, 0.96), rgba(10, 255, 136, 0.88));
  box-shadow: 0 0 18px rgba(53, 247, 255, 0.38);
}

#modal-viewport.sky-pro-active #modal-chart2d,
#modal-viewport.sky-pro-active > canvas {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#modal-viewport.sky-pro-active .modal-caption {
  z-index: 82;
  color: rgba(210, 248, 255, 0.88);
}

.sky-pro-stage {
  position: absolute;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 50%, rgba(53, 247, 255, 0.09), transparent 40%),
    linear-gradient(180deg, rgba(2, 8, 18, 0.14), rgba(1, 4, 12, 0.82));
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.sky-pro-stage.is-hidden {
  opacity: 0;
  transform: scale(0.985);
  visibility: hidden;
}

.sky-pro-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(53, 247, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 247, 255, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at 50% 45%, black 0 58%, transparent 82%);
  opacity: 0.65;
}

.sky-pro-hud {
  position: absolute;
  left: 24px;
  top: 22px;
  right: 190px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.sky-pro-kicker {
  display: block;
  margin-bottom: 4px;
  color: rgba(53, 247, 255, 0.78);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.sky-pro-title {
  display: block;
  color: #f5fbff;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sky-pro-meta {
  display: block;
  max-width: 620px;
  margin-top: 5px;
  color: rgba(184, 194, 230, 0.72);
  font-size: 11px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sky-pro-quality {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(53, 247, 255, 0.22);
  border-radius: 999px;
  background: rgba(4, 12, 26, 0.62);
  color: rgba(230, 250, 255, 0.82);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sky-pro-quality span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0aff88;
  box-shadow: 0 0 14px rgba(10, 255, 136, 0.8);
}

.sky-pro-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.sky-pro-bottom {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 14px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sky-pro-bottom span {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(53, 247, 255, 0.16);
  background: rgba(5, 13, 28, 0.55);
  color: rgba(205, 225, 236, 0.72);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sky-pro-grid-line {
  stroke: rgba(124, 158, 255, 0.09);
  stroke-width: 1;
}

.sky-pro-grid-line.vertical {
  stroke: rgba(53, 247, 255, 0.055);
}

.sky-pro-radar-ring {
  fill: none;
  stroke: rgba(53, 247, 255, 0.12);
  stroke-width: 1.4;
  stroke-dasharray: 10 15;
  animation: skyProDash 16s linear infinite;
}

.sky-pro-radar-ring.wide {
  stroke: rgba(255, 209, 92, 0.09);
  animation-duration: 22s;
  animation-direction: reverse;
}

.sky-pro-zone {
  opacity: 0;
  fill: rgba(255, 209, 92, 0.10);
  stroke: rgba(255, 209, 92, 0.42);
  stroke-width: 1.5;
  animation: skyProFadeIn 0.55s ease forwards;
}

.sky-pro-zone.bull {
  fill: rgba(10, 255, 136, 0.11);
  stroke: rgba(10, 255, 136, 0.48);
}

.sky-pro-zone.bear {
  fill: rgba(255, 77, 106, 0.12);
  stroke: rgba(255, 77, 106, 0.50);
}

.sky-pro-level {
  opacity: 0;
  stroke: rgba(255, 209, 92, 0.82);
  stroke-width: 2;
  stroke-linecap: round;
  animation: skyProFadeIn 0.45s ease forwards;
}

.sky-pro-level.bull { stroke: rgba(10, 255, 136, 0.86); }
.sky-pro-level.bear { stroke: rgba(255, 77, 106, 0.88); }
.sky-pro-level.dashed { stroke-dasharray: 10 10; }

.sky-pro-path {
  fill: none;
  stroke: #ffd15c;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1800;
  stroke-dashoffset: 1800;
  animation: skyProDraw 1.45s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.sky-pro-path.aura {
  stroke-width: 17;
  opacity: 0.16;
  animation-duration: 1.6s;
}

.sky-pro-path.bull { stroke: #0aff88; }
.sky-pro-path.bear { stroke: #ff4d6a; }
.sky-pro-path.neutral { stroke: #ffd15c; }

.sky-pro-node {
  opacity: 0;
  fill: #ffd15c;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 2;
  animation: skyProNodeIn 0.38s ease forwards;
}

.sky-pro-node.bull { fill: #0aff88; }
.sky-pro-node.bear { fill: #ff4d6a; }

.sky-pro-arrow {
  opacity: 0;
  fill: #ffd15c;
  filter: drop-shadow(0 0 18px rgba(255, 209, 92, 0.65));
  animation: skyProPop 0.45s cubic-bezier(0.2, 1.2, 0.2, 1) forwards;
}

.sky-pro-arrow.bull {
  fill: #0aff88;
  filter: drop-shadow(0 0 18px rgba(10, 255, 136, 0.7));
}

.sky-pro-arrow.bear {
  fill: #ff4d6a;
  filter: drop-shadow(0 0 18px rgba(255, 77, 106, 0.7));
}

.sky-pro-label {
  opacity: 0;
  animation: skyProLabelIn 0.45s ease forwards;
}

.sky-pro-label rect {
  fill: rgba(6, 12, 28, 0.86);
  stroke: rgba(255, 209, 92, 0.50);
  stroke-width: 1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.28));
}

.sky-pro-label.bull rect { stroke: rgba(10, 255, 136, 0.58); }
.sky-pro-label.bear rect { stroke: rgba(255, 77, 106, 0.58); }

.sky-pro-label text {
  fill: #eaf9ff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.035em;
  dominant-baseline: middle;
}

.sky-pro-execution-corridor {
  opacity: 0;
  stroke: rgba(53, 247, 255, 0.28);
  stroke-width: 1;
  animation: skyProFadeIn 0.45s ease 0.72s forwards;
}

.sky-pro-trade-line {
  stroke-width: 2;
  stroke-dasharray: 8 8;
  opacity: 0;
  animation: skyProFadeIn 0.45s ease 0.86s forwards;
}

.sky-pro-trade-line.entry { stroke: #ffd15c; }
.sky-pro-trade-line.entry.bull { stroke: #0aff88; }
.sky-pro-trade-line.entry.bear { stroke: #ff4d6a; }
.sky-pro-trade-line.tp { stroke: #0aff88; }
.sky-pro-trade-line.sl { stroke: #ff4d6a; }

.sky-pro-wick {
  opacity: 0;
  stroke-width: 2;
  stroke: rgba(255, 255, 255, 0.48);
  animation: skyProCandleIn 0.32s ease forwards;
}

.sky-pro-candle {
  opacity: 0;
  fill: #0aff88;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1;
  animation: skyProCandleIn 0.32s ease forwards;
}

.sky-pro-candle.bear { fill: #ff4d6a; }
.sky-pro-wick.bull { stroke: rgba(10, 255, 136, 0.64); }
.sky-pro-wick.bear { stroke: rgba(255, 77, 106, 0.64); }

.sky-pro-candle-outline {
  fill: none;
  stroke-width: 2.4;
  stroke: rgba(255, 209, 92, 0.72);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: skyProDraw 1.1s ease 0.35s forwards;
}

.sky-pro-candle-outline.bull { stroke: rgba(10, 255, 136, 0.75); }
.sky-pro-candle-outline.bear { stroke: rgba(255, 77, 106, 0.75); }

@keyframes skyProDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes skyProDash {
  to { stroke-dashoffset: -260; }
}

@keyframes skyProFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes skyProNodeIn {
  0% { opacity: 0; transform: scale(0.35); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes skyProLabelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes skyProPop {
  from { opacity: 0; transform: scale(0.55); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes skyProCandleIn {
  from { opacity: 0; transform: scaleY(0.35); }
  to { opacity: 1; transform: scaleY(1); }
}

@media (max-width: 1000px) {
  #modal-inner {
    grid-template-columns: 1fr;
  }
  #modal-viewport {
    min-height: 480px;
  }
  .sky-pro-hud {
    right: 18px;
  }
}

@media (max-width: 640px) {
  #modal-viewport {
    min-height: 390px;
  }
  .sky-pro-hud {
    left: 14px;
    top: 58px;
    right: 14px;
    flex-direction: column;
  }
  .sky-pro-meta {
    max-width: 86vw;
  }
  .sky-pro-bottom {
    display: none;
  }
  .sky-pro-label text {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sky-pro-stage *,
  .sky-pro-radar-ring,
  .sky-pro-path,
  .sky-pro-label,
  .sky-pro-node,
  .sky-pro-arrow,
  .sky-pro-candle,
  .sky-pro-wick {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
}
