html body :is(.mini-status,#cmsg) {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  z-index: 5;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility 0s linear .18s;
  font-size: 12px;
  pointer-events: none;
}
html body :is(.mini-status.is-loading,.mini-status.is-error,#cmsg.show) {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
html body :is(.mini-status,#cmsg)::before { content: none; }
html body #cmsgT { animation: none; padding: 0; background: transparent; }
.candle-loader-art { display: flex; flex-direction: column; align-items: center; gap: 10px; }
html body #cmsg .candle-loader-art { padding: 0; background: transparent; animation: none; }
html body #cmsg.show:not(.is-loading) .candle-loader-art { display: none; }
html body :is(.mini-status,#cmsg):not(.is-loading) .candle-loader-art :is(i,s) { animation-play-state: paused; }
.candle-loader-art i {
  width: 23px;
  height: 23px;
  border: 2px solid color-mix(in srgb,var(--accent-primary,var(--accent)) 15%,transparent);
  border-top-color: var(--accent-primary,var(--accent));
  border-right-color: color-mix(in srgb,var(--accent-primary,var(--accent)) 65%,transparent);
  border-radius: 50%;
  animation: candle-loader-spin .75s linear infinite;
}
.candle-loader-art b { display: flex; gap: 8px; align-items: flex-end; height: 21px; }
.candle-loader-art s {
  position: relative;
  display: block;
  width: 6px;
  height: 10px;
  background: var(--accent-primary,var(--accent));
  opacity: .23;
  animation: candle-loader-pulse 1s ease-in-out infinite alternate;
}
.candle-loader-art s::before { content: ""; position: absolute; top: -3px; bottom: -3px; left: 2px; width: 2px; background: inherit; }
.candle-loader-art s:nth-child(2) { height: 16px; margin-bottom: 1px; animation-delay: .12s; }
.candle-loader-art s:nth-child(3) { height: 12px; margin-bottom: 4px; animation-delay: .24s; }
.candle-loader-art s:nth-child(4) { height: 17px; margin-bottom: 4px; animation-delay: .36s; }
.candle-loader-art s:nth-child(5) { height: 13px; margin-bottom: 8px; animation-delay: .48s; }
@keyframes candle-loader-spin { to { transform: rotate(360deg); } }
@keyframes candle-loader-pulse { to { opacity: .85; } }
@media (prefers-reduced-motion: reduce) {
  .candle-loader-art :is(i,s) { animation: none; }
  html body :is(.mini-status,#cmsg) { transition: none; }
}
/* Keep the existing control styles. These rules only reflow the narrow layout. */
html body #chartOverlay .mini-head .mini-left-actions,
html body .density-preview .mini-head .mini-left-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px !important;
  white-space: nowrap;
}
html body :is(#chartOverlay,.density-preview) .mini-left-actions > * { flex-shrink: 0; }
html body :is(#chartOverlay,.density-preview) .mini-head .mini-left { min-width: 0; flex-wrap: wrap; }
.mobile-coin-nav,.mobile-drawing-toggle { display: none; }

@media (max-width: 767px) {
  html body > header { grid-template-columns: minmax(0,1fr) auto !important; gap: 4px !important; }
  html body > header .hright { display: flex !important; gap: 4px !important; align-items: center; min-width: 0; }
  html body > header .hright > :not(.profile-wrap,.picker-wrap,#authOpen,#headerGoogle,#notificationsOpen,#settingsOpen,.header-venue,[data-select=exchangeChoice]),
  html body > header .picker-wrap { display: none !important; }
  html body > header .hright :is(#notificationsOpen,#settingsOpen,#authOpen) {
    display: inline-grid !important;
    flex: 0 0 44px !important;
    min-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
  }
  html body > header .hright .profile-wrap { width: 44px !important; }
  html body > header .hright :is(.header-venue,.select-menu-trigger) { min-height: 44px !important; }
  html body > header .hright .header-venue { width: 112px !important; }
  html body > header .hright [data-select=exchangeChoice] { max-width: none; }
  html body .mobile-bottom-nav button { min-height: 44px !important; }
  html body #screenerGrid { grid-template-columns: minmax(0,1fr) !important; }
  html body #viewCoins:not([style*="display: none"]) {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0;
    overflow: auto !important;
    height: auto !important;
    max-height: 100%;
    padding-bottom: 8px;
    overscroll-behavior: contain;
    scroll-padding-top: 52px;
  }
  html body #viewCoins > .mobile-coin-nav {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 16;
    order: -2;
    gap: 6px;
    padding: 4px 6px;
    background: var(--bg-base);
  }
  html body #viewCoins > .mobile-coin-nav button { display: inline-flex; min-height: 44px; }
  html body #viewCoins > #chartPanel {
    order: -1;
    flex: 0 0 clamp(340px,62dvh,640px) !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }
  html body #viewCoins > #coinSidebar {
    --mobile-list-height: clamp(320px,60dvh,560px);
    display: flex !important;
    flex: 0 0 var(--mobile-list-height) !important;
    flex-direction: column;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: var(--mobile-list-height) !important;
    height: var(--mobile-list-height) !important;
    visibility: visible !important;
  }
  html body #viewCoins #coinSidebar > .panel.list { flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; }
  html body #viewCoins :is(#splitter,#sidebarToggle) { display: none !important; }
  html body #chartPanel .ctop { min-width: 0; }
  html body #chartPanel .chart-controls { flex-wrap: wrap !important; gap: 6px; min-width: 0; }
  html body #chartPanel #dtools { display: none !important; }
  html body #chartPanel.mobile-drawing-open #dtools { display: flex !important; flex-shrink: 0; }
  html body #coinSidebar #scroll,
  html body :is(.listing-table-scroll,#marketViewBody) { overflow-x: auto !important; overscroll-behavior-x: contain; }
  html body #viewCoins #coinSidebar .tbl { min-width: 402px; }
  html body #viewCoins #coinSidebar :is(.row,#thead) > :nth-child(2),
  html body :is(.listing-table,.density-table) :is(td,th):first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-surface);
  }
  html body dialog:not(#chartOverlay)[open] { box-sizing: border-box; max-width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  html body dialog#chartOverlay[open] { width: 100vw !important; max-width: 100vw !important; height: 100dvh !important; max-height: 100dvh !important; margin: 0 !important; }
}
html body #sidebarToggle {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border-radius: 8px;
}
.coins-pro-preview {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 176px;
  border-top: 1px solid var(--border-subtle);
}
.coins-pro-skeleton {
  position: absolute;
  inset: 0;
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
  opacity: .55;
}
.coins-pro-skeleton > div {
  height: 44px;
  display: grid;
  grid-template-columns: 1.4fr repeat(4,1fr);
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.coins-pro-skeleton i { height: 9px; border-radius: 3px; background: var(--muted); opacity: .4; }
html body .coins-pro-preview .coins-pro-gate {
  min-height: 176px;
  padding: 10px;
  gap: 6px;
  background: linear-gradient(transparent,var(--bg-surface) 46%);
  border: 0;
  border-radius: 0;
}
.coins-pro-gate h3,.coins-pro-gate p { margin: 0; }
.coins-pro-gate > svg,#screenerGrid > .pro-grid-stub > svg { color: #f59e0b; }
html body #screenerGrid > .pro-grid-stub img {
  opacity: .35;
  filter: blur(5px);
}
html body #screenerGrid > .pro-grid-stub::before {
  backdrop-filter: blur(5px);
  background: color-mix(in srgb,var(--bg-surface) 65%,transparent);
}
html body #screenerGrid > .pro-grid-stub button {
  box-sizing: border-box;
  width: 100%;
  max-width: 240px;
  height: 36px;
  min-height: 36px;
  border-radius: 8px;
  padding-block: 0;
}
