/* ============================================================
   BA7LAK · 通联动态 — 深色极简版式
   ============================================================ */

:root {
  --bg:          #07090f;
  --bg-soft:     #0d1119;
  --panel:       rgba(255, 255, 255, 0.035);
  --panel-line:  rgba(255, 255, 255, 0.075);
  --text:        #eef2f8;
  --text-dim:    #8b97ab;
  --text-faint:  #5b6678;
  --accent:      #4fd1ff;
  --accent-2:    #7c8cff;
  --accent-3:    #34e6b0;
  --warn:        #ffb347;
  --radius:      18px;
  --radius-sm:   12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- 背景光晕 ---------- */
.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
}
.b1 {
  width: 46vw; height: 46vw; min-width: 320px; min-height: 320px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 68%);
  top: -14vw; left: -8vw;
  animation: drift1 26s ease-in-out infinite;
}
.b2 {
  width: 38vw; height: 38vw; min-width: 260px; min-height: 260px;
  background: radial-gradient(circle, var(--accent-2) 0%, transparent 68%);
  top: 22vh; right: -12vw;
  animation: drift2 32s ease-in-out infinite;
}
.b3 {
  width: 34vw; height: 34vw; min-width: 240px; min-height: 240px;
  background: radial-gradient(circle, var(--accent-3) 0%, transparent 70%);
  bottom: -16vw; left: 28vw;
  opacity: 0.2;
  animation: drift3 38s ease-in-out infinite;
}
@keyframes drift1 { 0%,100% { transform: translate(0,0) } 50% { transform: translate(6vw,4vh) } }
@keyframes drift2 { 0%,100% { transform: translate(0,0) } 50% { transform: translate(-5vw,7vh) } }
@keyframes drift3 { 0%,100% { transform: translate(0,0) } 50% { transform: translate(4vw,-6vh) } }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 11px 16px 10px;
  background: rgba(7, 9, 15, .86);
  border-bottom: 1px solid var(--panel-line);
  backdrop-filter: blur(16px);
}

/* 第一行：绿点 + LIVE + 主标题 + 域名 */
.brand-line1 {
  display: flex;
  align-items: center;
  gap: 7px;
}
.brand-live {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent-3);
  line-height: 1;
  flex: none;
}
.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  margin-left: 3px;
  background: linear-gradient(110deg, #ffffff 12%, #cfe6ff 55%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  flex: none;
}
.brand-host {
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  margin-left: auto;          /* 右对齐，与左侧标题拉开距离 */
}

/* 第二行：连接状态 · TS1/TS2（强制单行，绝不折成第三行） */
.brand-line2 {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text-faint);
  overflow: hidden;
}
/* 连接状态文字（绿/红/琥珀）：窄屏时优先收缩，保证右侧 TS 组始终可见 */
.brand-line2 .conn {
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}
.brand-line2 .conn.ok   { color: var(--accent-3); }
.brand-line2 .conn.warn { color: var(--warn); }
/* 竖线分隔符 */
.line2-sep {
  width: 1px;
  height: 10px;
  background: var(--panel-line);
  flex: none;
}
/* TS1 / TS2 组 */
.ts-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  flex: none;
}
/* TS1/TS2 整体靠右，使第二行右边缘与第一行的域名对齐。
   用 margin-left:auto 把这一组推到最右，两行便自然右对齐。 */
.ts-group {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  margin-left: auto;
  flex: none;
}
.ts-tag {
  color: var(--text-faint);
  opacity: .72;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}
.ts-val {
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-2, var(--accent));
  white-space: nowrap;
}
/* 无通联时灰色占位 */
.ts-val.none {
  color: var(--text-faint);
  opacity: .5;
  font-weight: 400;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: background .3s;
  flex: none;
}
.dot.on {
  background: var(--accent-3);
  box-shadow: 0 0 0 0 rgba(52, 230, 176, .55);
  animation: pulse 2.2s infinite;
}
.dot.off { background: var(--warn); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 230, 176, .5) }
  70%  { box-shadow: 0 0 0 9px rgba(52, 230, 176, 0) }
  100% { box-shadow: 0 0 0 0 rgba(52, 230, 176, 0) }
}

/* ---------- 数据卡片 ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 9px;
}
.stat {
  padding: 8px 6px 7px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
  text-align: center;
}
.stat-num {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.stat-label {
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

/* ---------- 主体 ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 13px 16px;
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
}

/* 板块：同一时刻只显示一个 */
.board { display: none; }
.board.active { display: block; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: 11px 12px 4px;
  backdrop-filter: blur(14px);
  margin-bottom: 9px;
}
.panel:last-child { margin-bottom: 0; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  margin-bottom: 1px;
  border-bottom: 1px solid var(--panel-line);
}
.panel-head h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.panel-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* 面板标题右侧：统计文字 + 条数下拉 */
.head-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* 面板头强制单行：标题 / 「共 N 条」/ 条数下拉 一律挤在同一行，
   窄屏也不换行（默认是 wrap，会把右侧整组甩到第二行去）。
   id+class 的选择器优先级高于窄屏媒体查询里的 .head-right。 */
.panel-head.head-inline { flex-wrap: nowrap; row-gap: 0; }
.panel-head.head-inline .head-right {
  width: auto; flex-wrap: nowrap; gap: 8px; margin-left: auto; min-width: 0;
}
/* 万一还是挤不下，让「共 N 条」自己省略，绝不把下拉甩到下一行 */
.panel-head.head-inline .panel-sub {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.limit-pick {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.limit-pick select {
  appearance: none;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--panel-line);
  border-radius: 7px;
  padding: 3px 22px 3px 10px;
  cursor: pointer;
  line-height: 1.4;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.limit-pick select:hover { color: var(--text); }
.limit-pick select:focus {
  outline: none;
  border-color: rgba(79, 209, 255, .5);
}
.limit-pick select option {
  background: #10141d;
  color: var(--text);
}

/* ---------- 通联动态 ---------- */
.feed {
  list-style: none;
  padding: 7px 0 3px;
}

.feed li.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 10px 5px 11px;
  margin-bottom: 4px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .028);
  border: 1px solid rgba(255, 255, 255, .05);
  position: relative;
  overflow: hidden;
  animation: slideIn .38s cubic-bezier(.22,.9,.3,1) both;
}
.feed li.item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: .85;
}
.feed li.item.is-data::before {
  background: linear-gradient(180deg, var(--accent-2), #b06cff);
}
.feed li.item:last-child { margin-bottom: 0; }
/* 矮屏手机（iPhone SE 这类竖屏不到 620px 的）再压一档 */
@media (max-height: 620px) {
  #board-info .panel { padding: 5px 9px 2px; margin-bottom: 4px; }
  #board-info .panel-head { padding-bottom: 1px; }
  #board-info .panel-head h2 { font-size: 12px; }
  #board-info .info-body { font-size: 10.5px; line-height: 1.34; }
  #board-info .info-term { padding: 2px 0; }
  #board-info .info-term .it-key,
  #board-info .info-term .it-val { font-size: 10.5px; line-height: 1.34; }
  #board-info .info-since { font-size: 10.5px; padding: 3px 7px; margin-top: 2px; }
  #board-info .info-note { font-size: 9.5px; margin-top: 2px; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.item-main {
  min-width: 0;
  flex: 1 1 auto;
}
.item-row1 {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.item-row1 .cs {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
  flex: none;
}
.item-row1 .s-tg {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.item-row1 .s-tgname {
  color: var(--text-faint);
  font-weight: 400;
}
.tag {
  flex: none;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 4px;
  color: var(--accent);
  background: rgba(79, 209, 255, .09);
  border: 1px solid rgba(79, 209, 255, .24);
}
.tag.data {
  color: var(--accent-2);
  background: rgba(124, 140, 255, .12);
  border-color: rgba(124, 140, 255, .22);
}

.item-row2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
  row-gap: 2px;
}
.item-row2 .s-dur { color: var(--text-dim); }
.item-row2 .s-loss { color: var(--warn); }
.item-row2 .s-ber { color: var(--text-dim); }
.item-row2 .s-name { color: var(--accent-3); }     /* 实时页 TalkerAlias 名字 */
.item-row2 .s-dmr { color: var(--text-dim); opacity: .8; }  /* 实时页 DMR 数字 ID */
/* 通话进行中：时长位置显示「通话中」，绿色 + 呼吸点 */
.item-row2 .s-dur.live {
  color: var(--accent-3);
  font-weight: 600;
}
.item-row2 .s-dur.live .live-dot2 {
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--accent-3);
  vertical-align: middle;
  animation: pulse2 1.4s ease-in-out infinite;
}
@keyframes pulse2 {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: .35; transform: scale(.72); }
}
.item-row2 .dot-sep {
  width: 2.5px; height: 2.5px;
  border-radius: 50%;
  background: var(--text-faint);
  opacity: .7;
  flex: none;
  align-self: center;
}

.item-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-variant-numeric: tabular-nums;
}
.item-side .when {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.item-side .ago {
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
  opacity: .85;
}

/* ---------- 排行榜 ---------- */
.rank { list-style: none; }

.rank li.row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}
.rank li.row:last-child { border-bottom: none; }

.idx {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.rank li.row:nth-child(1) .idx { color: #ffd76e; }
.rank li.row:nth-child(2) .idx { color: #cfd8e6; }
.rank li.row:nth-child(3) .idx { color: #e0a878; }

.row-main { min-width: 0; }
.row-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.row-val {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 条形背景 */
.bar-wrap {
  position: relative;
}
.bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(79,209,255,.13), rgba(79,209,255,0));
  border-radius: 6px;
  z-index: -1;
  transition: width .5s ease;
}

/* ---------- 空态 ---------- */
.empty {
  padding: 30px 10px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
.empty-icon {
  font-size: 30px;
  opacity: .5;
  margin-bottom: 8px;
}
.empty-hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-faint);
  opacity: .8;
}

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* 先给一层不透明底色兜底：部分国产浏览器不支持 backdrop-filter */
  background: #0b0f18;
  background: rgba(11, 15, 24, .97);
  border-top: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .55);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  font-family: inherit;
  /* 未选中也不再靠 opacity 压暗（国产浏览器渲染差异会让字糊掉），
     直接用稍亮的实色，保证三个按钮都看得清 */
  color: #93a0b5;
  opacity: 1;
  padding: 6px 4px 6px;
  min-height: 44px;                 /* 触控友好下限，不能再小了 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, transform .2s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
/* 三个按钮之间加细分隔线，边界更清楚 */
.tab + .tab { border-left: 1px solid rgba(255, 255, 255, .07); }
.tab-icon {
  font-size: 17px;
  line-height: 1;
  filter: grayscale(1) opacity(.85);
  transition: filter .2s ease, transform .2s ease;
}
.tab-text {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .04em;
}
/* 选中项：整格铺一层自上而下的淡光 + 文字变亮，比单靠文字变色醒目得多 */
.tab.active {
  color: var(--accent);
  background: linear-gradient(180deg,
              rgba(79, 209, 255, .18), rgba(79, 209, 255, .03) 62%, transparent);
}
.tab.active .tab-icon {
  filter: none;
  transform: translateY(-1px) scale(1.05);
}
/* 用实心强调色 + 轻微发光，不用 background-clip:text 渐变字
   （部分浏览器不支持时会把文字直接渲染成透明） */
.tab.active .tab-text {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(79, 209, 255, .45);
}
.tab.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 30px; height: 2.5px;      /* 指示条跟着按钮一起收小 */
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 8px rgba(79, 209, 255, .7);
}
/* 选中项：底部一层柔和光晕，强化"当前所在" */
.tab.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 70% at 50% 100%, rgba(79, 209, 255, .14), transparent 70%);
  pointer-events: none;
}
.tab:active { transform: scale(.96); }

/* ---------- 说明页（目标：多数手机竖屏一屏读完，不用上下滑） ---------- */
/* 卡片间距 / 头部留白压到最低 */
#board-info .panel { padding: 7px 10px 3px; margin-bottom: 6px; }
#board-info .panel:last-child { margin-bottom: 0; }
#board-info .panel-head { padding-bottom: 3px; margin-bottom: 0; }
#board-info .panel-head h2 { font-size: 12.5px; }

.info-body {
  padding: 4px 2px 2px;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.42;
}
.info-body p + p { margin-top: 3px; }
.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .045);
}
.info-row:last-of-type { border-bottom: none; }
.info-key { color: var(--text-faint); white-space: nowrap; }
.info-val { color: var(--text); text-align: right; }

/* 术语条目：改成「键 + 值」横向排，比上下两行少一整行的高度 */
.info-term {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0 8px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .045);
}
.info-term:last-of-type { border-bottom: none; }
.info-term .it-key {
  flex: none;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.info-term .it-val {
  flex: 1 1 0;
  min-width: 0;
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.42;
}

/* 采集起始时间：日期写死在 HTML 里，不再由 JS 动态渲染 */
.info-since {
  margin-top: 3px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: rgba(79, 209, 255, .07);
  border: 1px solid rgba(79, 209, 255, .16);
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.45;
}
.info-since b {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.info-note {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--text-faint);
  opacity: .85;
  line-height: 1.4;
}

/* ---------- 通话进行中：整行高亮（绿色竖条 + 背景光） ---------- */
.feed li.item.is-live::before {
  background: linear-gradient(180deg, var(--accent-3), #12c48f);
  opacity: 1;
  box-shadow: 0 0 14px rgba(52, 230, 176, .7);
}
.feed li.item.is-live {
  background: linear-gradient(90deg, rgba(52, 230, 176, .13), rgba(52, 230, 176, .03) 62%, transparent);
  border-color: rgba(52, 230, 176, .3);
  animation: slideIn .38s cubic-bezier(.22,.9,.3,1) both,
             liveGlow 2.2s ease-in-out infinite;
}
@keyframes liveGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 230, 176, 0), inset 0 0 22px rgba(52, 230, 176, .05); }
  50%      { box-shadow: 0 0 16px -2px rgba(52, 230, 176, .38), inset 0 0 22px rgba(52, 230, 176, .1); }
}
/* 通话中的呼号也带一点绿，扫一眼就认出来 */
.feed li.item.is-live .item-row1 .cs { color: var(--accent-3); }

/* 守听(spotter)实时说话人：来自 BrandMeister 全网，已结束的略淡以区别于热点日志 */
.feed li.item.spot-item:not(.is-live) { opacity: .82; }

.item-row2 .s-dur { color: var(--text-dim); }
/* 通话被打断（只有开始事件，结束事件丢了）：灰绿，不再呼吸 */
.item-row2 .s-dur.cut { color: var(--text-dim); }
/* 服务端封口的记录：时长后面挂一个小标记，说明这个数字不是真实通话时长 */
.item-row2 .s-dur .sealed-tag {
  margin-left: .4em;
  padding: .05em .4em;
  font-size: 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 176, 79, .38);
  color: #ffb04f;
  white-space: nowrap;
  vertical-align: 1px;
}

/* ---------- 新记录高亮 ---------- */
@keyframes flash {
  0%   { background: rgba(79, 209, 255, .14); }
  100% { background: transparent; }
}
.feed li.item.fresh { animation: slideIn .42s cubic-bezier(.22,.9,.3,1) both, flash 2.4s ease-out; }

/* ---------- 时间范围切换 ---------- */
.range-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--panel-line);
}
.range-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
  white-space: nowrap;
}
.range-tabs button:hover { color: var(--text); }
.range-tabs button.active {
  background: linear-gradient(135deg, rgba(79, 209, 255, .22), rgba(124, 140, 255, .22));
  color: var(--text);
  font-weight: 600;
}

/* ---------- 范围概览行 ---------- */
.scope-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 11px 2px 13px;
  font-size: 12px;
  color: var(--text-dim);
}
.scope-item b {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.scope-item.dim {
  color: var(--text-faint);
  margin-left: auto;
}

/* ---------- 加载更早 ---------- */
.more-wrap {
  padding: 6px 0 14px;
  text-align: center;
}
.more-btn {
  appearance: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--panel-line);
  border-radius: 9px;
  padding: 8px 20px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.more-btn:hover:not(:disabled) {
  background: rgba(79, 209, 255, .12);
  color: var(--text);
}
.more-btn:disabled { opacity: .5; cursor: default; }

/* ---------- 守听（BrandMeister 实时语音，浏览器直连） ---------- */

.panel-listen { padding: 10px 11px 11px; }
.listen-body { display: flex; flex-direction: column; gap: 8px; }

/* 一行：TS1 / TS2 / 其它通话组输入 / 收听（守听中换成停止） */
/* flex-wrap 只是兜底：≥360px 的手机都能排进一行，
   万一遇到极窄屏，宁可让按钮换行，也不要把字挤成一团 */
.listen-row { display: flex; align-items: stretch; gap: 5px; flex-wrap: wrap; }
/* hidden 属性必须能压过上面的 display:flex/inline-block，否则隐藏不了 */
.listen-go[hidden], .listen-input[hidden], .listen-pick[hidden] { display: none; }

.listen-pick {
  flex: 0 0 auto;                  /* 不参与伸缩：宽度由内容决定，绝不挤扁 */
  display: flex; align-items: center; gap: 5px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 12px; line-height: 1.15;
  white-space: nowrap;
  cursor: pointer; text-align: left;
  transition: border-color .18s ease, background .18s ease;
}
.listen-pick:hover { border-color: rgba(79, 209, 255, .5); background: rgba(79, 209, 255, .08); }
.listen-pick .lp-slot {
  flex: none; font-size: 9.5px; font-weight: 700; letter-spacing: .03em;
  padding: 2px 5px; border-radius: 6px;
  color: var(--accent); background: rgba(79, 209, 255, .14);
}
.listen-pick .lp-tg { flex: 1 1 auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.listen-pick .lp-wave { flex: none; display: none; align-items: flex-end; gap: 2px; height: 10px; }
.listen-pick .lp-wave i {
  width: 2px; height: 3px; border-radius: 1px; background: var(--accent-3);
  animation: lpWave .9s ease-in-out infinite;
}
.listen-pick .lp-wave i:nth-child(2) { animation-delay: .15s; }
.listen-pick .lp-wave i:nth-child(3) { animation-delay: .3s; }
@keyframes lpWave {
  0%, 100% { height: 3px; }
  50%      { height: 10px; }
}

/* 正在播放的那一个 */
.listen-pick.on {
  border-color: var(--accent-3);
  background: rgba(52, 230, 176, .12);
}
.listen-pick.on .lp-slot { color: var(--accent-3); background: rgba(52, 230, 176, .16); }
.listen-pick.on .lp-wave { display: flex; }

/* 收听 / 停止：同一格互斥显示 */
.listen-go {
  flex: none; padding: 7px 11px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 12.5px; white-space: nowrap; cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.listen-go:hover:not(:disabled) { border-color: rgba(79, 209, 255, .5); color: var(--text); }
.listen-go:disabled { opacity: .45; cursor: default; }
/* 停止：收听中才出现，用暖色区分 */
.listen-stop { color: #ff8b8b; border-color: rgba(255, 107, 107, .32); background: rgba(255, 107, 107, .1); }
.listen-stop:hover:not(:disabled) { border-color: rgba(255, 107, 107, .6); color: #ff8b8b; }

/* 自定义通话组：与 TS1/TS2 同一行，靠 flex 抢占剩余宽度 */
.listen-input {
  flex: 1 1 46px; min-width: 46px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 12.5px; font-family: inherit;
  outline: none;
  transition: border-color .18s ease;
}
/* 隐藏数字输入框的上下小箭头，窄行里更干净 */
.listen-input::-webkit-outer-spin-button,
.listen-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.listen-input { -moz-appearance: textfield; }
.listen-input::placeholder { color: var(--text-faint); font-size: 11.5px; }
.listen-input:focus { border-color: rgba(79, 209, 255, .55); }

/* 状态行：状态 / 当前通话组 / 说话人 */
/* 状态行与电平条都压到最紧 */
.listen-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.ls-pill {
  flex: none; padding: 2px 8px; border-radius: 9px;
  font-size: 11px; font-weight: 600;
  color: var(--text-faint); background: rgba(255, 255, 255, .06);
  transition: color .18s ease, background .18s ease;
}
.ls-pill.wait { color: var(--warn);   background: rgba(255, 179, 71, .14); }
.ls-pill.ok   { color: var(--accent-3); background: rgba(52, 230, 176, .14); }
.ls-pill.bad  { color: #ff6b6b;         background: rgba(255, 107, 107, .14); }
.ls-tg   { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.ls-talk { color: var(--text-dim); }
.ls-talk:empty { display: none; }

/* 屏幕常亮按钮：基础外观（字体大小 / 内边距 / 边框 / 圆角 / 配色 / hover）
   全部直接复用「收听」按钮的 .listen-go —— HTML 上同时挂两个 class，
   这里只补 flex 布局（图标+文字）与激活态，保证画面完全统一。
   窄屏那份 .listen-go 的压缩（padding 6px 9px / font-size 12px）也自动跟着生效。 */
.wake-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: auto;             /* 贴到「未收听」状态行的最末尾 */
}
.wake-btn.on {
  color: var(--accent-3);
  border-color: rgba(52, 230, 176, .45);
  background: rgba(52, 230, 176, .10);
}
.wake-hint { margin-top: 6px; font-size: 11.5px; line-height: 1.5; color: var(--warn); }

/* 电平条 */
.listen-meter {
  height: 5px; border-radius: 3px; overflow: hidden;
  background: rgba(255, 255, 255, .06);
}
.lm-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-3), var(--warn));
  transition: width .07s linear;
}

/* 音量 */
.listen-vol { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.listen-vol .lv-key { flex: none; color: var(--text-faint); }
.listen-vol .lv-val {
  flex: none; width: 38px; text-align: right;
  color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.listen-vol input[type=range] { flex: 1 1 auto; min-width: 0; height: 18px; accent-color: var(--accent); }

/* ---------- 窄屏 ---------- */
@media (max-width: 420px) {
  main { padding: 10px 10px 16px; padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 10px 13px 9px; }
  .brand-title { font-size: 15.5px; }
  .brand-host { font-size: 9.5px; }
  /* 行2 在窄屏可以换行，保证 TS1/TS2 不被挤掉 */
  .brand-line2 { font-size: 11px; gap: 5px; margin-top: 5px; }
  .ts-group { gap: 9px; }
  .ts-val { font-size: 11px; }
  .panel { padding: 10px 11px 3px; margin-bottom: 8px; }
  .stat-row { gap: 7px; margin-bottom: 8px; }
  .stat { padding: 7px 5px 6px; }
  .stat-num { font-size: 18px; }
  .stat-label { font-size: 10px; }
  .item-row1 .cs { font-size: 15px; }
  .item-side .when { font-size: 11px; }
  /* 窄屏精简：隐藏通话组名称与相对时间，保证两行完整显示 */
  .item-row1 .s-tgname { display: none; }
  .item-side .ago { display: none; }
  .item-row2 { font-size: 11px; gap: 6px; }
  .feed li.item { padding: 5px 9px 5px 10px; gap: 8px; margin-bottom: 4px; }
  /* 说明页窄屏：比通用档再压一档，保证一屏能读完 */
  #board-info .panel { padding: 6px 9px 2px; margin-bottom: 5px; }
  #board-info .panel-head { padding-bottom: 2px; }
  #board-info .info-body { font-size: 11px; line-height: 1.38; padding: 3px 2px 2px; }
  #board-info .info-term { padding: 2.5px 0; gap: 0 6px; }
  #board-info .info-term .it-key,
  #board-info .info-term .it-val { font-size: 11px; line-height: 1.38; }
  #board-info .info-since { font-size: 11px; padding: 4px 7px; margin-top: 2px; }
  #board-info .info-note { font-size: 10px; margin-top: 2px; }
  .panel-head { flex-wrap: wrap; row-gap: 6px; }
  .head-right { width: 100%; justify-content: space-between; }
  .range-tabs button { padding: 5px 7px; font-size: 11px; }
  .scope-item.dim { margin-left: 0; }
  /* 守听：TS1 / TS2 / 输入框 / 按钮坚持同一行，窄屏只把内边距再压一点 */
  .panel-listen { padding: 9px 10px 10px; }
  .listen-row { gap: 4px; }
  .listen-pick { padding: 6px 7px; font-size: 11.5px; gap: 4px; }
  .listen-pick .lp-tg { font-size: 12px; }
  .listen-input { padding: 6px 7px; font-size: 12px; }
  .listen-input::placeholder { font-size: 11px; }
  .listen-go { padding: 6px 9px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .dot.on { animation: none; }
  .feed li.item, .feed li.item.fresh, .feed li.item.is-live { animation: none; }
  .listen-pick .lp-wave i { animation: none; height: 7px; }
}

/* ---------- 统计页 ---------- */
.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;             /* 日期再长也不许把区间按钮挤到下一行 */
  margin-bottom: 8px;
}
.stats-scope {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-dim);
  min-width: 0;                  /* 允许收缩：日期过长时自己省略，按钮不动 */
  flex: 1 1 auto;
}
.stats-scope .ss-emoji { font-size: 14px; flex: none; }
.stats-scope .ss-text { color: var(--text-faint); letter-spacing: .03em; flex: none; }
.stats-scope .ss-val {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
#range-tabs { flex: none; }

/* 群组切换行：TG 46020 / TG 45401 */
.stats-tg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.stats-tg-row .tg-row-label {
  font-size: 12.5px;
  color: var(--text-faint);
  letter-spacing: .03em;
  flex: none;
}
.stats-tg-row .range-tabs { flex: none; }

/* 指标行：一行四项，紧凑不占地方 */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 9px;
}
.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px 5px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  text-align: center;
  min-width: 0;
}
.metric-num {
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-label {
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: .04em;
  line-height: 1.2;
  white-space: nowrap;
}
.metric-short .metric-num { color: var(--warn); }

/* 两个排行左右并排：每行两行式（呼号占满整列，次数·时长下移为副行），呼号不再被截断 */
.rank-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.rank-grid .panel { margin-bottom: 0; padding: 9px 10px 4px; }
.rank-grid .panel-head { padding-bottom: 4px; }
.rank-grid .panel-head h2 { font-size: 12.5px; }
.rank-grid .panel-head h2 .panel-sub { font-weight: 400; font-size: 11px; }
.rank-grid .rank li.row {
  grid-template-columns: 20px 1fr;
  gap: 6px;
  padding: 6px 1px;
}
.rank-grid .idx { font-size: 11px; }
.rank-grid .row-title { font-size: 12.5px; }
.rank-grid .row-sub { font-size: 10px; }

/* 矮屏再压一档，保证统计页尽量一屏读完 */
@media (max-height: 760px) {
  .stats-head { margin-bottom: 6px; }
  .stats-tg-row { margin-bottom: 7px; }
  .metric-grid { gap: 5px; margin-bottom: 7px; }
  .metric { padding: 5px 2px 4px; }
  .rank li.row { padding: 5px 2px; }
  .rank-grid .rank li.row { padding: 4px 1px; }
}
@media (max-width: 420px) {
  .stats-head { gap: 6px; }
  .metric-num { font-size: 12px; }
  .metric-label { font-size: 9px; }
  .rank-grid { gap: 7px; }
  .rank-grid .row-title { font-size: 12px; }
  .rank-grid .row-sub { font-size: 9.5px; }
  .rank-grid .panel-head h2 { font-size: 12px; }
}

/* ============================================================
   自适应增强：呼号 / 次数 / 时长随屏宽缩放
   目标 —— 手机上不再是一团看不清的小字，统计页尽量一屏读完。
   做法：关键字号改用 clamp()，行高随屏压缩，两个排行榜始终并排
   （改成上下堆叠会多出 10 行，反而读不完）。
   放在文件末尾，覆盖上面窄屏档里偏小的固定字号。
   ============================================================ */

/* 排行行：序号列和间距一起收窄，把宽度让给呼号 */
.rank li.row {
  grid-template-columns: clamp(18px, 3.6vw, 30px) 1fr auto;
  gap: clamp(5px, 1.1vw, 8px);
  padding: clamp(4px, 1vw, 7px) 2px;
}
.rank-grid .rank li.row {
  grid-template-columns: clamp(18px, 3.2vw, 20px) 1fr;
  gap: clamp(4px, 1vw, 6px);
  padding: clamp(3px, 0.9vw, 6px) 1px;
}
.idx { font-size: clamp(11px, 2.6vw, 12.5px); }
.rank-grid .idx { font-size: clamp(10.5px, 2.4vw, 11px); }

/* 呼号：小屏也能完整显示，不再被挤成省略号 */
.row-title { font-size: clamp(13.5px, 3.3vw, 15px); }
.rank-grid .row-title { font-size: clamp(13.5px, 3.3vw, 14.5px); }

/* 次数 · 时长：原先窄屏只有 9.5px，这里统一抬到可读区间 */
.row-sub { font-size: clamp(11.5px, 2.8vw, 12.5px); }
.rank-grid .row-sub { font-size: clamp(11.5px, 2.8vw, 12px); }

/* 顶部指标行 */
.metric-num { font-size: clamp(15px, 4.2vw, 19px); }
.metric-label { font-size: clamp(10px, 2.5vw, 11px); }
.metric { padding: clamp(5px, 1.2vw, 8px) 2px clamp(4px, 1vw, 6px); }

/* 手机竖屏（<=600px）：整体收紧，两个排行仍并排以保住一屏 */
@media (max-width: 600px) {
  .rank-grid { gap: 6px; }
  .rank-grid .panel { padding: 7px 7px 3px; }
  .rank-grid .panel-head h2 { font-size: 11.5px; }
  .metric-grid { gap: 4px; margin-bottom: 6px; }
  .stats-head { margin-bottom: 6px; }
  .stats-tg-row { margin-bottom: 6px; }
}

/* 平板（601~1024px）：字号取中间档，间距放宽 */
@media (min-width: 601px) and (max-width: 1024px) {
  .rank-grid { gap: 10px; }
  .rank-grid .panel { padding: 10px 12px 5px; }
  .metric-num { font-size: clamp(17px, 2.6vw, 22px); }
  .row-title { font-size: clamp(14px, 2vw, 16px); }
  .rank-grid .row-title { font-size: clamp(14px, 2vw, 15px); }
  .row-sub { font-size: clamp(11.5px, 1.7vw, 13px); }
  .rank-grid .row-sub { font-size: clamp(11.5px, 1.7vw, 12.5px); }
}

/* 桌面（>=1025px）：恢复宽松排版 */
@media (min-width: 1025px) {
  .rank li.row { padding: 7px 2px; }
  .rank-grid .rank li.row { padding: 6px 1px; }
  .metric-num { font-size: 19px; }
  .metric-label { font-size: 10.5px; }
}

/* 矮屏（横放的手机 / 小窗）：再压一档行高，尽量一屏读完 */
@media (max-height: 700px) {
  .rank-grid .rank li.row { padding: 2px 1px; }
  .metric { padding: 4px 2px 3px; }
  .stats-head { margin-bottom: 5px; }
  .stats-tg-row { margin-bottom: 5px; }
}
