/* 手机版 H5（/mobile.html）专用样式
   设计目标：单手拇指可达、卡片一屏 2~3 场、关键结论（方向/盘口/水位）一眼可见
   仅本页加载，不影响桌面各页；桌面样式（style.css）只提供 CSS 变量与 toast */

:root {
  --m-bg: #eef1f6;
  --m-card: #ffffff;
  --m-text: #0f172a;
  --m-sub: #64748b;
  --m-faint: #94a3b8;
  --m-line: #e6ebf2;
  --m-over: #f97316;
  --m-under: #2563eb;
  --m-header: linear-gradient(135deg, #111a33 0%, #1c2b4d 100%);
  --m-radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 视图切换依赖 hidden 属性，必须压过组件类里的 display 声明（.m-login 的 display:flex
   优先级高于 UA 的 [hidden]，否则登录后登录卡片仍会盖在主视图上） */
[hidden] { display: none !important; }

body.m-body {
  margin: 0;
  padding: 0;
  background: var(--m-bg);
  color: var(--m-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

/* ══════════ 登录 ══════════ */
.m-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--m-header);
}
.m-login-card {
  width: 100%;
  max-width: 380px;
  background: var(--m-card);
  border-radius: 18px;
  padding: 26px 22px 20px;
  box-shadow: 0 18px 40px rgba(9, 15, 32, 0.35);
  text-align: center;
}
.m-login-logo { font-size: 34px; line-height: 1; }
.m-login-card h1 { font-size: 20px; margin: 8px 0 2px; }
.m-login-sub { margin: 0 0 18px; color: var(--m-sub); font-size: 12.5px; }
.m-field { display: block; text-align: left; margin-bottom: 12px; }
.m-field span { display: block; font-size: 12px; color: var(--m-sub); margin-bottom: 6px; }
.m-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 16px;              /* ≥16px 防止 iOS 聚焦时自动放大 */
  color: var(--m-text);
  background: #f7f9fc;
  border: 1px solid var(--m-line);
  border-radius: 12px;
  outline: none;
}
.m-field input:focus { border-color: #1c2b4d; background: #fff; }
.m-login-error {
  margin: 0 0 10px;
  color: #dc2626;
  font-size: 12.5px;
  text-align: left;
}
.m-btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #1c2b4d;
}
.m-btn:disabled { opacity: 0.6; }
.m-btn-primary { background: linear-gradient(135deg, #1c2b4d, #2b4480); }
/* 服务异常时的重试按钮：与登录按钮并列展示 */
.m-btn-ghost {
  margin-top: 8px;
  color: #1c2b4d;
  background: #eef2f8;
  border: 1px solid var(--m-line);
}
.m-login-tip { margin: 14px 0 0; font-size: 12px; color: var(--m-faint); }
.m-login-desktop { display: inline-block; margin-top: 10px; font-size: 12.5px; color: #2b4480; text-decoration: none; }

/* ══════════ 顶部栏 ══════════ */
.m-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--m-header);
  padding: calc(8px + env(safe-area-inset-top)) 12px 0;
  color: #fff;
}
.m-header-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 2px 8px; }
.m-brand { font-size: 16px; font-weight: 600; }
.m-ver { font-size: 11px; font-weight: 400; opacity: 0.6; margin-left: 2px; }
.m-account { display: flex; align-items: center; gap: 8px; }
.m-username { font-size: 12px; opacity: 0.85; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-logout {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 13px;
}

/* 引擎切换：横向可滚动，引擎再多也不挤压 */
.m-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px 10px;
  scrollbar-width: none;
}
.m-tabs::-webkit-scrollbar { display: none; }
.m-tab {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  white-space: nowrap;
}
.m-tab.is-active {
  color: #111a33;
  background: #fff;
  border-color: #fff;
  font-weight: 600;
}

/* ══════════ 主体 ══════════ */
.m-main { padding: 10px 10px calc(28px + env(safe-area-inset-bottom)); }

.m-summary { display: flex; gap: 8px; margin-bottom: 10px; }
.m-stat {
  flex: 1;
  background: var(--m-card);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.m-stat b { display: block; font-size: 17px; line-height: 1.2; }
.m-stat span { font-size: 11px; color: var(--m-sub); }

.m-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 8px;
  font-size: 12.5px;
  color: var(--m-sub);
}
.m-refresh {
  height: 28px;
  padding: 0 12px;
  font-size: 12.5px;
  color: #1c2b4d;
  background: #fff;
  border: 1px solid var(--m-line);
  border-radius: 14px;
}
.m-refresh.is-busy { opacity: 0.55; }

.m-list { display: flex; flex-direction: column; gap: 10px; }

/* ══════════ 卡片 ══════════ */
.m-card {
  background: var(--m-card);
  border-radius: var(--m-radius);
  padding: 11px 12px 9px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
  animation: m-in 0.22s ease;
}
.m-card.is-new { box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.5), 0 2px 10px rgba(15, 23, 42, 0.07); }
@keyframes m-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.m-card-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--m-sub); }
.m-league {
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 7px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
}
.m-kick { margin-left: auto; font-variant-numeric: tabular-nums; }
.m-kick em { font-style: normal; color: var(--m-faint); margin-left: 4px; }

.m-match {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 0 9px;
  font-size: 16px;
  font-weight: 600;
}
.m-team { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-team.away { text-align: right; }
.m-vs { flex: 0 0 auto; font-size: 11px; font-weight: 400; color: var(--m-faint); }

/* 同推引擎：同一场还有哪些引擎在推荐（后端 co_engines，对阵下方） */
.m-co {
  margin: -5px 0 9px;
  font-size: 11.5px;
  color: var(--m-faint);
}
.m-co .co-engine {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}
.m-co .co-engine.co-same { background: #eef6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.m-co .co-engine.co-diff { background: #f8fafc; color: var(--m-faint); border: 1px dashed var(--m-line); }

/* 结论区：方向 + 盘口 + 水位 —— 手机上一眼可见的核心信息 */
.m-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border-left: 4px solid var(--m-faint);
}
.m-pick.over { border-left-color: var(--m-over); background: #fff7ed; }
.m-pick.under { border-left-color: var(--m-under); background: #eff6ff; }
.m-badge {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--m-faint);
}
.m-badge.over { background: var(--m-over); }
.m-badge.under { background: var(--m-under); }
.m-line { font-size: 16px; font-weight: 700; }
.m-odds { margin-left: auto; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-odds em { font-style: normal; font-size: 11px; font-weight: 400; color: var(--m-faint); margin-right: 1px; }

.m-state {
  padding: 2px 8px;
  border-radius: 9px;
  font-size: 11.5px;
  background: #e2e8f0;
  color: #475569;
}
.m-state.is-live { background: #fee2e2; color: #b91c1c; }
.m-state.is-confirmed { background: #fef3c7; color: #b45309; }

/* ══════════ 标签（策略票 / 摘要字段 / 命中徽章） ══════════ */
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.m-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9px;
  background: #f4f6fa;
  color: #334155;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.m-chip em { font-style: normal; font-size: 11px; color: var(--m-faint); }
.m-chip b { font-weight: 600; }
.m-chip i { font-style: normal; color: var(--m-sub); font-size: 11px; }
.m-chip u { font-style: normal; text-decoration: none; font-size: 10.5px; padding: 0 4px; border-radius: 6px; }
.m-chip u.m-follow { background: #dcfce7; color: #15803d; }
.m-chip u.m-against { background: #fee2e2; color: #b91c1c; }
.m-chip.is-same { background: #eef6ff; }
.m-chip.m-chip-dim { color: var(--m-faint); }

.m-hit { padding: 3px 9px; border-radius: 9px; font-size: 12px; font-weight: 600; }
.m-hit-strong { background: #dcfce7; color: #15803d; }
.m-hit-mid { background: #fef3c7; color: #b45309; }
.m-hit-weak { background: #f1f5f9; color: #64748b; }
.m-hit-plain { background: #f4f6fa; color: #334155; }

/* ══════════ 展开详情 ══════════ */
.m-card-foot {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--m-line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--m-faint);
}
.m-card-foot .m-caret { transition: transform 0.2s; }
.m-card.is-open .m-card-foot .m-caret { transform: rotate(180deg); }
.m-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin: 9px 0 0;
  padding: 9px 0 0;
  border-top: 1px dashed var(--m-line);
}
.m-detail > div { min-width: 0; }
.m-detail dt { font-size: 11px; color: var(--m-faint); }
.m-detail dd { margin: 0; font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }

/* ══════════ 空态与状态条 ══════════ */
.m-empty { text-align: center; padding: 56px 20px; color: var(--m-sub); }
.m-empty-icon { font-size: 40px; }
.m-status {
  margin-top: 14px;
  text-align: center;
  font-size: 11.5px;
  color: var(--m-faint);
}
.m-status.is-error { color: #dc2626; }

/* ══════════ 平板/大屏兜底：居中收窄，避免卡片过宽 ══════════ */
@media (min-width: 720px) {
  .m-main, .m-header-top, .m-tabs { max-width: 680px; margin-left: auto; margin-right: auto; }
}
