/* ============================================================
 * game.css — 顶栏、预览台、主内容区壳、底部导航、Toast、粒子
 * v17.2
 * 改动：.meta-row.tags 加 max-height + 滚动，避免标签挤掉数据
 * ============================================================ */

/* ---------- 顶栏 ---------- */
.topbar {
  flex-shrink: 0; height: 48px; padding: 0 10px;
  background: #6B4028; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 0 0 #4A2A18; position: relative; z-index: 5;
}
.shop-name-wrap {
  display: flex; align-items: center; gap: 6px;
  max-width: 140px;
  overflow: hidden;
}
.shop-logo-img {
  width: 28px; height: 28px;
  image-rendering: pixelated;
  flex-shrink: 0;
  background: #8B5E3C;
  box-shadow: 0 0 0 2px #4A2A18, inset -1px -1px 0 0 rgba(0,0,0,.2), inset 1px 1px 0 0 rgba(255,255,255,.15);
}
.shop-logo-img.hidden { display: none; }
.shop-name {
  font-size: 13px; font-weight: 800; color: #FFE7C9;
  letter-spacing: .5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-stats { margin-left: auto; display: flex; gap: 5px; }
.stat-pill {
  display: flex; align-items: center; gap: 4px;
  background: #8B5E3C; padding: 3px 8px;
  font-size: 12px; color: #FFE7C9;
  box-shadow: inset -2px -2px 0 0 rgba(0,0,0,.2), inset 2px 2px 0 0 rgba(255,255,255,.15);
}
.stat-pill b { color: #FFD98A; font-size: 13px; }
.ico-coin, .ico-star { width: 10px; height: 10px; display: inline-block; }
.ico-coin {
  background: #FFD98A;
  box-shadow: inset -2px -2px 0 #C09020, inset 2px 2px 0 #FFF0B0;
  border-radius: 50%;
}
.ico-star {
  background: #FFD98A;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.icon-btn {
  width: 30px; height: 30px;
  background: #8B5E3C; border: none;
  color: #FFE7C9; font-size: 15px; font-weight: 800;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset -2px -2px 0 0 rgba(0,0,0,.2), inset 2px 2px 0 0 rgba(255,255,255,.15);
  font-family: inherit;
}
.icon-btn:active { transform: translateY(2px); }
.icon-btn.off { opacity: .5; }

/* ---------- 预览台 ---------- */
.preview-stage {
  flex-shrink: 0; display: flex; gap: 10px;
  padding: 10px;
  background: #EAD7BE;
  box-shadow: inset 0 -4px 0 0 #D0B896;
  position: relative;
}
.canvas-frame {
  width: 144px; height: 144px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #FFF8F0 0%, #F0E0CC 100%);
  box-shadow: inset -3px -3px 0 0 #D8C4A8, inset 3px 3px 0 0 #FFF, 0 0 0 3px #A87B54, 0 4px 0 0 #7A5638;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#drink-canvas {
  width: 144px; height: 144px;
  image-rendering: pixelated; image-rendering: crisp-edges;
  display: block;
}
.canvas-frame.bump { animation: canvasBump .28s ease-out; }
@keyframes canvasBump { 0% { transform: scale(1); } 35% { transform: scale(1.05); } 100% { transform: scale(1); } }
.canvas-pop {
  position: absolute; top: 6px; right: 6px;
  background: #5EA83A; color: #fff;
  font-size: 11px; font-weight: 800;
  padding: 3px 6px;
  animation: popUp .8s ease-out forwards;
  pointer-events: none;
  box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
@keyframes popUp {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-36px) scale(1.2); opacity: 0; }
}

/* ★ 预览元数据：整体固定高度，标签区独立滚动 */
.preview-meta {
  flex: 1; display: flex; flex-direction: column;
  justify-content: flex-start; gap: 4px;
  min-width: 0;
  max-height: 144px;
  overflow: hidden;
  padding-right: 2px;
}
.meta-row { display: flex; align-items: flex-start; gap: 5px; font-size: 11px; }

/* ★ 标签行：限制高度 + 内部滚动，不挤压下方数据 */
.meta-row.tags {
  flex-wrap: wrap;
  gap: 3px;
  min-height: 18px;
  max-height: 56px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  flex-shrink: 1;
}
.meta-row.tags::-webkit-scrollbar { width: 3px; }
.meta-row.tags::-webkit-scrollbar-track { background: transparent; }
.meta-row.tags::-webkit-scrollbar-thumb { background: #C4A88A; border-radius: 2px; }

.meta-label { color: #A88A6A; font-weight: 700; flex-shrink: 0; width: 42px; font-size: 10.5px; padding-top: 1px; }
.meta-val { color: #5A3A24; font-size: 13px; font-weight: 800; }
.meta-val.price { color: #E8703A; font-size: 15px; }
.tag-empty { color: #C4A88A; font-size: 11px; }
.tag {
  background: #D8B890; color: #5A3A24;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; white-space: nowrap;
  animation: tagIn .22s ease-out;
}
.tag.juice { background: #5EA83A; color: #fff; }
.tag.syn-good    { background: #5EA83A; color: #fff; font-weight: 800; }
.tag.syn-special { background: #FFB03A; color: #fff; font-weight: 800; }
.tag.syn-bad     { background: #D04030; color: #fff; font-weight: 800; }
@keyframes tagIn {
  0%   { transform: scale(0) rotate(-8deg); }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- 主内容区壳 ---------- */
.content { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.tab-panel {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: panelIn .18s ease-out;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 底部导航 ---------- */
.bottom-nav {
  flex-shrink: 0; height: 58px;
  background: #6B4028;
  display: grid; grid-template-columns: repeat(4, 1fr);
  box-shadow: 0 -4px 0 0 #4A2A18;
  position: relative; z-index: 5;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-btn {
  border: none; background: transparent;
  color: #C9A07A;
  font-family: inherit; font-size: 11px; font-weight: 700;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative;
  transition: .12s;
}
.nav-btn .nav-txt { font-size: 12px; letter-spacing: .5px; }
.nav-btn.on { color: #FFE7C9; background: #8B5E3C; box-shadow: inset 0 -4px 0 0 #E8703A; }
.nav-btn:active { background: #5A3820; }
.nav-badge {
  position: absolute; top: 6px; right: 50%; margin-right: -26px;
  background: #E8703A; color: #fff;
  font-size: 9px; font-weight: 900;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #6B4028;
  animation: badgePop .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes badgePop { 0% { transform: scale(0); } 100% { transform: scale(1); } }

/* ---------- Toast ---------- */
#toast-box {
  position: absolute; top: 60px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column;
  gap: 6px; align-items: center;
  pointer-events: none;
  width: 90%; max-width: 340px;
}
.toast {
  background: #FFFCF6; color: #5A3A24;
  font-size: 12px; font-weight: 700;
  padding: 9px 14px;
  box-shadow: inset -3px -3px 0 0 #E0CBB0, inset 3px 3px 0 0 #FFF, 0 0 0 3px #8B5E3C, 0 4px 0 0 rgba(90,58,36,.3);
  text-align: center; line-height: 1.5;
  opacity: 0;
  transform: translateY(-16px) scale(.9);
  transition: .25s cubic-bezier(.34,1.56,.64,1);
  max-width: 100%; word-break: break-word;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.good { background: #E8FFD8; box-shadow: inset -3px -3px 0 0 #B8E090, inset 3px 3px 0 0 #FFF, 0 0 0 3px #5EA83A, 0 4px 0 0 rgba(90,58,36,.3); }
.toast.bad  { background: #FFE0D8; box-shadow: inset -3px -3px 0 0 #F0B0A0, inset 3px 3px 0 0 #FFF, 0 0 0 3px #C04030, 0 4px 0 0 rgba(90,58,36,.3); }
.toast b { color: #C06030; }

/* ---------- 粒子层 ---------- */
#fx-layer {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 150;
  overflow: hidden;
}
.fx-coin {
  position: absolute;
  font-size: 14px; font-weight: 900;
  color: #FFC844;
  text-shadow: 1px 1px 0 #A07020, -1px -1px 0 #A07020;
  animation: coinFly 1s ease-out forwards;
}
@keyframes coinFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), -60px) scale(.5); opacity: 0; }
}
.fx-star {
  position: absolute;
  font-size: 16px; color: #FFD98A;
  text-shadow: 0 0 4px #FFB03A;
  animation: starBurst .9s ease-out forwards;
  pointer-events: none;
}
@keyframes starBurst {
  0%   { transform: translate(0,0) scale(0.3) rotate(0); opacity: 1; }
  60%  { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(180deg); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.4), calc(var(--dy) * 1.4)) scale(0.6) rotate(360deg); opacity: 0; }
}