:root {
  --bg: #f8f9fc;
  --panel: #ffffff;
  --text: #1e2430;
  --muted: #6b7280;
  
  /* Glass Colors */
  --up: #27ae60;
  --up-bg: rgba(39, 174, 96, 0.15);
  --down: #e74c3c;
  --down-bg: rgba(231, 76, 60, 0.15);
  --flat: #95a5a6;
  --flat-bg: rgba(149, 165, 166, 0.15);
  
  --shadow: 0 4px 14px rgba(20, 30, 50, 0.05);
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden; /* Prevent scrollbars, rely on chart area */
}

body { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px;
  background: var(--panel); box-shadow: var(--shadow); z-index: 5; flex-wrap: wrap;
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, #1e9e5a, #4ad08a);
  box-shadow: 0 0 0 4px rgba(30, 158, 90, 0.15);
}
.brand h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
select, button {
  font: inherit; font-size: 14px; padding: 8px 12px;
  border-radius: 8px; border: 1px solid #d7dbe3; background: var(--panel);
  color: var(--text); cursor: pointer; transition: border-color .15s, background .15s;
}
select:hover, button:hover { border-color: #b6bdc9; }
button:active { transform: translateY(1px); }
.status { font-size: 13px; color: var(--muted); min-width: 120px; text-align: right; }
.status.error { color: var(--down); }

/* ---------- Chart area ---------- */
.chart-area {
  position: relative; 
  flex: 1; 
  margin: 16px;
  border-radius: var(--radius); 
  background: var(--panel);
  box-shadow: inset 0 0 0 1px #eaedf2; 
  overflow: hidden; 
}

.empty-state {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 15px;
}

/* ---------- Bubbles (Glassmorphism) ---------- */
.bubble {
  position: absolute; 
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; cursor: pointer;
  transition: transform .25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity .4s ease;
  will-change: transform, left, top, width, height;
  opacity: 0; 
  padding: 4px; 
  overflow: hidden; 
  box-sizing: border-box;
  
  /* Text styling matches reference */
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 2px rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
}

.bubble.visible { opacity: 1; }
.bubble:hover { 
  transform: scale(1.05); 
  z-index: 10; 
  box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
}

.bubble .sym {
  font-weight: 700; letter-spacing: -0.01em;
  line-height: 1.1; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%;
}

.bubble .chg {
  font-weight: 500; line-height: 1.2; margin-top: 2px; white-space: nowrap;
}

/* Glass Palettes */
.bubble.up {
  background: radial-gradient(circle at 50% 0%, rgba(46, 204, 113, 0.4) 0%, rgba(46, 204, 113, 0.15) 100%);
  border: 3px solid #2ecc71;
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.2), inset 0 0 15px rgba(46, 204, 113, 0.2);
}
.bubble.down {
  background: radial-gradient(circle at 50% 0%, rgba(231, 76, 60, 0.4) 0%, rgba(231, 76, 60, 0.15) 100%);
  border: 3px solid #e74c3c;
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.2), inset 0 0 15px rgba(231, 76, 60, 0.2);
}
.bubble.flat {
  background: radial-gradient(circle at 50% 0%, rgba(149, 165, 166, 0.4) 0%, rgba(149, 165, 166, 0.15) 100%);
  border: 3px solid #95a5a6;
  box-shadow: 0 6px 20px rgba(149, 165, 166, 0.2), inset 0 0 15px rgba(149, 165, 166, 0.2);
}

/* Force text to stay readable on light backgrounds */
.bubble.flat .sym, .bubble.flat .chg {
  color: #ffffff;
}

/* ---------- Footer ---------- */
.footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 20px 16px; font-size: 12.5px;
  color: var(--muted); flex-wrap: wrap; flex-shrink: 0;
}
.legend { display: flex; gap: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.swatch.up { background: var(--up); }
.swatch.down { background: var(--down); }
.swatch.flat { background: var(--flat); }

@media (max-width: 640px) {
  .topbar { padding: 12px; }
  .status { width: 100%; text-align: left; }
  .chart-area { margin: 10px; }
  .brand h1 { font-size: 16px; }
}
