/* ===========================================================
   每日饮食选择转盘 — 主题样式
   设计要点：奶油米色背景 / 深墨绿 + 番茄红 + 芥末黄点缀
   衬线标题 + 中文正文 + 数字，温暖杂志感
   =========================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 颜色 */
  --bg: #f5efe6;            /* 奶油米色 */
  --bg-2: #efe6d6;          /* 稍深底色 */
  --paper: #faf7f2;         /* 卡片纸白 */
  --ink: #2f4a3a;           /* 深墨绿（主文字 / 描边） */
  --ink-soft: #4d6655;      /* 墨绿次级 */
  --muted: #8a8378;         /* 灰文字 */
  --line: rgba(47, 74, 58, 0.18);

  --accent: #c8553d;        /* 番茄红（强调 / 指针） */
  --accent-deep: #a83f2b;
  --gold: #e0a458;          /* 芥末黄 */
  --olive: #7a8b5c;         /* 橄榄绿 */
  --mint: #8ab0a2;          /* 薄荷青 */
  --char: #5b5b5b;          /* 炭灰 */

  /* 类别色（与 JS 中 CONFIG.categories 对应） */
  --c-staple: #e0a458;
  --c-fast:   #c8553d;
  --c-snack:  #7a8b5c;
  --c-light:  #8ab0a2;
  --c-skip:   #5b5b5b;

  /* 字体 */
  --font-display: "Fraunces", "Songti SC", "STSong", "SimSun", serif;
  --font-body: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-num: "Inter", "Noto Sans SC", sans-serif;

  /* 尺寸 */
  --wheel-size: min(88vw, 520px);
  --radius-card: 22px;
  --radius-pill: 999px;

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(47, 74, 58, 0.08);
  --shadow-md: 0 10px 30px rgba(47, 74, 58, 0.12);
  --shadow-lg: 0 30px 80px rgba(47, 74, 58, 0.18);
}

/* ---------- 2. 基础重置 ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  /* 背景叠加：径向暖光 + 纸纹感 */
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(224, 164, 88, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 100%, rgba(138, 176, 162, 0.18), transparent 60%),
    var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* 噪点纹理（轻微纸感） */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.29  0 0 0 0 0.23  0 0 0 0.22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- 3. 容器布局 ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 32px) 60px;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 4vw, 36px);
}

/* ---------- 4. 顶部品牌 ---------- */
.hero {
  text-align: center;
  padding-top: 8px;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
}

.hero__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(200, 85, 61, 0.18);
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(40px, 9vw, 72px);
  line-height: 1.05;
  margin: 18px 0 6px;
  letter-spacing: 0.02em;
  font-variation-settings: "opsz" 100, "SOFT" 30;
  color: var(--ink);
  /* 入场动画初值（anime.js 接管） */
  opacity: 0;
  transform: translateY(8px);
}

.hero__subtitle {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 14px;
}

.hero__subtitle span:first-child {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--ink);
}

.hero__subtitle-cn {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.hero__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.badge--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 12px;
}
.badge__num { font-weight: 600; }
.badge__sep { opacity: 0.5; }
.badge__label { margin-left: 4px; opacity: 0.85; }

/* ---------- 5. 转盘舞台 ---------- */
.wheel-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 6px 0 0;
}

.wheel-stage__halo {
  position: absolute;
  inset: -30px -10px;
  background:
    radial-gradient(closest-side, rgba(224, 164, 88, 0.32), transparent 70%);
  filter: blur(20px);
  z-index: 0;
  pointer-events: none;
}

.pointer {
  position: relative;
  z-index: 3;
  margin-bottom: -18px;
  filter: drop-shadow(0 4px 6px rgba(200, 85, 61, 0.35));
  transform-origin: 50% 0%;
}
.pointer svg { display: block; }

.wheel-wrapper {
  position: relative;
  width: var(--wheel-size);
  height: var(--wheel-size);
  z-index: 1;
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
  /* anime.js 接管 rotate/transform */
  transform-origin: 50% 50%;
  filter: drop-shadow(0 24px 40px rgba(47, 74, 58, 0.22));
  will-change: transform;
}

/* 中心 START 按钮 */
.spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--paper);
  background:
    radial-gradient(circle at 30% 25%, #4a6a55 0%, var(--ink) 60%);
  box-shadow:
    0 6px 14px rgba(47, 74, 58, 0.4),
    inset 0 -4px 8px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 2;
}
.spin-btn::before {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 1.5px dashed rgba(245, 239, 230, 0.45);
  pointer-events: none;
}
.spin-btn:hover { transform: translate(-50%, -50%) scale(1.04); }
.spin-btn:active { transform: translate(-50%, -50%) scale(0.96); }
.spin-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }

.spin-btn__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1;
}
.spin-btn__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(14px, 2.2vw, 20px);
  letter-spacing: 0.14em;
}
.spin-btn__sub {
  font-size: 11px;
  letter-spacing: 0.3em;
  opacity: 0.85;
}

.hint {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-align: center;
}

/* ---------- 6. 类别标签 ---------- */
.categories {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.categories__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.chip__dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.chip--staple .chip__dot { background: var(--c-staple); }
.chip--fast   .chip__dot { background: var(--c-fast); }
.chip--snack  .chip__dot { background: var(--c-snack); }
.chip--light  .chip__dot { background: var(--c-light); }
.chip--skip   .chip__dot { background: var(--c-skip); }
.chip--active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.chip--active .chip__dot { box-shadow: 0 0 0 2px var(--paper); }

.categories__note {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---------- 7. 底部说明 ---------- */
.foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
}
.foot__row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.foot__key {
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.05em;
}
.foot__val {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ---------- 8. 转盘扇形（由 SVG 注入，这里只设文字样式） ---------- */
.wedge-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.18);
  stroke-width: 0.6;
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
}
.wedge-emoji {
  font-size: 18px;
  pointer-events: none;
  user-select: none;
}

/* ---------- 9. 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.modal.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.2s ease, visibility 0s linear 0s;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 33, 0.45);
  backdrop-filter: blur(6px);
}
.modal__card {
  position: relative;
  width: min(92vw, 360px);
  background: var(--paper);
  border-radius: var(--radius-card);
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  transform: translateY(20px) scale(0.94);
  opacity: 0;
}
.modal.is-open .modal__card {
  animation: modalIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes modalIn {
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal__cat {
  display: inline-block;
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}
.modal__emoji {
  font-size: 64px;
  line-height: 1;
  margin: 4px 0 10px;
  filter: drop-shadow(0 6px 10px rgba(47, 74, 58, 0.15));
}
.modal__name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.modal__quote {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 22px;
  line-height: 1.6;
}
.modal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  min-width: 110px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: rgba(47, 74, 58, 0.06); }
.btn--primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 4px 10px rgba(47, 74, 58, 0.3);
}
.btn--primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 6px 14px rgba(200, 85, 61, 0.4);
}

/* ---------- 10. Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 30px);
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  letter-spacing: 0.06em;
}
.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 11. 响应式 ---------- */
@media (min-width: 768px) {
  .app { padding: 48px 32px 80px; }
  .wheel-wrapper { width: min(60vw, 480px); height: min(60vw, 480px); }
  .hero__title { font-size: 76px; }
}
@media (min-width: 1024px) {
  .app { max-width: 880px; }
  .wheel-wrapper { width: 520px; height: 520px; }
  .foot { grid-template-columns: repeat(3, 1fr); padding: 18px 24px; }
}
@media (max-width: 360px) {
  .hero__title { font-size: 38px; }
  .spin-btn__sub { display: none; }
  .modal__name { font-size: 26px; }
}

/* ---------- 12. 减弱动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
