/* ===================================================
   山下大白菜 · 设计系统 Design Tokens
   暖色促销 / 移动优先 / 无外链依赖
   =================================================== */

:root {
  /* 品牌色 */
  --brand-50: #FFF2ED;
  --brand-100: #FFE1D6;
  --brand-200: #FFC4B0;
  --brand-500: #E8452C;
  --brand-600: #C9341E;
  --brand-700: #A22712;

  /* 强调色（券、徽标、评分） */
  --gold-50: #FFF7E8;
  --gold-100: #FFEDC9;
  --gold-500: #F5A524;
  --gold-600: #C97F0D;

  /* 语义色 */
  --ok-50: #EAF7EF;
  --ok-600: #12A150;
  --warn-50: #FFF6E5;
  --warn-600: #B4690E;
  --danger-50: #FDECEA;
  --danger-600: #D92D20;

  /* 中性色 */
  --ink-900: #1F1A17;
  --ink-700: #3D342E;
  --ink-500: #7A6E67;
  --ink-400: #9C9089;
  --ink-300: #BEB3AC;
  --line: #F2E6DE;
  --line-strong: #E6D5CA;
  --surface: #FFFFFF;
  --surface-2: #FBF3ED;
  --surface-3: #F6EAE2;
  --bg: #FFF9F5;
  --desk-bg: #F3E9E1;

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* 阴影 */
  --sh-sm: 0 1px 2px rgba(31, 26, 23, .05);
  --sh-md: 0 6px 18px rgba(31, 26, 23, .07);
  --sh-lg: 0 14px 36px rgba(31, 26, 23, .10);
  --sh-bar: 0 -6px 20px rgba(31, 26, 23, .06);

  /* 尺寸 */
  --tap: 44px;
  --page-max: 480px;

  /* 动效 */
  --ease: cubic-bezier(.2, .7, .3, 1);
  --dur: 200ms;

  /* 字体：中文系统栈，不引外链 */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-num: "SF Pro Text", "DIN Alternate", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* hidden 必须压过组件自身的 display 声明 */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--desk-bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

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

.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;
}

/* ---------- 通用组件 ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--tap); padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), transform 120ms var(--ease);
  user-select: none;
}
.btn:active { transform: scale(.985); }

.btn-primary {
  background: var(--brand-500); color: #fff;
  box-shadow: 0 6px 16px rgba(232, 69, 44, .24);
}
.btn-primary:hover { background: var(--brand-600); }

.btn-ghost {
  background: var(--surface); color: var(--ink-700);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { border-color: var(--brand-200); color: var(--brand-600); }

.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-700);
  font-size: 13px;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--brand-200); color: var(--brand-600); }
.chip[aria-pressed="true"] {
  background: var(--brand-500); border-color: var(--brand-500);
  color: #fff; font-weight: 600;
}

.tag {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--brand-50); color: var(--brand-600);
}
.tag-gold { background: var(--gold-50); color: var(--gold-600); }
.tag-ok { background: var(--ok-50); color: var(--ok-600); }
.tag-ghost { background: var(--surface-3); color: var(--ink-500); }

.price {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--brand-500);
  font-weight: 700;
  letter-spacing: -.02em;
}
.price .cur { font-size: .68em; margin-right: 1px; }
.price-old {
  font-family: var(--font-num);
  font-size: 12px; color: var(--ink-300);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-500);
}
.empty h3 { font-size: 15px; color: var(--ink-700); margin-bottom: 6px; }
.empty p { font-size: 13px; }

/* 品牌标识（两端共用） */
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.brand p { font-size: 11.5px; color: var(--ink-400); margin-top: 1px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand-500), var(--brand-700));
  color: #fff; font-size: 17px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(232, 69, 44, .26);
}

/* 图标按钮 */
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-700);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { border-color: var(--brand-200); color: var(--brand-600); }

/* 文字按钮 */
.text-btn { font-size: 13px; color: var(--ink-500); padding: 6px 2px; }
.text-btn:hover { color: var(--brand-600); }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px);
  padding: 9px 16px; border-radius: var(--r-pill);
  background: rgba(31, 26, 23, .9);
  color: #fff; font-size: 12.5px;
  opacity: 0; pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
  z-index: 60;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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