:root {
  /* Pink Theme & Harmonious Accents */
  --bg-gradient: radial-gradient(130% 120% at 50% 0%, #fed7e2 0%, #fbcfe8 35%, #fce7f3 70%, #f472b6 100%);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-hover: rgba(255, 255, 255, 0.98);
  --panel-active: #ffffff;
  --panel-border: rgba(244, 114, 182, 0.28);
  --panel-border-glow: rgba(236, 72, 153, 0.4);
  
  --text-main: #1f1224;
  --text-sub: #704d6e;
  --text-muted: #9d7b9c;

  --accent-pink: #ec4899;
  --accent-deep: #db2777;
  
  --up: #059669;
  --up-bg: rgba(5, 150, 105, 0.12);
  --up-border: rgba(5, 150, 105, 0.25);
  
  --down: #e11d48;
  --down-bg: rgba(225, 29, 72, 0.12);
  --down-border: rgba(225, 29, 72, 0.25);
  
  --shadow-sm: 0 4px 12px rgba(190, 24, 93, 0.06);
  --shadow-md: 0 10px 25px -4px rgba(190, 24, 93, 0.1), 0 4px 10px -2px rgba(190, 24, 93, 0.05);
  --shadow-lg: 0 18px 36px -6px rgba(190, 24, 93, 0.15), 0 8px 16px -4px rgba(190, 24, 93, 0.08);
}

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

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 1060px;
  height: calc(100vh - 40px);
  max-height: 840px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(244, 114, 182, 0.2);
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.3px;
  color: #831843;
}

.brand-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Volatility Control in Header */
.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.volatility-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(253, 242, 248, 0.8);
  border: 1px solid rgba(244, 114, 182, 0.3);
  padding: 6px 12px;
  border-radius: 14px;
}

.vol-label {
  font-size: 12px;
  font-weight: 700;
  color: #831843;
  white-space: nowrap;
}

.vol-label strong {
  color: #be123c;
}

#volatility-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 75px;
  height: 5px;
  background: rgba(244, 114, 182, 0.4);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

#volatility-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #db2777;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(219, 39, 119, 0.5);
  transition: transform 0.1s ease;
}

#volatility-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.vol-presets {
  display: flex;
  gap: 4px;
}

.vol-tag {
  background: transparent;
  border: 1px solid transparent;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s ease;
}

.vol-tag:hover {
  background: rgba(244, 114, 182, 0.15);
  color: #831843;
}

.vol-tag.active {
  background: #db2777;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(219, 39, 119, 0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.staff-mail-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  color: #831843;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(244, 114, 182, 0.35);
  padding: 6px 10px;
  border-radius: 10px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.staff-mail-btn:hover {
  background: #ffffff;
  border-color: #db2777;
  color: #db2777;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(219, 39, 119, 0.15);
}

.account {
  display: flex;
  align-items: center;
}

.account-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.label {
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

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

#capital {
  font-size: 22px;
  font-weight: 800;
  color: #500724;
}

.chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
}

.chip.up, .quote-sub.up, .mono.up, .chip-sm.up {
  color: var(--up);
  background: var(--up-bg);
  border-color: var(--up-border);
}

.chip.down, .quote-sub.down, .mono.down, .chip-sm.down {
  color: var(--down);
  background: var(--down-bg);
  border-color: var(--down-border);
}

.chip-sm {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 700;
  border: 1px solid transparent;
}

.clock-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #831843;
  background: rgba(251, 207, 232, 0.6);
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(244, 114, 182, 0.3);
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Main Body Layout */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  min-height: 0;
}

/* Asset List / Nav */
.asset-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.asset-list::-webkit-scrollbar {
  width: 6px;
}

.asset-list::-webkit-scrollbar-thumb {
  background: rgba(244, 114, 182, 0.4);
  border-radius: 999px;
}

.asset-card {
  text-align: left;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid var(--panel-border);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text-main);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.asset-card:hover {
  background: var(--panel-hover);
  border-color: rgba(236, 72, 153, 0.5);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.asset-card.active {
  border-color: var(--accent-deep);
  background: var(--panel-active);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.22), var(--shadow-md);
}

.asset-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.card-icon {
  font-size: 22px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(253, 242, 248, 0.9);
  border-radius: 10px;
  border: 1px solid rgba(244, 114, 182, 0.2);
  flex-shrink: 0;
}

.card-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.card-info .sym {
  font-weight: 800;
  font-size: 15px;
  color: #831843;
}

.card-info .subname {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-price-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.card-price-col .price {
  font-size: 14px;
  font-weight: 700;
  color: #500724;
}

/* Chart Panel */
.chart-panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--panel-border);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 16px;
}

.asset-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timeline-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(253, 242, 248, 0.9);
  border: 1.5px solid rgba(244, 114, 182, 0.4);
  color: #831843;
  padding: 8px 14px;
  border-radius: 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.timeline-toggle-btn:hover {
  background: #ffffff;
  border-color: #db2777;
  color: #db2777;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.timeline-toggle-btn.active-timeline {
  background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
  color: #ffffff;
  border-color: #db2777;
  box-shadow: 0 4px 14px rgba(219, 39, 119, 0.35);
}

.timeline-toggle-btn.active-timeline:hover {
  background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.asset-huge-icon {
  font-size: 32px;
  width: 52px;
  height: 52px;
  background: rgba(254, 226, 226, 0.5);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(244, 114, 182, 0.3);
  box-shadow: 0 4px 10px rgba(244, 114, 182, 0.15);
}

#asset-name {
  font-size: 20px;
  font-weight: 800;
  color: #831843;
  margin-bottom: 2px;
}

.ticker-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-deep);
  background: rgba(244, 114, 182, 0.18);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.quote-wrapper {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#asset-quote {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.quote-sub {
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 6px;
}

.canvas-container {
  flex: 1;
  position: relative;
  width: 100%;
  min-height: 180px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  border: 1px solid rgba(244, 114, 182, 0.15);
  margin: 8px 0;
  overflow: hidden;
}

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

.chart-foot {
  padding-top: 14px;
  border-top: 1px solid rgba(244, 114, 182, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
}

.desc-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9d174d;
  background: rgba(251, 207, 232, 0.7);
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

#asset-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.4;
}

/* Bottom Trading Tray */
.tray {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.holding-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#holding {
  font-size: 15px;
  color: #831843;
}

.holding-val {
  font-weight: 800;
  color: #701a75;
}

.holding-sub {
  color: var(--text-sub);
  font-weight: 600;
  margin-left: 4px;
}

.controls {
  display: flex;
  gap: 12px;
}

.controls button {
  border: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 130px;
}

.btn-sell {
  background: #ffffff;
  color: #be123c;
  border: 1.5px solid rgba(225, 29, 72, 0.25) !important;
  box-shadow: var(--shadow-sm);
}

.btn-sell:hover {
  background: #fff1f2;
  border-color: #be123c !important;
  transform: translateY(-1px);
}

.btn-sell:active, .pulse-sell {
  background: #f43f5e !important;
  color: #ffffff !important;
  transform: scale(0.97);
}

.btn-buy.primary {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.btn-buy.primary:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
  transform: translateY(-1px);
}

.btn-buy.primary:active, .pulse-buy {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
}

/* Responsive */
@media (max-width: 900px) {
  header {
    flex-wrap: wrap;
    gap: 12px;
  }
  .header-center {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .app-container {
    height: auto;
    max-height: none;
  }

  main {
    grid-template-columns: 1fr;
  }

  .chart-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .chart-actions {
    width: 100%;
    justify-content: space-between;
  }

  .asset-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .asset-card {
    min-width: 170px;
  }

  .tray {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .controls {
    justify-content: stretch;
  }

  .controls button {
    flex: 1;
  }
}
