:root {
  color-scheme: dark;
  --bg: #080d15;
  --panel: #101722;
  --panel-2: #0c131d;
  --line: #243246;
  --line-soft: #1a2636;
  --text: #edf4ff;
  --muted: #95a6bd;
  --soft: #65758b;
  --buy: #19c37d;
  --buy-2: #2dd4bf;
  --sell: #ff5c73;
  --exit: #ffb020;
  --entry: #4f8cff;
  --tp: #8bffcd;
  --hold: #f5c451;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Pretendard, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

.futuresShell {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.eyebrow,
.subtitle,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  color: var(--entry);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  margin-top: 4px;
  font-size: clamp(30px, 3.2vw, 48px);
  line-height: 1.05;
}

.subtitle {
  margin-top: 9px;
  max-width: 780px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

.topLinks {
  display: flex;
  gap: 8px;
}

.topLinks a,
.modeBadge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #0c131d;
  text-decoration: none;
  white-space: nowrap;
}

.modeBadge {
  color: var(--buy);
  border-color: rgba(25, 195, 125, 0.5);
  font-weight: 800;
}

.strategyLabPanel {
  border: 1px solid #27405f;
  background: linear-gradient(180deg, rgba(12, 22, 35, 0.96), rgba(8, 13, 21, 0.96));
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}

.strategyLabHeader {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.strategyLabHeader h2 {
  margin: 2px 0 6px;
  font-size: 22px;
}

.strategyLabHeader p {
  margin: 0;
  color: #aebdd0;
}

.strategyModeBadge {
  flex: 0 0 auto;
  border: 1px solid #365f9d;
  background: #10213a;
  color: #d8e8ff;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 900;
}

.strategyLabGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.strategyLabGrid > div {
  border: 1px solid #1d3350;
  background: #08111d;
  border-radius: 8px;
  padding: 10px;
}

.strategyLabGrid span {
  display: block;
  color: #92a5bc;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 7px;
}

.strategyLabGrid strong {
  color: #f7fbff;
  font-size: 16px;
}

.strategyReasonBox {
  margin-top: 10px;
  border: 1px solid #1e3653;
  background: #09121e;
  border-radius: 8px;
  padding: 11px 12px;
  color: #bdd0e9;
  line-height: 1.55;
}

.mainNav a[aria-current="page"] {
  border-color: rgba(79, 140, 255, 0.8);
  background: rgba(79, 140, 255, 0.16);
}

.controlPanel {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(440px, 1fr) minmax(180px, auto) minmax(180px, auto);
  gap: 10px;
  margin-bottom: 10px;
}

.phase621Panel {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 10px;
  margin: 10px 0;
}

.phase621Card {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(99, 166, 255, 0.38);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(18, 31, 50, 0.98), rgba(13, 20, 31, 0.98));
}

.phase621Header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.phase621Header h2 {
  margin-top: 3px;
  font-size: 20px;
}

.phase621Header p:not(.tinyLabel) {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.phase621Status,
.referenceBadge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(139, 255, 205, 0.34);
  border-radius: 8px;
  background: rgba(25, 195, 125, 0.12);
  color: #9ffbd3;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.phase621Status.dryRun,
.referenceBadge {
  border-color: rgba(245, 196, 81, 0.36);
  background: rgba(245, 196, 81, 0.12);
  color: #f9d67b;
}

.phase621MetricGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.shadowCompareGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.shadowCompareGrid div {
  min-width: 0;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
}

.shadowCompareGrid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.shadowCompareGrid strong {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.apiSourceLine {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.legacyReplayCard {
  border-color: rgba(245, 196, 81, 0.32);
}

.legacyReplayCard .cardTitle {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.controlGroup,
.signalCard,
.viabilityCard,
.levelCard,
.dataBridgePanel,
.chartPanel,
.reasonCard,
.costCard,
.backtestCard,
.scoreBreakdownCard,
.sourceMapPanel .analysisCard,
.apiCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.controlGroup {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  min-width: 0;
}

.compactControl {
  justify-content: flex-start;
}

.perTradeTargetControl {
  display: grid;
  grid-template-columns: auto 76px auto;
  align-items: center;
}

.perTradeTargetControl .controlHint {
  grid-column: 1 / -1;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.2;
}

.targetProfitInput {
  width: 76px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 900;
}

.actionHint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.actionChip small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.1;
}

.controlSuffix {
  color: var(--muted);
  font-weight: 900;
}

.controlLabel {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: #0a111b;
  cursor: pointer;
}

.segmented button:hover {
  color: var(--text);
  border-color: #2d3c52;
}

.segmented button.isActive {
  color: var(--text);
  border-color: rgba(79, 140, 255, 0.75);
  background: rgba(79, 140, 255, 0.18);
}

.executionBoard {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(320px, 0.55fr) minmax(380px, 0.8fr);
  gap: 10px;
  margin-bottom: 10px;
}

.dailyTargetPanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(79, 140, 255, 0.08), rgba(16, 23, 34, 0.98));
  padding: 14px;
  margin-bottom: 10px;
}

.dailyTargetHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.dailyTargetHeader h2 {
  margin-top: 3px;
  font-size: 20px;
}

.dailyTargetHeader p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dailyStatusBadge {
  min-width: 150px;
  padding: 9px 12px;
  border: 1px solid rgba(79, 140, 255, 0.55);
  border-radius: 8px;
  background: rgba(79, 140, 255, 0.14);
  color: var(--text);
  text-align: center;
  font-weight: 900;
}

.dailyStatusBadge.isStop {
  border-color: rgba(255, 92, 115, 0.55);
  background: rgba(255, 92, 115, 0.14);
}

.dailyStatusBadge.isDone {
  border-color: rgba(25, 195, 125, 0.55);
  background: rgba(25, 195, 125, 0.14);
}

.dailyTargetControls {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto auto auto;
  gap: 8px;
  align-items: end;
}

.dailyTargetControls label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.dailyTargetControls span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.dailyTargetControls input {
  width: 100%;
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  font-weight: 900;
}

.dailyTargetControls button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #0a111b;
  cursor: pointer;
  font-weight: 900;
}

.dailyTargetControls button:hover {
  border-color: rgba(79, 140, 255, 0.7);
}

.dailyTargetControls button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.dailySaveStatus {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 140, 255, 0.42);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(79, 140, 255, 0.08);
  font-size: 13px;
  font-weight: 800;
  min-height: 48px;
}

.dailySaveStatus strong {
  color: var(--text);
  white-space: nowrap;
  font-size: 15px;
}

.dailySaveStatus span {
  min-width: 0;
  line-height: 1.35;
}

.dailySaveStatus.isGood {
  color: var(--buy);
  border-color: rgba(25, 195, 125, 0.68);
  background: rgba(25, 195, 125, 0.12);
  box-shadow: inset 0 0 0 1px rgba(25, 195, 125, 0.2);
}

.dailySaveStatus.isBad {
  color: var(--sell);
  border-color: rgba(255, 92, 115, 0.68);
  background: rgba(255, 92, 115, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 92, 115, 0.2);
}

.dailySaveStatus.isBusy {
  color: var(--entry);
  border-color: rgba(79, 140, 255, 0.8);
  background: rgba(79, 140, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(79, 140, 255, 0.22);
}

.dailySaveStatus.isReady {
  border-style: dashed;
}

.dailyTargetPanel.flashGood {
  animation: dailyFlashGood 0.85s ease;
}

.dailyTargetPanel.flashBad {
  animation: dailyFlashBad 0.85s ease;
}

@keyframes dailyFlashGood {
  0% { box-shadow: 0 0 0 rgba(25, 195, 125, 0); }
  35% { box-shadow: 0 0 0 3px rgba(25, 195, 125, 0.34); }
  100% { box-shadow: 0 0 0 rgba(25, 195, 125, 0); }
}

@keyframes dailyFlashBad {
  0% { box-shadow: 0 0 0 rgba(255, 92, 115, 0); }
  35% { box-shadow: 0 0 0 3px rgba(255, 92, 115, 0.34); }
  100% { box-shadow: 0 0 0 rgba(255, 92, 115, 0); }
}

.dailyProgress {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.dailyProgressTrack {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #07101a;
  border: 1px solid var(--line-soft);
}

.dailyProgressTrack div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--entry), var(--buy));
  transition: width 0.25s ease;
}

.dailyProgress > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dailyMetricGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.dailyMetricGrid div,
.dailyPositionBox {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8, 13, 21, 0.62);
  padding: 10px;
}

.dailyMetricGrid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 6px;
}

.dailyMetricGrid strong {
  font-size: 16px;
}

.dailyPositionBox {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.backtestNote {
  margin: 7px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.signalCard,
.viabilityCard,
.levelCard,
.reasonCard,
.costCard,
.backtestCard,
.apiCard,
.chartPanel {
  padding: 14px;
}

.signalCard {
  border-color: #314052;
}

.signalCard.isBuy {
  border-color: rgba(25, 195, 125, 0.62);
}

.signalCard.isSell {
  border-color: rgba(255, 92, 115, 0.62);
}

.signalCard.isHold {
  border-color: rgba(245, 196, 81, 0.58);
}

.signalMeta,
.sectionHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.signalMeta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.signalMain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
}

.tinyLabel {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

#mainSignal {
  margin-top: 5px;
  font-size: clamp(42px, 5.4vw, 74px);
  line-height: 0.95;
  white-space: nowrap;
}

.isBuy #mainSignal {
  color: var(--buy);
}

.isSell #mainSignal {
  color: var(--sell);
}

.isHold #mainSignal {
  color: var(--hold);
}

.signalReason {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.strengthBox,
.viabilityScore {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 108px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.strengthBox span,
.viabilityScore strong {
  font-size: 28px;
  font-weight: 950;
}

.strengthBox small,
.viabilityScore span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.actionStrip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.actionChip {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 8px;
  color: #071016;
  font-size: 16px;
  font-weight: 950;
  opacity: 0.85;
}

.actionChip.buy,
.actionChip.add {
  background: var(--buy);
}

.actionChip.add {
  background: var(--buy-2);
}

.actionChip.exit {
  background: var(--exit);
}

.actionChip.sell {
  background: var(--sell);
}

.actionChip.isActive {
  outline: 3px solid rgba(255, 255, 255, 0.72);
  opacity: 1;
}

.cardTitle {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 950;
}

.viabilityScore {
  min-height: 90px;
  margin-bottom: 10px;
}

.viabilityExplain {
  margin: -2px 0 10px;
  color: #dce8fa;
  line-height: 1.45;
  font-size: 13px;
}

.viabilityGuide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.viabilityGuide span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.viabilityGuide b {
  color: var(--text);
}

.miniGrid,
.levelGrid,
.costGrid,
.metricGrid {
  display: grid;
  gap: 8px;
}

.miniGrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.levelGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.miniGrid div,
.levelGrid div,
.costGrid div,
.metricGrid div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.miniGrid span,
.levelGrid span,
.costGrid span,
.metricGrid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.miniGrid strong,
.levelGrid strong,
.costGrid strong,
.metricGrid strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.levelGrid .entry strong {
  color: var(--entry);
}

.levelGrid .entryRule {
  grid-column: span 2;
}

.levelGrid .entryRule strong {
  color: var(--text);
}

.levelGrid .stop strong {
  color: var(--sell);
}

.levelGrid .tp strong {
  color: var(--tp);
}

.chartPanel {
  margin-bottom: 10px;
}

.dataBridgePanel {
  padding: 14px;
  margin-bottom: 10px;
}

.dataBridgeHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.dataBridgeHeader h2 {
  margin-top: 4px;
  font-size: 20px;
}

.dataBridgeCounts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dataBridgeCounts span,
.sourcePills span,
.driverChips span,
.chartTools button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dataBridgeCounts b {
  color: var(--entry);
  font-size: 16px;
}

.sourcePills,
.driverChips,
.volumeBridge,
.scoreBreakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sourcePills {
  margin-bottom: 8px;
}

.sourcePills b {
  color: var(--text);
}

.driverChips span.driverUp {
  color: var(--buy);
  border-color: rgba(25, 195, 125, 0.34);
}

.driverChips span.driverDown {
  color: var(--sell);
  border-color: rgba(255, 92, 115, 0.34);
}

.driverChips span.driverNeutral {
  color: var(--hold);
  border-color: rgba(245, 196, 81, 0.34);
}

.volumeBridge {
  margin-top: 10px;
}

.volumeBridge div {
  min-width: 150px;
  flex: 1 1 150px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
}

.volumeBridge span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.volumeBridge strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 15px;
}

.setupCyclePanel {
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.setupHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.setupHeader h2 {
  margin: 2px 0 4px;
  font-size: 20px;
}

.setupHeader p {
  color: var(--muted);
  font-size: 13px;
}

.stateMachineBadge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(79, 140, 255, 0.45);
  border-radius: 8px;
  background: rgba(79, 140, 255, 0.14);
  color: var(--entry);
  font-weight: 900;
  white-space: nowrap;
}

.setupGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.setupGrid div {
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
}

.setupGrid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.setupGrid strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.missedOpportunityBox {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 176, 32, 0.45);
  border-radius: 8px;
  background: rgba(255, 176, 32, 0.09);
  color: #ffd88a;
  display: grid;
  gap: 5px;
}

.missedOpportunityBox[hidden] {
  display: none;
}

.missedOpportunityBox strong {
  color: #ffcc66;
  font-size: 15px;
}

.missedOpportunityBox span {
  color: #f8e7bd;
  line-height: 1.55;
}

.sectionHeader {
  margin-bottom: 12px;
}

.sectionHeader h2 {
  font-size: 18px;
}

.sectionHeader p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

#refreshText {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chartTools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.chartTools button {
  min-height: 34px;
  cursor: pointer;
}

.chartTools button.isActive {
  color: var(--text);
  border-color: rgba(79, 140, 255, 0.75);
  background: rgba(79, 140, 255, 0.18);
}

.chartShell {
  position: relative;
  overflow: hidden;
  min-height: 552px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: #080d15;
}

.signalChart {
  width: 100%;
  height: 500px;
}

.fallbackChart {
  display: block;
  width: 100%;
  height: 500px;
}

.fallbackChart[hidden] {
  display: none;
}

.biasOverlay {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 100%;
  height: 500px;
  pointer-events: none;
  mix-blend-mode: screen;
}

.chartStatus {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid rgba(79, 140, 255, 0.48);
  background: rgba(8, 13, 21, 0.82);
  color: #dce8fa;
  font-size: 12px;
  pointer-events: none;
}

.realtimeProof {
  position: absolute;
  left: 12px;
  top: 48px;
  z-index: 5;
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(25, 195, 125, 0.42);
  border-radius: 8px;
  background: rgba(8, 13, 21, 0.82);
  color: #8bffcd;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.markerHelp {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 5;
  display: grid;
  gap: 6px;
  max-width: min(520px, calc(100% - 320px));
  padding: 10px;
  border: 1px solid rgba(36, 50, 70, 0.82);
  border-radius: 8px;
  background: rgba(8, 13, 21, 0.82);
  color: #dce8fa;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
}

.markerHelp span {
  display: block;
}

.markerHelp b {
  color: var(--text);
}

.chartLegend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 60px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
}

.chartLegend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chartLegend .legendText {
  flex: 1 1 320px;
  justify-content: flex-end;
  color: #dce8fa;
}

.chartLegend i {
  display: inline-block;
  width: 20px;
  height: 4px;
  border-radius: 999px;
}

.buyDot {
  background: var(--buy);
}

.addDot {
  background: var(--buy-2);
}

.sellDot {
  background: var(--sell);
}

.exitDot {
  background: var(--exit);
}

.entryLine {
  background: var(--entry);
}

.tpLine {
  background: var(--tp);
}

.slLine {
  background: var(--sell);
}

.volumeBarLine {
  background: rgba(25, 195, 125, 0.65);
}

.volumeMa20Line {
  background: var(--hold);
}

.volumeMa50Line {
  background: var(--tp);
}

.longBiasBox {
  background: rgba(25, 195, 125, 0.65);
}

.shortBiasBox {
  background: rgba(255, 92, 115, 0.65);
}

.neutralBiasBox {
  background: rgba(148, 163, 184, 0.65);
}

.scoreBreakdown span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.scoreBreakdown b {
  color: var(--text);
}

.advancedDetails {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.advancedDetails summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.advancedGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}

.advancedGrid article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
}

.driverList,
.patternStats {
  display: grid;
  gap: 8px;
}

.driverList span,
.patternStats span {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: #0a111b;
  color: #dce8fa;
  font-size: 12px;
  line-height: 1.35;
}

.driverList b,
.patternStats b {
  color: var(--text);
  white-space: nowrap;
}

.detailGrid,
.backtestGrid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  gap: 10px;
  margin-bottom: 10px;
}

#reasonList {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

#reasonList li {
  color: #dce8fa;
  line-height: 1.48;
}

.costGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metricGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#toggleApi {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a111b;
  color: var(--text);
  cursor: pointer;
}

#apiOutput {
  margin: 12px 0 0;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #070b11;
  color: #b8c7dc;
  font-size: 12px;
  line-height: 1.45;
}

.analysisGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.analysisCard {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.replayMetricGrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.forwardValidationCard {
  border-color: rgba(99, 166, 255, 0.36);
}

.forwardStatusLine {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(99, 166, 255, 0.24);
  border-radius: 8px;
  background: rgba(22, 55, 105, 0.22);
  color: #cfe2ff;
  font-size: 12px;
  line-height: 1.45;
}

.sourceMapPanel {
  margin: 10px 0;
}

.sourceMapList {
  display: grid;
  gap: 8px;
}

.sourceMapList div {
  display: grid;
  grid-template-columns: minmax(190px, 0.34fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0a111b;
}

.sourceMapList b {
  color: #e8f0fb;
  font-size: 12px;
}

.sourceMapList span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.replayList {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.replayRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
}

.replayRow b {
  color: var(--text);
}

.replayRow.isWin b {
  color: var(--buy);
}

.replayRow.isLoss b {
  color: var(--sell);
}

.chartTooltip {
  position: absolute;
  z-index: 8;
  max-width: 260px;
  white-space: pre-line;
  padding: 9px 10px;
  border: 1px solid rgba(79, 140, 255, 0.65);
  border-radius: 8px;
  color: var(--text);
  background: rgba(8, 13, 21, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}

@media (max-width: 1120px) {
  .topbar,
  .controlPanel,
  .phase621Panel,
  .phase621Header,
  .shadowCompareGrid,
  .executionBoard,
  .setupGrid,
  .dataBridgeHeader,
  .detailGrid,
  .backtestGrid,
  .advancedGrid,
  .analysisGrid,
  .dailyTargetControls,
  .dailyMetricGrid,
  .strategyLabGrid {
    grid-template-columns: 1fr;
  }

  .strategyLabHeader {
    flex-direction: column;
  }

  .dataBridgeHeader {
    display: grid;
  }

  .dataBridgeCounts {
    justify-content: flex-start;
  }

  .topLinks {
    justify-self: start;
  }

  .controlGroup {
    align-items: flex-start;
    flex-direction: column;
  }

  .levelGrid,
  .metricGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .futuresShell {
    width: 100%;
    padding: 14px 8px 32px;
  }

  .signalMain {
    grid-template-columns: 1fr;
  }

  #mainSignal {
    white-space: normal;
    font-size: 42px;
  }

  .actionStrip,
  .miniGrid,
  .levelGrid,
  .costGrid,
  .metricGrid,
  .dailyMetricGrid,
  .strategyLabGrid {
    grid-template-columns: 1fr;
  }

  .dailyTargetHeader {
    display: grid;
  }

  .segmented button {
    min-width: 56px;
    padding: 0 9px;
  }

  .chartShell {
    min-height: 500px;
  }

  .signalChart,
  .fallbackChart {
    height: 438px;
  }
}
