@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.6);
  --bg-card-hover: rgba(17, 24, 39, 0.8);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-glow: rgba(255, 255, 255, 0.02);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-orange: #f97316;
  --accent-amber: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-yellow: #eab308;
  --gradient-brand: linear-gradient(135deg, #f97316, #ef4444);
  --gradient-blue: linear-gradient(135deg, #3b82f6, #06b6d4);
  --gradient-green: linear-gradient(135deg, #22c55e, #06b6d4);
  --gradient-red: linear-gradient(135deg, #ef4444, #f97316);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow-red: 0 0 40px rgba(239,68,68,0.15);
  --shadow-glow-green: 0 0 40px rgba(34,197,94,0.15);
  --shadow-glow-blue: 0 0 40px rgba(59,130,246,0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background mesh */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(249,115,22,0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(59,130,246,0.05), transparent),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(239,68,68,0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

/* === HEADER === */

header {
  text-align: center;
  padding: 3rem 0 2rem;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.toolbar {
  margin-top: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.tz-selector,
.lang-selector {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tz-selector select,
.lang-selector select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.6rem;
}

.tz-selector select:focus,
.lang-selector select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* === CARDS (Glassmorphism) === */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.2s, box-shadow 0.3s, border-color 0.3s;
}

.card:hover {
  border-color: rgba(255,255,255,0.1);
  box-shadow: var(--shadow-md);
}

.card h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

/* === LATEST VALUES (Hero metrics) === */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.metric {
  text-align: center;
  padding: 1.2rem 0.8rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  transition: transform 0.2s, background 0.2s;
}

.metric:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.04);
}

.metric .label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.metric .value {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.3s;
}

.metric:first-child .value {
  color: var(--accent-orange);
}

.metric:nth-child(2) .value {
  color: var(--accent-blue);
}

.metric:nth-child(3) .value {
  color: var(--accent-cyan);
}

.ts {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Live pulse indicator */
.live-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* === RISK STATUS PANEL === */

.risk-panel {
  text-align: center;
  padding: 0.5rem 0;
}

.risk-meter {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  border-radius: var(--radius-xl);
  padding: 1rem 2rem;
  border: 1px solid var(--glass-border);
  margin-bottom: 1rem;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.risk-meter::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.06;
  transition: background 0.5s;
}

.risk-meter .risk-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.risk-meter .risk-text {
  text-align: left;
}

.risk-meter .risk-verdict {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.risk-meter .risk-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.risk-meter.risk-high {
  border-color: rgba(239,68,68,0.3);
  box-shadow: var(--shadow-glow-red);
}
.risk-meter.risk-high::before { background: var(--accent-red); }
.risk-meter.risk-high .risk-verdict { color: var(--accent-red); }

.risk-meter.risk-low {
  border-color: rgba(34,197,94,0.3);
  box-shadow: var(--shadow-glow-green);
}
.risk-meter.risk-low::before { background: var(--accent-green); }
.risk-meter.risk-low .risk-verdict { color: var(--accent-green); }

.risk-meter.risk-neutral {
  border-color: rgba(148,163,184,0.2);
}
.risk-meter.risk-neutral .risk-verdict { color: var(--text-secondary); }

.risk-indicators {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.risk-ind {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  transition: background 0.2s;
}

.risk-ind:hover {
  background: rgba(255,255,255,0.06);
}

.risk-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.risk-dot.green  { background: var(--accent-green); box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.risk-dot.yellow { background: var(--accent-yellow); box-shadow: 0 0 6px rgba(234,179,8,0.4); }
.risk-dot.orange { background: var(--accent-orange); box-shadow: 0 0 6px rgba(249,115,22,0.4); }
.risk-dot.red    { background: var(--accent-red); box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.risk-dot.gray   { background: var(--text-muted); }

/* === CHARTS === */

.chart-container {
  position: relative;
  margin-bottom: 1.2rem;
  height: 220px;
  padding: 0.5rem;
  background: rgba(255,255,255,0.01);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.chart-container:last-child {
  margin-bottom: 0;
}

/* === HISTORY TABLE === */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th, td {
  padding: 0.7rem 0.8rem;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255,255,255,0.02);
}

th:first-child,
td:first-child {
  text-align: left;
}

td {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

/* === INDICATOR GUIDE === */

.guide-intro {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.guide-intro strong {
  color: var(--accent-orange);
  font-weight: 600;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.guide-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  transition: border-color 0.2s, transform 0.2s;
}

.guide-item:hover {
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}

.guide-item h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.guide-item:nth-child(1) h3 { color: var(--accent-orange); }
.guide-item:nth-child(2) h3 { color: var(--accent-blue); }
.guide-item:nth-child(3) h3 { color: var(--accent-cyan); }

.guide-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.threshold-table {
  width: 100%;
  font-size: 0.78rem;
}

.threshold-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.5rem;
  text-align: left;
  background: transparent;
}

.threshold-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
}

.threshold-table td:first-child {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.tag-green  { background: rgba(34,197,94,0.12);  color: var(--accent-green); }
.tag-yellow { background: rgba(234,179,8,0.12);   color: var(--accent-yellow); }
.tag-orange { background: rgba(249,115,22,0.12);  color: var(--accent-orange); }
.tag-red    { background: rgba(239,68,68,0.12);   color: var(--accent-red); }
.tag-gray   { background: rgba(148,163,184,0.1);  color: var(--text-muted); }

/* Verdict section */
.guide-verdict {
  margin-bottom: 1.5rem;
}

.guide-verdict h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 0.8rem;
}

.verdict-table td:last-child {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
}

/* Burry section */
.guide-burry {
  background: rgba(239,68,68,0.04);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.guide-burry h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-red);
  margin-bottom: 0.6rem;
}

.guide-burry p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.guide-burry ol {
  padding-left: 1.2rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 0.8rem;
}

.guide-burry ol li::marker {
  color: var(--accent-red);
  font-weight: 600;
}

.burry-quote {
  font-style: italic;
  color: var(--text-muted);
  border-left: 2px solid var(--accent-red);
  padding: 0.6rem 0.8rem;
  margin-top: 0.8rem;
  font-size: 0.8rem;
  background: rgba(239,68,68,0.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.guide-disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.8rem;
  opacity: 0.7;
}

/* === FOOTER === */

footer {
  text-align: center;
  padding: 2.5rem 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

footer a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--accent-cyan);
}

/* === ANIMATIONS === */

/* Fade-in-up for sections */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }
.card:nth-child(4) { animation-delay: 0.24s; }
.card:nth-child(5) { animation-delay: 0.32s; }

/* Number count-up shimmer */
@keyframes shimmer {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

.value.counting {
  animation: shimmer 0.08s ease-in-out infinite;
}

/* Value change flash */
@keyframes valueFlash {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.value.flash {
  animation: valueFlash 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Slide-in for risk indicators */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.risk-ind {
  animation: slideIn 0.3s ease-out both;
}

.risk-ind:nth-child(1) { animation-delay: 0.1s; }
.risk-ind:nth-child(2) { animation-delay: 0.2s; }
.risk-ind:nth-child(3) { animation-delay: 0.3s; }

/* Table row fade-in */
@keyframes rowFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

tbody tr {
  animation: rowFadeIn 0.3s ease-out both;
}

/* Stagger first 10 rows */
tbody tr:nth-child(1)  { animation-delay: 0.02s; }
tbody tr:nth-child(2)  { animation-delay: 0.04s; }
tbody tr:nth-child(3)  { animation-delay: 0.06s; }
tbody tr:nth-child(4)  { animation-delay: 0.08s; }
tbody tr:nth-child(5)  { animation-delay: 0.10s; }
tbody tr:nth-child(6)  { animation-delay: 0.12s; }
tbody tr:nth-child(7)  { animation-delay: 0.14s; }
tbody tr:nth-child(8)  { animation-delay: 0.16s; }
tbody tr:nth-child(9)  { animation-delay: 0.18s; }
tbody tr:nth-child(10) { animation-delay: 0.20s; }

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* === RESPONSIVE === */

@media (max-width: 768px) {
  header h1 {
    font-size: 1.6rem;
  }

  .container {
    padding: 0 1rem;
  }

  .card {
    padding: 1.2rem;
    border-radius: var(--radius-md);
  }

  .metric .value {
    font-size: 1.3rem;
  }

  .risk-meter {
    padding: 0.8rem 1.2rem;
  }

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

  .chart-container {
    height: 180px;
  }
}
