:root {
  color-scheme: dark;
  --bg: #07100e;
  --surface: #0b1714;
  --surface-raised: #0e1d19;
  --surface-soft: #12231f;
  --line: rgba(146, 190, 174, 0.16);
  --line-strong: rgba(164, 214, 190, 0.29);
  --text: #effaf4;
  --muted: #82a095;
  --muted-strong: #b3cbbf;
  --positive: #45e08f;
  --positive-soft: rgba(69, 224, 143, 0.12);
  --negative: #ff7078;
  --negative-soft: rgba(255, 112, 120, 0.12);
  --accent: #ddfb82;
  --accent-soft: rgba(221, 251, 130, 0.12);
  --warning: #f6c86e;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  --radius: 10px;
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  min-width: 960px;
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% -10%, rgba(68, 156, 119, 0.12), transparent 34%),
    radial-gradient(circle at 92% 0%, rgba(168, 208, 86, 0.06), transparent 26%),
    var(--bg);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100vh;
}

/* Keep the TradingData page inside the same LimeFinance shell as the homepage. */
.site-header {
  position: relative;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 14, 0.92);
  backdrop-filter: blur(18px);
}

.site-header a,
.site-header a:hover,
.site-header a:focus-visible {
  text-decoration: none;
}

.site-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 92%;
  min-height: 104px;
  margin: 0 auto;
  gap: 28px;
}

.site-header .brand-mark {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  height: auto;
  gap: 11px;
  overflow: visible;
  border-radius: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.site-header .brand-mark .brand-logo {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(182, 239, 77, 0.2));
}

.site-header .brand-mark > span {
  color: #ffffff;
  transition: color 0.3s ease;
}

.site-header .brand-mark > span > span {
  color: #22c55e;
  transition: color 0.3s ease;
}

.site-header .brand-mark:hover > span,
.site-header .brand-mark:focus-visible > span {
  color: #22c55e;
}

.site-header .brand-mark:hover > span > span,
.site-header .brand-mark:focus-visible > span > span {
  color: #ffffff;
}

.site-header .desktop-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: 0 1 auto;
}

.nav-live-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-live-wrap > .nav-link {
  padding-right: 19px;
}

.nav-live-link {
  position: absolute;
  top: 2px;
  right: 3px;
  z-index: 1;
  padding: 0 2px;
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  transition: color 180ms ease, transform 180ms ease;
}

.nav-live-link:hover,
.nav-live-link:focus-visible {
  color: var(--text);
  transform: translateY(-1px);
}

.site-header .nav-link {
  position: relative;
  padding: 11px 10px;
  color: rgba(239, 250, 244, 0.72);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  transition: color 180ms ease;
}

.site-header .nav-link::after {
  content: "";
  display: none;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
  color: var(--text);
}

.site-header .nav-link.active::after,
.site-header .nav-link:hover::after {
  transform: scaleX(1);
}

.site-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.site-header .language-switch {
  position: relative;
}

.site-header .language-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.site-header .language-toggle:hover,
.site-header .language-toggle:focus-visible {
  color: var(--accent);
  background: rgba(221, 251, 130, 0.08);
}

.site-header .language-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.site-header .language-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-header .language-current {
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.site-header .language-chevron {
  font-size: 13px;
  line-height: 1;
  transition: transform 180ms ease;
}

.site-header .language-switch.open .language-toggle {
  border-color: var(--line-strong);
  background: rgba(221, 251, 130, 0.08);
}

.site-header .language-switch.open .language-chevron {
  transform: rotate(180deg);
}

.site-header .language-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 60;
  width: 180px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 23, 20, 0.98);
  box-shadow: var(--shadow);
}

.site-header .language-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  color: var(--muted-strong);
  background: transparent;
  text-align: left;
  font-size: 12px;
}

.site-header .language-menu button:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.site-header .mobile-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--accent);
  background: rgba(17, 34, 29, 0.72);
  font-size: 18px;
}

.site-header .mobile-panel {
  display: none;
}

.topbar {
  position: relative;
  z-index: 60;
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 10px;
  width: max-content;
  max-width: min(640px, 100%);
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(7, 16, 14, 0.9);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.topbar.is-floating {
  position: fixed;
  top: 8px;
  left: 8px;
  width: max-content;
  max-width: calc(100vw - 16px);
  transform: none;
}

.topbar.is-dragging {
  cursor: grabbing;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
}

.topbar button,
.topbar select,
.topbar input,
.topbar a {
  touch-action: auto;
  user-select: auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 290px;
}

.data-product-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 10px;
}

.data-product-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.topbar-state {
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 12px;
  white-space: nowrap;
}

.state-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(130, 160, 149, 0.09);
}

.state-dot.is-loading {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(246, 200, 110, 0.09);
  animation: pulse 1.3s ease-in-out infinite;
}

.state-dot.is-online {
  background: var(--positive);
  box-shadow: 0 0 0 4px rgba(69, 224, 143, 0.09);
}

.state-dot.is-error {
  background: var(--negative);
  box-shadow: 0 0 0 4px rgba(255, 112, 120, 0.09);
}

.state-separator {
  color: rgba(179, 203, 191, 0.4);
}

.topbar-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

.icon-button,
.secondary-button,
.lock-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted-strong);
  background: rgba(17, 34, 29, 0.72);
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
}

.icon-button:hover,
.secondary-button:hover,
.lock-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-soft);
}

.icon-button:active,
.secondary-button:active,
.lock-button:active {
  transform: translateY(1px);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
}

.icon-button > span:first-child {
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
}

.fullscreen-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.fullscreen-icon svg {
  display: block;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fullscreen-exit-icon {
  display: none !important;
}

.fullscreen-icon[data-state="exit"] .fullscreen-enter-icon {
  display: none;
}

.fullscreen-icon[data-state="exit"] .fullscreen-exit-icon {
  display: block !important;
}

.button-label {
  font-size: 12px;
}

.main-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  position: relative;
  min-height: 0;
  gap: 8px;
  padding: 8px 20px 0;
}

.control-bar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 51px;
  gap: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 29, 24, 0.8);
  box-shadow: var(--shadow);
}

.topbar > .control-bar {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.topbar > .control-bar .view-tab {
  padding-right: 8px;
  padding-left: 8px;
}

.topbar > .control-bar .control-group {
  gap: 5px;
}

.topbar > .control-bar .control-select {
  min-height: 30px;
  padding-right: 22px;
  padding-left: 7px;
}

.topbar > .control-bar .lock-button {
  min-height: 30px;
  width: 30px;
  min-width: 30px;
  height: 30px;
  margin-left: -4px;
  padding: 0;
}

.topbar > .control-bar .toolbar-spacer {
  display: none;
}

.view-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  white-space: nowrap;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.view-tab:hover {
  color: var(--text);
  background: rgba(83, 129, 104, 0.09);
}

.view-tab.is-active {
  border-color: rgba(221, 251, 130, 0.24);
  color: var(--accent);
  background: var(--accent-soft);
}

.ranking-toggle {
  min-width: 84px;
  justify-content: center;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
}

.ranking-toggle .ranking-arrow {
  color: var(--muted);
  opacity: 0.52;
  transition: color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.ranking-toggle .ranking-arrow.is-active {
  opacity: 1;
  transform: translateY(-1px);
}

.ranking-toggle[data-ranking-side="gainers"].is-active {
  border-color: rgba(69, 224, 143, 0.3);
  background: var(--positive-soft);
}

.ranking-toggle[data-ranking-side="gainers"].is-active .ranking-arrow.is-active {
  color: var(--positive);
}

.ranking-toggle[data-ranking-side="losers"].is-active {
  border-color: rgba(255, 112, 120, 0.3);
  background: var(--negative-soft);
}

.ranking-toggle[data-ranking-side="losers"].is-active .ranking-arrow.is-active {
  color: var(--negative);
}

.toolbar-divider {
  width: 1px;
  height: 25px;
  background: var(--line);
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.control-label {
  color: var(--muted);
  font-size: 11px;
}

.control-select,
.symbol-select,
.watch-symbol-select,
.watch-interval-select {
  min-height: 31px;
  padding: 0 26px 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background-color: var(--surface-raised);
  font-size: 12px;
}

.control-select:hover,
.symbol-select:hover,
.watch-symbol-select:hover,
.watch-interval-select:hover {
  border-color: var(--line-strong);
}

.refresh-readout {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  min-width: 37px;
  color: var(--muted-strong);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.refresh-readout strong {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.toolbar-spacer {
  flex: 1;
}

.lock-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  color: var(--accent);
  border-color: rgba(221, 251, 130, 0.3);
  background: var(--accent-soft);
}

.lock-button.is-locked {
  color: var(--warning);
  border-color: rgba(246, 200, 110, 0.35);
  background: rgba(246, 200, 110, 0.1);
}

.lock-icon {
  display: inline-grid;
  width: 15px;
  height: 15px;
  place-items: center;
  line-height: 1;
}

.lock-svg {
  display: block;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.lock-closed {
  display: none;
}

.lock-button.is-locked .lock-open {
  display: none;
}

.lock-button.is-locked .lock-closed {
  display: block;
}

.view-panel {
  display: flex;
  grid-area: 1 / 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
}

.view-panel.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition-delay: 0s;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  gap: 15px;
}

.rank-pane {
  display: flex;
  grid-area: 1 / 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Preserve the cached iframe viewport while the other ranking is shown.
   display:none would initialize the hidden charts at zero width/height. */
.rank-pane[hidden] {
  display: flex !important;
  visibility: hidden;
  pointer-events: none;
}

.eyebrow {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.2;
}

.eyebrow.positive {
  color: var(--positive);
}

.eyebrow.negative {
  color: var(--negative);
}

.eyebrow.accent {
  color: var(--accent);
}

.detail-header h1 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--negative);
}

.accent {
  color: var(--accent);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(260px, 1fr));
  flex: 1 1 auto;
  min-height: 0;
  gap: 7px;
  align-content: stretch;
  padding: 10px;
  overflow: auto;
  scrollbar-color: rgba(130, 160, 149, 0.34) transparent;
  scrollbar-width: thin;
}

.grid-empty-state {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(17, 34, 29, 0.32);
}

.chart-card,
.multi-card,
.watch-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(146, 190, 174, 0.14);
  border-radius: 8px;
  background: #091512;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.chart-card:hover,
.multi-card:hover,
.watch-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.27);
}

.card-header,
.multi-card-header,
.watch-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 40px;
  gap: 8px;
  padding: 7px 9px 6px;
  border-bottom: 1px solid rgba(146, 190, 174, 0.11);
  background: rgba(17, 34, 29, 0.58);
}

.card-title-line,
.multi-card-title,
.watch-card-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  color: var(--muted-strong);
  background: rgba(130, 160, 149, 0.1);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.gainers-pane .rank-badge {
  color: var(--positive);
  background: var(--positive-soft);
}

.losers-pane .rank-badge {
  color: var(--negative);
  background: var(--negative-soft);
}

.card-symbol,
.multi-card-symbol,
.watch-card-symbol {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  white-space: nowrap;
}

.card-action {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
}

.card-action:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.chart-card .card-title-line {
  flex: 1 1 auto;
}

.chart-card .card-symbol {
  flex: 1 1 0;
}

.rank-intervals {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
}

.rank-interval-button {
  min-width: 28px;
  min-height: 25px;
  padding: 0 5px;
  border: 1px solid rgba(146, 190, 174, 0.16);
  border-radius: 5px;
  color: var(--muted);
  background: rgba(17, 34, 29, 0.32);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.rank-interval-button:hover {
  color: var(--accent);
  border-color: rgba(221, 251, 130, 0.46);
  background: var(--accent-soft);
}

.rank-interval-button.is-active {
  color: var(--accent);
  border-color: rgba(221, 251, 130, 0.7);
  background: rgba(61, 112, 71, 0.42);
  box-shadow: inset 0 0 0 1px rgba(115, 207, 84, 0.12);
}

.chart-host {
  position: relative;
  flex: 1 1 0%;
  min-height: 0;
  background: #080f0d;
}

.chart-host > .tradingview-widget-container {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.chart-host iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
}

.widget-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(179, 203, 191, 0.52);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  pointer-events: none;
}

/*
 * Keep recently viewed TradingView cards mounted while their view is not
 * active. Removing an iframe destroys its browsing context and makes the
 * next visit pay the full widget load cost again. The cache is intentionally
 * bounded in app.js so switching remains fast without growing forever.
 */
.chart-cache {
  position: fixed;
  top: -10000px;
  left: -10000px;
  z-index: -1;
  width: 420px;
  height: 260px;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.chart-cache .chart-card,
.chart-cache .multi-card,
.chart-cache .watch-card {
  width: 100%;
  height: 100%;
}

.detail-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 20px;
  padding: 3px 2px 0;
}

.detail-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.multi-title-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.multi-title-row .symbol-search {
  margin-top: 5px;
}

.detail-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.symbol-select {
  min-width: 165px;
  min-height: 35px;
  color: var(--accent);
  border-color: rgba(221, 251, 130, 0.27);
  background: rgba(24, 45, 35, 0.82);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
}

.symbol-search {
  position: relative;
  min-width: 220px;
}

.symbol-search-input {
  width: 220px;
  min-height: 35px;
  padding: 0 30px 0 11px;
  border: 1px solid rgba(221, 251, 130, 0.27);
  border-radius: 7px;
  color: var(--accent);
  background: rgba(24, 45, 35, 0.82);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.symbol-search-input::placeholder {
  color: var(--muted);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-weight: 500;
}

.symbol-search-input:hover,
.symbol-search-input:focus {
  border-color: var(--line-strong);
}

.symbol-search-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--muted-strong);
  background: transparent;
  font-size: 20px;
  line-height: 1;
  transform: translateY(-50%);
}

.symbol-search-toggle:hover,
.symbol-search-toggle[aria-expanded="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.symbol-search-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: grid;
  max-height: 330px;
  overflow: auto;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(10, 25, 20, 0.98);
  box-shadow: var(--shadow);
}

.symbol-search-option,
.symbol-search-empty {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  color: var(--muted-strong);
  background: transparent;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-align: left;
}

.symbol-search-option:hover,
.symbol-search-option[aria-selected="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.symbol-search-empty {
  color: var(--muted);
  cursor: default;
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
}

.secondary-button {
  min-height: 35px;
  padding: 0 11px;
  font-size: 12px;
}

.multi-grid,
.watch-grid {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
  margin-top: 14px;
  overflow: auto;
}

.multi-grid.layout-6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.multi-card-header {
  min-height: 43px;
}

.multi-card-title {
  gap: 8px;
}

.interval-chip {
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.multi-interval-select {
  min-height: 26px;
  padding: 0 20px 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted-strong);
  background: var(--surface);
  font-size: 11px;
}

.watch-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.watch-card-header {
  align-items: center;
  min-height: 46px;
}

.watch-card-title {
  flex: 1;
}

.watch-card-selects {
  display: flex;
  align-items: center;
  gap: 5px;
}

.watch-symbol-select {
  width: 116px;
  min-height: 27px;
  padding-left: 7px;
  padding-right: 19px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.watch-interval-select {
  width: 54px;
  min-height: 27px;
  padding-left: 6px;
  padding-right: 17px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.remove-watch-button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 16px;
  line-height: 1;
}

.remove-watch-button:hover {
  color: var(--negative);
  background: var(--negative-soft);
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 42px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(420px, calc(100vw - 44px));
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: rgba(14, 29, 25, 0.96);
  box-shadow: var(--shadow);
  font-size: 12px;
  animation: toast-in 180ms ease-out both;
}

.toast.is-error {
  border-color: rgba(255, 112, 120, 0.45);
}

.toast.is-success {
  border-color: rgba(69, 224, 143, 0.45);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
  }

  50% {
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1800px) {
  body {
    min-width: 780px;
  }

  .topbar-state {
    display: none;
  }

  .topbar {
    padding-right: 18px;
    padding-left: 18px;
  }

.main-shell {
    padding-right: 13px;
    padding-left: 13px;
  }

  .overview-layout {
    gap: 10px;
  }

  .chart-grid {
    gap: 5px;
    padding: 7px;
  }

  .chart-grid.density-40 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(250px, 1fr));
  }

  .card-header {
    padding-right: 6px;
    padding-left: 6px;
  }

  .card-meta {
    display: none;
  }
}

@media (max-width: 1400px) {
  .topbar-state {
    display: none;
  }

  .overview-layout {
    overflow: auto;
  }

  .rank-pane {
    min-height: 680px;
  }

  .chart-grid.density-40 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(7, minmax(260px, 1fr));
  }

  .watch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }

}

@media (max-width: 1500px) {
  .site-header .header-inner {
    flex-wrap: wrap;
    row-gap: 12px;
    padding-top: 8px;
    padding-bottom: 6px;
  }

  .site-header .topbar {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    max-width: 100%;
    justify-content: center;
  }

  .site-header .topbar.is-floating {
    flex: 0 1 auto;
    width: max-content;
    max-width: calc(100vw - 16px);
    justify-content: initial;
  }

  .site-header .desktop-nav {
    display: none;
  }

  .site-header .mobile-toggle {
    display: block;
  }

  .site-header .mobile-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 20px;
    left: 20px;
    display: block;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(11, 23, 20, 0.98);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 180ms ease, transform 180ms ease;
  }

  .site-header .mobile-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .site-header .mobile-panel nav {
    display: grid;
    gap: 4px;
  }

  .site-header .mobile-panel a {
    padding: 12px 10px;
    border-radius: 10px;
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 700;
  }

  .site-header .mobile-panel .nav-live-wrap {
    display: block;
  }

  .site-header .mobile-panel .nav-live-wrap > .mobile-nav-link {
    display: block;
    width: 100%;
    padding-right: 42px;
  }

  .site-header .mobile-panel .nav-live-link {
    top: 14px;
    right: 12px;
    padding: 0;
    color: var(--accent);
    font-size: 9px;
  }

  .site-header .mobile-panel .nav-live-link:hover,
  .site-header .mobile-panel .nav-live-link:focus-visible {
    color: var(--accent);
    background: transparent;
    transform: none;
  }

  .site-header .mobile-panel a:hover,
  .site-header .mobile-panel a[aria-current="page"] {
    color: var(--text);
    background: var(--accent-soft);
  }
}

@media (max-width: 1120px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
  }

  .topbar,
  .control-bar,
  .detail-header {
    flex-wrap: wrap;
  }

  .topbar {
    top: auto;
    min-height: 54px;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .main-shell {
    min-height: 900px;
    overflow: visible;
  }

  .view-panel.is-active {
    overflow: visible;
  }

  .overview-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .rank-pane {
    min-height: 920px;
  }

  .multi-grid.layout-6 {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, 520px);
    overflow: visible;
  }

  .watch-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(8, 520px);
    overflow: visible;
  }

}

@media (max-width: 760px) {
  body {
    min-width: 0;
  }

  .brand-lockup {
    min-width: 0;
  }

  .site-header .header-inner {
    width: calc(100% - 28px);
    min-height: 68px;
  }

  .site-header .brand-mark {
    font-size: 16px;
  }

  .site-header .brand-mark .brand-logo {
    width: 36px;
    height: 36px;
  }

  .site-header .mobile-panel {
    right: 14px;
    left: 14px;
  }

  .topbar {
    top: auto;
    left: auto;
    width: 100%;
    max-width: 100%;
    gap: 8px;
    padding: 7px 8px;
    transform: none;
  }

  .topbar.is-floating {
    width: 100%;
    max-width: 100%;
  }

  .brand-name {
    font-size: 11px;
  }

  .button-label,
  .toolbar-divider,
  .overview-only-control,
  .auto-refresh-control {
    display: none;
  }

  .control-bar {
    align-items: stretch;
  }

  .view-tabs {
    width: 100%;
  }

  .view-tab {
    flex: 1;
    justify-content: center;
    padding: 0 6px;
  }

  .toolbar-spacer {
    display: none;
  }

  .lock-button {
    margin-left: auto;
  }

  .topbar > .control-bar .lock-button {
    margin-left: auto;
  }

  .detail-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-controls {
    justify-content: flex-start;
    width: 100%;
  }

  .symbol-search {
    flex: 1 1 220px;
    min-width: 0;
  }

  .symbol-search-input {
    width: 100%;
  }

  .chart-grid.density-40 {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(20, minmax(320px, 1fr));
  }

  .multi-grid.layout-6 {
    grid-template-rows: repeat(6, 430px);
  }

}

/* 移动端与 Live 保持同一套可见横向导航，取消汉堡菜单。 */
@media (max-width: 1500px) {
  .site-header .header-inner {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 8px;
  }

  .site-header .header-actions {
    order: 0;
    margin-left: auto;
  }

  .site-header .desktop-nav {
    display: flex;
    order: 2;
    flex: 1 0 100%;
    width: 100%;
    margin-left: 0;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-header .desktop-nav::-webkit-scrollbar {
    display: none;
  }

  .site-header .desktop-nav .nav-link {
    flex: 0 0 auto;
    padding: 3px 0 6px;
    font-size: 12px;
  }

  .site-header .mobile-toggle,
  .site-header .mobile-panel {
    display: none !important;
  }
}
