/* =====================================================================
   base.css — 重置 + 基础排版
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* hidden 属性靠的是浏览器默认样式里的 display:none，而默认样式的优先级
   比我们自己写的任何一条 display 都低 —— 只要某个 class 上写了
   display:flex（.field、.rec-cat 这些都写了），它就把 hidden 顶掉，
   元素明明标了 hidden 却还在页面上。这里补一条，让 hidden 真的能藏住。
   必须用 !important：base.css 比 components.css 先加载，同优先级下后者会赢。
   需要例外的地方用更高优先级的选择器 + !important 覆盖（见语音模型页的 noscript）。 */
[hidden] { display: none !important; }

/* ★ 手机上整页被"缩小 + 右边切掉"的根治办法。
   页面里有横滑的标签行（.filter-tabs、.area-quick-tabs 这些 overflow-x:auto 的），
   手机浏览器看到布局宽度超出屏幕，就会把【整个布局视口】放大来装 ——
   实测 390 的屏被放大到 545：整页缩水、右边看不见，而且用户自己调不回来。
   （这不是"横向滚动条"，页面其实滑不动，所以用 scrollWidth 那类办法根本测不出来。）
   html 和 body 两个都要写，只写一个不生效 —— 实测过。
   横滑行本身不受影响：它们的滚动发生在自己那一层。 */
html, body { overflow-x: hidden; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background .3s var(--ease), color .3s var(--ease);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }


button { font-family: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }

input, textarea, select { font-family: inherit; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent-soft); }

/* —— 页面进入：轻微淡入上移，让切页不生硬 —— */
@keyframes page-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}
.app-content { animation: page-in .18s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------
   手机上去掉毛玻璃（backdrop-filter）

   固定条（顶栏/底部导航/输入坞上沿）盖在一直滚动、一直打字的内容上，
   每一帧都要重新虚化一遍。iPhone 的 Safari 对这个明显吃力 —— 打字机
   一开就掉帧；安卓马力足看不出来。近实色背景视觉上几乎无差，滚动立刻顺。
   桌面端保留毛玻璃。
   --------------------------------------------------------------- */
@media (pointer: coarse) {
  .app-header-mobile, .bottom-nav, .wb-top, .paste-actions {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .app-header-mobile, .wb-top, .paste-actions { background: var(--bg); }
  .bottom-nav { background: var(--bg-elevated); }
}
