/* ==========================================================================
   base.css — 设计变量 / reset / 排版
   手机优先，向上适配平板与桌面
   ========================================================================== */

:root {
  /* 色板 */
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;

  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;

  /* 尺寸 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --tabbar-h: 60px;
  --topbar-h: 56px;
  --sidebar-w: 224px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .14);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-en: "SF Pro Display", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* hidden 属性优先于任何 display 设定，否则 .field{display:flex} 会盖掉它 */
[hidden] { display: none !important; }

html {
  /* 16px 起，低于此值 iOS 输入框会自动放大 */
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, h4, p, figure { margin: 0; }

h1 { font-size: clamp(1.35rem, 4.5vw, 1.75rem); line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: clamp(1.1rem, 3.6vw, 1.3rem); line-height: 1.35; font-weight: 650; }
h3 { font-size: 1rem; line-height: 1.4; font-weight: 600; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

/* 移动端：去掉点击高亮，自建按下态 */
* { -webkit-tap-highlight-color: transparent; }

:where(button, a, label, input, select, textarea):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: #bfdbfe; }

/* 滚动条（桌面） */
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 3px solid var(--bg); }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* 工具类 */
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-1 { gap: 6px; } .gap-2 { gap: 12px; } .gap-3 { gap: 20px; }
.grow { flex: 1; }
.hide { display: none !important; }

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

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
