:root {
  --bg-color: #0b0f19;
  --card-bg: rgba(18, 26, 43, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --primary-cyan: #00F2FE;
  --primary-blue: #4FACFE;
  --neon-green: #00E676;
  --neon-green-glow: rgba(0, 230, 118, 0.35);
  --neon-red: #FF5252;
  --text-main: #FFFFFF;
  --text-muted: #8E9BAE;
  --accent-gold: #FFD700;
  --radius-lg: 18px;
  --radius-md: 12px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 242, 254, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(79, 172, 254, 0.12) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 480px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-ai {
  font-size: 0.65rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  color: #000;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.25);
  padding: 6px 12px;
  border-radius: 20px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--neon-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--neon-green);
  animation: pulse 1.5s infinite;
}

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

.status-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--neon-green);
}

/* Pair Card */
.pair-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pair-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.coin-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #F7931A, #FFB900);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: #FFF;
  box-shadow: 0 4px 12px rgba(247, 147, 26, 0.3);
}

.pair-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.pair-full {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.price-container {
  text-align: right;
}

.live-price {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
}

.price-change.positive {
  font-size: 0.8rem;
  color: var(--neon-green);
  font-weight: 600;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.stat-val {
  font-size: 0.85rem;
  font-weight: 700;
}

.signal-buy {
  color: var(--primary-cyan);
}

.highlight-green {
  color: var(--neon-green);
  font-family: var(--font-mono);
  font-size: 1rem;
}

/* Chart Box */
.chart-box {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tf-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(7, 11, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#chartCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.trade-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--neon-green);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 15px var(--neon-green-glow);
  transition: all 0.3s ease;
}

.trade-overlay.hidden {
  display: none;
  opacity: 0;
}

.pnl-counter {
  display: flex;
  flex-direction: column;
}

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

.pnl-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--neon-green);
}

/* Controls */
.control-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trade-specs {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.spec-title {
  color: var(--text-muted);
}

.spec-value {
  font-weight: 700;
}

.spec-value.leverage {
  color: var(--accent-gold);
}

.btn-trade {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  color: #000;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-trade:active {
  transform: scale(0.98);
}

.btn-trade.running {
  background: linear-gradient(135deg, #FFB900, #F7931A);
  box-shadow: 0 4px 20px rgba(247, 147, 26, 0.4);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal-backdrop.hidden {
  display: none;
}

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

.modal-card {
  background: #111928;
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  animation: scaleUp 0.3s ease;
}

@keyframes scaleUp {
  from { transform: scale(0.9); }
  to { transform: scale(1); }
}

.modal-icon-wrap {
  position: relative;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--neon-green), #00B0FF);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #000;
  font-weight: 900;
  box-shadow: 0 0 25px var(--neon-green-glow);
}

.confetti-effect {
  position: absolute;
  top: -10px;
  right: -15px;
  font-size: 1.8rem;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
}

.modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.profit-box {
  background: rgba(0, 230, 118, 0.08);
  border: 1px dashed rgba(0, 230, 118, 0.4);
  border-radius: var(--radius-md);
  width: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profit-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.profit-amount {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--neon-green);
  text-shadow: 0 0 12px var(--neon-green-glow);
}

.profit-sub {
  font-size: 0.72rem;
  color: var(--neon-green);
}

.result-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
  border-top: 1px solid var(--card-border);
  padding-top: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.detail-row span:last-child {
  color: #FFF;
  font-weight: 600;
}

.green-text {
  color: var(--neon-green) !important;
}

.btn-confirm {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--neon-green), #00E5FF);
  color: #000;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 4px 20px var(--neon-green-glow);
}
