:root {
  --bg: #0a0e27;
  --bg-elevated: #10163a;
  --card-bg: #ffffff;
  --card-fg: #10163a;
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --text: #e7e9f5;
  --text-dim: #9aa0c3;
  --border: #232a55;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  min-height: 100vh;
}

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

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
}
.brand span { color: var(--accent-2); }

.nav-links { display: flex; gap: 32px; }
.nav-links a {
  color: var(--text-dim);
  font-weight: 600;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.messages { max-width: 1200px; margin: 20px auto 0; padding: 0 32px; }
.message {
  padding: 12px 18px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-weight: 600;
}
.message-error { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.4); }
.message-success { background: rgba(34,197,94,0.15); color: #86efac; border: 1px solid rgba(34,197,94,0.4); }

.site-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 24px;
  border-top: 1px solid var(--border);
}

/* ---- Hero (Home) ---- */
.hero {
  display: flex;
  align-items: center;
  gap: 48px;
  min-height: 60vh;
}
.hero-text { flex: 1; }
.hero-text h1 {
  font-size: 42px;
  line-height: 1.15;
  margin-bottom: 20px;
}
.hero-text p {
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 480px;
}
.hero-visual {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-visual svg { width: 100%; max-width: 420px; }

.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 15px;
  letter-spacing: 0.5px;
}
.btn:hover { filter: brightness(1.1); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

/* ---- Page headers ---- */
.page-title {
  text-align: center;
  margin-bottom: 8px;
  font-size: 32px;
}
.page-subtitle {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 40px;
}

/* ---- Overview ---- */
.period-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}
.period-tabs a {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.period-tabs a.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.chart-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
}

.index-list { display: flex; flex-direction: column; gap: 0; }
.index-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.index-row:last-child { border-bottom: none; }
.index-name { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.index-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.index-region { color: var(--text-dim); font-size: 12px; margin-left: 6px; }
.index-price { font-weight: 700; text-align: right; min-width: 100px; }
.index-change { font-size: 13px; text-align: right; min-width: 90px; }
.up { color: var(--green); }
.down { color: var(--red); }

/* ---- Features ---- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
}
.feature-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  font-size: 24px;
}
.feature-card h3 { margin: 0 0 10px; }
.feature-card p { color: var(--text-dim); font-size: 14px; margin-bottom: 22px; min-height: 42px; }

/* ---- Tables (Screener / News) ---- */
.card-table {
  background: var(--card-bg);
  color: var(--card-fg);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}
.card-table table { width: 100%; border-collapse: collapse; }
.card-table th, .card-table td {
  padding: 14px 20px;
  text-align: left;
  font-size: 14px;
}
.card-table th {
  color: #6b7280;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.card-table tr:not(:last-child) td { border-bottom: 1px solid #f1f2f6; }
.card-table .pos { color: var(--green); font-weight: 700; }
.card-table .neg { color: var(--red); font-weight: 700; }
.section-heading { text-align: center; font-size: 26px; margin: 40px 0 18px; }
.empty-note { text-align: center; color: var(--text-dim); padding: 24px; }

/* ---- Predict ---- */
.predict-form {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}
.predict-form input[type="text"] {
  width: 100%;
  padding: 16px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 16px;
  margin-bottom: 20px;
  text-align: center;
}
.popular-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.popular-tags a {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.popular-tags a:hover { color: var(--text); border-color: var(--accent); }

/* ---- Result ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-tile {
  background: var(--card-bg);
  color: var(--card-fg);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-tile .label { font-size: 12px; color: #6b7280; font-weight: 700; text-transform: uppercase; }
.stat-tile .value { font-size: 22px; font-weight: 800; margin-top: 6px; }
.stat-tile.highlight .value { color: var(--accent); }
.stat-tile .delta { font-size: 13px; margin-top: 4px; font-weight: 700; }
.stat-tile .delta.pos { color: var(--green); }
.stat-tile .delta.neg { color: var(--red); }

#chart-container {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.disclaimer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 18px;
}

/* ---- Ticker tape ---- */
.ticker-tape {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  padding: 10px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  font-size: 13px;
  color: var(--text-dim);
}
.ticker-tape .t-item { white-space: nowrap; font-weight: 600; }
.ticker-tape .t-sym { color: var(--text); }

@media (max-width: 720px) {
  .hero { flex-direction: column; text-align: center; }
  .hero-text p { margin: 0 auto 32px; }
}
