/* ===== 可爱风格：奶油底 + 粉色/薄荷 ===== */
:root {
  --cream: #FFF6EC;
  --pink: #FF8FAB;
  --pink-soft: #FFD6E0;
  --mint: #7FD8BE;
  --mint-soft: #D3F5EA;
  --purple: #C7A9F0;
  --green: #8CD790;
  --ink: #5D4A55;
  --card: #FFFFFF;
  --shadow: 0 6px 20px rgba(255, 143, 171, 0.18);
}

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

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Hiragino Maru Gothic ProN", "Yuanti SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #FFEFF4 0%, var(--cream) 45%, #EAFBF3 100%);
  color: var(--ink);
  overflow-x: hidden;
}

/* 手机比例容器 */
.phone {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 14px calc(86px + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

/* ===== 背景飘浮食物 emoji ===== */
#float-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#float-bg span {
  position: absolute;
  bottom: -60px;
  font-size: 26px;
  opacity: 0;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: .35; }
  90%  { opacity: .25; }
  100% { transform: translateY(-110vh) rotate(30deg); opacity: 0; }
}

/* ===== 顶部吉祥物 ===== */
.hero { text-align: center; padding-top: 14px; }
.hero video {
  width: 100%;
  border-radius: 24px;
  box-shadow: var(--shadow);
  background: var(--pink-soft);
  display: block;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.hero h1 {
  font-size: 24px;
  margin: 12px 0 4px;
  letter-spacing: 2px;
  text-shadow: 0 2px 0 #fff;
}

/* 音乐开关 */
.hero { position: relative; }
#bgm-toggle {
  position: absolute; top: 24px; right: 10px;
  width: 42px; height: 42px; border-radius: 50%;
  border: 2.5px solid #fff;
  background: rgba(255,255,255,.85);
  font-size: 19px; cursor: pointer;
  box-shadow: 0 3px 10px rgba(255,143,171,.35);
  transition: transform .12s;
  z-index: 2;
}
#bgm-toggle:active { transform: scale(.85); }
#bgm-toggle.playing { animation: fabBob 2s ease-in-out infinite; }
#bgm-toggle.off { filter: grayscale(1); opacity: .75; }

/* ===== 卡片 ===== */
.tab { display: none; }
.tab.active { display: block; }

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 16px;
  animation: cardIn .45s cubic-bezier(.2, .9, .3, 1.3) both;
}
@keyframes cardIn {
  from { transform: translateY(24px) scale(.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.card h2 { font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .mini-btn { margin-left: auto; }

.empty-hint { color: #B9A6B1; font-size: 13px; text-align: center; padding: 10px 0; }

/* ===== 按钮 ===== */
.cute-btn {
  border: none;
  border-radius: 18px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 0 rgba(0,0,0,.08);
  transition: transform .12s;
}
.cute-btn:active { transform: scale(.9); }
.cute-btn.pink   { background: var(--pink); }
.cute-btn.purple { background: var(--purple); }
.cute-btn.mint   { background: var(--mint); }
.cute-btn.green  { background: var(--green); }
.cute-btn.small  { padding: 10px 16px; border-radius: 14px; }
.cute-btn.wide   { width: 100%; margin-top: 10px; }
.cute-btn:disabled { opacity: .55; }

.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .cute-btn { flex: 1; }

.mini-btn {
  border: none; background: var(--pink-soft); color: var(--ink);
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: 14px;
  transition: transform .12s;
}
.mini-btn:active { transform: scale(.85); }

/* ===== 输入行 ===== */
.input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.input-row input, .chat-input-row input {
  flex: 1;
  border: 2px solid var(--pink-soft);
  border-radius: 16px;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #FFFDFB;
  outline: none;
}
.input-row input:focus, .chat-input-row input:focus { border-color: var(--pink); }

/* ===== 本周菜单 ===== */
.week-list { list-style: none; }
.week-list li {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(90deg, #FFF0F4, #F0FBF6);
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-weight: 600;
  animation: popIn .3s cubic-bezier(.2,.9,.3,1.4) both;
}
@keyframes popIn { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.week-list li .mini-btn { margin-left: auto; background: #fff; }

/* ===== 历史菜品 ===== */
.dish-list { list-style: none; }
.dish-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px;
  border-bottom: 1.5px dashed #FBE3EA;
  animation: popIn .3s both;
}
.dish-list li:last-child { border-bottom: none; }
.dish-check {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--pink-soft);
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.dish-check.on { background: var(--pink); border-color: var(--pink); }
.dish-name { font-size: 15px; flex: 1; }
.dish-list .mini-btn { background: #FFF0F0; font-size: 12px; }

/* 勾选时冒爱心 */
.heart-burst {
  position: fixed; pointer-events: none; font-size: 16px;
  animation: heartFly .8s ease-out forwards; z-index: 99;
}
@keyframes heartFly {
  from { transform: translate(0,0) scale(.6); opacity: 1; }
  to   { transform: translate(var(--dx), -70px) scale(1.3); opacity: 0; }
}

/* ===== 轮盘 ===== */
.wheel-card { text-align: center; }
.wheel-wrap { position: relative; width: min(320px, 82vw); margin: 6px auto 4px; }
#wheel { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 16px rgba(255,143,171,.25)); }
.wheel-pointer {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 30px; color: var(--pink); z-index: 3;
  text-shadow: 0 2px 0 #fff;
}
.wheel-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 5px solid #fff;
  background: var(--pink);
  color: #fff; font-size: 20px; font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  z-index: 2;
  transition: transform .12s;
}
.wheel-center:active { transform: translate(-50%,-50%) scale(.88); }

/* 双轮盘（主食+配菜） */
.duo-wrap { display: flex; gap: 12px; justify-content: center; margin: 4px 0 12px; }
.duo-col { position: relative; width: 44%; text-align: center; }
.duo-col canvas { width: 100%; height: auto; display: block; filter: drop-shadow(0 5px 10px rgba(255,143,171,.22)); }
.duo-pointer {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  font-size: 20px; color: var(--pink); z-index: 2; text-shadow: 0 2px 0 #fff;
}
.duo-label { font-size: 14px; font-weight: 700; margin-top: 6px; }
/* 主食/配菜徽章（点击切换） */
.cat-badge {
  border: none; cursor: pointer; font-family: inherit;
  font-size: 11.5px; font-weight: 700; color: var(--ink);
  background: var(--mint-soft); border-radius: 999px;
  padding: 5px 9px; white-space: nowrap;
  transition: transform .12s;
}
.cat-badge:active { transform: scale(.88); }

/* 轮盘选项 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--mint-soft);
  border-radius: 999px;
  padding: 7px 8px 7px 14px;
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  animation: popIn .25s both;
}
.chip button {
  border: none; background: #fff; border-radius: 50%;
  width: 20px; height: 20px; font-size: 11px; cursor: pointer; color: var(--ink);
}

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 20px rgba(255,143,171,.15);
  display: flex;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tabbar-btn {
  flex: 1; border: none; background: none;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: #C4AEBB; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border-radius: 16px;
  transition: all .2s;
}
.tabbar-btn span { font-size: 22px; transition: transform .25s cubic-bezier(.2,.9,.3,1.6); }
.tabbar-btn.active { color: var(--pink); background: #FFF0F4; }
.tabbar-btn.active span { transform: scale(1.25) rotate(-8deg); }

/* ===== AI 聊天 ===== */
#chat-fab {
  position: fixed;
  right: max(16px, calc(50% - 240px + 16px));
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255,143,171,.4);
  z-index: 11;
  animation: fabBob 2.6s ease-in-out infinite;
}
@keyframes fabBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.sheet {
  position: fixed; bottom: 0; left: 50%;
  transform: translate(-50%, 105%);
  width: 100%; max-width: 480px;
  height: 72dvh;
  background: #fff;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,.15);
  z-index: 20;
  display: flex; flex-direction: column;
  transition: transform .35s cubic-bezier(.2,.9,.3,1.1);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-head {
  padding: 16px 18px 10px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 800; font-size: 17px;
}
.sheet-head small { font-weight: 500; color: #C4AEBB; font-size: 12px; }

.chat-msgs { flex: 1; overflow-y: auto; padding: 6px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.55;
  animation: popIn .25s both;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.ai   { background: #FFF0F4; border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.user { background: var(--mint-soft); border-bottom-right-radius: 6px; align-self: flex-end; }
.msg.sys  { background: #F5F1E8; font-size: 12.5px; color: #9C8F7F; align-self: center; text-align: center; }

.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--pink);
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; transform: translateY(0);} 40% { opacity: 1; transform: translateY(-4px);} }

.chat-input-row {
  display: flex; gap: 8px;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
}

/* ===== 弹窗 ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(93,74,85,.45);
  display: none;
  align-items: center; justify-content: center;
  z-index: 30;
  padding: 24px;
}
.modal.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 28px;
  padding: 28px 24px;
  width: 100%; max-width: 340px;
  text-align: center;
  animation: popIn .3s cubic-bezier(.2,.9,.3,1.4) both;
  max-height: 80dvh;
  overflow-y: auto;
}
.modal-box h3 { font-size: 22px; margin: 10px 0; }
.modal-box pre {
  font-family: inherit; white-space: pre-wrap; word-break: break-word;
  text-align: left; font-size: 14px; line-height: 1.6;
  background: #FFF8F0; border-radius: 14px; padding: 12px; margin: 8px 0 14px;
}
.modal-box pre:empty { display: none; }
.result-emoji { font-size: 54px; animation: fabBob 1.8s ease-in-out infinite; }
.confirm-text { color: #B9A6B1; font-size: 13.5px; margin: 4px 0 14px; }

/* 盲盒 */
.bb-box {
  font-size: 90px;
  cursor: pointer;
  display: inline-block;
  animation: bbShake .7s ease-in-out infinite;
}
@keyframes bbShake {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-8deg) translateX(-3px); }
  40% { transform: rotate(8deg) translateX(3px); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(6deg); }
}
.bb-box.opening { animation: bbOpen .5s ease-in forwards; }
@keyframes bbOpen {
  40% { transform: scale(1.25) rotate(6deg); }
  100% { transform: scale(0); opacity: 0; }
}
#bb-hint { color: #B9A6B1; font-size: 14px; margin-top: 8px; }
.bb-dish { font-size: 64px; animation: popIn .4s cubic-bezier(.2,.9,.3,1.6) both; }
.hidden { display: none !important; }

/* 彩带画布 */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
