/* ============================================================
   base.css
   Reset、排版、通用布局
   ============================================================ */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-cn);
  font-size: var(--fs-normal);
  line-height: 1.5;
  /* 孩子会连点，禁用双击缩放，但保留双指缩放（无障碍） */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

#app {
  min-height: 100%;
  padding-bottom: var(--safe-b);
}

/* ---------- 排版 ---------- */
h1, h2, h3, h4 { margin: 0; font-weight: 700; }

.fs-hero   { font-size: var(--fs-hero); }
.fs-big    { font-size: var(--fs-big); }
.fs-title  { font-size: var(--fs-title); }
.fs-word   { font-size: var(--fs-word); font-family: var(--font-en); font-weight: 700; }
.fs-word-sm{ font-size: var(--fs-word-sm); font-family: var(--font-en); font-weight: 700; }
.fs-small  { font-size: var(--fs-small); }
.fs-tiny   { font-size: var(--fs-tiny); }

.en { font-family: var(--font-en); }

.text-light { color: var(--c-text-light); }
.text-green { color: var(--c-green); }
.text-red   { color: var(--c-red); }
.text-warn  { color: var(--c-warn); }
.text-center{ text-align: center; }

/* ---------- 布局工具 ---------- */
.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

.row       { display: flex; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.col       { display: flex; flex-direction: column; gap: var(--sp-2); }
.center    { display: flex; align-items: center; justify-content: center; }
.grow      { flex: 1; }
.hidden    { display: none !important; }
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-1 { margin-bottom: var(--sp-1); } .mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }

/* ---------- 输入框 ---------- */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font-family: inherit;
  /* 必须 ≥16px，否则 iOS 聚焦时会自动放大页面 */
  font-size: 17px;
  color: var(--c-text);
  background: var(--c-card);
  border: 2px solid var(--c-border);
  border-radius: var(--r-input);
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--c-hero);
}

input::placeholder { color: #9AAAB6; }

select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234A5A66' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* ---------- 滚动条（桌面端）---------- */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--c-border);
    border-radius: var(--r-pill);
  }
}

/* ---------- 动画 ---------- */
@keyframes pop {
  0%   { transform: scale(.96); opacity: .7; }
  100% { transform: scale(1);   opacity: 1; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-5px); }
  75%      { transform: translateX(5px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pop       { animation: pop .18s ease-out; }
.shake     { animation: shake .28s ease-in-out; }
.fade-up   { animation: fadeUp .22s ease-out; }

/* 尊重用户的「减少动效」偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 加载与空态 ---------- */
.loading {
  padding: var(--sp-6) 0;
  text-align: center;
  color: var(--c-text-light);
}

.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-hero);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--c-text-light);
  font-size: var(--fs-normal);
}
.empty-emoji { font-size: 46px; display: block; margin-bottom: var(--sp-3); }
