/* static/markets.css */
/* Wise-like, clean, product UI. No global reset beyond this page scope */
:root{
  --mk-bg: #f5f7fb;
  --mk-card: #ffffff;
  --mk-text: #111827;
  --mk-muted: #6b7280;
  --mk-line: #e5e7eb;
  --mk-soft: #f3f4f6;
  --mk-shadow: 0 10px 30px rgba(17,24,39,.08);
  --mk-radius: 18px;
  --mk-radius2: 14px;

  --mk-brand: #1a73e8;   /* 主按钮色 */
  --mk-brand2: #0b5bd3;  /* hover */
  --mk-danger: #ef4444;
  --mk-success: #10b981;
}

/* 页面容器建议加 class="mk-page" 包裹 markets 内容 */
.mk-page{
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px 60px;
}

/* 顶部标题区 */
.mk-hero{
  text-align: center;
  margin: 6px 0 28px;
}
.mk-hero h1{
  margin: 8px 0 10px;
  color: var(--mk-text);
  font-size: 30px;
  letter-spacing: -0.02em;
  font-weight: 900;
}
.mk-hero p{
  margin: 0;
  color: var(--mk-muted);
  font-size: 16px;
  line-height: 1.7;
}

/* 通用卡片 */
.mk-card{
  background: var(--mk-card);
  border: 1px solid rgba(229,231,235,.85);
  border-radius: var(--mk-radius);
  box-shadow: var(--mk-shadow);
  overflow: hidden;
}

/* 卡片头部：大汇率展示 */
.mk-card-head{
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(229,231,235,.75);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  justify-content: space-between;
}

.mk-card-head .mk-mini-title{
  color: var(--mk-text);
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.02em;
  line-height: 1.5;
}

.mk-kpi{
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mk-kpi .mk-kpi-big{
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--mk-text);
  line-height: 1.05;
}
.mk-kpi .mk-kpi-sub{
  font-size: 13px;
  color: var(--mk-muted);
}
.mk-badges{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.mk-pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(229,231,235,.9);
  background: #fff;
  color: #374151;
  font-size: 12px;
  white-space: nowrap;
}
.mk-pill span{
  color: var(--mk-muted);
}

/* 表单区 */
.mk-card-body{
  padding: 16px 18px 18px;
}

.mk-grid{
  display: grid;
  grid-template-columns: 1.15fr 1fr 56px 1fr;
  gap: 12px;
  align-items: end;
}

.mk-field label{
  display: block;
  font-size: 12px;
  color: var(--mk-muted);
  margin: 0 0 6px;
}

.mk-input,
.mk-select{
  width: 100%;
  height: 48px;
  border-radius: var(--mk-radius2);
  border: 1.8px solid rgba(229,231,235,.95);
  background: #fff;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--mk-text);
  outline: none;
  transition: border .18s, box-shadow .18s;
  box-sizing: border-box;
}
.mk-input:focus,
.mk-select:focus{
  border-color: rgba(26,115,232,.55);
  box-shadow: 0 0 0 4px rgba(26,115,232,.12);
}
.mk-input::placeholder{
  color: rgba(107,114,128,.8);
}

/* 交换按钮：圆形、像 Wise 的 swap */
.mk-swap{
  width: 56px;
  height: 48px;
  border-radius: 14px;
  border: 1.8px solid rgba(229,231,235,.95);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .15s, border .15s, box-shadow .15s;
}
.mk-swap:hover{
  border-color: rgba(26,115,232,.35);
  box-shadow: 0 6px 16px rgba(17,24,39,.08);
}
.mk-swap:active{
  transform: translateY(1px);
}
.mk-swap svg{
  width: 18px;
  height: 18px;
  color: #374151;
}

/* 结果区 */
.mk-result{
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--mk-radius2);
  background: var(--mk-bg);
  border: 1px solid rgba(229,231,235,.85);
}
.mk-result .mk-result-big{
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--mk-text);
  line-height: 1.15;
}
.mk-result .mk-result-note{
  margin-top: 6px;
  color: var(--mk-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* 操作按钮 */
.mk-actions{
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.mk-btn{
  height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(229,231,235,.95);
  background: #fff;
  color: #111827;
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform .15s, box-shadow .15s, border .15s, background .15s;
}
.mk-btn:hover{
  box-shadow: 0 10px 18px rgba(17,24,39,.08);
  border-color: rgba(26,115,232,.25);
}
.mk-btn:active{ transform: translateY(1px); }

.mk-btn-primary{
  background: #111827;
  border: 1px solid #111827;
  color: #ffffff;
  font-weight: 800;
}

.mk-btn-primary:hover{
  background: #0b1220;
  border-color: #0b1220;
  box-shadow: 0 10px 20px rgba(17,24,39,.18);
}


/* 分割卡片：mini（USD↔CNY） */
.mk-mini{
  margin-top: 16px;
}
.mk-mini .mk-mini-head{
  padding: 16px 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(229,231,235,.75);
}
.mk-mini .mk-mini-title{
  color: var(--mk-text);
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.02em;
  line-height: 1.5;
}
.mk-mini .mk-mini-sub{
  font-size: 12.5px;
  color: var(--mk-muted);
  margin-top: 4px;
}
.mk-mini .mk-mini-body{
  padding: 16px 18px 18px;
}
.mk-mini .mk-mini-rate{
  font-size: 30px;
  font-weight: 900;
  color: var(--mk-text);
}

/* USD↔CNY 三张指标卡：更像 Wise */
.mk-mini-body .mk-fx-metrics{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 720px){
  .mk-mini-body .mk-fx-metrics{ grid-template-columns:1fr; }
}
.mk-fx-metric{
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.mk-fx-metric:hover{
  border-color: rgba(26,115,232,.18);
  box-shadow: 0 10px 18px rgba(17,24,39,.06);
}
.mk-fx-metric:active{
  transform: translateY(1px);
}
.mk-fx-metric-label{
  font-size: 12px;
  color: var(--mk-muted);
  font-weight: 800;
}
.mk-fx-metric-val{
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
  color: var(--mk-text);
}

/* 通用标题（你页面里多处用到） */
.mk-section-title{
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.02em;
  line-height: 1.5;
}

/* =========================
   News: single-column list
   ========================= */
#news-list{
  display:flex;
  flex-direction:column;
  gap: 12px;
}

/* 单条新闻卡（更饱满） */
.mk-news-row--single{
  display:flex;
  gap:16px;
  padding:16px;
  border:1px solid rgba(229,231,235,.85);
  border-radius:16px;
  background:#fff;
  align-items:stretch;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.mk-news-row--single:hover{
  border-color: rgba(26,115,232,.18);
  box-shadow: 0 10px 18px rgba(17,24,39,.06);
}
.mk-news-row--single:active{
  transform: translateY(1px);
}

.mk-thumb--big{
width: 280px;          /* 200 -> 240 */
  aspect-ratio: 16 / 9;  /* 固定比例，比写死高度更稳 */
  height: auto;          /* 交给 aspect-ratio */
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid rgba(229,231,235,.85);
  flex: 0 0 auto;
  position: relative;
}
.mk-thumb--big img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 没图时占位更好看 */
.mk-thumb--big.noimg{
  display: grid;
  place-items: center;
}
.mk-thumb--big.noimg::after{
  content: "No Image";
  font-size: 12px;
  color: #9ca3af;
}
.mk-news-body2{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
}

.mk-news-link--big{
  font-size:16px;
  font-weight:900;
  color:#111827;
  line-height:1.35;
  text-decoration:none;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.mk-news-link--big:hover{ text-decoration:underline; }

.mk-news-sum--big{
  margin-top:8px;
  font-size:14px;
  color:#374151;
  line-height:1.7;
  opacity:.92;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.mk-news-meta2{
  margin-top:auto;
  padding-top:10px;
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  color:#6b7280;
  font-size:12.5px;
}

/* loading / empty */
.mk-news-row--loading,
.mk-news-row--empty{
  border: 1px dashed rgba(229,231,235,.85);
  border-radius: 16px;
  background: #fff;
  padding: 20px 16px;
  text-align: center;
  color: var(--mk-muted);
}

/* mobile */
@media (max-width: 760px){
  .mk-news-row--single{
    flex-direction:column;
  }
  .mk-thumb--big{
    width:100%;
    height: 180px;
  }
}

/* =========================
   News header: two columns
   (description / search)
   ========================= */
.mk-news-head2{
  display: grid;
  grid-template-columns: 60% 40%;

  gap: 18px;
  align-items: center;
  margin-top: 10px;
}

/* 左侧：说明文字 */
.mk-news-head-left{
  min-width: 0;
}
.mk-news-head-left .mk-result-note{
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: #374151;
}

/* =========================
   Pager: centered + spacing
   ========================= */
.mk-pager--center{
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 响应式：移动端头部变上下结构 */
@media (max-width: 900px){
  .mk-news-head2{
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .mk-news-head2-right .mk-input{
    width: 100%;
  }
}
/* 卡片之间统一留白 */
.mk-card{
  margin-bottom: 20px;
}

.mk-mini-sub{
  font-size: 12.5px;
  color: var(--mk-muted);   /* #6b7280 */
  line-height: 1.6;
}
.mk-news-actions{
  margin-bottom: 20px;
}
/* 新闻区右侧：搜索 + 按钮整体容器 */
.mk-news-head2-right{
  display: flex;
  flex-direction: column;      /* 上下排列 */
  align-items: center;         /* 整体水平居中 */
  gap: 14px;                   /* 搜索框 与 按钮的距离 */
  
}

/* 搜索输入框 */
.mk-news-head2-right .mk-input{
  width: 320px;
  max-width: 100%;
}

/* 搜索 / 清空 按钮组 */
.mk-news-actions{
  display: flex;
  justify-content: center;     /* 按钮组居中 */
  gap: 14px;                   /* 两个按钮之间拉开 */
  margin-top: 4px;             /* 额外留一点呼吸感 */
}

/* 按钮边框视觉变轻（你前面提过） */
.mk-news-actions .mk-btn{
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(229,231,235,.75);
  font-weight: 700;
}

/* =========================
   Mobile optimize (<=640px)
   ========================= */
@media (max-width: 640px){

  /* 卡片整体左右留白更舒服 */
  .mk-page{
    padding-left: 12px;
    padding-right: 12px;
  }
  .mk-card,
  .mk-mini{
    border-radius: 16px;
  }

  /* ===== USD/CNY mini card header ===== */
  .mk-mini .mk-mini-head{
    padding: 14px 14px;
    gap: 10px;
  }

  /* 标题更紧凑 */
  .mk-mini .mk-section-title,
  .mk-mini .mk-mini-title{
    font-size: 16px;
    line-height: 1.25;
    margin: 0;
  }
  .mk-mini .mk-mini-sub{
    font-size: 12.5px;
    line-height: 1.6;
    margin-top: 6px;
  }

  /* 右侧 pills 区：居中、自动换行，不挤成一团 */
  .mk-mini .mk-mini-head > div:last-child{
    width: 100%;
    justify-content: center !important;
    gap: 8px !important;
  }
  .mk-mini .mk-pill{
    padding: 6px 10px;
    font-size: 12px;
  }

  /* ===== mini body ===== */
  .mk-mini .mk-mini-body{
    padding: 14px 14px 16px;
  }

  /* 主汇率：更适合手机的排版 */
  .mk-mini .mk-mini-rate,
  #fx-rate-line{
    font-size: 26px !important;     /* 34 -> 26 */
    line-height: 1.2 !important;
    letter-spacing: -0.02em;
    word-break: keep-all;           /* 避免奇怪断词 */
  }

  /* 让 “1 USD = 6.9953 CNY” 在手机端更自然换行 */
  #fx-rate-line{
    display: block;
    white-space: normal;
  }

  /* 3 个指标卡：手机端改成 1 列更好看 */
  .mk-mini-body .mk-fx-metrics,
  .mk-mini-body > div[style*="grid-template-columns:repeat(3"]{
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-top: 12px !important;
  }

  /* 指标卡内部字号稍微调大一点更易读 */
  #fx-last, #fx-change, #fx-change-pct{
    font-size: 18px;
  }

  /* 说明文字与卡片间距更舒服 */
  .mk-mini .mk-mini-sub,
  .mk-mini-body .mk-mini-sub{
    margin-top: 10px !important;
  }
}

/* =========================
   Global spacing between cards
   ========================= */
.mk-card + .mk-card{
  margin-top: 16px; /* ✅ 让新闻区与上面卡片缝隙一致 */
}

/* =========================
   News Section (Two-column head)
   ========================= */
.mk-news-card{
  padding: 18px 18px 22px;
}

.mk-divider{
  height: 1px;
  background: rgba(229,231,235,.85);
  margin: 16px 0;
}

/* 头部两列 */
.mk-news-head2{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: start;
}

/* 左侧标题/说明 */
.mk-news-title{
  font-size: 20px;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.mk-news-desc{
  margin: 8px 0 0;
  font-size: 13px;                /* ✅ 跟上面“说明”一致 */
  line-height: 1.7;
  color: var(--mk-muted);         /* ✅ 颜色一致 */
}

/* 右侧搜索：输入框不贴边，按钮与输入框拉开，按钮居中 */
.mk-news-head2-right{
  display: grid;
  gap: 10px;
  justify-items: end;
}

.mk-news-q{
  width: 360px;
  height: 44px;
  padding: 10px 14px;             /* ✅ 输入框内侧留白 */
}

.mk-news-actions{
  display: flex;
  gap: 12px;                      /* ✅ 搜索/清空间距 */
  justify-content: center;         /* ✅ 按钮中间对齐 */
  width: 100%;
}

/* 按钮边框变细 + 更紧凑 */
.mk-btn{
  border: 1px solid rgba(229,231,235,.9); /* ✅ 原来太粗 */
}

.mk-btn-compact{
  height: 40px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
}

/* 新闻列表容器 */
.mk-news-list{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 分页居中 + 与列表拉开 */
.mk-pager--center{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.mk-page-indicator{
  padding: 7px 12px;
}

.mk-news-footer{
  margin-top: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--mk-muted);
}

/* =========================
   News image preview mode
   ========================= */
.mk-thumb--big img{
  width: 100%;
  height: 100%;
  object-fit: cover;  /* ✅ 图片预览更好看 */
  display: block;
}

/* =========================
   Mobile optimizations
   ========================= */
@media (max-width: 900px){
  .mk-news-head2{
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .mk-news-head2-right{
    justify-items: start;
    width: 100%;
  }

  .mk-news-q{
    width: 100%;
    max-width: 520px;
  }

  .mk-news-actions{
    justify-content: flex-start; /* 手机端更自然 */
  }
}

@media (max-width: 760px){
  /* 新闻卡片：图片变封面图更舒服 */
  .mk-news-row--single{
    flex-direction: column;
  }
  .mk-thumb--big{
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9; /* ✅ 手机端封面比例 */
  }

  /* 分页：指示器独占一行居中 */
  #page-indicator{
    width: 100%;
    justify-content: center;
    display: inline-flex;
  }

  /* USD/CNY 这块手机端不要太大，避免挤压 */
  .mk-mini .mk-mini-rate{
    font-size: 26px;
    line-height: 1.2;
    word-break: break-word;
  }
}
/* =========================
   Hero title responsive (mobile)
   ========================= */
.mk-hero{
  padding: 0 6px; /* 手机端左右留点边距 */
}

.mk-hero h1{
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.22;
}

/* 手机端：标题自适应更紧凑，不让“｜”孤零零占一行 */
@media (max-width: 520px){
  .mk-hero{
    margin: 6px 0 18px;
  }

  .mk-hero h1{
    font-size: 22px;        /* ✅ 关键：缩小 */
    letter-spacing: -0.01em;
    margin: 6px 0 8px;
  }

  /* 把竖线改成“换行符”的视觉效果：避免单独占一行 */
  .mk-hero h1{
    text-align: center;
  }
  /* 用伪元素把“｜”左右留空（更像分隔符，不像一个字） */
  .mk-hero h1{
    /* 如果你标题里有全角 ｜，会看起来更自然 */
  }

  .mk-hero p{
    font-size: 13px;
    line-height: 1.7;
    padding: 0 10px;
  }
}

/* 更小屏：再压一点 */
@media (max-width: 360px){
  .mk-hero h1{
    font-size: 20px;
    line-height: 1.2;
  }
}

/* =========================
   USD/CNY 三宫格：纯 CSS 居中（适配你当前的 inline grid 结构）
   ========================= */

/* 命中 USD/CNY mini 卡片里那个三列 grid（你现在是 inline style 写的 grid-template-columns:repeat(3...)） */
.mk-mini .mk-mini-body > div[style*="grid-template-columns:repeat(3"]{
  text-align: center;                 /* 让子元素默认居中 */
}

/* 命中三张小卡片本身：让内容真正居中 + 垂直排列更规整 */
.mk-mini .mk-mini-body > div[style*="grid-template-columns:repeat(3"] > div{
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;                /* ✅ 关键：让 label / value 水平居中 */
}

/* 命中三张卡片里的“数值”：居中+不乱换行 */
.mk-mini #fx-last,
.mk-mini #fx-change,
.mk-mini #fx-change-pct{
  text-align: center;
  width: 100%;
  white-space: nowrap;
}

.mk-tags{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}

.mk-tag{
  border:1px solid #e5e7eb;
  background:#fff;
  color:#374151;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  cursor:pointer;
  transition:.15s;
}

.mk-tag:hover{
  border-color:#cbd5e1;
  transform: translateY(-1px);
}

.mk-tag.is-active{
  border-color: var(--mk-brand);
  color: var(--mk-brand);
  background: rgba(255,107,53,.08);
}
/* 手机端：更新/来源尽量同一排，太长就省略 */
@media (max-width: 640px){
  .mk-badges{
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;          /* 不换行 */
    gap: 8px;
  }
  .mk-badges .mk-pill{
    flex: 1;                    /* 两个 pill 平分一行 */
    min-width: 0;               /* 允许收缩（关键） */
    font-size: 11.5px;
    padding: 6px 8px;
    overflow: hidden;           /* 省略号三件套 */
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
