/* 频率 App · 手机适配样式
   原则：只覆盖桌面外壳，不改动设计内部样式；不用内容探测，不堆 !important。
   结构：1 视口与安全区 2 顶部黑条 3 主体容器 4 滚动区 5 底部导航
        6 解析页（黑底）7 解析浮层 8 触控与排版 */

:root {
  --freq-bar: 44px;
  --freq-gut: 16px;
  --freq-nav: 44px;
  --freq-ink: #08080a;
  --freq-paper: #ffffff;
  --freq-deep: #0b0b0c;
}

/* 1 视口与安全区 */
html,
body {
  height: 100dvh;
  margin: 0;
  background: var(--freq-ink);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

/* 2 顶部黑条 */
.top-studio-bar {
  background: var(--freq-ink);
  box-sizing: border-box;
  height: calc(var(--freq-bar) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--freq-gut) 0;
  display: flex;
  align-items: center;
  border-bottom: 0;
}

.top-studio-bar,
.top-studio-bar * {
  color: #f2f3f5;
}

.top-studio-bar svg,
.top-studio-bar svg * {
  fill: #f2f3f5;
  opacity: 1;
}

.studio-actions {
  display: none;
}

/* 3 主体容器 */
.stage-shell {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: calc(var(--freq-bar) + env(safe-area-inset-top, 0px));
  background: var(--freq-ink);
  padding: 0;
  display: block;
  overflow: hidden;
}

.phone-unit {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--freq-paper);
}

aside.desk-companion {
  display: none;
}

/* 4 滚动区 */
.scroll-area {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--freq-nav) + 6px + env(safe-area-inset-bottom, 0px));
  scrollbar-width: none;
}

.scroll-area::-webkit-scrollbar {
  display: none;
  width: 0;
}

/* 5 底部导航 */
.nav-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--freq-nav) + 18px + env(safe-area-inset-bottom, 0px));
  padding: 0;
  background: var(--freq-ink);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 60;
}

.nav-dock > * {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  font-size: 11px;
}

.nav-dock > *:nth-child(n + 4) {
  display: none;
}

/* 6 解析页：固定黑底，不依赖任何运行时判断 */
.detail-body,
.detail-body .view-pad {
  background: var(--freq-deep);
}

.detail-body h1,
.detail-body h2,
.detail-body h3 {
  color: #f2f3f5;
}

/* 7 解析浮层（点「展开信号解析」） */
body.decode-open {
  overflow: hidden;
}

body.decode-open aside.desk-companion {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 900;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--freq-deep);
  padding: calc(52px + env(safe-area-inset-top, 0px)) 0
    calc(40px + env(safe-area-inset-bottom, 0px));
}

#decode-close {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 901;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font: 20px/1 -apple-system, sans-serif;
  display: none;
  align-items: center;
  justify-content: center;
}

body.decode-open #decode-close {
  display: flex;
}

/* 8 触控与排版 */
.nav-dock > *,
.card-cta-bar,
button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.m-title {
  line-height: 1.36;
}

/* 打赏：顶部按钮 + 全屏浮层 */
#tip-open{margin-left:auto;height:28px;padding:0 12px;border-radius:14px;border:1px solid rgba(212,255,0,.55);background:transparent;color:#D4FF00;font-size:11px;letter-spacing:.08em}
#tip-sheet{position:fixed;inset:0;z-index:950;display:none;flex-direction:column;align-items:center;justify-content:center;gap:18px;background:rgba(8,8,10,.97);padding:calc(28px + env(safe-area-inset-top,0px)) 24px calc(28px + env(safe-area-inset-bottom,0px))}
body.tip-open #tip-sheet{display:flex}
body.tip-open{overflow:hidden}
#tip-sheet .tip-title{color:#F2F3F5;font-size:17px;font-weight:600;letter-spacing:.02em}
#tip-sheet .tip-copy{color:#9AA0A6;font-size:13px;line-height:1.7;text-align:center;max-width:280px}
#tip-sheet img{width:220px;height:220px;object-fit:contain;border-radius:12px;background:#fff;padding:8px}
#tip-sheet .tip-hint{color:#6B7076;font-size:11px;letter-spacing:.06em}
#tip-close{position:absolute;top:calc(14px + env(safe-area-inset-top,0px));right:16px;width:36px;height:36px;border-radius:50%;border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.1);color:#fff;font-size:19px;line-height:1}

/* 解析页：底部只留一条呼吸缝，不再出现大片黑底空白 */
.detail-body { padding-bottom: 8px; }
.scroll-area:has(.detail-body) { padding-bottom: calc(var(--freq-nav) + 18px + env(safe-area-inset-bottom, 0px)); }
