:root {
  color-scheme: dark;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #1d222b;
  color: #f5f7fb;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #1d222b;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 14px;
  min-width: 0;
  background: #343945;
  border-bottom: 1px solid #1a1f27;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 12px;
}

.brand__logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1;
}

.sidebar-toggle {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #e9edf5;
  background: #343a46;
  border: 1px solid #464d5a;
  border-radius: 4px;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: #ee5752;
  border-color: #ee5752;
}

.index-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.index-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  gap: 2px;
  height: 32px;
  padding: 0 4px 0 7px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #cfd4dc;
  border-radius: 4px;
  white-space: nowrap;
}

.index-card--compact {
  flex: 0 0 auto;
  width: max-content;
  padding: 0 10px;
}

.index-card__text {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}

.index-card__label {
  flex: 0 1 auto;
  min-width: 0;
  color: inherit;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.index-card__value {
  flex: 0 1 auto;
  min-width: 0;
  color: inherit;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.index-card__pct {
  flex: 0 0 auto;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}

.index-card__chart {
  flex: 0 0 auto;
  width: 75px;
  height: 100%;
  object-fit: fill;
  opacity: 0.9;
}

.is-up {
  color: #ff4246;
}

.is-down {
  color: #20d86b;
}

.workspace {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 0;
  overflow: hidden;
}

.app-shell.is-sidebar-collapsed .workspace {
  grid-template-columns: 1fr;
}

.app-shell.is-sidebar-collapsed .sidebar {
  display: none;
}



.heatmap-panel {
  grid-column: 2;
  grid-row: 1;
}

.app-shell.is-sidebar-collapsed .heatmap-panel {
  grid-column: 1;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  align-items: start;
  padding: 12px;
  background: #262b35;
  border-right: 1px solid #171b22;
  min-height: 0;
  overflow: hidden;
}

.panel {
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #dce2ec;
}

.market-list {
  display: grid;
  gap: 8px;
}

.view-nav {
  display: grid;
  gap: 8px;
}

.view-link {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  color: #e9edf5;
  font-size: 13px;
  background: #343a46;
  border: 1px solid #464d5a;
  border-radius: 5px;
}

.view-link:hover,
.view-link.is-active {
  background: #ee5752;
  border-color: #ee5752;
}

.market-button {
  width: 100%;
  height: 26px;
  border: 1px solid #464d5a;
  border-radius: 5px;
  color: #e9edf5;
  font-size: 12px;
  background: #343a46;
  cursor: pointer;
  text-align: left;
  padding: 0 12px;
}

.market-button:hover,
.market-button.is-active {
  background: #ee5752;
  border-color: #ee5752;
}

.chart-type-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.chart-type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: #e9edf5;
  font-size: 13px;
  cursor: pointer;
}

.chart-type-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #ee5752;
}

.quote-error {
  align-self: end;
  justify-self: start;
  width: 100%;
  padding: 7px 8px;
  color: #991b1b;
  font-size: 10px;
  line-height: 1.35;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
}

.quote-error[hidden] {
  display: none;
}

.heatmap-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  background: #252931;
  overflow: hidden;
}

.heatmap-stage {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.heatmap-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
  touch-action: none;
  user-select: none;
}

.heatmap-stage canvas.is-zoomed {
  cursor: grab;
}

.heatmap-stage canvas.is-dragging {
  cursor: grabbing;
}

.heatmap-panel[hidden] {
  display: none;
}

.legend {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 6px;
  padding: 0;
  background: transparent;
}

.legend-bar {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 18px;
  overflow: hidden;
  border-radius: 2px;
}

.legend-bar__label {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  pointer-events: none;
}

.tooltip-root {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.stock-tooltip {
  position: fixed;
  width: 360px;
  min-height: 180px;
  overflow: hidden;
  color: #111827;
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 4px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.stock-tooltip[hidden] {
  display: none;
}

.stock-tooltip__title {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 10px;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  line-height: 24px;
  background: #f2f4f8;
}

.stock-tooltip__title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-tooltip__title-code {
  flex-shrink: 0;
  color: #6b7280;
  font-weight: 400;
  font-size: 11px;
}

.stock-tooltip__current {
  border-bottom: 1px solid rgba(17, 24, 39, 0.12);
}

.stock-tooltip__current-summary {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 82px 86px;
  align-items: center;
  column-gap: 8px;
  min-width: 0;
  padding: 12px 10px;
  color: #ffffff;
  font-size: 18px;
  line-height: 1.1;
}

.stock-tooltip__row {
  display: grid;
  grid-template-columns: minmax(78px, 1fr) 64px 66px;
  align-items: center;
  column-gap: 8px;
  min-width: 0;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
}

.stock-tooltip__current-name,
.stock-tooltip__row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-tooltip__row-name {
  color: #111827;
}

.stock-tooltip__price,
.stock-tooltip__change {
  text-align: right;
  font-weight: 800;
  color: #ffffff;
}

.stock-tooltip__row-price,
.stock-tooltip__row-change {
  text-align: right;
  font-weight: 700;
}

.stock-tooltip__chart {
  display: block;
  width: 100%;
  aspect-ratio: 545 / 300;
  object-fit: cover;
  background: #ffffff;
}

.stock-tooltip__chart--minute {
  margin-top: 4px;
}

.stock-tooltip__rows {
  display: grid;
}

.stock-tooltip__row {
  height: 20px;
  color: #111827;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.stock-tooltip__row:last-child {
  border-bottom: 0;
}

@media (max-width: 640px) {
  .topbar {
    gap: 8px;
    padding: 7px 8px;
  }

  .index-bar {
    gap: 4px;
  }

  .index-card {
    gap: 3px;
    padding: 0 3px;
  }

  .index-card__label,
  .index-card__pct {
    font-size: 10px;
  }
}

  .index-card__value {
    font-size: 11px;
  }
}
