/* 招财虎 — 竖屏手机 H5 画布，按 390×844 设计后等比缩放 */
:root {
  --w: 390px;
  --h: 844px;
  --red-deep: #4a060c;
  --red: #8d1018;
  --red-bright: #d01924;
  --gold: #f6d15a;
  --gold-deep: #c48a12;
  --gold-shine: #fff3b0;
  --ink: #3a1a0a;
  --cream: #fff6d9;
  --frame: #e8b423;
  --safe: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: #140306;
  font-family: "PingFang SC", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  user-select: none; touch-action: manipulation;
}
#viewport {
  width: 100vw; width: 100dvw;
  height: 100vh; height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background:
    radial-gradient(ellipse at 50% 30%, #3a0a10 0%, #140306 70%);
}
#stage {
  width: var(--w); height: var(--h);
  position: relative;
  transform-origin: center center;
  flex-shrink: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 18%, #b31b22 0%, #6b0b12 42%, #3c070c 100%);
  color: var(--cream);
  box-shadow: 0 0 0 2px #5a0a10, 0 12px 40px rgba(0,0,0,.55);
}
#stage.mode-huhu {
  background:
    radial-gradient(ellipse at 50% 20%, #ffe28a 0%, #e0a01a 38%, #8a4e00 100%);
}
#stage.mode-huhu .reel-frame {
  box-shadow:
    0 0 0 3px #7a3d00,
    0 0 28px 8px rgba(255, 214, 80, .85),
    inset 0 0 18px rgba(255, 240, 180, .35);
}

/* background decor */
.bg-lanterns { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.clouds {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 12% 22%, rgba(255,220,150,.18) 0 40px, transparent 41px),
    radial-gradient(circle at 88% 18%, rgba(255,220,150,.16) 0 36px, transparent 37px);
}
.lantern {
  position: absolute; top: 72px; width: 46px; height: 64px;
  background:
    radial-gradient(circle at 50% 30%, #ffd86a, transparent 40%),
    linear-gradient(#f3c14a, #e3222c 18%, #b91018 70%, #7a0c10);
  border-radius: 18px 18px 16px 16px;
  box-shadow: 0 6px 10px rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.3);
}
.lantern::before {
  content: ""; position: absolute; left: 50%; top: -10px; width: 2px; height: 12px;
  background: #e8c56a; transform: translateX(-50%);
}
.lantern::after {
  content: ""; position: absolute; left: 50%; bottom: -16px; width: 8px; height: 16px;
  background: linear-gradient(#f6d15a, #c48a12); transform: translateX(-50%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}
.lantern.left { left: 10px; }
.lantern.right { right: 10px; }
#stage.mode-huhu .lantern {
  filter: saturate(1.2) brightness(1.15);
}

.topbar, .mascot-area, .reel-wrap, .win-board, .controls { position: relative; z-index: 2; }

.topbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 0;
}
.logo {
  margin: 0; font-size: 24px; letter-spacing: 2px;
  background: linear-gradient(#fff8d0, #f0c43a 45%, #c88710);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; font-weight: 900;
  filter: drop-shadow(0 2px 0 #6b2a00);
}
.topbar-right { display: flex; gap: 6px; }
.icon-btn, .round-btn, .close-btn, .pager button {
  appearance: none; border: 0; cursor: pointer;
  font-weight: 700; color: #4a2200;
  background: linear-gradient(#ffe9a0, #e0a224);
  box-shadow: 0 2px 0 #8a5a00, inset 0 1px 0 #fff6cc;
}
.icon-btn {
  height: 32px; padding: 0 10px; border-radius: 16px; font-size: 13px;
}
.icon-btn:active, .round-btn:active, .spin-btn:active, .primary-btn:active { transform: translateY(1px); }

.mascot-area {
  height: 148px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  position: relative;
}
.mascot-glow {
  position: absolute; width: 180px; height: 90px; bottom: 20px;
  background: radial-gradient(ellipse, rgba(255,210,80,.45), transparent 70%);
  pointer-events: none;
}
.mascot { width: 168px; height: 136px; z-index: 1; }
.mascot svg, .splash-tiger svg, .feature-tiger svg { width: 100%; height: 100%; display: block; }
.mascot.jump {
  animation: tigerJump 900ms cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes tigerJump {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-28px) scale(1.12) rotate(-6deg); }
  70% { transform: translateY(8px) scale(1.04) rotate(3deg); }
  100% { transform: translateY(0) scale(1); }
}
.title-plaque {
  margin-top: -6px; font-size: 11px; letter-spacing: 3px; color: #ffe9a4;
  text-shadow: 0 1px 0 #5a1a00;
}

.reel-wrap { padding: 4px 22px 0; }
.reel-frame {
  position: relative;
  width: 346px; height: 346px; margin: 0 auto;
  padding: 16px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, #ffe9a0, #d4a017 40%, #9a6408 70%, #f3d36a);
  box-shadow:
    0 0 0 3px #6a3a00,
    0 8px 0 #5a2800,
    0 12px 22px rgba(0,0,0,.4),
    inset 0 2px 0 #fff4c4;
}
.reel-frame::before {
  content: ""; position: absolute; inset: 8px; border-radius: 12px;
  border: 2px solid rgba(120, 60, 0, .35);
  pointer-events: none;
}
.frame-shine {
  position: absolute; inset: 0; border-radius: 18px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.28), transparent 28%);
}
.reels {
  width: 314px; height: 314px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 7px;
  background: #2a080c; border-radius: 8px; overflow: hidden;
  padding: 7px;
}
.cell-window {
  position: relative; overflow: hidden; border-radius: 8px;
  background: linear-gradient(#4a1016, #2a080c);
  box-shadow: inset 0 0 8px rgba(0,0,0,.55);
}
.col-strip { will-change: transform; display: flex; flex-direction: column; }
.cell {
  width: 100%;
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 2px;
  flex: 0 0 100%;
}
.cell .sym { width: 100%; height: 100%; }
.cell.locked {
  outline: 2px solid #ffe27a;
  outline-offset: -3px;
  filter: drop-shadow(0 0 8px #ffd24a);
  border-radius: 10px;
}
.cell.win-glow {
  animation: winPulse 700ms ease-in-out infinite;
}
@keyframes winPulse {
  0%,100% { filter: brightness(1); }
  50% { filter: brightness(1.35) drop-shadow(0 0 8px #ffe080); }
}

.payline-overlay {
  position: absolute; left: 16px; top: 16px; width: 314px; height: 314px;
  pointer-events: none; overflow: visible; z-index: 4;
}

.win-board {
  margin: 10px 28px 0;
  height: 54px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(#3a0c10, #24070a);
  border: 2px solid #e0a224;
  box-shadow: inset 0 0 12px rgba(0,0,0,.4), 0 2px 0 #5a2800;
}
.win-label { font-size: 13px; color: #f3d36a; letter-spacing: 1px; }
.win-value {
  font-size: 26px; font-weight: 900; color: #ffe9a0;
  text-shadow: 0 0 12px rgba(255, 200, 60, .5);
  font-variant-numeric: tabular-nums;
}
.win-board.celebrate { animation: boardFlash 500ms ease-in-out 3; }
@keyframes boardFlash {
  0%,100% { box-shadow: inset 0 0 12px rgba(0,0,0,.4), 0 0 0 #f6d15a; }
  50% { box-shadow: inset 0 0 16px rgba(255,220,80,.4), 0 0 18px #f6d15a; }
}

.controls { padding: 10px 14px 8px; }
.hud-row { display: flex; gap: 8px; margin-bottom: 10px; }
.hud-chip {
  flex: 1; appearance: none; border: 1px solid #e0a224; border-radius: 10px;
  background: linear-gradient(#4a1016, #2c090c); color: var(--cream);
  padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  cursor: pointer;
}
.hud-k { font-size: 11px; color: #f3d36a; }
.hud-v { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

.action-row { display: flex; align-items: center; justify-content: space-between; }
.side-actions { display: flex; flex-direction: column; gap: 8px; width: 72px; }
.round-btn {
  height: 36px; border-radius: 18px; font-size: 13px;
}
.round-btn.on {
  background: linear-gradient(#fff1b8, #ffb020);
  box-shadow: 0 0 10px rgba(255,180,40,.7), 0 2px 0 #8a5a00;
  color: #6a1a00;
}
.spin-btn {
  position: relative; width: 108px; height: 108px; border-radius: 50%;
  border: 0; cursor: pointer; color: #5a2200;
  background:
    radial-gradient(circle at 35% 30%, #fff8d0, #f0c43a 42%, #c88710 70%, #8a5a00);
  box-shadow:
    0 0 0 5px #6a3a00,
    0 0 0 8px #f3d36a,
    0 8px 0 #4a2400,
    0 12px 18px rgba(0,0,0,.4);
}
.spin-ring {
  position: absolute; inset: 8px; border-radius: 50%;
  border: 2px dashed rgba(120,60,0,.35); pointer-events: none;
}
.spin-text { font-size: 26px; font-weight: 900; letter-spacing: 2px; position: relative; }
.spin-btn.spinning .spin-ring { animation: spinDash 1s linear infinite; }
@keyframes spinDash { to { transform: rotate(360deg); } }
.spin-btn:disabled { filter: grayscale(.15) brightness(.9); cursor: default; }

.disclaimer {
  margin: 8px 0 0; text-align: center; font-size: 11px; color: rgba(255,232,180,.7);
  letter-spacing: .5px;
}

/* feature overlay */
.feature-overlay {
  position: absolute; inset: 0; z-index: 20; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.feature-overlay[hidden] { display: none; }
.feature-gold {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255,220,80,.0), rgba(255,180,0,.0));
  animation: goldWash 800ms ease forwards;
}
@keyframes goldWash {
  0% { background: radial-gradient(circle at 50% 40%, rgba(255,240,160,.0), rgba(180,80,0,.0)); }
  40% { background: radial-gradient(circle at 50% 40%, rgba(255,240,160,.85), rgba(180,80,0,.45)); }
  100% { background: radial-gradient(circle at 50% 40%, rgba(255,240,160,.15), rgba(180,80,0,.12)); }
}
.feature-tiger {
  width: 240px; height: 200px; z-index: 2;
  animation: featureTigerIn 900ms cubic-bezier(.15,1.4,.4,1) both;
  filter: drop-shadow(0 8px 16px rgba(80,30,0,.5));
}
@keyframes featureTigerIn {
  0% { transform: translateY(160px) scale(.4) rotate(-12deg); opacity: 0; }
  55% { transform: translateY(-18px) scale(1.12) rotate(4deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
.feature-banner {
  z-index: 3; margin-top: 8px;
  padding: 10px 28px; border-radius: 12px;
  background: linear-gradient(#8d1018, #d01924 50%, #8d1018);
  border: 3px solid #f6d15a;
  box-shadow: 0 0 24px rgba(255,200,60,.8), 0 6px 0 #5a2800;
  animation: bannerIn 700ms 200ms cubic-bezier(.2,1.3,.4,1) both;
}
.feature-banner span {
  font-size: 36px; font-weight: 900; letter-spacing: 4px;
  background: linear-gradient(#fff8d0, #f0c43a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #5a0000);
}
@keyframes bannerIn {
  0% { transform: scaleX(.2) scaleY(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.feature-overlay.fadeout { animation: fo 400ms ease forwards; }
@keyframes fo { to { opacity: 0; } }

.fx-canvas {
  position: absolute; inset: 0; z-index: 18; pointer-events: none;
}

/* modals */
.modal {
  position: absolute; inset: 0; z-index: 30;
  background: rgba(20, 3, 6, .72);
  display: flex; align-items: center; justify-content: center;
  padding: 18px 14px;
}
.modal[hidden] { display: none; }
.modal.show { display: flex; }
.panel {
  width: 100%; max-height: 92%;
  background: linear-gradient(#6b0b12, #3c070c);
  border: 3px solid #e0a224;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,230,150,.3);
  display: flex; flex-direction: column; overflow: hidden;
  color: var(--cream);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(224,162,36,.4);
}
.panel-head h2 { margin: 0; font-size: 18px; color: #ffe9a0; }
.close-btn { height: 30px; padding: 0 10px; border-radius: 15px; font-size: 13px; }
.panel-body { padding: 12px 14px 16px; }
.panel-body.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }

.splash { background: rgba(20,3,6,.82); }
.splash-inner { text-align: center; padding: 22px 16px 20px; }
.splash-tiger { width: 200px; height: 170px; margin: 0 auto 6px; }
.splash-inner h2 {
  margin: 0; font-size: 36px;
  background: linear-gradient(#fff8d0, #f0c43a 50%, #c88710);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #6b2a00);
}
.splash-sub { margin: 4px 0 16px; color: #f3d36a; letter-spacing: 3px; }
.primary-btn {
  appearance: none; border: 0; cursor: pointer;
  width: 100%; height: 46px; border-radius: 23px;
  font-size: 18px; font-weight: 800; color: #4a2200;
  background: linear-gradient(#ffe9a0, #e0a224);
  box-shadow: 0 3px 0 #8a5a00, inset 0 1px 0 #fff6cc;
}
.primary-btn.ghost { margin-top: 12px; background: linear-gradient(#fff1c4, #d4a64a); }

.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px;
}
.stat-grid div {
  background: rgba(0,0,0,.25); border: 1px solid rgba(224,162,36,.45);
  border-radius: 10px; padding: 8px 4px; text-align: center;
}
.stat-grid span { display: block; font-size: 11px; color: #f3d36a; }
.stat-grid b { font-size: 15px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 15px;
}
.switch-row input { width: 20px; height: 20px; accent-color: #e0a224; }
.block-title { margin: 12px 0 8px; color: #f3d36a; font-size: 14px; font-weight: 700; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row.tall { gap: 10px; }
.chip {
  appearance: none; border: 1px solid #e0a224; background: rgba(0,0,0,.28);
  color: #fff6d9; border-radius: 18px; height: 36px; padding: 0 14px;
  font-weight: 700; cursor: pointer;
}
.chip.on {
  background: linear-gradient(#ffe9a0, #e0a224); color: #4a2200;
  box-shadow: 0 0 8px rgba(255,200,80,.5);
}
.total-bet { margin: 14px 0; text-align: center; font-size: 16px; }
.total-bet b { color: #ffe9a0; font-size: 22px; }
.hint { font-size: 13px; color: rgba(255,232,180,.8); margin: 0 0 10px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  flex: 1; height: 34px; border-radius: 17px; border: 1px solid #e0a224;
  background: rgba(0,0,0,.28); color: #fff6d9; font-weight: 700; cursor: pointer;
}
.tab.on { background: linear-gradient(#ffe9a0, #e0a224); color: #4a2200; }
.tab-page { display: none; }
.tab-page.on { display: block; }
.tab-page h3 { margin: 12px 0 6px; color: #ffe9a0; font-size: 16px; }
.tab-page p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.65; color: #fff3d0; }
.rule-symbol { width: 72px; height: 72px; margin: 6px 0 8px; }
.rule-symbol svg { width: 100%; height: 100%; }

.line-diagrams { display: grid; gap: 10px; }
.line-card {
  background: rgba(0,0,0,.25); border: 1px solid rgba(224,162,36,.35);
  border-radius: 10px; padding: 8px; display: flex; align-items: center; gap: 10px;
}
.line-card svg { width: 120px; height: 120px; flex-shrink: 0; }
.line-card p { margin: 0; font-size: 13px; }

.paytable { display: flex; flex-direction: column; gap: 8px; }
.pay-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.22); border-radius: 10px; padding: 6px 8px;
  border: 1px solid rgba(224,162,36,.3);
}
.pay-row .sym { width: 56px; height: 56px; flex-shrink: 0; }
.pay-row .name { flex: 1; font-weight: 700; }
.pay-row .mult { color: #ffe9a0; font-weight: 800; }

.history-list { display: flex; flex-direction: column; gap: 8px; min-height: 280px; max-height: 520px; overflow-y: auto; }
.hist-item {
  text-align: left; width: 100%;
  background: rgba(0,0,0,.25); border: 1px solid rgba(224,162,36,.4);
  border-radius: 10px; padding: 8px 10px; color: inherit; cursor: pointer;
}
.hist-item .row1 { display: flex; justify-content: space-between; font-size: 13px; }
.hist-item .row2 { display: flex; justify-content: space-between; margin-top: 4px; font-size: 13px; }
.hist-item .win { color: #ffe9a0; font-weight: 800; }
.hist-item .tag {
  display: inline-block; margin-top: 4px; font-size: 11px; padding: 1px 6px;
  border-radius: 8px; background: linear-gradient(#d01924, #8d1018);
  border: 1px solid #f6d15a; color: #ffe9a0; font-weight: 700;
}
.hist-empty { text-align: center; padding: 40px 10px; color: rgba(255,232,180,.7); }
.pager {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px;
}
.pager button { height: 32px; padding: 0 12px; border-radius: 16px; }
.pager button:disabled { opacity: .4; }

.detail-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  width: 210px; margin: 8px auto 12px;
}
.detail-grid .dcell { aspect-ratio: 1; }
.detail-meta p { margin: 4px 0; font-size: 14px; }
.detail-meta b { color: #ffe9a0; }

/* big win toast */
.bigwin-toast {
  position: absolute; left: 50%; top: 42%; z-index: 22;
  transform: translate(-50%, -50%) scale(.6);
  padding: 10px 22px; border-radius: 14px;
  background: linear-gradient(#8d1018, #d01924);
  border: 3px solid #f6d15a;
  color: #ffe9a0; font-size: 28px; font-weight: 900; letter-spacing: 2px;
  box-shadow: 0 0 24px rgba(255,200,60,.85);
  animation: toastIn 700ms cubic-bezier(.2,1.3,.3,1) both;
  pointer-events: none; white-space: nowrap;
}
@keyframes toastIn {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
