/* =========================================================
   CoinASX V89 全站主题自适应
   目标：
   1) 原站区域
   2) 二开区域
   3) V84 行情 Tabs / Cards
   4) V87 加密新闻入口与弹窗
   5) 弹窗、输入框、卡片、导航文字
   均统一通过变量切换
   ========================================================= */

/* 默认深色 */
html{
  --cx-bg:#08090b;
  --cx-bg-soft:#0f1114;
  --cx-surface:#15171b;
  --cx-surface-2:#1b1e23;
  --cx-surface-3:#22252b;
  --cx-border:#282c33;

  --cx-text:#f4f5f6;
  --cx-text-2:#c4c8cf;
  --cx-text-3:#898f99;
  --cx-icon:#e9ebee;

  --cx-input:#181a1f;
  --cx-overlay:rgba(0,0,0,.66);
  --cx-shadow:0 12px 36px rgba(0,0,0,.24);

  --cx-green:#12c99a;
  --cx-red:#f25568;
  --cx-accent:#2b6cf6;
}

/* 明确浅色主题 */
html.cx-theme-light{
  --cx-bg:#f5f6f8;
  --cx-bg-soft:#ffffff;
  --cx-surface:#ffffff;
  --cx-surface-2:#f0f2f5;
  --cx-surface-3:#e8ebef;
  --cx-border:#dde1e7;

  --cx-text:#111318;
  --cx-text-2:#3e434c;
  --cx-text-3:#7a818c;
  --cx-icon:#2d323a;

  --cx-input:#eef0f3;
  --cx-overlay:rgba(16,20,28,.38);
  --cx-shadow:0 10px 30px rgba(20,28,40,.08);

  --cx-green:#00a77d;
  --cx-red:#e5485d;
  --cx-accent:#2563eb;
}

/* 明确深色主题 */
html.cx-theme-dark{
  color-scheme:dark;
}

/* 系统浅色作为没有站内主题信息时的兜底 */
@media(prefers-color-scheme:light){
  html:not(.cx-theme-dark):not(.cx-theme-light){
    --cx-bg:#f5f6f8;
    --cx-bg-soft:#ffffff;
    --cx-surface:#ffffff;
    --cx-surface-2:#f0f2f5;
    --cx-surface-3:#e8ebef;
    --cx-border:#dde1e7;
    --cx-text:#111318;
    --cx-text-2:#3e434c;
    --cx-text-3:#7a818c;
    --cx-icon:#2d323a;
    --cx-input:#eef0f3;
    --cx-overlay:rgba(16,20,28,.38);
    --cx-shadow:0 10px 30px rgba(20,28,40,.08);
    --cx-green:#00a77d;
    --cx-red:#e5485d;
  }
}

/* ---------- 全站基础 ---------- */
html,
body,
#app{
  background-color:var(--cx-bg)!important;
  color:var(--cx-text)!important;
}

body,
#app,
.page,
[class*="page"],
[class*="container"],
[class*="content"]{
  color:var(--cx-text);
}

/* 常见文本颜色 */
.textColor,
.text-color,
[class*="textColor"]{
  color:var(--cx-text)!important;
}

.textColor2,
.text-grey,
.text-gray,
[class*="text-grey"],
[class*="text-gray"]{
  color:var(--cx-text-3)!important;
}

/* 只覆盖明确的通用二开卡片，不对所有 div 强制背景 */
.cx-card,
.cx-panel,
[class*="cx-card"],
[class*="cx-panel"],
[class*="custom-card"],
[class*="custom-panel"]{
  background:var(--cx-surface)!important;
  color:var(--cx-text)!important;
  border-color:var(--cx-border)!important;
}

/* Vant 常见组件 */
.van-popup,
.van-dialog,
.van-action-sheet,
.van-picker,
.van-cell,
.van-cell-group,
.van-dropdown-menu__bar,
.van-dropdown-item__content{
  background:var(--cx-surface)!important;
  color:var(--cx-text)!important;
}

.van-cell__title,
.van-cell__value,
.van-dialog__message,
.van-picker__toolbar,
.van-picker-column__item{
  color:var(--cx-text)!important;
}

.van-overlay{
  background:var(--cx-overlay)!important;
}

/* 输入框 */
.inputBackground,
.tabBackground,
input,
textarea,
select{
  color:var(--cx-text)!important;
}

.inputBackground,
.tabBackground{
  background:var(--cx-input)!important;
  border-color:var(--cx-border)!important;
}

input::placeholder,
textarea::placeholder{
  color:var(--cx-text-3)!important;
}

/* ---------- 首页 / 二开首页 ---------- */
.home,
.new-home,
.home-page,
.homePage,
[class*="home-page"]{
  background:var(--cx-bg)!important;
  color:var(--cx-text)!important;
}

.home .market-header,
.new-home .market-header,
.home .home-section,
.new-home .home-section{
  background-color:var(--cx-bg)!important;
  color:var(--cx-text)!important;
}

.home .market-search,
.new-home .market-search{
  background:var(--cx-input)!important;
  border-color:var(--cx-border)!important;
  color:var(--cx-text-3)!important;
}

.home .asset-card,
.new-home .asset-card,
.home .market-card,
.new-home .market-card,
.home .notice-row,
.new-home .notice-row{
  background:var(--cx-surface)!important;
  border-color:var(--cx-border)!important;
  color:var(--cx-text)!important;
}

/* ---------- 快捷功能 ---------- */
.home .quick-item,
.new-home .quick-item,
.home .quick-item *,
.new-home .quick-item *{
  color:var(--cx-text)!important;
}

.home .quick-icon,
.new-home .quick-icon{
  background:var(--cx-surface-2)!important;
  border-color:var(--cx-border)!important;
  color:var(--cx-icon)!important;
}

/* ---------- V84 行情分类 ---------- */
.cx84-market-tab{
  color:var(--cx-text-3)!important;
}

.cx84-market-tab.active{
  color:var(--cx-text)!important;
}

.cx84-market-tab.active:after{
  background:var(--cx-text)!important;
}

/* ---------- 行情卡片 ---------- */
.home .market-card,
.new-home .market-card{
  background:var(--cx-surface)!important;
  border-color:var(--cx-border)!important;
  box-shadow:none!important;
}

.home .market-card .card-title span,
.new-home .market-card .card-title span,
.home .market-card .card-price,
.new-home .market-card .card-price{
  color:var(--cx-text)!important;
}

.home .market-card .card-change,
.new-home .market-card .card-change{
  color:var(--cx-text-2)!important;
}

.home .market-card .up,
.new-home .market-card .up,
.home .market-card .text-green,
.new-home .market-card .text-green{
  color:var(--cx-green)!important;
  stroke:var(--cx-green)!important;
}

.home .market-card .down,
.new-home .market-card .down,
.home .market-card .text-red,
.new-home .market-card .text-red{
  color:var(--cx-red)!important;
  stroke:var(--cx-red)!important;
}

/* 保持无闪动 */
.home .market-card,
.new-home .market-card,
.home .market-card *,
.new-home .market-card *{
  animation:none!important;
  transition:none!important;
}

/* ---------- V87 加密新闻入口 ---------- */
.cx87-news-trigger{
  background:var(--cx-surface)!important;
  color:var(--cx-text)!important;
  border-color:var(--cx-border)!important;
}

.cx87-news-trigger-title{
  color:var(--cx-text)!important;
}

.cx87-news-trigger-sub,
.cx87-news-arrow{
  color:var(--cx-text-3)!important;
}

.cx87-news-dot{
  background:var(--cx-green)!important;
}

/* ---------- V87 加密新闻底部弹窗 ---------- */
.cx87-news-mask{
  background:var(--cx-overlay)!important;
}

.cx87-news-panel{
  background:var(--cx-bg-soft)!important;
  color:var(--cx-text)!important;
  border-color:var(--cx-border)!important;
  box-shadow:var(--cx-shadow)!important;
}

.cx87-news-head{
  background:var(--cx-bg-soft)!important;
  border-color:var(--cx-border)!important;
}

.cx87-news-head h3{
  color:var(--cx-text)!important;
}

.cx87-news-source{
  color:var(--cx-text-3)!important;
}

.cx87-news-close{
  background:var(--cx-surface-2)!important;
  color:var(--cx-text-2)!important;
}

.cx87-news-list{
  background:var(--cx-bg-soft)!important;
}

.cx87-news-item{
  border-color:var(--cx-border)!important;
}

.cx87-news-title{
  color:var(--cx-text)!important;
}

.cx87-news-meta,
.cx87-news-empty{
  color:var(--cx-text-3)!important;
}

/* ---------- 二开交易区域 ---------- */
.trade-buy-sell,
.contract-header,
.deep-data,
[class*="trade-buy-sell"],
[class*="contract-header"],
[class*="deep-data"]{
  color:var(--cx-text)!important;
}

.trade-buy-sell .inputBackground,
[class*="trade-buy-sell"] .inputBackground{
  background:var(--cx-input)!important;
  color:var(--cx-text)!important;
}

/* ---------- 资产区域 ---------- */
[class*="asset"] .price,
[class*="wallet"] .price,
[class*="asset"] .price_box,
[class*="wallet"] .price_box{
  color:var(--cx-text)!important;
}

/* ---------- 原底部/悬浮导航：只切颜色，不动布局 ---------- */
.van-tabbar,
.van-tabbar--fixed,
[class*="bottom-nav"],
[class*="floating-nav"]{
  background-color:var(--cx-bg-soft)!important;
  border-color:var(--cx-border)!important;
}

.van-tabbar-item,
[class*="bottom-nav"] *,
[class*="floating-nav"] *{
  color:var(--cx-text-3)!important;
}

.van-tabbar-item--active{
  color:var(--cx-accent)!important;
}

/* 防止旧版硬编码黑字破坏浅/深主题 */
html.cx-theme-dark .home .quick-item *,
html.cx-theme-dark .new-home .quick-item *,
html.cx-theme-dark .home .market-card *,
html.cx-theme-dark .new-home .market-card *{
  color:inherit;
}

/* 红绿重新提升优先级 */
html.cx-theme-dark .home .market-card .up,
html.cx-theme-dark .new-home .market-card .up,
html.cx-theme-light .home .market-card .up,
html.cx-theme-light .new-home .market-card .up{
  color:var(--cx-green)!important;
}

html.cx-theme-dark .home .market-card .down,
html.cx-theme-dark .new-home .market-card .down,
html.cx-theme-light .home .market-card .down,
html.cx-theme-light .new-home .market-card .down{
  color:var(--cx-red)!important;
}
