/* ==========================================================================
   BULL RUN: TRADER'S SIDECAR - STYLESHEET
   Google Chrome Dino Minimalist + Crypto Trading UI Tokens
   ========================================================================== */

:root {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #182234;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --accent-green: #22c55e;
  --accent-green-glow: rgba(34, 197, 94, 0.4);
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --accent-cyan: #06b6d4;
  --canvas-bg: #0b1120;
  --chart-grid: rgba(255, 255, 255, 0.05);
  --font-mono: 'SF Mono', 'Fira Code', 'Roboto Mono', 'Courier New', monospace;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.4);
  --radius-sm: 6px;
  --radius-md: 10px;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #cbd5e1;
  --accent-green: #16a34a;
  --accent-green-glow: rgba(22, 163, 74, 0.3);
  --accent-red: #dc2626;
  --accent-orange: #d97706;
  --accent-cyan: #0891b2;
  --canvas-bg: #f8fafc;
  --chart-grid: rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* App Outer Container */
.sidecar-wrapper {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Header & Trader Bar */
.sidecar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-img {
  height: 28px;
  width: auto;
  max-width: 100px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  transition: transform 0.2s ease;
}

.brand-logo-img:hover {
  transform: scale(1.05);
}

.brand-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  font-weight: 700;
  border: 1px solid rgba(34, 197, 94, 0.3);
  letter-spacing: 0.05em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.icon-btn.active {
  color: var(--accent-green);
  border-color: var(--accent-green);
}

/* Game Canvas Container */
.game-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 540 / 260;
  background: var(--canvas-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

canvas#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Overlays (Pause, Blur, Boss Key, Game Over) */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  z-index: 20;
  transition: opacity 0.15s ease;
}

[data-theme="light"] .game-overlay {
  background: rgba(248, 250, 252, 0.92);
}

.game-overlay.hidden {
  display: none !important;
}

.overlay-tag {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-orange);
  margin-bottom: 6px;
  font-weight: 700;
}

.overlay-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.overlay-title.rekt {
  color: var(--accent-red);
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.overlay-pnl {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.overlay-pnl span {
  color: var(--accent-green);
  font-weight: 700;
}

.overlay-pnl.rekt span {
  color: var(--accent-red);
}

/* Mega Telegram CTA Button */
.mega-tg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #0088cc 0%, #00a2ed 50%, #229ed9 100%);
  color: #ffffff !important;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 28px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 4px 18px rgba(0, 136, 204, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.25);
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  animation: megaPulse 2s infinite ease-in-out;
  position: relative;
  z-index: 30;
  max-width: 90%;
}

.mega-tg-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 26px rgba(0, 136, 204, 0.75), inset 0 1px 2px rgba(255, 255, 255, 0.6);
  background: linear-gradient(135deg, #0099e6 0%, #1ab3ff 50%, #38bdf8 100%);
}

.mega-tg-btn:active {
  transform: translateY(1px) scale(0.98);
}

.mega-tg-btn .tg-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.mega-tg-btn .tg-arrow {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.mega-tg-btn:hover .tg-arrow {
  transform: translateX(4px);
}

@keyframes megaPulse {
  0%, 100% {
    box-shadow: 0 4px 18px rgba(0, 136, 204, 0.45);
  }
  50% {
    box-shadow: 0 6px 28px rgba(0, 136, 204, 0.8), 0 0 12px rgba(34, 197, 94, 0.4);
    transform: scale(1.02);
  }
}

.action-prompt {
  font-size: 0.70rem;
  padding: 5px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  font-weight: 600;
  animation: pulsePrompt 1.4s infinite ease-in-out;
}

@keyframes pulsePrompt {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}

/* Boss Screen Fake Disguise */
#bossOverlay {
  background: #131722;
  color: #d1d4dc;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  z-index: 50;
  align-items: stretch;
  justify-content: flex-start;
  padding: 12px;
  cursor: pointer;
}

.fake-chart-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #2a2e39;
  padding-bottom: 6px;
  font-size: 0.75rem;
}

.fake-chart-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: #787b86;
  font-size: 0.75rem;
}

/* Live Traders Counter Bar Directly Above Game */
.live-traders-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.72rem;
  box-shadow: var(--shadow-sm);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-green);
  animation: liveDotPulse 1.6s infinite ease-in-out;
}

@keyframes liveDotPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 12px var(--accent-green); }
}

.live-text {
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
}

.live-count {
  color: var(--accent-green);
  font-weight: 800;
  font-family: var(--font-mono);
  background: rgba(34, 197, 94, 0.12);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(34, 197, 94, 0.3);
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
}

.mobile-touch-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* Mobile Virtual Touch Controls */
.mobile-controls-bar {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
}

.touch-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-bottom-width: 3px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 12px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.1s ease;
  box-shadow: var(--shadow-sm);
}

.touch-btn:active, .touch-btn.active {
  background: var(--bg-card);
  border-bottom-width: 1px;
  transform: translateY(2px);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.touch-btn-jump {
  border-color: rgba(34, 197, 94, 0.4);
}

.touch-btn-duck {
  border-color: rgba(6, 182, 212, 0.4);
}

/* Controls & Hotkey Footer */
.sidecar-footer {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.key-hints {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.key-hint {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kbd {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 700;
}

.mode-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MOBILE & TOUCH RESPONSIVE STYLES
   ========================================================================== */
@media (max-width: 600px) {
  body {
    padding: 6px;
  }

  .sidecar-wrapper {
    gap: 6px;
  }

  .sidecar-header {
    padding: 6px 10px;
  }

  .brand-logo-img {
    height: 24px;
  }

  .brand-title {
    font-size: 0.74rem;
  }

  .brand-badge {
    font-size: 0.55rem;
    padding: 1px 4px;
  }

  .icon-btn {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }

  .live-traders-bar {
    padding: 4px 8px;
    font-size: 0.64rem;
  }

  .live-text {
    font-size: 0.60rem;
  }

  .live-count {
    font-size: 0.68rem;
    padding: 1px 5px;
  }

  .mobile-touch-hint {
    font-size: 0.55rem;
    gap: 4px;
  }

  /* Show dedicated touch buttons on mobile */
  .mobile-controls-bar {
    display: grid;
  }

  .sidecar-footer {
    display: none; /* Replaced by touch buttons on small screens */
  }

  .overlay-title {
    font-size: 1rem;
  }

  .overlay-pnl {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }

  .mega-tg-btn {
    padding: 8px 14px;
    font-size: 0.68rem;
    gap: 6px;
  }

  .mega-tg-btn .tg-icon {
    width: 18px;
    height: 18px;
  }

  .action-prompt {
    font-size: 0.62rem;
    padding: 4px 10px;
  }
}

/* Prevent accidental text selections and zooming */
canvas#gameCanvas {
  touch-action: none;
}

