/* ============================================================
   style.css — 今天吃什么？
   设计基调：温暖疗愈、圆润、毛玻璃、轻游戏感
   ============================================================ */

/* ---------- 设计 Token（浅色） ---------- */
:root {
  --bg-1: #FBF8F3;
  --bg-2: #F3ECDD;
  --bg-3: #FDEFE4;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-strong: rgba(255, 255, 255, 0.85);
  --surface-border: rgba(255, 255, 255, 0.55);
  --text: #2B2A28;
  --text-soft: #726E66;
  --text-faint: #A29C90;

  --primary: #FF8C42;
  --primary-dark: #E8722B;
  --primary-soft: #FFD9B3;
  --secondary: #2EC4B6;
  --accent-yellow: #FFC93C;

  --c-china: #F25C54;
  --c-west: #4C6EF5;
  --c-malay: #2EC4B6;
  --c-japan: #F2668B;
  --c-korea: #9B5DE5;

  --shadow-sm: 0 2px 10px rgba(60, 45, 20, 0.08);
  --shadow-md: 0 10px 30px rgba(60, 45, 20, 0.12);
  --shadow-lg: 0 20px 60px rgba(60, 45, 20, 0.18);
  --glow-primary: 0 0 0 rgba(255, 140, 66, 0);

  --radius-s: 14px;
  --radius-m: 22px;
  --radius-l: 32px;
  --radius-pill: 999px;

  --font-display: 'Noto Sans SC', 'Baloo 2', sans-serif;
  --font-body: 'Noto Sans SC', sans-serif;
  --font-fun: 'Baloo 2', 'Noto Sans SC', sans-serif;

  color-scheme: light;
}

/* ---------- 深色模式 Token ---------- */
[data-theme="dark"] {
  --bg-1: #16161B;
  --bg-2: #1D1D24;
  --bg-3: #221A22;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(30, 30, 36, 0.9);
  --surface-border: rgba(255, 255, 255, 0.10);
  --text: #F3F1EC;
  --text-soft: #B7B3AB;
  --text-faint: #7C7972;

  --primary: #FF9A56;
  --primary-dark: #FFB27A;
  --primary-soft: rgba(255, 154, 86, 0.22);
  --secondary: #3FD8C7;
  --accent-yellow: #FFD873;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

/* ---------- Reset ---------- */
/* 一定要放在最前面且用 !important：避免后面 .modal-mask/.result-overlay
   等元件自己的 display:flex 规则，靠 class 的特异度盖过 [hidden] 属性 */
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, var(--bg-3) 0%, transparent 55%),
    radial-gradient(circle at 100% 0%, var(--bg-2) 0%, transparent 45%),
    var(--bg-1);
  background-attachment: fixed;
  transition: background-color .4s ease, color .4s ease;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
button { font-family: inherit; }
ul { list-style: none; margin: 0; padding: 0; }

/* ---------- 顶部工具列 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  background: color-mix(in srgb, var(--bg-1) 70%, transparent);
  border-bottom: 1px solid var(--surface-border);
}
.topbar__brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar__actions { display: flex; gap: 8px; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  backdrop-filter: blur(10px);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease, background .2s ease;
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: scale(.9); }

/* ---------- 版面 ---------- */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 18px 60px;
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 34px 6px 8px; }
.hero__title {
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 900;
  letter-spacing: .5px;
  background: linear-gradient(120deg, var(--primary-dark), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__subtitle {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- 轮盘区 ---------- */
.wheel-zone { position: relative; display: flex; justify-content: center; padding: 18px 0 10px; }

.wheel-stage__label {
  text-align: center;
  font-family: var(--font-fun);
  font-weight: 700;
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin: 0 auto 18px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.wheel-wrap {
  position: relative;
  width: min(88vw, 380px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

.wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  filter: drop-shadow(var(--shadow-lg));
  transform: rotate(0deg);
  will-change: transform;
}
.wheel-canvas.is-spinning { }

.wheel-pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 30px;
  color: var(--primary-dark);
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.25));
  z-index: 5;
  animation: pointerIdle 2.4s ease-in-out infinite;
}
@keyframes pointerIdle {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  50% { transform: translateX(-50%) rotate(-6deg); }
}

.wheel-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 34%;
  aspect-ratio: 1/1;
  border-radius: 50%;
  border: 4px solid var(--surface-strong);
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(232, 114, 43, 0.45), inset 0 2px 4px rgba(255,255,255,.35);
  transition: transform .16s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease, filter .3s ease;
  z-index: 6;
}
.wheel-center::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255,140,66,.55);
  animation: centerPulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes centerPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,140,66,.45); }
  70% { box-shadow: 0 0 0 18px rgba(255,140,66,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,140,66,0); }
}
.wheel-center:hover { transform: translate(-50%, -50%) scale(1.05); }
.wheel-center:active { transform: translate(-50%, -50%) scale(.92); }
.wheel-center:disabled { cursor: not-allowed; filter: saturate(.6) brightness(.95); }
.wheel-center:disabled::after { animation: none; box-shadow: none; }
.wheel-center__emoji { font-size: clamp(22px, 6vw, 30px); line-height: 1; }
.wheel-center__text { font-family: var(--font-fun); font-weight: 700; font-size: clamp(12px, 3vw, 15px); }

/* ---------- 结果卡片 ---------- */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 16, 10, 0.42);
  backdrop-filter: blur(6px);
  animation: fadeIn .25s ease both;
}
[data-theme="dark"] .result-overlay { background: rgba(0,0,0,0.6); }

.result-card {
  width: min(90vw, 360px);
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-l);
  padding: 34px 26px 26px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn .5s cubic-bezier(.2,1.4,.4,1) both;
}
.result-card__badge {
  display: inline-block;
  font-family: var(--font-fun);
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  background: color-mix(in srgb, var(--secondary) 16%, transparent);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}
.result-card__emoji {
  font-size: 64px;
  animation: bounceIn .7s cubic-bezier(.28,1.6,.4,1) .05s both;
  line-height: 1;
}
.result-card__name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  margin-top: 10px;
}
.result-card__hype {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 14px;
}
.result-card__actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.75) translateY(10px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes bounceIn {
  0% { transform: scale(.3) rotate(-15deg); opacity: 0; }
  55% { transform: scale(1.15) rotate(6deg); opacity: 1; }
  75% { transform: scale(.95) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- 彩带/五彩纸屑 canvas ---------- */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 65;
  width: 100%;
  height: 100%;
}

/* ---------- 按钮通用 ---------- */
.pill-btn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .16s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease, background .2s ease, color .2s ease;
}
.pill-btn:hover { transform: translateY(-2px); }
.pill-btn:active { transform: scale(.95); }

.pill-btn--primary {
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 20px rgba(232, 114, 43, 0.35);
}
.pill-btn--ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border);
}
.pill-btn--outline {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid color-mix(in srgb, var(--primary) 45%, var(--surface-border));
  font-size: 13px;
  padding: 10px 16px;
}
.pill-btn--ghost.is-active {
  background: linear-gradient(120deg, var(--c-japan), var(--primary-dark));
  color: #fff;
  border-color: transparent;
}
.pill-btn--outline.is-active {
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: transparent;
}
.pill-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- 操作列 ---------- */
.controls { margin-top: 6px; }
.controls__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.filter-panel {
  margin: 16px auto 0;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-m);
  padding: 16px;
  backdrop-filter: blur(12px);
  animation: slideDown .3s ease both;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.filter-panel__title { font-weight: 700; font-size: 13px; color: var(--text-soft); margin-bottom: 10px; }
.filter-panel__tags { display: flex; flex-wrap: wrap; gap: 8px; }

.tag-chip {
  border: 1.5px solid var(--surface-border);
  background: var(--surface-strong);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-soft);
  transition: all .18s ease;
}
.tag-chip.is-on {
  background: linear-gradient(120deg, var(--c-china), var(--primary-dark));
  color: #fff;
  border-color: transparent;
}

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20,16,10,.45);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease both;
}
[data-theme="dark"] .modal-mask { background: rgba(0,0,0,.6); }

@media (min-width: 640px) {
  .modal-mask { align-items: center; padding: 24px; }
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 86dvh;
  overflow-y: auto;
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheetUp .32s cubic-bezier(.2,1,.4,1) both;
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 640px) {
  .modal { border-radius: var(--radius-l); animation: popIn .32s cubic-bezier(.2,1,.4,1) both; }
}
.modal--wide { max-width: 560px; }
@keyframes sheetUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }

.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 12px;
  position: sticky; top: 0;
  background: var(--surface-strong);
  z-index: 2;
}
.modal__header h2 { font-size: 18px; font-weight: 900; }
.modal__body { padding: 4px 22px 26px; }

.empty-tip { color: var(--text-faint); font-size: 14px; text-align: center; padding: 30px 0; }

/* ---------- 历史列表 ---------- */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-list li {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  font-size: 14px;
}
.history-list .h-emoji { font-size: 22px; }
.history-list .h-name { font-weight: 700; flex: 1; }
.history-list .h-time { color: var(--text-faint); font-size: 12px; }

/* ---------- 料理管理列表 ---------- */
.manage__addBtn { width: 100%; justify-content: center; margin-bottom: 16px; }
.manage-list { display: flex; flex-direction: column; gap: 14px; }
.manage-group__title {
  font-family: var(--font-fun);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-soft);
  margin: 6px 0 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.manage-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-s);
  padding: 10px 12px;
}
.manage-item__emoji { font-size: 22px; }
.manage-item__name { font-weight: 700; font-size: 14px; flex: 1; }
.manage-item__tags { display: flex; gap: 4px; flex-wrap: wrap; }
.manage-item__tag {
  font-size: 10px;
  color: var(--text-faint);
  background: color-mix(in srgb, var(--text-faint) 12%, transparent);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}
.manage-item__fav {
  background: none; border: none; font-size: 18px; cursor: pointer;
  transition: transform .15s cubic-bezier(.34,1.56,.64,1);
}
.manage-item__fav:active { transform: scale(1.3); }
.manage-item__edit {
  background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-faint);
}

/* ---------- 表单 ---------- */
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 13px; color: var(--text-soft); font-weight: 700; }
.form-field input, .form-field select {
  font-family: inherit;
  font-size: 15px;
  padding: 11px 14px;
  border-radius: var(--radius-s);
  border: 1.5px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .2s ease;
}
.form-field input:focus, .form-field select:focus { border-color: var(--primary); }
.form-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  transition: all .3s cubic-bezier(.2,1,.4,1);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 可访问性：减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- 键盘焦点 ---------- */
:focus-visible { outline: 2.5px solid var(--secondary); outline-offset: 2px; }

/* ---------- 小屏幕微调 ---------- */
@media (max-width: 380px) {
  .hero__title { font-size: 26px; }
  .controls__row { gap: 8px; }
  .pill-btn--outline { padding: 9px 13px; font-size: 12px; }
}
