:root {
  --bg: #050913;
  --bg-2: #09111f;
  --bg-3: #101a2d;
  --card: rgba(10, 18, 34, 0.86);
  --card-2: rgba(13, 23, 42, 0.94);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f7ff;
  --muted: #8ea3c7;
  --good: #24d27e;
  --bad: #ff667f;
  --warn: #ffc14d;
  --accent: #72a8ff;
  --accent-2: #8f72ff;
  --accent-3: #5eead4;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.24);
  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(114, 168, 255, 0.11), transparent 25%),
    radial-gradient(circle at bottom right, rgba(143, 114, 255, 0.13), transparent 24%),
    linear-gradient(180deg, #050913 0%, #070d18 40%, #03070f 100%);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 14px;
}

button,
input,
button,
select,
textarea {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  cursor: pointer;
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text);
  border-radius: var(--radius-sm);
  padding: 14px 14px;
  outline: none;
  box-shadow: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(114, 168, 255, 0.5);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 4px rgba(114, 168, 255, 0.08);
}

input::placeholder,
textarea::placeholder {
  color: #6d82a6;
  -webkit-text-fill-color: #6d82a6;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, #8ea3c7 50%),
    linear-gradient(135deg, #8ea3c7 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

h3 {
  font-size: 18px;
  line-height: 1.15;
}

h4 {
  font-size: 15px;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
}

strong {
  font-weight: 800;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.15;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 0.65px, transparent 0.65px);
  background-size: 13px 13px;
  z-index: 0;
}

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 14px 12px 26px;
  position: relative;
  z-index: 1;
}

.layout {
  display: grid;
  gap: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.glass {
  background: rgba(8, 15, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.gradient-border {
  position: relative;
  overflow: hidden;
}

.gradient-border::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(114, 168, 255, 0.9),
    rgba(143, 114, 255, 0.65),
    rgba(36, 210, 126, 0.28)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.hero {
  overflow: hidden;
}

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

.subline {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 560px;
}

.hero-score-wrap {
  min-width: 116px;
  text-align: right;
}

.hero-score {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero-score-wrap span {
  font-size: 12px;
  color: var(--muted);
}

.hero-pills,
.section-title-row,
.chart-toolbar,
.pair-meta,
.controls-header,
.chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-pills {
  margin-top: 16px;
}

.row-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pill,
.tag,
.signal-badge,
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

.pill.warning {
  color: var(--warn);
}

.pill.positive {
  color: var(--good);
}

.section-title-row {
  justify-content: space-between;
  margin-bottom: 12px;
}

.controls-header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.compact-gap {
  margin-bottom: 10px;
}

.small,
.muted.small {
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.ghost-btn,
.icon-btn,
.primary-btn,
.mini-btn {
  transition:
    transform 0.15s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    opacity 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

.ghost-btn:hover,
.icon-btn:hover,
.primary-btn:hover,
.mini-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn:active,
.icon-btn:active,
.primary-btn:active,
.mini-btn:active {
  transform: translateY(0);
}

.ghost-btn,
.icon-btn,
.primary-btn {
  min-height: 46px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.ghost-btn:hover,
.icon-btn:hover,
.mini-btn:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.065);
}

.icon-btn {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.primary-btn {
  background: linear-gradient(135deg, #72a8ff, #8f72ff);
  border: none;
  font-weight: 700;
  box-shadow: 0 16px 30px rgba(114, 168, 255, 0.25);
}

.primary-btn:hover {
  filter: brightness(1.05);
}

.ghost-btn.danger {
  color: #ff9cae !important;
  -webkit-text-fill-color: #ff9cae;
}

.full-width {
  width: 100%;
}

.active-chip {
  border-color: rgba(114, 168, 255, 0.58);
  background: linear-gradient(135deg, rgba(114, 168, 255, 0.2), rgba(143, 114, 255, 0.14));
  box-shadow: inset 0 0 0 1px rgba(114, 168, 255, 0.08);
}

.decision-center {
  padding-top: 18px;
}

.decision-grid,
.overview-grid,
.control-grid,
.metric-grid,
.insight-grid,
.field-grid {
  display: grid;
  gap: 12px;
}

.decision-grid,
.overview-grid {
  grid-template-columns: repeat(3, 1fr);
}

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

.metric-grid {
  grid-template-columns: repeat(2, 1fr);
  margin: 14px 0;
}

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

.insight-grid {
  grid-template-columns: 1fr;
  margin-top: 14px;
}

.decision-box,
.stat-card,
.inset-card,
.metric-card {
  background: linear-gradient(180deg, rgba(17, 29, 52, 0.95), rgba(13, 23, 42, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.decision-box strong,
.stat-card strong,
.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.12;
}

.decision-box small,
.stat-card small,
.metric-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.metric-card {
  padding: 14px;
}

.metric-card .muted {
  display: block;
  margin-bottom: 6px;
}

.scanner-results,
.detail-panel,
.trade-panel {
  overflow: hidden;
}

.search-box input {
  margin-top: 12px;
}

.pair-list,
.watchlist,
.trade-list {
  display: grid;
  gap: 12px;
}

.pair-item,
.watch-item,
.trade-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.028));
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.pair-item:hover,
.watch-item:hover,
.trade-item:hover {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.036));
}

.pair-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.pair-left {
  min-width: 0;
  width: 100%;
}

.pair-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pair-symbol {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.score-badge {
  min-width: 58px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  flex: 0 0 auto;
}

.score-badge.good {
  color: var(--good);
  background: rgba(36, 210, 126, 0.08);
  border-color: rgba(36, 210, 126, 0.24);
}

.score-badge.bad {
  color: var(--bad);
  background: rgba(255, 102, 127, 0.08);
  border-color: rgba(255, 102, 127, 0.24);
}

.signal-badge {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.signal-buy {
  color: var(--good);
  background: rgba(36, 210, 126, 0.08);
  border-color: rgba(36, 210, 126, 0.24);
}

.signal-sell {
  color: var(--bad);
  background: rgba(255, 102, 127, 0.08);
  border-color: rgba(255, 102, 127, 0.24);
}

.signal-wait {
  color: var(--warn);
  background: rgba(255, 193, 77, 0.08);
  border-color: rgba(255, 193, 77, 0.24);
}

.sticky-row {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, rgba(10, 18, 34, 0.98), rgba(10, 18, 34, 0.82));
  padding-bottom: 10px;
  backdrop-filter: blur(12px);
}

.chart-toolbar {
  margin-bottom: 12px;
}

.chart-box {
  height: 320px;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.03);
}

.reason-list {
  padding-left: 18px;
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
  color: #dbe7ff;
}

.reason-list li {
  line-height: 1.45;
}

.gatekeeper-box {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.gate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.gate-ok {
  color: var(--good);
}

.gate-bad {
  color: var(--bad);
}

.gate-warn {
  color: var(--warn);
}

.trade-form {
  display: grid;
  gap: 14px;
}

.trade-output {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.03));
  border-radius: var(--radius-md);
  padding: 14px;
  color: #dbe7ff;
  line-height: 1.6;
}

.subsection {
  margin-top: 16px;
}

.trade-item-header,
.watch-item-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.trade-item-body,
.watch-item-body {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  color: #dbe7ff;
}

.trade-actions,
.watch-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.mini-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 13, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.hidden {
  display: none !important;
}

.modal-card {
  width: min(720px, 100%);
}

.wide-modal {
  max-width: 720px;
}

.settings-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 700px) {
  .decision-grid,
  .overview-grid,
  .control-grid,
  .field-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-score-wrap {
    text-align: left;
  }

  .chart-box {
    height: 270px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 12px 10px 22px;
  }

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

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 21px;
  }

  .hero-score {
    font-size: 38px;
  }

  .row-actions {
    grid-template-columns: 1fr 1fr;
  }

  .ghost-btn,
  .primary-btn,
  .icon-btn {
    font-size: 15px;
    padding: 12px 14px;
  }

  .pill,
  .tag,
  .signal-badge {
    font-size: 11px;
  }

  .pair-item,
  .trade-item-header,
  .watch-item-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .pair-title-row,
  .pair-meta {
    gap: 8px;
  }

  .chart-box {
    height: 240px;
  }
  }
