:root {
  color-scheme: dark;
  --page: #07111f;
  --surface: #0c1b2d;
  --surface-strong: #10243a;
  --line: rgba(139, 188, 218, 0.22);
  --line-strong: rgba(56, 189, 248, 0.52);
  --text: #f3f8fc;
  --muted: #91a8ba;
  --cyan: #38bdf8;
  --mint: #2dd4bf;
  --amber: #facc15;
  --red: #ff646d;
  --green: #27cf86;
  --coral: #fb7185;
  --violet: #a78bfa;
}

* { box-sizing: border-box; }
html,
body { max-width: 100%; overflow-x: hidden; }
[v-cloak] { display: none; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: var(--page);
  background-image:
    linear-gradient(rgba(90, 156, 194, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 156, 194, 0.04) 1px, transparent 1px),
    linear-gradient(120deg, rgba(56, 189, 248, 0.08), transparent 32%, rgba(250, 204, 21, 0.035) 72%, transparent);
  background-size: 40px 40px, 40px 40px, auto;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input { font: inherit; }
button,
a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.screener-page {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.screener-content {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.strategy-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(14, 25, 43, 0.9), rgba(11, 20, 34, 0.72));
  padding: 12px 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.strategy-brand h1 {
  margin: 0;
  color: #e7f1ff;
  font-size: 24px;
  line-height: 1.15;
}

.strategy-brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.strategy-header-actions,
.strategy-tabs {
  display: flex;
  align-items: center;
}

.strategy-header-actions { gap: 10px; }

.strategy-tabs {
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 19, 38, 0.7);
  padding: 4px;
}

.strategy-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 5px;
  color: #9fb5c8;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
}

.strategy-tab:hover,
.strategy-tab.active {
  background: linear-gradient(135deg, rgba(49, 195, 255, 0.88), rgba(45, 212, 191, 0.78));
  color: #051522;
}

.strategy-disclaimer {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(250, 204, 21, 0.26);
  border-radius: 999px;
  color: #e7d18a;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.screener-heading {
  max-width: 760px;
  padding: 42px 0 28px;
}

.screener-heading h2 {
  margin: 8px 0 10px;
  color: #f3f8fc;
  font-size: 34px;
  line-height: 1.2;
}

.screener-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.quick-screener {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 23, 40, 0.76);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

.quick-section {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid rgba(139, 188, 218, 0.14);
}

.quick-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.quick-section-heading > span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.quick-section-heading strong,
.quick-section-heading small { display: block; }
.quick-section-heading strong { color: #eaf4fb; font-size: 16px; }
.quick-section-heading small { margin-top: 6px; color: #718da2; font-size: 12px; }

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

.preset-cards button {
  min-width: 0;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 27, 45, 0.7);
  color: #a9bfd0;
  padding: 15px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.preset-cards button:hover { border-color: rgba(56, 189, 248, 0.48); transform: translateY(-1px); }
.preset-cards button.active { border-color: var(--cyan); background: #102d43; box-shadow: inset 0 3px 0 var(--mint); }
.preset-cards strong { display: block; color: #f1f8fc; font-size: 16px; }
.preset-cards span { display: block; margin-top: 8px; color: #8fa8ba; font-size: 12px; line-height: 1.55; }

.quick-controls {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(240px, 1fr) 140px;
  gap: 14px;
  align-items: end;
}

.quick-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
}

.selection-summary { min-width: 0; }
.selection-summary > span,
.selection-summary > small { display: block; }
.selection-summary > span { color: #718da2; font-size: 11px; font-weight: 800; }
.selection-summary > strong { display: block; margin: 5px 0; color: #f1f8fc; font-size: 16px; }
.selection-summary > small { max-width: 680px; color: #8fa8ba; line-height: 1.5; }

.standalone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 0 2px 18px;
  border-bottom: 1px solid var(--line);
}

.standalone-brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.standalone-brand strong { font-size: 19px; }
.standalone-brand span { color: var(--cyan); font-size: 14px; font-weight: 800; }

.standalone-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.standalone-back,
.button-secondary,
.button-reset,
.button-danger {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: #c9dce9;
  padding: 0 14px;
  cursor: pointer;
}

.standalone-back { display: inline-flex; align-items: center; }
.standalone-back:hover,
.button-secondary:hover,
.button-reset:hover { border-color: var(--line-strong); color: #fff; }

.standalone-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 54px;
  align-items: center;
  padding: 44px 0 34px;
}

.intro-copy { min-width: 0; max-width: 680px; }

.standalone-kicker {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.standalone-intro h1,
.standalone-results h2 {
  margin: 7px 0 8px;
  font-size: 38px;
  line-height: 1.2;
}

.filter-profile {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(14, 34, 54, 0.96), rgba(9, 25, 42, 0.9));
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

.filter-profile::after {
  position: absolute;
  right: -55px;
  bottom: -55px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(56, 189, 248, 0.035), 0 0 0 56px rgba(45, 212, 191, 0.025);
  content: "";
}

.profile-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.profile-heading span { color: var(--muted); font-size: 12px; font-weight: 800; }
.profile-heading strong { color: var(--mint); font-size: 14px; }
.profile-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.profile-metrics div { min-width: 0; border-left: 2px solid var(--cyan); padding-left: 10px; }
.profile-metrics div:nth-child(2) { border-left-color: var(--amber); }
.profile-metrics div:nth-child(3) { border-left-color: var(--coral); }
.profile-metrics small { display: block; color: #708da2; font-size: 11px; }
.profile-metrics strong { display: block; overflow: hidden; margin-top: 5px; color: #eef8ff; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.profile-weights { display: grid; gap: 8px; }
.profile-weights span { position: relative; height: 24px; overflow: hidden; border-radius: 4px; background: rgba(255, 255, 255, 0.045); }
.profile-weights i { display: block; height: 100%; background: rgba(56, 189, 248, 0.2); transition: width 180ms ease; }
.profile-weights span:nth-child(2) i { background: rgba(45, 212, 191, 0.2); }
.profile-weights span:nth-child(3) i { background: rgba(250, 204, 21, 0.17); }
.profile-weights em { position: absolute; top: 5px; left: 9px; color: #b9cedd; font-size: 11px; font-style: normal; }

.standalone-intro p,
.standalone-results header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.standalone-filter {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.filter-template-row,
.filter-section,
.filter-actions {
  min-width: 0;
  padding: 22px 0;
  border-bottom: 1px solid rgba(139, 188, 218, 0.14);
}

.filter-template-row { border-left: 3px solid var(--cyan); padding-left: 18px; }
.scope-section { border-left: 3px solid var(--violet); padding-left: 18px; }
.filter-section:nth-of-type(4) { border-left: 3px solid var(--mint); padding-left: 18px; }
.filter-section:nth-of-type(5) { border-left: 3px solid var(--amber); padding-left: 18px; }

.filter-label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 140px;
}

.filter-label span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.filter-label strong { font-size: 16px; }

.filter-template-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px 18px;
  align-items: center;
}

.template-segments {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 8px;
}

.template-segments button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 27, 45, 0.72);
  color: #a9bfd0;
  padding: 0 15px;
  cursor: pointer;
}

.template-segments button:hover,
.template-segments button.active {
  border-color: var(--cyan);
  background: var(--surface-strong);
  color: #fff;
}

.template-note {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.filter-section-title small { color: var(--muted); }

.scope-controls {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(240px, 1fr) 150px;
  gap: 14px;
  align-items: end;
}

.market-scope { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.market-scope button { min-height: 36px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.market-scope button.active { background: #17354d; color: #fff; box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.42); }
.keyword-control,
.limit-control { display: grid; gap: 7px; }
.keyword-control span,
.limit-control span { color: #9fb7c8; font-size: 12px; font-weight: 800; }
.keyword-control input,
.limit-control select { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--surface); color: var(--text); padding: 0 11px; }
.keyword-control input:focus,
.limit-control select:focus { border-color: var(--cyan); }

.weight-controls,
.threshold-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.weight-controls label,
.threshold-controls > label {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.weight-controls label {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 27, 45, 0.6);
}

.weight-controls label > span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #c4d6e3;
}

.weight-controls strong { color: var(--cyan); }
.weight-controls input { width: 100%; accent-color: var(--mint); }

.threshold-controls > label > span { color: #c4d6e3; font-size: 13px; font-weight: 700; }
.threshold-controls small { color: #718da2; }

.threshold-controls input[type="number"],
.template-save input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  padding: 0 11px;
}

.threshold-controls input:focus,
.template-save input:focus { border-color: var(--cyan); }

.input-unit { position: relative; }
.input-unit input { padding-right: 54px !important; }
.input-unit em {
  position: absolute;
  top: 50%;
  right: 11px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  transform: translateY(-50%);
}

.advanced-toggle {
  width: 100%;
  min-height: 42px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(10, 25, 42, 0.58);
  color: #a9c2d4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  cursor: pointer;
}
.advanced-toggle:hover { border-color: rgba(56, 189, 248, 0.62); color: #fff; }
.advanced-toggle strong { color: var(--cyan); font-size: 20px; }
.advanced-condition-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(139, 188, 218, 0.14); }
.range-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 7px; }
.range-pair i { color: var(--muted); font-size: 12px; font-style: normal; }

.risk-toggle {
  align-content: start;
  grid-template-columns: auto minmax(0, 1fr);
}

.risk-toggle > span { grid-column: 1 / -1; }
.risk-toggle > small { align-self: center; }

.risk-toggle button {
  position: relative;
  width: 48px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #17283a;
  cursor: pointer;
}

.risk-toggle button i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #7892a5;
  transition: transform 160ms ease, background 160ms ease;
}

.risk-toggle button.active { border-color: rgba(45, 212, 191, 0.6); background: rgba(45, 212, 191, 0.18); }
.risk-toggle button.active i { background: var(--mint); transform: translateX(21px); }

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.template-save,
.primary-actions { display: flex; align-items: center; gap: 8px; }
.template-save { flex: 1; max-width: 640px; }
.template-save input { flex: 1; }

.button-run {
  min-width: 160px;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--cyan), var(--mint));
  color: #05221f;
  font-weight: 900;
  cursor: pointer;
}

.button-run:hover { filter: brightness(1.08); }
.button-run:disabled,
.button-secondary:disabled { cursor: wait; opacity: 0.6; }
.button-danger { border-color: rgba(255, 100, 109, 0.34); color: #ff9da3; }

.filter-message {
  min-height: 22px;
  margin: 14px 0;
  color: #a8bece;
  font-size: 13px;
}
.filter-message.busy { color: var(--amber); }

.standalone-results {
  scroll-margin-top: 20px;
  padding-top: 34px;
}

.standalone-results > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.result-table { border-top: 1px solid var(--line); }
.result-table-head,
.result-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.4fr) minmax(130px, 0.9fr) 100px 110px 90px;
  gap: 12px;
  align-items: center;
  padding: 12px 10px;
}

.result-table-head {
  color: #7894a8;
  font-size: 12px;
  font-weight: 800;
}

.result-row {
  min-height: 60px;
  border-top: 1px solid rgba(139, 188, 218, 0.13);
  color: #b9ccda;
}
.result-row-action { cursor: pointer; outline: 0; }
.result-row-action:focus-visible { box-shadow: inset 3px 0 0 var(--cyan), 0 0 0 1px var(--cyan); }
.result-row:hover { background: rgba(16, 36, 58, 0.72); box-shadow: inset 3px 0 0 var(--cyan); }
.row-link { color: var(--cyan); font-size: 12px; font-weight: 800; }
.stock-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.stock-cell small { color: #627f94; }
.stock-cell strong { color: #eff8ff; }
.score-cell { color: var(--mint); font-size: 19px; }
.gain { color: var(--red); }
.loss { color: var(--green); }

.result-empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.result-boundary {
  margin: 14px 0 0;
  color: #7f98aa;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .strategy-topbar,
  .strategy-header-actions { align-items: stretch; flex-direction: column; }
  .strategy-tabs { width: 100%; }
  .strategy-tab { flex: 1; }
  .strategy-disclaimer { align-self: flex-start; }
  .quick-section { grid-template-columns: 1fr; gap: 16px; }
  .preset-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-controls { grid-template-columns: 1fr 1fr; }
  .market-scope { grid-column: 1 / -1; }
  .standalone-intro { grid-template-columns: 1fr; gap: 20px; }
  .scope-controls { grid-template-columns: 1fr 1fr; }
  .market-scope { grid-column: 1 / -1; }
  .weight-controls,
  .threshold-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-table-head { display: none; }
  .result-row { grid-template-columns: minmax(190px, 1.5fr) minmax(100px, 0.8fr) 90px 90px; }
  .result-row > span:nth-child(2) { display: none; }
}

@media (max-width: 680px) {
  .screener-heading { padding: 28px 0 20px; }
  .screener-heading h2 { font-size: 26px; }
  .screener-heading p { font-size: 14px; }
  .quick-section { padding: 20px 14px; }
  .preset-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .preset-cards button { min-height: 116px; padding: 12px; }
  .preset-cards strong { font-size: 14px; }
  .preset-cards span { display: -webkit-box; overflow: hidden; font-size: 11px; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
  .quick-controls { grid-template-columns: 1fr; }
  .market-scope { grid-column: auto; }
  .quick-action-row { align-items: stretch; flex-direction: column; padding: 18px 14px; }
  .screener-page { width: min(100vw - 20px, 1280px); max-width: 100%; padding-top: 14px; }
  .standalone-header,
  .standalone-header-actions,
  .filter-actions,
  .standalone-results > header { align-items: stretch; flex-direction: column; }
  .standalone-header-actions { gap: 9px; }
  .standalone-header-actions > span { display: none; }
  .standalone-back { justify-content: center; }
  .standalone-intro { padding: 28px 0 22px; }
  .standalone-brand { min-width: 0; flex-wrap: wrap; }
  .standalone-intro h1,
  .standalone-results h2 { max-width: 100%; overflow-wrap: anywhere; font-size: 25px; }
  .filter-template-row { grid-template-columns: 1fr; }
  .filter-template-row,
  .scope-section,
  .filter-section:nth-of-type(4),
  .filter-section:nth-of-type(5) { padding-left: 12px; }
  .scope-controls { grid-template-columns: 1fr; }
  .market-scope { grid-column: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-metrics { grid-template-columns: 1fr; }
  .filter-profile { min-height: 260px; }
  .template-note { grid-column: auto; }
  .template-segments { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-segments button { min-width: 0; padding: 0 8px; }
  .weight-controls,
  .threshold-controls { grid-template-columns: 1fr; }
  .filter-section-title { align-items: start; flex-direction: column; gap: 6px; }
  .template-save,
  .primary-actions { width: 100%; }
  .template-save { display: grid; grid-template-columns: 1fr; max-width: none; }
  .primary-actions { display: grid; grid-template-columns: 90px minmax(0, 1fr); }
  .button-run { min-width: 0; }
  .result-row { grid-template-columns: minmax(0, 1fr) 74px 76px; padding: 13px 4px; }
  .result-row > span:nth-child(2),
  .result-row > span:nth-child(4) { display: none; }
  .stock-cell { align-items: start; flex-direction: column; gap: 3px; }
}
