:root {
  --bg: #07100d;
  --card: rgba(10, 24, 20, 0.78);
  --card-border: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --muted: #a7b8b0;
  --accent: #f7931a;
  --accent-glow: rgba(247, 147, 26, 0.22);
  
  /* Harmonious Tailored HSL Colors */
  --good: #10b981;        /* Emerald */
  --good-glow: rgba(16, 185, 129, 0.18);
  
  --warning: #f59e0b;     /* Amber */
  --warning-glow: rgba(245, 158, 11, 0.18);
  
  --bad: #ef4444;         /* Coral Red */
  --bad-glow: rgba(239, 68, 68, 0.18);
  
  --hold: #38bdf8;        /* Sky */
  --hold-glow: rgba(56, 189, 248, 0.18);
  
  --shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5);
  --radius-lg: 8px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 540px at 20% 0%, rgba(247, 147, 26, 0.18), transparent 58%),
    radial-gradient(900px 600px at 85% 12%, rgba(16, 185, 129, 0.12), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

.container {
  max-width: 1120px;
  margin: 40px auto;
  padding: 0 20px 40px;
}

/* Header & Status Indicator */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 26px;
  margin: 0;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 11px;
  font-family: 'Outfit', sans-serif;
  background: var(--accent);
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 0 12px var(--accent-glow);
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 300;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  position: relative;
}

.dot::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.8); opacity: 0; }
}

.dot.ok { background: var(--good); }
.dot.ok::after { background: var(--good); }
.dot.err { background: var(--bad); }
.dot.err::after { background: var(--bad); }
.dot.loading { background: var(--accent); }
.dot.loading::after { background: var(--accent); }

/* Premium Glassmorphic Cards */
.card {
  border: 1px solid var(--card-border);
  background: var(--card);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 48px -10px rgba(0, 0, 0, 0.6);
  transform: translateY(-2px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(340px, 0.78fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-copy {
  padding: 34px 0;
}

.hero-copy h2 {
  max-width: 760px;
  margin: 10px 0 16px;
  font-size: 54px;
  line-height: 1.02;
  letter-spacing: 0;
  text-transform: none;
}

.hero-copy p {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}

.ghost-link {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  padding-bottom: 4px;
}

.live-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 0;
}

.live-price-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.18);
}

.small-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Grids layout */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.metric {
  padding: 20px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-family: 'Space Grotesk', sans-serif;
}

.value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.price-val {
  font-size: 30px;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0;
}

.price-val.compact {
  font-size: 24px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 18px;
}

.compact-heading {
  margin-bottom: 0;
}

.section-heading h2,
.method-card h2,
.backtest-card h2 {
  margin: 8px 0 10px;
  font-size: 25px;
  letter-spacing: 0;
  text-transform: none;
}

.section-heading p,
.method-card p,
.backtest-card p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 12px;
}

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

.stat-card {
  padding: 18px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.22);
}

.stat-card strong {
  display: block;
  margin: 7px 0;
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 29px;
  letter-spacing: 0;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-label {
  color: var(--text) !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.comparison {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

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

.comparison-row strong,
.comparison-row span {
  display: block;
}

.comparison-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.bar {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--good), var(--accent));
}

.muted-row .bar span {
  background: rgba(255, 255, 255, 0.38);
}

.chart-card {
  overflow: hidden;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.chart-controls {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

.chart-range {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chart-range:hover,
.chart-range.active {
  color: #121a14;
  background: var(--accent);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i {
  width: 22px;
  height: 3px;
  border-radius: 999px;
}

.chart-legend .legend-candle-up,
.chart-legend .legend-candle-down,
.chart-legend .legend-candle-live {
  width: 9px;
  height: 13px;
  border-radius: 1px;
}
.legend-candle-up { background: #22c55e; }
.legend-candle-down { background: #ef5b66; }
.legend-candle-live {
  border: 1px dashed #f8fafc;
  background: transparent;
}
.legend-sma50 { background: #38bdf8; }
.legend-sma200 { background: #22c55e; }
.legend-rsi { background: #f7931a; opacity: 0.65; }
.legend-rsi-threshold {
  background: #0ea5e9;
}
.legend-volume { background: #38bdf8; opacity: 0.7; }

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(247, 147, 26, 0.08), transparent 48%),
    rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

#btcTrendChart {
  display: block;
  width: 100%;
  min-height: 520px;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  background: rgba(7, 16, 13, 0.68);
}

.chart-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.explainer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 20px;
}

.condition-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.condition-columns h3 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.condition-columns ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.condition-columns li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.condition-columns li::before {
  content: counter(list-item) ".";
  min-width: 18px;
  color: var(--text);
  font-weight: 700;
}

.condition-columns li.passed::before,
.condition-columns li.failed::before {
  content: "";
  display: none;
}

.condition-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.passed .condition-flag {
  background: linear-gradient(180deg, #22c55e, #078b33);
}

.failed .condition-flag {
  background: linear-gradient(180deg, #f04444, #b90f0f);
}

.check-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.check-list li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.check-list li::before {
  content: "✓";
  margin-right: 8px;
  color: var(--good);
  font-weight: 800;
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.telegram-card {
  border-color: rgba(41, 182, 246, 0.24);
  background:
    radial-gradient(circle at 90% 10%, rgba(41, 182, 246, 0.14), transparent 38%),
    var(--card);
}

.telegram-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.telegram-card h2 {
  margin: 8px 0 8px;
  font-size: 20px;
  text-transform: none;
  letter-spacing: 0;
}

.telegram-description {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.telegram-count {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.telegram-action {
  min-width: 210px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  text-align: center;
}

.telegram-action span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.telegram-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid rgba(125, 211, 252, 0.4);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #229ed9, #168acd);
  box-shadow: 0 10px 26px rgba(34, 158, 217, 0.22);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.telegram-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(34, 158, 217, 0.3);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

/* Dynamic State Colors for Signals and Risks */
.signal-buy {
  border-color: var(--good);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(0, 0, 0, 0.3));
  box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.08);
}
.signal-buy .value { color: var(--good); text-shadow: 0 0 10px var(--good-glow); }

.signal-hold {
  border-color: var(--hold);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(0, 0, 0, 0.3));
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.08);
}
.signal-hold .value { color: var(--hold); text-shadow: 0 0 10px var(--hold-glow); }

.signal-sell {
  border-color: var(--bad);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(0, 0, 0, 0.3));
  box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.08);
}
.signal-sell .value { color: var(--bad); text-shadow: 0 0 10px var(--bad-glow); }

/* Risk cards */
.risk-low {
  border-color: var(--good);
}
.risk-low .value { color: var(--good); }

.risk-medium {
  border-color: var(--warning);
}
.risk-medium .value { color: var(--warning); }

.risk-high {
  border-color: var(--bad);
}
.risk-high .value { color: var(--bad); }

/* Technical details grid */
h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 16px;
  color: var(--text);
}

.update-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.info-lbl {
  color: var(--muted);
  font-size: 13px;
}

.info-val {
  font-weight: 500;
  font-size: 13px;
}

.monitor-active {
  color: var(--good);
  font-weight: 600;
  background: var(--good-glow);
  padding: 2px 8px;
  border-radius: 4px;
}

.select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.indicator-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ind-box {
  padding: 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ind-lbl {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.ind-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
}

/* CORS alert box */
.cors-helper {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(0, 0, 0, 0.4));
  border-color: rgba(245, 158, 11, 0.3);
  padding: 18px 24px;
}
.cors-helper h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--warning);
}
.cors-helper p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 10px;
}
.cors-helper pre {
  background: #000;
  padding: 8px 12px;
  border-radius: 6px;
  color: #fff;
  font-family: monospace;
  font-size: 11px;
  margin: 0;
  display: inline-block;
}

footer {
  margin-top: 30px;
  text-align: center;
}

.footnote {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* Responsive details */
@media (max-width: 768px) {
  .container {
    margin-top: 24px;
  }
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .grid, .grid-2 {
    grid-template-columns: 1fr;
  }
  .hero,
  .explainer-grid,
  .stats-grid,
  .comparison-row,
  .condition-columns,
  .chart-header {
    grid-template-columns: 1fr;
  }
  .chart-header {
    display: grid;
  }
  .chart-controls {
    justify-self: start;
    max-width: 100%;
    overflow-x: auto;
  }
  .hero-copy {
    padding: 14px 0 4px;
  }
  .hero-copy h2 {
    font-size: 36px;
  }
  .telegram-content {
    align-items: stretch;
    flex-direction: column;
  }
  .telegram-action {
    min-width: 0;
  }
}
