:root {
  --bg-primary: #0a0e14;
  --bg-secondary: #0f1419;
  --bg-card: rgba(20, 28, 38, 0.8);
  --bg-card-hover: rgba(28, 38, 52, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --btc-color: #F7931A;
  --btc-glow: rgba(247, 147, 26, 0.3);
  --gold-color: #FFD700;
  --gold-glow: rgba(255, 215, 0, 0.3);
  --success: #00C853;
  --danger: #FF5252;
  --accent: #58a6ff;
}

.light {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(245, 248, 250, 1);
  --border-color: rgba(0, 0, 0, 0.1);
  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8b949e;
}

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

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  min-height: 100vh;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(247, 147, 26, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 0%, rgba(255, 215, 0, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(88, 166, 255, 0.05) 0%, transparent 50%),
    var(--bg-primary);
}

/* Header */
.header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 20, 0.9);
}

.light .header {
  background: rgba(255, 255, 255, 0.9);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btc-logo, .gold-logo {
  font-size: 2.5rem;
  animation: float 3s ease-in-out infinite;
}

.btc-logo {
  color: var(--btc-color);
  text-shadow: 0 0 20px var(--btc-glow);
}

.gold-logo {
  animation-delay: 1.5s;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.title-group {
  text-align: center;
}

.main-title {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--btc-color), var(--gold-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
  transition: transform 0.2s;
}

.main-title:hover {
  transform: scale(1.02);
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.last-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.refresh-btn, .theme-toggle {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-btn:hover:not(:disabled), .theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.refresh-btn.cooldown {
  opacity: 0.6;
  cursor: not-allowed;
}

.theme-toggle {
  font-size: 1.2rem;
  padding: 0.5rem;
}

/* Dashboard */
.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Loading skeleton */
.loading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.skeleton-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  min-height: 200px;
}

.skeleton-line {
  height: 20px;
  background: linear-gradient(90deg, var(--border-color) 25%, transparent 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.skeleton-line.wide { width: 80%; }
.skeleton-line.short { width: 40%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  transition: all 0.3s ease;
  position: relative;
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.card.featured {
  border-color: rgba(247, 147, 26, 0.3);
  box-shadow: 
    0 0 30px rgba(247, 147, 26, 0.1),
    0 0 60px rgba(255, 215, 0, 0.05);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-icon {
  font-size: 1.2rem;
}

.info-icon {
  color: var(--text-muted);
  cursor: help;
  font-size: 0.9rem;
}

.tooltip {
  position: absolute;
  top: 60px;
  right: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 250px;
  z-index: 10;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Hero Section */
.hero-section {
  margin-bottom: 1.5rem;
}

.price-comparison {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.price-card {
  flex: 1;
  min-width: 200px;
  text-align: center;
  padding: 1rem;
}

.asset-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.asset-icon {
  font-size: 1.5rem;
}

.asset-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.price-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.btc-price .price-value {
  color: var(--btc-color);
}

.gold-price .price-value {
  color: var(--gold-color);
}

.price-change {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.price-change.positive { color: var(--success); }
.price-change.negative { color: var(--danger); }

.sparkline-canvas {
  display: block;
  margin: 0 auto;
}

.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vs-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--btc-color), var(--gold-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #000;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 30px rgba(247, 147, 26, 0.4);
}

.vs-badge:hover {
  transform: scale(1.1) rotate(10deg);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Market Cap Section */
.market-cap-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cap-label {
  font-size: 1rem;
  color: var(--text-secondary);
}

.cap-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
}

.btc-text { color: var(--btc-color); }
.gold-text { color: var(--gold-color); }

.flippening-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.flippening-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.flippening-pct {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--btc-color);
}

.flippening-container {
  position: relative;
}

.flippening-bar {
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.flippening-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--btc-color), var(--gold-color));
  border-radius: 12px;
  transition: width 1s ease-out;
}

.milestone {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.milestone.reached {
  color: var(--success);
}

.milestone-check {
  font-size: 0.7rem;
}

/* Volatility Gauges */
.volatility-gauges {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gauge-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gauge-label {
  min-width: 70px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.gauge-bar-container {
  flex: 1;
  height: 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
}

.gauge-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 1s ease-out;
}

.gauge-bar.btc-bar {
  background: linear-gradient(90deg, var(--btc-color), #ff7b00);
}

.gauge-bar.gold-bar {
  background: linear-gradient(90deg, var(--gold-color), #ffa500);
}

.gauge-value {
  min-width: 50px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  text-align: right;
}

.volatility-note, .volume-note, .oi-note {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Volume Section */
.volume-values {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1rem;
}

.volume-item {
  text-align: center;
}

.vol-label {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.vol-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 600;
}

.volume-comparison {
  margin-top: 1rem;
}

.volume-bar-stack {
  display: flex;
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.volume-segment {
  height: 100%;
  transition: width 1s ease-out;
}

.btc-segment { background: var(--btc-color); }
.gold-segment { background: var(--gold-color); }

.volume-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.btc-legend { color: var(--btc-color); }
.gold-legend { color: var(--gold-color); }

/* Futures OI */
.oi-comparison {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.oi-item {
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
}

.oi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.trend-arrow {
  font-size: 1.2rem;
}

.trend-arrow.up { color: var(--success); }
.trend-arrow.down { color: var(--danger); }

.oi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Stats Row */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 150px;
}

.stat-pill.fun-fact {
  min-width: 280px;
  border-color: var(--accent);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
}

/* Calculator */
.calculator-section {
  margin-bottom: 2rem;
}

.calculator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.calc-title {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.calc-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.calc-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calc-input-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.calc-input-group input {
  width: 150px;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  text-align: center;
}

.calc-input-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.calc-equals {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.calc-usd {
  text-align: center;
  margin-top: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Footer */
.footer {
  padding: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.data-source {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.powered-by {
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.powered-by:hover {
  text-decoration: underline;
}

.disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* VS Battle Overlay */
.vs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.vs-battle {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-direction: column;
}

.fighter {
  font-size: 5rem;
  animation: bounce 0.5s infinite alternate;
  opacity: 0.5;
  transition: all 0.5s;
}

.fighter.winner {
  opacity: 1;
  transform: scale(1.3);
  filter: drop-shadow(0 0 30px currentColor);
}

.btc-fighter { color: var(--btc-color); }
.gold-fighter { color: var(--gold-color); animation-delay: 0.25s; }

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-20px); }
}

.vs-text {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--btc-color), var(--gold-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.winner-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  animation: fadeInUp 0.5s 0.3s both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }
  
  .header-content {
    flex-direction: column;
    text-align: center;
  }
  
  .logo-section {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .main-title {
    font-size: 1.5rem;
  }
  
  .btc-logo, .gold-logo {
    font-size: 2rem;
  }
  
  .header-controls {
    justify-content: center;
  }
  
  .dashboard {
    padding: 1rem;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .price-comparison {
    flex-direction: column;
    gap: 1rem;
  }
  
  .price-value {
    font-size: 2rem;
  }
  
  .vs-divider {
    transform: rotate(90deg);
    margin: 1rem 0;
  }
  
  .stats-row {
    flex-direction: column;
    align-items: center;
  }
  
  .stat-pill {
    width: 100%;
    max-width: 300px;
  }
  
  .calc-inputs {
    flex-direction: column;
  }
  
  .calc-equals {
    margin: 0;
  }
  
  .fighter {
    font-size: 3rem;
  }
  
  .vs-text {
    font-size: 2rem;
  }
}