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

:root {
  --freq-bar: 44px;
  --freq-gut: 16px;
  --freq-nav: 58px;
  --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) + 16px + 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) + env(safe-area-inset-bottom, 0px));
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  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;
}
