﻿/* ===========================================================
   游戏盒子 · 设计令牌与基础样式
   视觉方向：浅米白底 + 白色大圆角卡片 + 胶囊控件 + 绿色强调
   （首页已按 iOS 参照物还原；运营后台 /admin 是独立的深色控制台）
   =========================================================== */
:root {
  /* ---------- 背景层级（浅色） ---------- */
  --bg: #f7f4ee;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #f4f1ea;
  --border: rgba(59, 46, 29, 0.10);
  --border-strong: rgba(59, 46, 29, 0.18);

  /* ---------- 品牌：绿色强调 ---------- */
  --brand: #4bcc8a;
  --brand-2: #35b374;
  --brand-3: #ff7a2f;
  --brand-soft: rgba(75, 204, 138, 0.14);
  --grad-brand: linear-gradient(135deg, #5ed69a 0%, #3ec47c 100%);

  /* ---------- 功能色 ---------- */
  --cyan: #2bb8a8;
  --teal: #4bcc8a;
  --grad-teal: linear-gradient(135deg, #5ed69a 0%, #3ec47c 100%);
  --gold: #f5a823;
  --grad-gold: linear-gradient(135deg, #ffd76b 0%, #f5a823 100%);
  --green: #4bcc8a;
  --purple: #8b7cf6;
  --grad-purple: linear-gradient(135deg, #a89bff 0%, #7b6bf0 100%);
  --pink: #ff4d6d;
  --grad-cyan: linear-gradient(135deg, #4fd8c9 0%, #2bb8a8 100%);
  --orange: #ff7a2f;
  --grad-orange: linear-gradient(135deg, #ffa62b 0%, #f0701a 100%);

  /* ---------- 文本（暖棕系） ---------- */
  --text: #2f2317;
  --text-2: #6f6152;
  --text-3: #a2947f;

  --line: rgba(59, 46, 29, 0.09);
  --shadow: 0 6px 20px rgba(60, 45, 25, 0.10);
  --shadow-brand: 0 8px 20px rgba(75, 204, 138, 0.30);
  --shadow-teal: 0 8px 20px rgba(75, 204, 138, 0.30);

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --r-xl: 26px;

  --nav-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Hiragino Sans GB",
    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #ece7dd;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* 关掉 Chrome 的字体自动放大（font boosting）：
     否则窄屏下 10px 的小字会被强行撑到 12px，尺寸全部失准 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0; }

/* ---------- 应用外壳（手机视图） ---------- */
/* 固定为视口高度：底栏常驻底部，仅 #view 内部滚动（标准 App 外壳） */
#phone {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media (min-width: 520px) {
  body { padding: 18px 0; align-items: center; }
  #phone {
    height: min(880px, calc(100vh - 36px));
    border-radius: 22px;
    box-shadow: 0 0 0 1px rgba(59, 46, 29, 0.08), 0 24px 60px rgba(60, 45, 25, 0.20);
  }
}

/* ---------- 顶部栏 ---------- */
#appbar:empty { display: none; }
#appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex: 0 0 auto;
  padding: 10px 12px 8px;
  background: rgba(247, 244, 238, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.appbar-row { display: flex; align-items: center; gap: 8px; }
.appbar-title { flex: 1; font-size: 17px; font-weight: 800; letter-spacing: 0.3px; color: var(--text); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; color: var(--text-2);
  background: rgba(59, 46, 29, 0.05);
  border: 1px solid var(--line);
  transition: 0.18s ease;
}
.icon-btn:active { background: rgba(59, 46, 29, 0.12); }

/* 搜索条 */
.searchbar {
  flex: 1;
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--border-strong);
  color: var(--text-3);
  font-size: 13px;
  overflow: hidden; white-space: nowrap;
}
.searchbar b { color: var(--brand-2); font-weight: 600; }

/* ---------- 内容区 ---------- */
#view {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
  /* 不再预留底栏高度：内容滚到底栏之下，毛玻璃才有内容可透 */
  padding-bottom: 0;
  scrollbar-width: none;
}
#view::-webkit-scrollbar { width: 0; }
.page { padding: 10px 12px calc(var(--nav-h) + var(--safe-b) + 24px); animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 底部导航：浮动胶囊 + 会「鼓着走」的选中药丸 ----------
   动效参考 LINE 的底部导航：
     1. 整条是浮动白色胶囊（左右留边、全圆角、细描边、柔光投影）
     2. 选中态是一枚浅灰色药丸，切换时先「鼓起来」（放大 + 加重投影）再飞向目标位
     3. 飞行途中整排图标/文字被横向挤扁再回弹（果冻形变）
     4. 图标线稿 → 实心填色；文字灰 → 黑加粗
   ------------------------------------------------------------- */
#tabbar {
  --pill-bg: #ededed;
  --pill-scale: 0.95;      /* 药丸宽度 = tab 槽宽 × 该倍率（<1 比槽位窄） */
  --pill-out: 3px;         /* 药丸距边框线的内缩量（正值 = 完全收在边框内） */
  position: absolute;
  left: 4%; right: 4%;         /* 方案 B：5 个 tab 需要更宽的条，才能让药丸保持横椭圆 */
  bottom: calc(12px + var(--safe-b));
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: stretch;
  padding: 0 4px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(59, 46, 29, 0.07);
  box-shadow: 0 8px 22px rgba(60, 45, 25, 0.12), 0 1px 2px rgba(60, 45, 25, 0.05);
  overflow: hidden;            /* 药丸被裁在胶囊条轮廓内，不会溢出边框 */
}
/* 选中药丸：收在边框线内滑动（不再上下探出条外） */
#tabbar .tab-pill {
  position: absolute;
  top: var(--pill-out); bottom: var(--pill-out); left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--pill-bg);
  /* 投影改为「内嵌感」：贴着边框内侧，不再往外冒 */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75),
              0 1px 3px rgba(60, 45, 25, 0.08);
  transform-origin: center center;
  /* 位置用独立属性 translate（不是 transform）：这样 scale 不会把位移一起放大，
     否则飞行时的 scale(1.22) 会让药丸中心随距离线性偏移 */
  transition: translate 0.5s cubic-bezier(0.34, 1.22, 0.5, 1),
              width 0.5s cubic-bezier(0.34, 1.22, 0.5, 1),
              box-shadow 0.34s ease,
              scale 0.34s ease;
  will-change: translate, width;
  pointer-events: none;
}
/* 飞行中：胀大成一个软球浮在条上方（参照物里药丸会明显变大、脱离条面、影子变重） */
#tabbar .tab-pill.flying {
  box-shadow: 0 16px 30px rgba(60, 45, 25, 0.26), 0 3px 6px rgba(60, 45, 25, 0.10);
  animation: pill-fly 0.5s cubic-bezier(0.34, 1.25, 0.5, 1);
}
@keyframes pill-fly {
  0%   { scale: 1 1; }
  30%  { scale: 1.22 1.16; }   /* 鼓起：变宽变高，像一颗软球 */
  62%  { scale: 1.06 1.03; }
  82%  { scale: 0.99 0.98; }   /* 落位轻微下压 */
  100% { scale: 1 1; }
}
.tab {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10px; color: #9c9c9c; font-weight: 500;
  border-radius: 999px;
}
.tab .ti { position: relative; width: 22px; height: 22px; }
.tab .ti svg { position: absolute; inset: 0; width: 22px; height: 22px; display: block; }
/* 线稿层 */
.tab .ti .outline { opacity: 1; transform: scale(1); transition: opacity 0.22s ease, transform 0.3s ease; }
/* 实心层：默认缩到 0.72 且透明 */
.tab .ti .solid {
  opacity: 0; transform: scale(0.72);
  transition: opacity 0.26s ease, transform 0.36s cubic-bezier(0.34, 1.42, 0.5, 1);
}
/* 图片图标（福利的福袋）：不参与线稿↔实心切换，靠亮度和尺寸区分选中 */
.tab .ti .ti-img {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  height: 23px; width: auto; display: block;
  pointer-events: none;
  filter: saturate(0.9) opacity(0.86);
  transition: filter 0.24s ease, height 0.3s cubic-bezier(0.34, 1.42, 0.5, 1);
}
.tab.on .ti .ti-img { height: 25px; filter: none; }
.tab .lb { line-height: 1; transition: color 0.24s ease; }
.tab.on { color: var(--text); font-weight: 800; }
.tab.on .ti .outline { opacity: 0; transform: scale(0.88); }
.tab.on .ti .solid { opacity: 1; transform: scale(1); }
/* 点击反馈：只作用于「被点中的那一个」按钮（图标+文字一起压一下再弹回），
   其余按钮完全不动 —— 注意这里不给整排加动画 */
.tab.tapped .jelly { animation: tab-press 0.44s cubic-bezier(0.34, 1.4, 0.5, 1); }
@keyframes tab-press {
  0%   { transform: scale(1, 1); }
  22%  { transform: scale(0.8, 1.16); }   /* 按下：横向压扁、纵向拉高 */
  52%  { transform: scale(1.1, 0.93); }   /* 回弹过冲 */
  76%  { transform: scale(0.98, 1.02); }
  100% { transform: scale(1, 1); }
}
@media (prefers-reduced-motion: reduce) {
  .tab.tapped .jelly { animation: none; }
  #tabbar .tab-pill.flying { animation: none; }
}

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  overflow: hidden;
}

.sec { margin-top: 16px; }
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.sec-head h2 { font-size: 16px; display: flex; align-items: center; gap: 6px; }
.sec-head h2::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px;
  background: var(--grad-brand);
  box-shadow: 0 0 8px rgba(75, 204, 138, 0.65);
}
.sec-head .more { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 2px; }

.tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px; line-height: 16px;
  border-radius: 4px;
  background: rgba(59, 46, 29, 0.06);
  color: var(--text-2);
  white-space: nowrap;
}
.tag.brand { background: rgba(255, 122, 47, 0.14); color: #e0701a; border: 1px solid rgba(255, 122, 47, 0.28); }
.tag.cyan { background: rgba(43, 184, 168, 0.13); color: var(--cyan); border: 1px solid rgba(43, 184, 168, 0.28); }
.tag.gold { background: rgba(255, 215, 107, 0.13); color: var(--gold); border: 1px solid rgba(255, 215, 107, 0.28); }
.tag.green { background: rgba(75, 204, 138, 0.14); color: var(--teal); border: 1px solid rgba(75, 204, 138, 0.28); }
.tag.purple { background: rgba(59, 46, 29, 0.07); color: #2f2317; border: 1px solid rgba(59, 46, 29, 0.16); }

/* ====== 按钮体系（对齐参考图） ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 32px; padding: 0 15px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  background: rgba(59, 46, 29, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform 0.14s ease, filter 0.14s ease, background 0.14s ease;
}
/* 主按钮：青绿→青 发光实心（对应参考图 Place bet） */
.btn.primary {
  background: var(--grad-teal);
  border-color: transparent;
  color: #04241c;
  box-shadow: var(--shadow-teal);
}
/* 强调按钮：青→紫→品红 霓虹渐变（最强 CTA，对应参考图霓虹进度条） */
.btn.accent {
  background: var(--grad-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px rgba(75, 204, 138, 0.38);
}
/* 次级按钮：半透明描边（对应参考图 All profits / Top-up） */
.btn.ghost {
  background: rgba(59, 46, 29, 0.05);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn:active { transform: scale(0.97); filter: brightness(1.08); }
.btn[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; }

.hscroll {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.hscroll::-webkit-scrollbar { display: none; }

.price { color: var(--pink); font-weight: 800; font-family: "DIN Alternate", var(--font); text-shadow: 0 0 12px rgba(255, 122, 47, 0.36); }
.price small { font-size: 10px; font-weight: 600; }
.strike { color: var(--text-3); text-decoration: line-through; font-size: 11px; }

.count {
  font-family: "DIN Alternate", var(--font);
  color: var(--text-3); font-size: 11px;
}

/* 折扣标 */
.discount {
  position: absolute; top: 0; left: 0;
  padding: 2px 6px;
  font-size: 10px; font-weight: 800; color: #fff;
  border-radius: 10px 0 10px 0;
  background: linear-gradient(135deg, #ff4fd8 0%, #a45cff 100%);
  box-shadow: 0 4px 12px rgba(255, 122, 47, 0.32);
  z-index: 2;
}
.discount.bt { background: var(--grad-purple); }
.discount.free { background: var(--grad-teal); }

/* 骨架/空态 */
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; opacity: 0.5; }

/* Toast */
#toast {
  position: fixed;
  left: 50%; bottom: 110px;
  transform: translate(-50%, 12px);
  z-index: 999;
  max-width: 320px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(29, 20, 54, 0.97);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  transition: 0.24s ease;
  pointer-events: none;
  box-shadow: var(--shadow), 0 0 22px rgba(75, 204, 138, 0.24);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 弹层 */
.mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(7, 4, 15, 0.68);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeMask 0.18s ease;
}
@keyframes fadeMask { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 480px;
  background:
    radial-gradient(90% 40% at 50% 0%, rgba(75, 204, 138, 0.16), transparent 70%),
    var(--bg-2);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border-top: 1px solid var(--border-strong);
  padding: 16px 16px calc(18px + var(--safe-b));
  animation: up 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 82vh; overflow-y: auto;
  box-shadow: 0 -14px 40px rgba(60, 45, 25, 0.12);
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet h3 { font-size: 16px; margin-bottom: 4px; }
.sheet .sub { color: var(--text-3); font-size: 12px; margin-bottom: 14px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
