/* ============================================================
   DN 移动助手 · 移动端 H5 样式
   ============================================================ */
:root {
  --bg: #0b1220;
  --bg2: #0f172a;
  --card: #17223a;
  --card2: #1e2c4a;
  --line: #2b3a5c;
  --txt: #e6edf7;
  --sub: #8ba0bd;
  --accent: #facc15;
  --accent-ink: #1a1202;
  --ok: #34d399;
  --err: #f87171;
  --warn: #fbbf24;
  --info: #38bdf8;
  --purple: #a78bfa;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(0, 0, 0, .35);
  --bar-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
#root { min-height: 100vh; padding: env(safe-area-inset-top) 12px calc(var(--bar-h) + 20px + env(safe-area-inset-bottom)); }
body[data-shell="off"] #root { padding-bottom: 20px; }
.hidden { display: none !important; }
button { font-family: inherit; }

/* ------- 顶部栏 ------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 6px 10px;
  background: rgba(11, 18, 32, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.app-title { flex: 1; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 10px;
  background: var(--card); color: var(--txt); font-size: 22px; line-height: 1;
}
.icon-btn:active { opacity: .7; }

/* ------- 底部导航 ------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: rgba(13, 21, 38, .97); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: 0; background: transparent; color: var(--sub);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 0 5px; font-size: 11px;
}
.tab-ico { font-size: 20px; line-height: 1.2; }
.tab.on { color: var(--accent); }

/* ------- 卡片/布局 ------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 12px;
}
.card.t { padding-top: 14px; }
.h2 { font-size: 13px; color: var(--sub); margin: 14px 4px 8px; display: flex; align-items: center; gap: 6px; }
.h2::before { content: ""; width: 4px; height: 13px; background: var(--accent); border-radius: 2px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--sub); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.divider { height: 1px; background: var(--line); margin: 10px 0; }

/* ------- 输入 ------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 5px; }
.field input, .field select, .field textarea,
.card > textarea, textarea.input-plain {
  width: 100%; padding: 10px 12px;
  background: var(--bg2); color: var(--txt);
  border: 1px solid var(--line); border-radius: 10px; font-size: 15px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 84px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
select option { background: var(--card2); }

/* ------- 按钮 ------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 12px 16px; font-size: 15px; font-weight: 600;
  background: var(--card2); color: var(--txt); cursor: pointer;
}
.btn:active { filter: brightness(1.15); }
.btn.primary { background: linear-gradient(135deg, #fde047, var(--accent)); color: var(--accent-ink); }
.btn.danger { background: rgba(248, 113, 113, .16); color: var(--err); border: 1px solid rgba(248, 113, 113, .4); }
.btn.ok { background: rgba(52, 211, 153, .14); color: var(--ok); border: 1px solid rgba(52, 211, 153, .4); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

/* ------- 通用下拉 / 步进 ------- */
select {
  background: var(--bg2); color: var(--txt);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 15px; outline: none; max-width: 100%;
}
select:focus { border-color: var(--accent); }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card2); color: var(--txt); font-size: 19px; line-height: 1;
}
.stepper input {
  width: 88px; text-align: center; padding: 7px 4px;
  background: var(--bg2); color: var(--txt); border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; font-weight: 700;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-num { gap: 4px; }
.chips-num .chip { min-width: 29px; padding: 7px 0; text-align: center; font-size: 14px; }
.chips-sym .chip { padding: 6px 10px; font-size: 13px; }

/* 下单页：选择彩种卡片吸顶（贴屏幕最顶，下方与最近开奖留间隔） */
#sel-card { position: sticky; top: 0; z-index: 12; background: var(--card);
  border-radius: 0 0 14px 14px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
body[data-shell="on"] #sel-card { top: env(safe-area-inset-top, 0px); }
.chip {
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--txt); cursor: pointer;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.chip:disabled { opacity: .45; }

/* ------- 分段 ------- */
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--sub); padding: 9px 0; border-radius: 9px; font-size: 14px; }
.seg button.on { background: var(--card2); color: var(--accent); font-weight: 700; }

/* ------- 列表 ------- */
.li {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 9px;
}
.li .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.li .ttl { font-weight: 700; font-size: 15px; }
.li .sub { color: var(--sub); font-size: 12px; margin-top: 3px; word-break: break-all; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.kv b { font-weight: 600; }

/* ------- 状态色 ------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; border: 1px solid; white-space: nowrap; }
.pill.wait { color: var(--warn); border-color: rgba(251, 191, 36, .5); background: rgba(251, 191, 36, .1); }
.pill.win { color: var(--ok); border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .1); }
.pill.lose { color: var(--sub); border-color: rgba(139, 160, 189, .5); }
.pill.cancel { color: var(--err); border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .1); }
.pill.run { color: var(--info); border-color: rgba(56, 189, 248, .5); background: rgba(56, 189, 248, .1); }
.pill.end { color: var(--purple); border-color: rgba(167, 139, 250, .5); background: rgba(167, 139, 250, .1); }
.pill.okc { color: var(--ok); border-color: rgba(52, 211, 153, .5); }
.pill.err { color: var(--err); border-color: rgba(248, 113, 113, .5); }

.amount { font-variant-numeric: tabular-nums; }
.plus { color: var(--ok); } .minus { color: var(--err); }

/* ------- 号码球 ------- */
.balls { display: flex; flex-wrap: wrap; gap: 4px; }
.ball {
  width: 26px; height: 26px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  background: #0e3a5e; color: #7dd3fc;
}
.ball.hi { background: #5b21b6; color: #e9d5ff; }

/* ------- 余额卡 ------- */
.balance-card { background: linear-gradient(135deg, #17223a, #101b31); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; position: relative; overflow: hidden; }
.balance-card .num { font-size: 32px; font-weight: 800; letter-spacing: .5px; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ------- 首页快捷入口 ------- */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick .q {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 4px; text-align: center; font-size: 12px; color: var(--txt); cursor: pointer;
}
.quick .q .ic { display: block; font-size: 20px; margin-bottom: 4px; }
.quick .q:active { filter: brightness(1.2); }

/* ------- 柱状条 ------- */
.barline { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.barline .lbl { width: 22px; text-align: right; color: var(--sub); }
.barline .track { flex: 1; height: 12px; background: var(--bg2); border-radius: 6px; overflow: hidden; }
.barline .fill { height: 100%; background: linear-gradient(90deg, #2563eb, var(--accent)); border-radius: 6px; min-width: 2px; }

/* ------- 表格（分布/明细） ------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 7px 4px; text-align: center; }
.tbl th { color: var(--sub); font-weight: 500; position: sticky; top: 0; background: var(--card); }
.hot { color: var(--accent); font-weight: 800; }

/* ------- 登录 ------- */
.login-wrap { max-width: 420px; margin: 0 auto; padding: 28px 16px 40px; }
.login-brand { text-align: center; margin: 14px 0 22px; }
.login-brand h1 { font-size: 24px; margin: 0 0 4px; color: var(--accent); }
.login-brand p { margin: 0; color: var(--sub); font-size: 12px; }
.gate-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--err); margin-right: 5px; }
.gate-dot.on { background: var(--ok); }
.auth-hint { min-height: 20px; font-size: 13px; margin: 4px 0 12px; text-align: center; }
.auth-hint.bad { color: var(--err); } .auth-hint.good { color: var(--ok); } .auth-hint.wait { color: var(--warn); }

/* ------- 挂机 ------- */
.machine-state {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 10px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: #475569; display: inline-block; }
.dot.run { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.logbox {
  background: #060b16; border: 1px solid var(--line); border-radius: 10px;
  min-height: 120px; max-height: 260px; overflow-y: auto;
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; padding: 8px;
  line-height: 1.7;
}
.logbox .ok { color: var(--ok); } .logbox .err { color: var(--err); } .logbox .dim { color: var(--sub); } .logbox .warn { color: var(--warn); }

/* ------- Toast / Modal ------- */
#toast-wrap { position: fixed; top: calc(env(safe-area-inset-top) + 14px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 99; pointer-events: none; }
.toast { background: rgba(23, 34, 58, .96); color: var(--txt); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font-size: 13px; max-width: 86vw; box-shadow: var(--shadow); animation: rise .2s ease; }
.toast.err { border-color: rgba(248, 113, 113, .6); color: #fecaca; }
.toast.ok { border-color: rgba(52, 211, 153, .6); color: #a7f3d0; }
@keyframes rise { from { transform: translateY(-8px); opacity: 0; } }

#modal-root .mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 20px; }
#modal-root .sheet { background: var(--card); border: 1px solid var(--line); border-radius: 16px; max-width: 420px; width: 100%; padding: 16px; box-shadow: var(--shadow); }
#modal-root .sheet h3 { margin: 0 0 10px; font-size: 16px; }

/* ------- 空态 ------- */
.empty { text-align: center; color: var(--sub); padding: 34px 0; font-size: 13px; }
.loading-ico { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 520px) {
  .root { max-width: 480px; margin: 0 auto; box-shadow: 0 0 40px rgba(0,0,0,.4); min-height: 100vh; }
  .app-header, .tabbar { left: 50%; transform: translateX(-50%); width: 480px; max-width: 100%; }
}
