/* 微光联盟 —— 全局样式（移动优先，暗色） */
:root {
  --bg: #14151b;
  --bg2: #191b23;
  --card: #1e212b;
  --card2: #242836;
  --line: #2c3040;
  --txt: #e9edf5;
  --muted: #8b93a7;
  --brand: #e0443b;
  --brand-d: #c2352c;
  --ok: #23b57e;
  --warn: #e0a83b;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(900px 420px at 50% -180px, rgba(224, 68, 59, .13), transparent 70%), var(--bg);
  color: var(--txt);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}
.wrap { max-width: 620px; margin: 0 auto; padding: 0 16px; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: .2px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* 顶部品牌 */
.brandbar { display: flex; align-items: center; gap: 10px; padding: 18px 0 10px; }
.logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, #e0443b, #a8281f); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 18px rgba(224, 68, 59, .3);
}
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .3px; }

/* 卡片 */
.card {
  background: linear-gradient(180deg, var(--card), #1b1e27);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-t { font-size: 15px; font-weight: 650; }
.card-s { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 11px; padding: 12px 18px; font-size: 15px; font-weight: 650;
  background: var(--card2); color: var(--txt); cursor: pointer; transition: .18s;
  font-family: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.985); }
.btn-primary { background: linear-gradient(140deg, #e0443b, #bf3a31); color: #fff; box-shadow: 0 8px 22px rgba(224, 68, 59, .28); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--txt); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* 输入 */
.field { margin-bottom: 12px; }
.label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.input, textarea, select {
  width: 100%; background: #12141a; color: var(--txt); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 13px; font-size: 15px; font-family: inherit; outline: none;
  transition: .16s;
}
.input:focus, textarea:focus, select:focus { border-color: #4a5068; background: #0f1117; }
textarea { min-height: 150px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.kpi-k { font-size: 11.5px; color: var(--muted); }
.kpi-v { font-size: 19px; font-weight: 700; margin-top: 3px; }
.kpi-v small { font-size: 11px; color: var(--muted); font-weight: 500; }

/* 底部分类 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(20, 21, 27, .92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
}
.tab { flex: 1; text-align: center; padding: 6px 0; color: var(--muted); font-size: 11.5px; cursor: pointer; border-radius: 10px; }
.tab i { display: block; font-size: 18px; font-style: normal; line-height: 1.3; }
.tab.on { color: var(--brand); background: rgba(224, 68, 59, .1); }

/* 列表项 */
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-size: 14px; }
.item .s { font-size: 11.5px; color: var(--muted); }
.item .amt { font-weight: 700; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 7px; font-size: 11px; font-weight: 600; }
.badge-ok { background: rgba(35, 181, 126, .16); color: #4dd6a0; }
.badge-warn { background: rgba(224, 168, 59, .16); color: #f0bd62; }
.badge-err { background: rgba(224, 68, 59, .16); color: #ff8a80; }
.badge-gray { background: rgba(255,255,255,.07); color: var(--muted); }

.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 0; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(6, 7, 10, .78); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center; z-index: 60; padding: 0;
}
.modal-mask.on { display: flex; }
.modal {
  width: 100%; max-width: 620px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 92vh; overflow: auto;
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(18px); opacity: .6 } to { transform: none; opacity: 1 } }
.modal-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-t { font-weight: 700; font-size: 16px; }
.x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }

/* 广告播放区 */
.adstage { position: relative; background: #0c0e13; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 300px; }
.adstage iframe { width: 100%; border: 0; display: block; background: #fff; }
.ad-frame { height: 300px; }
.ad-live { min-height: 300px; width: 100%; display: grid; place-items: center; padding: 6px; box-sizing: border-box; }
.ad-live > * { max-width: 100%; }
.ad-hint { position: absolute; left: 10px; bottom: 8px; font-size: 11.5px; color: #7d8497; background: rgba(10, 12, 18, .8); border-radius: 6px; padding: 2px 8px; }
.ad-nofill {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: rgba(16, 18, 24, .97); color: #e08a82; font-size: 12.5px; line-height: 2; padding: 16px;
}
.ad-nofill b { display: block; font-size: 14px; color: #f0a49c; margin-bottom: 4px; font-weight: 600; }
.ad-nofill span { color: #8c8290; font-size: 11.5px; }
.ad-overlay {
  position: absolute; right: 10px; top: 10px; background: rgba(10, 12, 18, .86);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12px; color: #fff;
  font-variant-numeric: tabular-nums;
}
.adempty { padding: 46px 16px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.9; }
.item .btn.on { color: #ff8a80; border-color: rgba(224, 68, 59, .45); background: rgba(224, 68, 59, .12); }

/* ============ 广告播放卡（页面内展开，不遮挡页面） ============ */
.adbody { position: relative; min-height: 110px; background: #0b0d12; border: 1px solid var(--line); border-radius: 12px; overflow: visible; }
.adbody #adwrap { position: relative; z-index: 1; width: 100%; text-align: center; }
.adbody iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.adbody .adph { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.9; padding: 16px; pointer-events: none; }
.adleft { font-variant-numeric: tabular-nums; color: #fff; background: rgba(255, 255, 255, .08); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.adx { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: #1d2029; color: #cfd3de; font-size: 16px; line-height: 1; cursor: pointer; }
.adx:hover { color: #fff; border-color: rgba(224, 68, 59, .5); }
.adrow { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.adrow .btn { flex: 1; }

/* 线路切换条 */
.hostbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin: 0 0 10px;
}
.hostbar-info { min-width: 0; }
.hostbar-k { font-size: 11px; color: var(--muted); }
.hostbar-v { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 进度条 */
.bar { height: 6px; border-radius: 999px; background: #2a2e3c; overflow: hidden; margin: 10px 0 4px; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e0443b, #f2735d); transition: width .3s linear; }

/* 提示条 */
.note { background: rgba(224, 168, 59, .1); border: 1px solid rgba(224, 168, 59, .25); color: #f0c878; border-radius: 11px; padding: 10px 12px; font-size: 12.5px; line-height: 1.7; }
.note-err { background: rgba(224, 68, 59, .1); border-color: rgba(224, 68, 59, .28); color: #ff9d94; }
.note-ok { background: rgba(35, 181, 126, .1); border-color: rgba(35, 181, 126, .28); color: #6fdcb0; }

.toast {
  position: fixed; left: 50%; top: 16%; transform: translate(-50%, -8px);
  background: #262a38; border: 1px solid var(--line); color: #fff; padding: 11px 18px;
  border-radius: 12px; font-size: 13.5px; z-index: 90; opacity: 0; pointer-events: none;
  transition: .22s; max-width: 86vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 复制框 */
.copyrow { display: flex; gap: 8px; }
.copyrow .input { font-size: 13px; }

/* 落地页 */
.hero { padding: 34px 0 20px; text-align: center; }
.hero h1 { font-size: 25px; line-height: 1.35; }
.hero h1 b { color: var(--brand); }
.hero p { color: var(--muted); font-size: 13.5px; margin: 10px 0 0; }
.feats { display: grid; gap: 10px; margin: 18px 0; }
.feat { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; }
.feat i { font-style: normal; font-size: 18px; }
.feat .t { font-size: 14px; font-weight: 650; }
.feat .s { font-size: 12px; color: var(--muted); }

.foot { text-align: center; color: #5f6678; font-size: 11.5px; padding: 26px 0 40px; line-height: 1.9; }
.foot a { color: #8b93a7; text-decoration: none; }
.foot a:hover { color: #fff; }

/* 首页顶部广告位 */
.home-ad {
  margin: 4px 0 14px; display: flex; justify-content: center; align-items: center;
  min-height: 0; overflow: hidden;
}
.home-ad > * { max-width: 100%; }
.home-ad iframe { display: block; border: 0; }

/* 开关（后台参数页） */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input {
  -webkit-appearance: none; appearance: none; margin: 0;
  width: 42px; height: 23px; border-radius: 23px; flex: 0 0 auto;
  background: #2a2f3d; border: 1px solid var(--line); position: relative;
  transition: background .18s, border-color .18s; cursor: pointer;
}
.switch input:checked { background: var(--brand); border-color: var(--brand); }
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; transition: left .18s;
}
.switch input:checked::after { left: 21px; }
.switch .txt { font-size: 12.5px; color: #9aa1b4; line-height: 1.6; }

/* 内容页：导航与正文 */.navline { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 14px; font-size: 12.5px; }
.navline a { color: #8b93a7; text-decoration: none; }
.navline a:hover { color: #fff; }
.doc { font-size: 14px; line-height: 1.9; color: #c8cedd; }
.doc h2 { font-size: 15.5px; color: #fff; margin: 24px 0 10px; padding-left: 10px; border-left: 3px solid #e0443b; }
.doc h2:first-child { margin-top: 0; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 14px 18px; padding: 0; }
.doc li { margin: 0 0 7px; }
.doc a { color: #ff9c7a; }
.doc b { color: #fff; }

/* 后台 */
.admin-wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.admin-tab { white-space: nowrap; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; cursor: pointer; }
.admin-tab.on { color: #fff; border-color: rgba(224,68,59,.5); background: rgba(224,68,59,.12); }

/* 曝光监控的数据源胶囊：分组之间留分隔线，别挤成一行文字 */
.ms-tabs { gap: 8px; padding: 2px 0 8px; align-items: center; }
.ms-tab { white-space: nowrap; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 13px; cursor: pointer; transition: .15s; }
.ms-tab:hover { color: #fff; border-color: rgba(255,255,255,.22); }
.ms-tab.on { color: #fff; border-color: rgba(224,68,59,.55); background: rgba(224,68,59,.14); font-weight: 600; }
.ms-sep { flex: 0 0 auto; width: 1px; height: 26px; margin: 0 4px; background: rgba(255,255,255,.12); }
/* 时间刻度切换：每 1 分钟 / 5 分钟 / 1 小时 / 6 小时 / 每天 */
.ms-bk-label { font-size: 12px; color: var(--muted); margin-right: 4px; }
#ms-live, #ms-refresh, #ms-pull { white-space: nowrap; flex: 0 0 auto; }
.card-h { flex-wrap: wrap; row-gap: 8px; }
.bk-pill { white-space: nowrap; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; transition: .15s; }
.bk-pill:hover { color: #fff; border-color: rgba(255,255,255,.22); }
.bk-pill.on { color: #fff; border-color: rgba(96,165,250,.5); background: rgba(96,165,250,.14); font-weight: 600; }
/* EPM / EPC 趋势线 */
.ms-trend { margin-top: 14px; padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: rgba(255,255,255,.02); }
.ms-trend:empty { display: none; }
.ms-ln + .ms-ln { margin-top: 10px; }
.ms-ln-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.ms-ln-h i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.ms-ln-h .num { color: #e6e8ef; font-size: 11.5px; white-space: nowrap; }
.ms-svg { display: block; width: 100%; height: 52px; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td { text-align: left; padding: 9px 8px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
table.tb th { color: var(--muted); font-weight: 600; font-size: 12px; }
.table-scroll { overflow-x: auto; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ 广告位：直接铺在页面里（和首页顶部广告代码一样，无外框无占位） ============ */
#adhost { display: none; margin: 0 0 10px; text-align: center; }
#adhost #adwrap { position: relative; width: 100%; }
/* 透明点击层：用户点广告时先记一次点击，再把这一下让给广告本身 */
.adhitmask { position: absolute; inset: 0; z-index: 3; cursor: pointer; }