/* =========================================================
   玄机测算 · 全局基础样式
   设计基准：375px 宽，1rem = 16px
   ========================================================= */
:root {
  --bg: #ededed;
  --bg-soft: #f5f1e9;
  --card: #ffffff;
  --ink: #2f2a26;
  --ink-2: #6f6a64;
  --ink-3: #a9a29a;
  --gold: #e4ab64;
  --gold-light: #f1bc7b;
  --gold-deep: #c98f45;
  --gold-pale: #f7e7ce;
  --red: #ff4a3d;
  --red-deep: #c81e2b;
  --red-dark: #8f1420;
  --cta-1: #ff4200;
  --cta-2: #ff6c2b;
  --shadow-card: 0 0.125rem 0.75rem rgba(203, 176, 110, 0.35);
  --shadow-soft: 0 0.25rem 1rem rgba(47, 42, 38, 0.06);
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --tabbar-h: 3.75rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "微软雅黑", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  margin: 0;
  background: #d9d6cf;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

ul, ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  border: 0;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

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

/* ---------- 画布 / 页面 ---------- */
.app {
  position: relative;
  width: 100%;
  max-width: 30rem;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: hidden;
  box-shadow: 0 0 2rem rgba(0, 0, 0, 0.08);
}

.page {
  position: relative;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1rem);
}

.page--plain {
  padding-bottom: calc(4.5rem + var(--safe-bottom));
}

.page-enter {
  animation: pageEnter 0.28s ease-out both;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(0.375rem); }
  to { opacity: 1; transform: translateY(0); }
}

.page-inner {
  padding: 0.9375rem;
}

/* ---------- 顶部品牌栏 ---------- */
.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3rem;
  padding: 0 0.9375rem;
}

.brandbar__logo {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #3a2d20;
}

.brandbar__logo i {
  display: inline-flex;
  width: 1.375rem;
  height: 1.375rem;
}

.brandbar__link {
  font-size: 0.75rem;
  color: var(--ink-2);
}

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.section {
  margin-top: 0.9375rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.625rem;
}

.section-head__title {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: #3a2d20;
}

.section-head__title::before {
  content: "";
  width: 0.1875rem;
  height: 0.875rem;
  border-radius: 0.1875rem;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-deep));
}

.section-head__more {
  font-size: 0.75rem;
  color: var(--ink-3);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 2.5rem;
  padding: 0 1.25rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:active {
  transform: scale(0.97);
  filter: brightness(0.97);
}

.btn-cta {
  color: #fff;
  background: linear-gradient(135deg, var(--cta-1), var(--cta-2));
  box-shadow: 0 0.25rem 0 #d63a00, 0 0.375rem 0.75rem rgba(255, 70, 5, 0.28);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.btn-gold {
  color: #cd560d;
  background: linear-gradient(0deg, #ecc081, #f7e7ce);
  box-shadow: 0 0.1875rem 0 #e68900;
}

.btn-ghost {
  color: var(--gold-deep);
  border: 1px solid rgba(201, 143, 69, 0.5);
  background: rgba(255, 255, 255, 0.6);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-sm {
  height: 2rem;
  padding: 0 0.875rem;
  font-size: 0.8125rem;
}

.btn-lg {
  height: 2.875rem;
  font-size: 1rem;
}

.btn-pulse {
  animation: breathe 1.5s ease-in-out infinite;
}

/* ---------- 标签 / 徽章 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 1.125rem;
  padding: 0 0.375rem;
  border-radius: 0.5625rem;
  font-size: 0.625rem;
  font-weight: 700;
  color: #8a4a12;
  background: linear-gradient(90deg, #ffe6bf, #f7cf95);
}

.tag--red {
  color: #fff;
  background: linear-gradient(90deg, #ff7a45, #ff4200);
}

/* ---------- 底部 Tab 栏 ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 30rem;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 1.875rem var(--safe-bottom);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #eeeeee;
  border-radius: 1.5625rem 1.5625rem 0 0;
  box-shadow: 0 -0.25rem 1rem rgba(47, 42, 38, 0.05);
  transform: translateX(-50%);
  backdrop-filter: blur(0.5rem);
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1875rem;
  min-width: 3.5rem;
  padding: 0 0.625rem;
  color: #9b958d;
  font-size: 0.6875rem;
}

.tabbar__item svg {
  width: 1.375rem;
  height: 1.375rem;
}

.tabbar__item.is-active {
  color: var(--gold-deep);
  font-weight: 700;
}

.tabbar__item.is-active svg {
  filter: drop-shadow(0 0.125rem 0.25rem rgba(228, 171, 100, 0.45));
}

/* ---------- 悬浮领券 ---------- */
.float-red {
  position: fixed;
  top: 40%;
  right: -0.625rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 3.28125rem;
  padding: 0.625rem 0.25rem;
  border: 1px solid rgba(255, 222, 168, 0.75);
  border-radius: 0.75rem 0 0 0.75rem;
  color: #ffe9c2;
  background: linear-gradient(180deg, #e23a2e, #b31422);
  box-shadow: 0 0.375rem 1rem rgba(143, 20, 32, 0.35);
  transition: right 0.2s linear, opacity 0.2s linear;
}

.float-red span {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
}

.float-red.is-mini {
  right: -1.5625rem;
  opacity: 0.4;
}

/* ---------- 吸底优惠条 ---------- */
.time-bar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  z-index: 25;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: 100%;
  max-width: 30rem;
  height: 2.75rem;
  color: #f3d8b1;
  font-size: 0.8125rem;
  background: #f35e4c;
  transform: translateX(-50%);
}

.time-bar.is-show {
  display: flex;
}

.time-bar b {
  font-size: 1.125rem;
  color: #fff7e6;
}

.time-bar .timer span {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0 0.1875rem;
  border-radius: 0.3125rem;
  background: #ad0000;
  box-shadow: inset 0 -2px 0.25rem rgba(152, 0, 0, 0.5);
  font-size: 0.75rem;
  line-height: 1.5rem;
  text-align: center;
}

/* ---------- 遮罩 / 弹层 ---------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mask.is-open {
  opacity: 1;
  visibility: visible;
}

.mask--bottom {
  align-items: flex-end;
  padding: 0;
}

.sheet {
  width: 100%;
  max-width: 30rem;
  padding: 1.25rem 1.25rem calc(1.25rem + var(--safe-bottom));
  border-radius: 1.25rem 1.25rem 0 0;
  background: #fff;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mask.is-open .sheet {
  transform: translateY(0);
}

.sheet__grab {
  width: 2.25rem;
  height: 0.25rem;
  margin: 0 auto 1rem;
  border-radius: 999px;
  background: #e6e2da;
}

.sheet__title {
  margin-bottom: 1rem;
  font-size: 1.0625rem;
  font-weight: 700;
  text-align: center;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  top: 45%;
  z-index: 90;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.toast {
  max-width: 15rem;
  margin: 0 auto 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  color: #fff;
  font-size: 0.8125rem;
  text-align: center;
  background: rgba(30, 24, 20, 0.86);
  opacity: 0;
  transform: translateY(0.5rem);
  animation: toastIn 0.2s ease-out forwards;
}

.toast.is-out {
  animation: toastOut 0.2s ease-in forwards;
}

/* ---------- 表单 ---------- */
.field {
  margin-bottom: 0.875rem;
}

.field__label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.field__label em {
  color: var(--red);
  font-style: normal;
}

.input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  border: 1px solid #e8e2d8;
  border-radius: 0.625rem;
  background: #faf8f4;
  outline: none;
  font-size: 0.9375rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 0.1875rem rgba(228, 171, 100, 0.16);
}

.input::placeholder {
  color: #bdb6ac;
}

.radio-pills {
  display: flex;
  gap: 0.5rem;
}

.radio-pills button {
  flex: 1;
  height: 2.75rem;
  border: 1px solid #e8e2d8;
  border-radius: 0.625rem;
  background: #faf8f4;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.radio-pills button.is-active {
  border-color: var(--gold);
  color: #8a4a12;
  background: #fff4e2;
  font-weight: 700;
}

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--ink-3);
  line-height: 1.5;
}

.checkline input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.0625rem;
  accent-color: var(--gold-deep);
}

/* ---------- 价格 ---------- */
.price {
  display: inline-flex;
  align-items: baseline;
  gap: 0.125rem;
  color: var(--red);
  font-weight: 800;
}

.price i {
  font-style: normal;
  font-size: 0.875rem;
}

.price b {
  font-size: 1.5rem;
  font-family: "DIN Alternate", "Helvetica Neue", sans-serif;
}

.price s {
  margin-left: 0.25rem;
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 400;
}

/* ---------- 空状态 ---------- */
.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.empty svg {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 0.75rem;
  opacity: 0.5;
}

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-8 { margin-top: 0.5rem; }
.mt-12 { margin-top: 0.75rem; }
.mt-16 { margin-top: 1rem; }
.mb-8 { margin-bottom: 0.5rem; }
.mb-12 { margin-bottom: 0.75rem; }
.text-gold { color: var(--gold-deep); }
.text-muted { color: var(--ink-3); }
.text-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;
}

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