:root {
  --cream: #fff7ec;
  --cream-deep: #ffeeda;
  --ink: #3a2a20;
  --muted: #93796a;
  --orange: #ff7a45;
  --orange-deep: #e85d2a;
  --caramel: #b2642e;
  --pink: #ff8a9b;
  --line: #ffe3ca;
  --white: #fffdfa;
  --shadow: 0 18px 40px -22px rgba(178, 100, 46, 0.55);
}

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

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 80% 0%, #ffe6cf 0%, rgba(255, 230, 207, 0) 55%),
    radial-gradient(100% 70% at 10% 100%, #ffe9d5 0%, rgba(255, 233, 213, 0) 60%),
    var(--cream);
  background-attachment: fixed;
}

.app {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(14px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.loc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  max-width: 78%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.icon-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  transition: transform 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

/* ---------- 小精灵 ---------- */

.mascot {
  position: relative;
  width: 190px;
  aspect-ratio: 848 / 732;
  margin: 0 auto;
  animation: float 4.6s ease-in-out infinite;
}

.mascot.big {
  width: 232px;
  margin-bottom: 8px;
}

.mascot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.mascot .wink {
  opacity: 0;
  animation: blink 5.4s ease-in-out infinite;
}

@keyframes blink {
  0%,
  91% {
    opacity: 0;
  }
  92.5%,
  96% {
    opacity: 1;
  }
  97.5%,
  100% {
    opacity: 0;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-9px) rotate(1.2deg);
  }
}

/* ---------- 头部问候 ---------- */

.hero {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -6px 0 10px;
}

.hero .mascot {
  width: 104px;
  margin: 0;
  flex: none;
  transform-origin: 50% 90%;
}

.hero-text {
  min-width: 0;
}

.hero-title {
  font-size: 21px;
  margin: 0 0 4px;
  letter-spacing: 0.2px;
}

.hero-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 加载 ---------- */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 40px;
}

.title {
  font-size: 24px;
  letter-spacing: 0.3px;
  margin: 18px 0 8px;
}

.sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.hint {
  margin-top: 18px;
  font-size: 12px;
  color: #b9a094;
}

.dots {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  opacity: 0.3;
  animation: pulse 1.2s ease-in-out infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

/* ---------- 模式切换 ---------- */

.chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 4px 0 18px;
}

.chips.wrap {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin: 10px 0 0;
}

.chip {
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}

.chip.small {
  padding: 7px 12px;
  font-size: 13px;
}

.chip.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(255, 122, 69, 0.9);
}

.chip:active {
  transform: scale(0.96);
}

/* ---------- 卡片 ---------- */

.card-wrap {
  animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  position: relative;
  background: linear-gradient(180deg, #fffefb 0%, #fff8ef 100%);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 20px 20px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1.5px dashed rgba(255, 163, 112, 0.35);
  border-radius: 24px;
  pointer-events: none;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.4px;
}

.badge.soft {
  color: #b58e6d;
  background: #fff1e0;
  border: 1px solid #ffe0c2;
}

.badge.rating {
  color: #d9822b;
  background: #fff3dd;
  border: 1px solid #ffe2b4;
  font-weight: 600;
}

.dish {
  font-size: 72px;
  line-height: 1;
  margin: 10px 0 6px;
  filter: drop-shadow(0 10px 14px rgba(178, 100, 46, 0.18));
}

.name {
  font-size: 26px;
  margin: 6px 0 4px;
  letter-spacing: 0.5px;
}

.cuisine {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 16px 0 12px;
  font-size: 12.5px;
  color: #7b6252;
}

.meta span {
  background: #fff2e3;
  border-radius: 10px;
  padding: 6px 10px;
}

.meta .ok {
  color: #4f7a4a;
  background: #f0f7ec;
}

.meta .off {
  color: #a08b7e;
  background: #f5efe9;
}

.reason {
  margin: 0;
  font-size: 14px;
  color: var(--caramel);
  line-height: 1.6;
  padding: 0 6px;
}

/* ---------- 按钮 ---------- */

.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.actions.single {
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 300px;
  margin-top: 26px;
}

.btn {
  font-family: inherit;
  border: none;
  border-radius: 18px;
  padding: 15px 10px;
  font-size: clamp(14px, 4.1vw, 15.5px);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s ease, box-shadow 0.2s ease;
}

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

.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #ff8b57 0%, var(--orange) 55%, #f06a34 100%);
  box-shadow: 0 12px 24px -12px rgba(240, 106, 52, 0.9);
}

.btn.ghost {
  color: var(--caramel);
  background: #fff1e3;
  border: 1.5px solid #ffdcc0;
}

.btn.small {
  padding: 12px 18px;
  font-size: 14px;
  border-radius: 14px;
}

.links {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 16px;
}

.link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 2px;
}

.link.danger {
  color: #c06a58;
}

.link.tiny {
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
}

.foot {
  margin-top: auto;
  padding-top: 26px;
  text-align: center;
  font-size: 11.5px;
  color: #bda596;
  line-height: 1.8;
}

/* ---------- 今日历史 ---------- */

.history {
  margin-top: 26px;
  padding: 0 4px;
}

.history-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: #bda596;
  letter-spacing: 0.3px;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.h-item {
  font-size: 12.5px;
  color: #8a7264;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 10px;
}

/* ---------- 面板 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 42, 32, 0.38);
  backdrop-filter: blur(2px);
  z-index: 20;
  animation: fade 0.2s ease both;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  margin: 0 auto;
  max-width: 460px;
  background: var(--white);
  border-radius: 28px 28px 0 0;
  padding: 20px 22px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px -20px rgba(90, 55, 30, 0.45);
  animation: slide 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  max-height: 88dvh;
  overflow-y: auto;
}

.sheet.tall {
  max-height: 92dvh;
}

@keyframes slide {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sheet-head h3 {
  margin: 0;
  font-size: 18px;
}

.sheet-sub {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.platform {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: inherit;
  font-size: 16px;
  padding: 16px 18px;
  margin-bottom: 10px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: #fff7ee;
  color: var(--ink);
  cursor: pointer;
}

.platform:active {
  transform: scale(0.99);
}

.platform .arrow {
  color: var(--muted);
}

.tiny-note {
  font-size: 11.5px;
  color: #bda596;
  text-align: center;
  margin: 6px 0 0;
}

.group {
  margin-top: 18px;
}

.group h4 {
  margin: 0 0 2px;
  font-size: 14px;
  color: var(--ink);
}

.group-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.row-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: #f0e3d6;
  cursor: pointer;
  transition: background 0.2s ease;
  flex: none;
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(120, 80, 50, 0.25);
  transition: transform 0.2s ease;
}

.switch.on {
  background: var(--orange);
}

.switch.on i {
  transform: translateX(22px);
}

.range {
  width: 44%;
  accent-color: var(--orange);
}

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 26px;
  gap: 12px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  background: rgba(58, 42, 32, 0.9);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 40;
  max-width: 86vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .mascot,
  .mascot .wink,
  .dots i,
  .card-wrap,
  .sheet,
  .overlay {
    animation: none !important;
  }
}
