* { box-sizing: border-box; }
html, body { overflow-x: hidden; }

.markets-page { color: #122131; background: #f6f8fb; width: 100%; max-width: 100%; padding: 0 8px 14px; }
.ticker-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #dde4ee;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: .82rem;
  overflow: hidden;
}
.ticker-item { white-space: nowrap; }
.ticker-item em { font-style: normal; color: #4b5d75; margin-left: 4px; }
.pos { color: #17a34a; }
.neg { color: #dc3545; }
.neutral { color: #6b7280; }

.dashboard-panel {
  background: #ffffff;
  border: 1px solid #dde4ee;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(27, 45, 74, 0.06);
  width: 100%;
}
.coin-header { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid #e6ebf2; padding-bottom: 12px; }
.coin-meta { display: flex; gap: 10px; align-items: center; }
.coin-icon { width: 36px; height: 36px; border-radius: 50%; background: #e8eefb; color: #3b5bdb; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.coin-pair { font-size: 1.02rem; font-weight: 700; }
.coin-name { color: #64748b; font-size: .9rem; }
.header-stats { display:grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 8px; flex:1; }
.header-stats span { color:#64748b; font-size:.74rem; display:block; }
.header-stats strong { font-size: .9rem; transition: color .2s ease, text-shadow .2s ease; }

.price-flash-up { color: #16a34a !important; text-shadow: 0 0 8px rgba(22,163,74,.45); }
.price-flash-down { color: #dc3545 !important; text-shadow: 0 0 8px rgba(220,53,69,.45); }

.toolbar { display:flex; gap:8px; align-items:flex-end; margin: 12px 0; width: 100%; }
.toolbar-spacer { flex: 1; }
.timeframe-select-wrap { display:flex; flex-direction:column; gap:3px; width:auto; margin-left:auto; }
.timeframe-select-wrap span { color:#64748b; font-size:.74rem; }
#timeframeSelect { width:auto; min-width: 150px; margin:0; padding:7px 10px; background:#f8fafe; color:#223047; border:1px solid #d6dfeb; border-radius:8px; }

.status { color:#5b6b81; margin-bottom:8px; min-height: 20px; font-size: .86rem; }
.status.live { color: #1f7a3b; }
.status.error { color: #b42318; }

.chart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.chart-shell {
  position: relative;
  border: 1px solid #e3e9f2;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  width: 100%;
  max-width: none;
  margin: 0;
  overflow: hidden;
}
#chartCanvas { width: 100%; height: 520px; display:block; border-radius: 8px; cursor: crosshair; }
.hover-info { margin-top: 8px; font-size: .78rem; color:#4b5d75; background:#f8fafe; border:1px solid #dbe5f3; border-radius:6px; padding:6px 8px; min-height: 32px; }
.ma-legend { position:absolute; top: 12px; left: 12px; z-index: 3; display:flex; gap:10px; flex-wrap:wrap; font-size:.74rem; color:#4b5d75; background:rgba(255,255,255,.92); padding:4px 8px; border-radius:6px; }
.ma-item { display:flex; align-items:center; gap:4px; }
.ma-item i { width:10px; height:10px; border-radius:2px; display:inline-block; }
.ma5 i { background:#f59e0b; }
.ma10 i { background:#3b82f6; }
.ma30 i { background:#8b5cf6; }
.ma-item em { font-style: normal; }

.live-side-panel { border: 1px solid #e3e9f2; border-radius: 12px; padding: 10px; background: #fff; }
.live-side-panel h3 { margin: 0 0 8px; font-size: .95rem; }
.live-price { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.live-change { font-size: .9rem; margin-bottom: 4px; }
.live-time { font-size: .78rem; color: #64748b; margin-bottom: 8px; }
.live-sparkline { width: 100%; height: 80px; border: 1px solid #e8edf4; border-radius: 8px; background: #fcfdff; }

@media (max-width: 1366px) { #chartCanvas { height: 460px; } }
@media (max-width: 980px) {
  .chart-layout { grid-template-columns: 1fr; }
  .live-side-panel { order: 2; }
}
@media (max-width: 768px) {
  .markets-page { padding: 0 4px 10px; }
  #chartCanvas { height: 320px; }
  .ticker-strip { overflow-x: auto; flex-wrap: nowrap; }
}
