/* ===== 幸运水果机 —— 按设计图 600×805 复刻 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: radial-gradient(80% 60% at 50% 0%, #123a8f 0%, #06103a 55%, #03081f 100%);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}

/* 600×805 设计稿舞台,由 JS 等比缩放居中 —— 多端适配 */
#stage {
  position: absolute; left: 50%; top: 50%;
  width: 600px; height: 805px;
  transform-origin: center center;
  background: linear-gradient(#0b2a8f, #0a1c60);
  display: flex; flex-direction: column;
  box-shadow: 0 0 90px rgba(30, 100, 255, .4);
}

/* ---------- 顶部装饰条 ---------- */
.topbar {
  height: 18px; flex: none; position: relative;
  background: linear-gradient(#3d9bfd, #1976e8);
  border-bottom: 2px solid #0b2f7e;
}
.deco-gem { position: absolute; top: 2px; width: 13px; height: 13px;
  background: linear-gradient(135deg, #ffe082, #ff8f00);
  transform: rotate(45deg); border-radius: 3px; box-shadow: 0 0 6px #ffd54f; }
.deco-gem.left { left: 10px; } .deco-gem.right { right: 10px; }

/* ---------- 标题行 ---------- */
.title-row {
  height: 46px; flex: none; position: relative;
  background: linear-gradient(#2f92fb, #1976e8);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; z-index: 5;
}
.id-badge {
  min-width: 128px; height: 30px; line-height: 26px;
  background: linear-gradient(#123a8f, #0a1f5c);
  border: 2px solid #f7c948; border-radius: 15px;
  color: #ffe082; font-size: 17px; font-weight: 700; text-align: center;
  padding: 0 12px;
}
.id-icon::before { content: "🪪"; font-size: 14px; margin-right: 4px;
  filter: grayscale(1) sepia(1) saturate(4) hue-rotate(-12deg) brightness(1.25); }
.game-title {
  position: absolute; left: 50%; top: -8px; transform: translateX(-50%);
  width: 250px; height: 52px; text-align: center;
  background:
    radial-gradient(ellipse at center, #2aa6ff 0%, #1567c9 70%, transparent 71%);
  border-radius: 50%;
  border: 3px solid #ffd54f;
  box-shadow: 0 0 10px rgba(255, 213, 79, .8), inset 0 0 12px #0d47a1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.game-title::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -70px; width: 44px;
  background: linear-gradient(115deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg);
  animation: titleSweep 3.4s ease-in-out infinite;
}
@keyframes titleSweep { 55%, 100% { left: 115%; } }
.game-title span {
  font-size: 30px; font-weight: 900; letter-spacing: 2px;
  background: linear-gradient(#ffe3f1 15%, #ff5fa2 45%, #e91e63 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 2px rgba(90, 0, 40, .45);
  -webkit-text-stroke: 1px #7b1042;
}
.coin-box { display: flex; align-items: center; gap: 5px;
  color: #fff; font-size: 19px; font-weight: 700; min-width: 110px; justify-content: flex-end; }
.coin-icon { font-size: 20px;
  filter: grayscale(1) sepia(1) saturate(4) hue-rotate(-12deg) brightness(1.3)
          drop-shadow(0 0 3px #ffca28); }

/* ---------- 跑马灯 ---------- */
.marquee-row {
  height: 30px; flex: none; display: flex; align-items: center;
  background: linear-gradient(#eaf4ff, #bcd8f7);
  padding: 0 8px; gap: 6px; z-index: 4;
}
.horn { font-size: 18px; flex: none; }
.marquee-track {
  flex: 1; height: 24px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(#ff5252, #d32f2f);
  border: 1px solid #b71c1c; position: relative;
}
.marquee-text {
  position: absolute; white-space: nowrap; line-height: 24px;
  color: #fff; font-size: 15px; font-weight: 700;
  animation: marquee 16s linear infinite; padding-left: 100%;
}
@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------- 机身与转盘 ---------- */
.machine {
  flex: none; height: 408px; position: relative;
  background: linear-gradient(#0e2c86, #0a1c60);
  padding: 6px 52px;
}
.side-panel {
  position: absolute; top: 0; bottom: 0; width: 26px; z-index: 3;
}
.side-panel.left {
  left: 0;
  background: linear-gradient(90deg, #6ea8f7 0%, #2c5fd4 55%, #10307f 100%);
  clip-path: polygon(0 0, 100% 6%, 100% 94%, 0 100%);
}
.side-panel.right {
  right: 0;
  background: linear-gradient(-90deg, #6ea8f7 0%, #2c5fd4 55%, #10307f 100%);
  clip-path: polygon(100% 0, 0 6%, 0 94%, 100% 100%);
}
.board {
  position: relative; width: 100%; height: 100%;
  background: linear-gradient(#ff5fa2, #e91e63);
  border: 3px solid #3d78e0;
  border-radius: 12px; padding: 10px;
  box-shadow: 0 0 14px rgba(255, 64, 160, .55), 0 0 0 2px #10307f,
    inset 0 0 6px #ad1457;
}
/* 粉框上的灯珠(JS 生成) */
.lamp-frame { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.lamp { position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #ffe3f2; box-shadow: 0 0 4px #fff;
  animation: twinkle .96s ease-in-out infinite; }

/* 7×7 网格:外圈 24 格 + 中央 5×5 区 */
.ring {
  width: 100%; height: 100%;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  background: #0a1a55; border-radius: 6px; padding: 4px;
}
.tile {
  position: relative; border-radius: 6px;
  background: linear-gradient(#fdf6dd, #f3dfa0);
  border: 2px solid #c79a2a;
  box-shadow: inset 0 0 0 1px #ffe89b, inset 0 -4px 6px rgba(160, 110, 10, .35);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.tile .icon { font-size: 34px; line-height: 1;
  filter: drop-shadow(0 2px 1px rgba(120, 70, 0, .35)); }
.tile .badge {
  position: absolute; right: 1px; bottom: 1px;
  background: #e53935; color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 4px; padding: 0 3px; line-height: 14px;
  border: 1px solid #ffcdd2;
}
/* BAR 与 7 用样式文字 */
.tile .bar-face { text-align: center; line-height: 1; }
.tile .bar-face b {
  display: block; font-size: 12px; font-weight: 900; color: #fff;
  background: linear-gradient(#ff8a80, #c62828); border-radius: 3px;
  padding: 0 3px; line-height: 15px; border: 1px solid #7f0000; letter-spacing: 1px;
  text-shadow: 0 1px 1px #4e0000; transform: skewX(-6deg);
}
.tile .bar-face b + b { margin-top: 1px; }
.tile .bar-face .odds { display: block;
  color: #d32f2f; font-size: 11px; font-weight: 900; line-height: 12px; }
.tile .seven-face {
  font-size: 34px; font-weight: 900; color: #e53935; font-style: italic;
  text-shadow: 0 0 2px #fff, 0 2px 2px rgba(120, 0, 0, .5);
  -webkit-text-stroke: 1px #ffd54f;
}
.tile.luck { background: linear-gradient(135deg, #ff5fa2, #ffee58 35%, #26c6da 65%, #7e57c2); }
.tile .luck-face {
  font-size: 15px; font-weight: 900; letter-spacing: 1px; font-style: italic;
  background: linear-gradient(#fff59d, #ff4081);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: .5px #4a148c;
  text-shadow: 0 0 6px rgba(255, 255, 255, .8);
}
/* 跑灯高亮 */
.tile.active {
  border-color: #fff;
  box-shadow: 0 0 14px 4px #ffeb3b, inset 0 0 12px rgba(255, 235, 59, .9);
  z-index: 2;
}
.tile.hit { animation: hitFlash .28s steps(2) 8; }
@keyframes hitFlash { 50% { filter: brightness(1.8); } }

/* 中央区 */
.center-zone {
  grid-area: 2 / 2 / 7 / 7; position: relative;
  background:
    radial-gradient(circle at 25% 20%, rgba(64, 156, 255, .25), transparent 40%),
    linear-gradient(#0a2166, #071847);
  border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
}
.stars { position: absolute; inset: 0; pointer-events: none; }
.star { position: absolute; border-radius: 50%; background: #fff;
  animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: .95; } }
.corner-gem {
  position: absolute; width: 42px; height: 42px; z-index: 3;
  background:
    radial-gradient(circle at 35% 35%, #b3e5fc 0%, #29b6f6 45%, #0d47a1 100%);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  filter: drop-shadow(0 0 4px #4fc3f7);
}
.corner-gem.tl { left: -8px; top: -8px; } .corner-gem.tr { right: -8px; top: -8px; }
.corner-gem.bl { left: -8px; bottom: -8px; } .corner-gem.br { right: -8px; bottom: -8px; }

.mini-window {
  margin-top: 8px; width: 116px; height: 28px; z-index: 4; flex: none;
  background: #050a1e; border: 2px solid #f7c948; border-radius: 5px;
  color: #ffee58; font-size: 19px; font-weight: 900; text-align: center;
  line-height: 26px; box-shadow: 0 0 8px rgba(247, 201, 72, .5);
}
.dial {
  position: relative; margin-top: 5px;
  width: 210px; height: 210px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 40%, #123188 0%, #0a1c60 68%, #071440 100%);
  border: 5px solid #f7c948;
  box-shadow: 0 0 16px rgba(247, 201, 72, .55), inset 0 0 20px #051034;
  display: flex; align-items: center; justify-content: center;
}
.dial-lights { position: absolute; inset: 0; pointer-events: none;
  animation: dialRotate 18s linear infinite; }
.dial-lights.fast { animation: dialRotate .7s linear infinite; }
@keyframes dialRotate { to { transform: rotate(360deg); } }
.dial-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%;
  animation: twinkle 1.6s ease-in-out infinite; }
.lucky-text {
  font-size: 52px; font-weight: 900; letter-spacing: 4px; font-style: italic;
  background: linear-gradient(#ffffff 20%, #ff8fc2 50%, #ff2d87 85%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1.5px #ff4d9e;
  text-shadow: 0 0 14px rgba(255, 77, 158, .9);
  animation: luckyGlow 2.2s ease-in-out infinite;
}
@keyframes luckyGlow {
  50% { filter: brightness(1.4) drop-shadow(0 0 16px rgba(255, 77, 158, .95)); }
}
.jp-box {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  min-width: 96px; padding: 0 10px; height: 28px; line-height: 24px;
  background: #050a1e; border: 2px solid #f7c948; border-radius: 6px;
  color: #ffd54f; font-size: 17px; font-weight: 900; text-align: center;
  box-shadow: 0 0 8px rgba(247, 201, 72, .5);
}

/* ---------- 操作按钮行 ---------- */
.ctrl-row {
  flex: none; height: 56px; display: flex; align-items: center;
  gap: 7px; padding: 3px 10px 1px;
}
.ctrl-row button { border: none; cursor: pointer; font-family: inherit;
  color: #fff; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.45);
  position: relative; overflow: hidden; }
.ctrl-row button::before {
  content: ""; position: absolute; top: 3px; left: 12%; right: 12%; height: 38%;
  border-radius: 50%; pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, .55), rgba(255, 255, 255, .04));
}
.ctrl-row button:active { filter: brightness(1.2); }
.ctrl-row button:disabled { filter: saturate(.75) brightness(.92); cursor: default; }
.btn-oval {
  width: 96px; height: 48px; border-radius: 26px; font-size: 21px;
  background: linear-gradient(#a5d66f, #4caf50 45%, #2e7d32);
  border-bottom: 4px solid #1b5e20 !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, .4), inset 0 2px 3px rgba(255,255,255,.5);
}
.btn-round {
  width: 50px; height: 50px; border-radius: 50%; font-size: 16px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, .4), inset 0 2px 3px rgba(255,255,255,.5);
}
.btn-round.blue { background: radial-gradient(circle at 35% 30%, #90caf9, #1e88e5 60%, #0d47a1); }
.btn-round.green { background: radial-gradient(circle at 35% 30%, #b9f6ca, #43a047 60%, #1b5e20); }
.score-stack { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.score-box {
  height: 24px; line-height: 20px; text-align: center;
  background: #071233; border: 2px solid #2b5cd9; border-radius: 5px;
  color: #fff; font-size: 15px; font-weight: 800;
  box-shadow: inset 0 0 6px #030a20;
}
.btn-square {
  width: 74px; height: 50px; border-radius: 8px; font-size: 16px; line-height: 1.15;
  background: linear-gradient(#ff8a65, #e64a19 55%, #bf360c);
  border-bottom: 4px solid #870000 !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, .4), inset 0 2px 3px rgba(255,255,255,.4);
}
.btn-square b { display: block; font-size: 15px; color: #ffee58; }

/* ---------- 押注数字区 ---------- */
.bet-grid {
  flex: none; display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 5px; padding: 3px 10px 4px;
}
.bet-col { display: flex; flex-direction: column; gap: 4px; }
.odds-box {
  height: 26px; line-height: 22px; text-align: center;
  background: #120d02; border: 2px solid #f7c948; border-radius: 5px;
  color: #ffd54f; font-size: 16px; font-weight: 900;
  box-shadow: inset 0 0 5px #000;
}
.bet-col.staked .odds-box {
  background: linear-gradient(#fff59d, #fbc02d); color: #4e2c00;
  box-shadow: 0 0 8px rgba(255, 213, 79, .8);
}
.num-box {
  height: 22px; line-height: 18px; text-align: center;
  background: #071233; border: 2px solid #2b5cd9; border-radius: 5px;
  color: #e3f2fd; font-size: 14px; font-weight: 800;
  box-shadow: inset 0 0 6px #030a20;
}
.num-box.win-flash { color: #ffee58; animation: hitFlash .3s steps(2) 6; }

/* ---------- 八张符号卡 ---------- */
.cards-row {
  flex: 1; display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 6px; padding: 4px 10px 6px;
}
.card {
  border-radius: 10px; border: 2px solid #4fc3f7;
  background: linear-gradient(#ffffff 0%, #ffd3e2 40%, #ff6f9c 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .45), inset 0 2px 2px #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
}
.card:active { transform: scale(.93); }
.card.staked {
  border-color: #ffd54f;
  box-shadow: 0 0 14px rgba(255, 213, 79, .8), 0 3px 6px rgba(0, 0, 0, .45),
    inset 0 2px 2px #fff;
}
.card .icon { font-size: 38px; filter: drop-shadow(0 2px 2px rgba(90, 0, 40, .4)); }
.card .bar-face b {
  display: block; font-size: 16px; font-weight: 900; color: #fff;
  background: linear-gradient(#ff8a80, #c62828); border-radius: 3px;
  padding: 1px 5px; border: 1px solid #7f0000; letter-spacing: 1px;
  transform: skewX(-6deg);
}
.card .bar-face b + b { margin-top: 2px; }
.card .seven-face {
  font-size: 44px; font-weight: 900; color: #e53935; font-style: italic;
  -webkit-text-stroke: 1.5px #ffd54f; text-shadow: 0 2px 3px rgba(120, 0, 0, .5);
}

/* ---------- 底部导航 ---------- */
.bottom-nav {
  flex: none; height: 60px; display: flex; gap: 6px;
  padding: 3px 10px 6px; background: linear-gradient(#0d2270, #081744);
}
.bottom-nav button {
  flex: 1; border: none; cursor: pointer; font-family: inherit;
  background: transparent; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
.bottom-nav i { font-style: normal; font-size: 22px;
  filter: grayscale(1) sepia(1) saturate(4) hue-rotate(-12deg) brightness(1.25)
          drop-shadow(0 0 3px rgba(255, 202, 40, .7)); }
.bottom-nav span {
  display: block; width: 100%; line-height: 18px;
  background: linear-gradient(#123a8f, #0a1f5c);
  border: 1.5px solid #f7c948; border-radius: 9px;
  color: #ffe082; font-size: 13px; font-weight: 700;
}
.bottom-nav button:active i { transform: scale(1.15); }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(2, 8, 30, .72);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.mask.hidden { display: none; }
.dialog {
  width: min(86vw, 420px); max-height: 72vh; display: flex; flex-direction: column;
  background: linear-gradient(#12307f, #0a1c55);
  border: 3px solid #f7c948; border-radius: 14px;
  box-shadow: 0 0 30px rgba(247, 201, 72, .35);
}
.dialog-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid rgba(247, 201, 72, .4);
  color: #ffd54f; font-size: 18px; font-weight: 900;
}
#dlgClose { background: none; border: none; color: #ffd54f;
  font-size: 26px; line-height: 1; cursor: pointer; }
.dialog-body { padding: 12px 14px; overflow-y: auto; color: #e3f2fd; font-size: 15px; }
.dialog-body table { width: 100%; border-collapse: collapse; }
.dialog-body th, .dialog-body td {
  border: 1px solid rgba(79, 195, 247, .4); padding: 5px 6px;
  text-align: center; font-size: 14px;
}
.dialog-body th { color: #ffd54f; }
.dialog-body .rec-in { color: #69f0ae; } .dialog-body .rec-out { color: #ff8a80; }
.dlg-btn {
  display: block; margin: 12px auto 4px; padding: 8px 26px;
  background: linear-gradient(#ffd54f, #ff8f00); border: none; border-radius: 20px;
  color: #4e2c00; font-size: 16px; font-weight: 900; cursor: pointer;
}
.dialog-body p { margin: 6px 0; line-height: 1.55; }
.dialog-body .tip { color: #90caf9; font-size: 13px; }

/* ---------- 横幅提示(免费跑 / LUCK 揭晓 / 大奖) ---------- */
.banner {
  position: absolute; inset: 0; z-index: 20; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.banner.hidden { display: none; }
.banner span {
  padding: 14px 32px; border-radius: 16px; text-align: center;
  font-size: 28px; font-weight: 900; color: #ffe082;
  background: rgba(5, 10, 35, .9);
  border: 3px solid #f7c948;
  box-shadow: 0 0 28px rgba(247, 201, 72, .65);
  text-shadow: 0 0 12px rgba(255, 213, 79, .8);
  animation: bannerPop .28s ease-out;
}
.banner span i {
  display: block; font-style: normal; font-size: 32px; color: #69f0ae;
  margin-top: 6px; text-shadow: 0 0 10px rgba(105, 240, 174, .8);
}
.banner-fail span { color: #b0bec5; border-color: #78909c;
  box-shadow: none; text-shadow: none; }
.banner-prize span {
  animation: bannerPop .28s ease-out, prizeGlow .9s ease-in-out infinite;
}
@keyframes bannerPop { from { transform: scale(.4); opacity: 0; } }
@keyframes prizeGlow { 50% { box-shadow: 0 0 55px rgba(255, 213, 79, 1); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%);
  background: rgba(5, 10, 30, .92); color: #ffd54f;
  border: 2px solid #f7c948; border-radius: 10px;
  padding: 10px 22px; font-size: 17px; font-weight: 800;
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 60;
  white-space: nowrap;
}
.toast.show { opacity: 1; }
