/* ============================================================
   雷神之錘 (Power of Thor) — 6x5 雷霆掉落消除機台樣式表
   風格：北歐雷霆神域、電光紫藍色系、天降倍數落雷
   ============================================================ */

:root {
  --thor-cyan: #00f5ff;
  --thor-blue: #3867d6;
  --thor-purple: #8854d0;
  --thor-purple-dark: #2c0b4d;
  --thor-gold: #ffd700;
  --thor-gold-glow: #ffeaa7;
  --thor-bg: #090214;
  --thor-card: rgba(26, 9, 50, 0.9);
  --thor-border: rgba(255, 215, 0, 0.45);
  --grid-cell-size: min(8.2vw, 11vh, 64px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body[data-theme="thor"] {
  background: 
    linear-gradient(180deg, rgba(6, 1, 16, 0.75) 0%, rgba(22, 6, 45, 0.8) 40%, rgba(4, 1, 10, 0.95) 100%),
    url('assets/thor_bg.jpg') center top / cover no-repeat fixed;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", "PingFang SC", "Microsoft YaHei", sans-serif;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* 頂部通用導航條 */
.app-header {
  height: calc(52px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  background: rgba(7, 11, 25, 0.95);
  border-bottom: 1px solid var(--thor-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10001;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: visible !important;
}

/* Iframe 嵌入環境優化：隱藏 8-in-1 大廳導航列，精簡為 38px 專屬頂部條，釋放大量垂直空間，杜絕裁切 */
body.is-embedded .app-header {
  height: calc(38px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
  background: rgba(7, 11, 25, 0.98);
  overflow: visible !important;
}
body.is-embedded .game-switcher {
  display: none !important;
}
body.is-embedded .header-right {
  width: 100%;
  justify-content: space-between;
}

.game-switcher {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
.game-switcher::-webkit-scrollbar { display: none; }

.switch-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #9cb1d6;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
}

.switch-tab:hover, .switch-tab.active {
  background: linear-gradient(135deg, rgba(84, 160, 255, 0.3), rgba(95, 39, 205, 0.2));
  border-color: var(--thor-cyan);
  color: #fff;
  box-shadow: 0 0 14px rgba(0, 210, 211, 0.4);
}

.badge-hot {
  background: linear-gradient(135deg, #ff4757, #eb2f06);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  overflow: visible !important;
  position: relative;
  z-index: 10002;
}

.wallet-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--thor-border);
  padding: 4px 8px;
  border-radius: 8px;
}

.wallet-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.wallet-label {
  font-size: 9px;
  color: #9cb1d6;
}

.wallet-amount {
  font-size: 14px;
  font-weight: 800;
  color: var(--thor-cyan);
  font-family: "JetBrains Mono", monospace, sans-serif;
}

.wallet-curr {
  font-size: 10px;
  color: #fff;
  margin-left: 2px;
}

.thor-refill {
  background: linear-gradient(135deg, #0abde3, #10ac84);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
}
.thor-refill:active { transform: scale(0.92); }

.currency-select {
  background: #0f1838;
  border: 1px solid var(--thor-border);
  color: #fff;
  font-size: 11px;
  padding: 5px;
  border-radius: 6px;
  outline: none;
}

.btn-header-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
}

/* 遊戲主舞台區域 */
.thor-stage-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  gap: 16px;
  overflow: hidden;
  position: relative;
}

/* 左側功能面板 */
.thor-side-panel {
  width: 175px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.feature-card {
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.thor-buy-card {
  background: linear-gradient(135deg, rgba(42, 14, 82, 0.95), rgba(16, 4, 36, 0.95));
  border: 2px solid var(--thor-gold);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.3), inset 0 0 15px rgba(0, 245, 255, 0.15);
}
.thor-buy-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 26px rgba(255, 215, 0, 0.6), inset 0 0 20px rgba(0, 245, 255, 0.3);
}
.thor-buy-card:active { transform: scale(0.96); }

.card-badge {
  font-size: 8px;
  background: var(--thor-cyan);
  color: #000;
  font-weight: 900;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  margin-bottom: 4px;
}

.card-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}

.card-price {
  font-size: 16px;
  font-weight: 900;
  color: var(--thor-gold);
  margin: 4px 0;
}

.card-sub {
  font-size: 9px;
  color: #cbd5e1;
  line-height: 1.2;
}

.thor-ante-card {
  border-color: rgba(95, 39, 205, 0.5);
}

.ante-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.ante-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--thor-cyan);
}

.ante-desc {
  font-size: 9px;
  color: #9cb1d6;
  text-align: left;
}

/* Switch toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333; transition: .3s; border-radius: 20px;
}
.slider:before {
  position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px;
  background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--thor-cyan); }
input:checked + .slider:before { transform: translateX(16px); }

.thor-mult-card {
  background: radial-gradient(circle, rgba(30, 45, 95, 0.9), rgba(10, 15, 35, 0.95));
  border: 1px solid var(--thor-blue);
}

.mult-icon { font-size: 20px; margin-bottom: 2px; }
.mult-label { font-size: 10px; color: #9cb1d6; font-weight: 600; }
.mult-val {
  font-size: 26px;
  font-weight: 900;
  color: var(--thor-gold);
  text-shadow: 0 0 15px rgba(255, 211, 42, 0.7);
  font-family: "JetBrains Mono", monospace;
  margin: 2px 0;
}
.mult-hint { font-size: 8px; color: #64748b; }

/* 免費旋轉指示器 */
.thor-fs-indicator {
  background: linear-gradient(135deg, #341f97, #0abde3);
  border: 2px solid var(--thor-cyan);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  animation: pulse-thor 1.5s infinite alternate;
}
@keyframes pulse-thor {
  from { box-shadow: 0 0 10px rgba(0, 210, 211, 0.4); }
  to { box-shadow: 0 0 25px rgba(84, 160, 255, 0.8); }
}
.fs-badge { font-size: 9px; font-weight: 800; color: #c8d6e5; }
.fs-count-box { margin: 4px 0; }
.fs-num { font-size: 28px; font-weight: 900; color: #fff; }
.fs-text { font-size: 10px; color: #c8d6e5; margin-left: 4px; }
.fs-total-won { font-size: 11px; font-weight: 700; color: #fff; }
.fs-win-val { color: var(--thor-gold); font-weight: 800; }

/* 中央 6x5 瀑布流盤面 */
.thor-grid-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-height: 100%;
}

.temple-arch-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.hud-telemetry {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  font-weight: 800;
  color: var(--thor-cyan);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--thor-border);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 8px rgba(0, 210, 211, 0.3);
}

.thunder-bolt {
  font-size: 14px;
  color: var(--thor-gold);
  filter: drop-shadow(0 0 6px var(--thor-gold));
}

.thor-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--thor-cyan);
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0, 210, 211, 0.6);
}

.thor-board {
  position: relative;
  background: radial-gradient(circle at 50% 20%, rgba(35, 12, 65, 0.94) 0%, rgba(9, 2, 20, 0.98) 100%);
  border: 3px solid var(--thor-gold);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 0 35px rgba(138, 43, 226, 0.45), 0 0 16px rgba(0, 245, 255, 0.35), inset 0 0 25px rgba(255, 215, 0, 0.15);
  outline: 1px solid rgba(0, 245, 255, 0.4);
  animation: board-aurora 6s ease-in-out infinite alternate;
  overflow: hidden;
  contain: paint layout;
}

@keyframes board-aurora {
  0% { box-shadow: 0 0 35px rgba(138, 43, 226, 0.45), 0 0 16px rgba(0, 245, 255, 0.35), inset 0 0 25px rgba(255, 215, 0, 0.15); }
  50% { box-shadow: 0 0 45px rgba(0, 245, 255, 0.55), 0 0 24px rgba(255, 215, 0, 0.4), inset 0 0 30px rgba(0, 245, 255, 0.2); }
  100% { box-shadow: 0 0 35px rgba(138, 43, 226, 0.45), 0 0 16px rgba(0, 245, 255, 0.35), inset 0 0 25px rgba(255, 215, 0, 0.15); }
}

.thor-grid {
  display: grid;
  grid-template-columns: repeat(6, var(--grid-cell-size));
  grid-template-rows: repeat(5, var(--grid-cell-size));
  gap: 4px;
  position: relative;
  overflow: hidden;
  contain: paint layout;
}

.grid-cell {
  background: radial-gradient(circle at 50% 30%, rgba(46, 15, 82, 0.82) 0%, rgba(12, 3, 26, 0.94) 100%);
  border: 1.5px solid rgba(255, 215, 0, 0.35);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 12px rgba(0, 245, 255, 0.1), 0 3px 8px rgba(0,0,0,0.6);
  will-change: transform;
  contain: paint layout style;
}

.grid-cell.intro-cascade {
  animation: cell-intro 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

@keyframes cell-intro {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.75);
    filter: brightness(2) drop-shadow(0 0 16px var(--thor-cyan));
  }
  60% {
    transform: translateY(3px) scale(1.03);
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

.grid-cell.highlight-win,
.grid-cell.electric-burst {
  border-color: var(--thor-cyan) !important;
  box-shadow: 0 0 0 2px var(--thor-cyan), 0 0 20px rgba(0, 245, 255, 0.9), inset 0 0 14px rgba(0, 245, 255, 0.5) !important;
  background: radial-gradient(circle at 50% 50%, rgba(0, 245, 255, 0.45) 0%, rgba(255, 215, 0, 0.3) 100%) !important;
  animation: cell-electric-pulse 0.28s infinite alternate ease-in-out;
  z-index: 10;
}

@keyframes cell-electric-pulse {
  from {
    transform: scale(0.98);
    box-shadow: 0 0 0 2px var(--thor-cyan), 0 0 12px rgba(0, 245, 255, 0.7), inset 0 0 8px rgba(0, 245, 255, 0.3);
  }
  to {
    transform: scale(1.06);
    box-shadow: 0 0 0 3px #fff, 0 0 24px var(--thor-cyan), inset 0 0 18px rgba(0, 245, 255, 0.6);
  }
}

.grid-cell.exploding {
  animation: cell-explode 0.45s forwards;
}

.grid-cell.falling {
  animation: cell-fall 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes cell-fall {
  0% { transform: translateY(-40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* 老虎機真實高速滾動 (Reel Blur Roll) - GPU 合成層加速，Safari 安全 */
.grid-cell.rolling {
  animation: reel-motion-blur 0.12s linear infinite;
  opacity: 0.65;
  will-change: transform, opacity;
}

@keyframes reel-motion-blur {
  0%   { transform: translateY(0) scale(1); opacity: 0.65; }
  25%  { transform: translateY(10px) scale(1, 0.96); opacity: 0.45; }
  50%  { transform: translateY(0) scale(1); opacity: 0.7; }
  75%  { transform: translateY(-10px) scale(1, 0.96); opacity: 0.45; }
  100% { transform: translateY(0) scale(1); opacity: 0.65; }
}

/* 依序停軸與真實回彈定位 (Staggered Reel Landing with Elastic Bounce) */
.grid-cell.reel-landing {
  animation: reel-elastic-land 0.36s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  will-change: transform, opacity;
}

@keyframes reel-elastic-land {
  0% {
    transform: translateY(-28px) scaleY(1.12);
    opacity: 0.4;
  }
  65% {
    transform: translateY(4px) scaleY(0.96);
    opacity: 1;
  }
  85% {
    transform: translateY(-2px) scaleY(1.02);
  }
  100% {
    transform: translateY(0) scaleY(1);
    opacity: 1;
  }
}

/* SCATTER 雷神降臨特寫光環 */
.grid-cell.scatter-alert {
  box-shadow: 0 0 0 3px #00f5ff, 0 0 24px #ffd700, inset 0 0 14px rgba(0, 245, 255, 0.6) !important;
  border-color: #00f5ff !important;
  animation: scatter-pulse 0.4s ease-in-out 2 alternate;
}
@keyframes scatter-pulse {
  from { transform: scale(1); filter: brightness(1); }
  to { transform: scale(1.12); filter: brightness(1.6); }
}

/* 3D 向量高科技符號視覺 */
.symbol-vector-box {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.symbol-svg {
  width: calc(var(--grid-cell-size) * 0.84);
  height: calc(var(--grid-cell-size) * 0.84);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.9));
  transition: transform 0.25s, filter 0.25s;
  animation: symbol-breathe 5s ease-in-out infinite alternate;
  will-change: transform;
}

/* 效能優化：僅用 transform，避免每幀重算 filter (GPU killer) */
@keyframes symbol-breathe {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.grid-cell:hover .symbol-svg {
  transform: scale(1.14);
  filter: drop-shadow(0 0 14px var(--thor-cyan));
}

.symbol-name-tag {
  display: none !important;
}

/* 3D 量子落雷倍數球 (Quantum Plasma Orbs) */
.quantum-orb-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--grid-cell-size) * 0.85);
  height: calc(var(--grid-cell-size) * 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
  animation: orb-levitate 2.5s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes orb-levitate {
  from { transform: translate(-50%, -54%); }
  to { transform: translate(-50%, -46%); }
}

.quantum-orb-core {
  position: absolute;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  box-shadow: 0 0 25px currentColor;
  animation: core-pulse 1s ease-in-out infinite alternate;
}

@keyframes core-pulse {
  from { transform: scale(0.9); filter: brightness(1); }
  to { transform: scale(1.15); filter: brightness(1.5); }
}

.quantum-orb-ring {
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  border: 2px dashed currentColor;
  animation: ring-rotate-cw 4s linear infinite;
}

.quantum-orb-ring-inner {
  position: absolute;
  width: 76%;
  height: 76%;
  border-radius: 50%;
  border: 1.5px dotted currentColor;
  animation: ring-rotate-ccw 2.5s linear infinite;
}

@keyframes ring-rotate-cw {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes ring-rotate-ccw {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

.quantum-orb-text {
  position: relative;
  z-index: 5;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 8px #000, 0 0 16px currentColor;
  letter-spacing: -0.5px;
}

/* 色系等級 */
.orb-blue { color: #54a0ff; }
.orb-blue .quantum-orb-core { background: radial-gradient(circle, #70a1ff 0%, #54a0ff 60%, #2e86de 100%); }

.orb-green { color: #1dd1a1; }
.orb-green .quantum-orb-core { background: radial-gradient(circle, #55efc4 0%, #1dd1a1 60%, #10ac84 100%); }

.orb-purple { color: #a55eea; }
.orb-purple .quantum-orb-core { background: radial-gradient(circle, #d980fa 0%, #a55eea 60%, #5f27cd 100%); }

.orb-gold {
  color: #ffd32a;
  filter: drop-shadow(0 0 15px rgba(255, 159, 67, 0.9));
}
.orb-gold .quantum-orb-core {
  background: radial-gradient(circle, #ffffff 0%, #ffd32a 40%, #ff9f43 100%);
  box-shadow: 0 0 35px #ff9f43, 0 0 15px #ffd32a;
}
.orb-gold .quantum-orb-ring {
  border-color: #ffd32a;
  border-width: 2.5px;
}

/* 掉落消除中獎飛字浮層 */
.thor-announcer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-size: 24px;
  font-weight: 900;
  color: var(--thor-cyan);
  text-shadow: 0 0 20px rgba(0,0,0,0.9), 0 0 10px var(--thor-cyan);
  white-space: nowrap;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s, transform 0.3s;
}

.thor-announcer.show {
  opacity: 1;
  transform: translate(-50%, -70%) scale(1.15);
}

/* 當局中獎明細與乘數結算條 */
.thor-status-bar {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  background: rgba(12, 19, 44, 0.9);
  border: 1px solid var(--thor-border);
  border-radius: 8px;
  padding: 6px 14px;
  width: 100%;
  justify-content: space-around;
}

.status-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.status-col .label {
  font-size: 9px;
  color: #9cb1d6;
}

.status-col .value {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
}

.status-col.highlight .value {
  color: var(--thor-gold);
  font-size: 16px;
}

/* 底部操控儀表板 */
.thor-dashboard {
  height: 78px;
  background: rgba(7, 11, 25, 0.98);
  border-top: 2px solid var(--thor-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 90;
}

.dash-block {
  display: flex;
  align-items: center;
}

.bet-control-block {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.block-label {
  font-size: 9px;
  color: #9cb1d6;
  font-weight: 600;
}

.thor-stepper {
  display: flex;
  align-items: center;
  background: #111b3e;
  border: 1px solid var(--thor-border);
  border-radius: 6px;
  overflow: hidden;
}

.btn-step {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-step:hover { background: rgba(84, 160, 255, 0.2); color: var(--thor-cyan); }
.btn-step.max-btn { width: 36px; font-size: 10px; background: rgba(84, 160, 255, 0.15); color: var(--thor-cyan); }

.bet-display-value {
  padding: 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--thor-gold);
  font-family: "JetBrains Mono", monospace;
  min-width: 55px;
  text-align: center;
}

/* 快捷籌碼 */
.quick-bets-block {
  gap: 4px;
  display: flex;
}

.thor-chip {
  background: #121d42;
  border: 1px solid rgba(84, 160, 255, 0.3);
  color: #9cb1d6;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.thor-chip:hover, .thor-chip.active {
  background: var(--thor-blue);
  color: #fff;
  border-color: var(--thor-cyan);
  font-weight: 800;
}

/* 節奏按鈕群 */
.toggle-group-block {
  gap: 6px;
}

.thor-toggle {
  background: #111b3e;
  border: 1px solid var(--thor-border);
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
}
.thor-toggle.active {
  background: linear-gradient(135deg, rgba(0, 210, 211, 0.3), rgba(95, 39, 205, 0.3));
  border-color: var(--thor-cyan);
  color: var(--thor-cyan);
  box-shadow: 0 0 10px rgba(0, 210, 211, 0.4);
}

/* 旋轉按鈕 */
.thor-spin-btn {
  width: 90px;
  height: 56px;
  background: linear-gradient(135deg, #00d2d3 0%, #2e86de 50%, #5f27cd 100%);
  border: 2px solid #fff;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 210, 211, 0.5);
}
.thor-spin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(0, 210, 211, 0.8);
}
.thor-spin-btn:active { transform: scale(0.94); }
.thor-spin-btn.spinning { background: #333; border-color: #555; box-shadow: none; cursor: not-allowed; }

.spin-icon { font-size: 18px; line-height: 1; }
.spin-label { font-size: 11px; font-weight: 900; letter-spacing: 1px; }

/* 大獎彈窗 */
.win-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.win-modal-overlay.active { display: flex; }

.thor-modal-card {
  background: radial-gradient(circle, #192a56 0%, #080c1d 100%);
  border: 3px solid var(--thor-cyan);
  border-radius: 20px;
  padding: 30px 40px;
  text-align: center;
  box-shadow: 0 0 50px rgba(0, 210, 211, 0.8);
  position: relative;
  overflow: hidden;
  animation: zoom-win 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.win-title-banner {
  font-size: 38px;
  font-weight: 900;
  color: var(--thor-gold);
  text-shadow: 0 0 20px rgba(255, 211, 42, 0.8), 0 4px 6px #000;
  letter-spacing: 2px;
}

.win-amount-counter {
  font-size: 46px;
  font-weight: 900;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  margin: 15px 0;
}

.win-subtitle {
  font-size: 14px;
  color: var(--thor-cyan);
  font-weight: 700;
  margin-bottom: 20px;
}

.thor-collect-btn {
  background: linear-gradient(135deg, #00d2d3, #2e86de);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  padding: 10px 30px;
  cursor: pointer;
}

/* 彈窗通用 */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-backdrop.open { display: flex; }

.modal-dialog {
  background: #0d1530;
  border: 1px solid var(--thor-border);
  border-radius: 12px;
  width: 90%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 16px;
}
.modal-dialog.wide { max-width: 550px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(84, 160, 255, 0.2);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.modal-header h3 { font-size: 15px; color: var(--thor-cyan); }
.modal-close { background: transparent; border: none; color: #aaa; font-size: 18px; cursor: pointer; }

.auto-spin-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.auto-opt {
  background: #141f45;
  border: 1px solid var(--thor-border);
  color: #fff;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
.auto-opt.active { background: var(--thor-cyan); color: #000; }
.thor-action-btn {
  width: 100%;
  background: linear-gradient(135deg, #00d2d3, #2e86de);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  padding: 12px;
  cursor: pointer;
}

.paytable-section { margin-bottom: 16px; line-height: 1.6; font-size: 12px; }
.paytable-section h4 { color: var(--thor-cyan); margin-bottom: 6px; font-size: 13px; }
.paytable-section ul { padding-left: 18px; }
.paytable-grid-symbols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.sym-card {
  background: #131d42;
  border: 1px solid rgba(84, 160, 255, 0.2);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.sym-card-icon { font-size: 24px; }
.sym-card-meta { line-height: 1.3; }
.sym-card-title { font-weight: 800; color: var(--thor-gold); }

/* ============================================================
   全設備與 Iframe 完美適配佈局 (Responsive & Iframe Fit)
   確保在任何 Iframe 寬高、平板、手機皆能 100% 完整展示無裁切
   ============================================================ */

/* 中尺寸 Iframe 或筆電 (寬度 <= 1120px 或 高度 <= 760px) */
@media (max-width: 1120px), (max-height: 760px) {
  :root {
    --grid-cell-size: min(8vw, 10vh, 58px);
  }
  .thor-stage-container {
    padding: 2px 8px;
    gap: 8px;
  }
  .thor-side-panel {
    width: 155px;
    gap: 6px;
  }
  .thor-dashboard {
    height: 66px;
    padding: 0 10px;
  }
}

/* 窄版 Iframe / 平板 / 直式手機 (寬度 <= 850px) */
@media (max-width: 850px) {
  /* 頂部 Header 在手機端自動隱藏 10 遊戲切換標籤，轉為 38px 簡潔 HUD 頂部列 */
  .game-switcher {
    display: none !important;
  }
  .app-header {
    height: calc(38px + env(safe-area-inset-top, 0px)) !important;
    padding: env(safe-area-inset-top, 0px) 10px 0 10px !important;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .wallet-badge {
    padding: 3px 8px;
    gap: 6px;
  }
  .wallet-amount {
    font-size: 13px;
  }
  .btn-refill {
    padding: 3px 8px;
    font-size: 11px;
  }

  :root {
    --grid-cell-size: min(14vw, 7.4vh, 48px);
  }
  .thor-stage-container {
    flex-direction: column;
    padding: 2px 4px;
    gap: 4px;
    justify-content: flex-start;
  }

  /* 特色功能面板轉為橫向極簡工具條，釋放 70px+ 垂直空間給盤面 */
  .thor-side-panel {
    width: 100%;
    max-width: 440px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
  }
  .feature-card {
    min-height: 36px;
    padding: 3px 6px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 6px;
  }
  .buy-bonus-card {
    flex: 1.2;
  }
  .card-badge { display: none; }
  .card-title { font-size: 10px; white-space: nowrap; }
  .card-price { font-size: 11px; margin: 0; white-space: nowrap; }
  .card-sub { display: none; }

  .ante-bet-card {
    flex: 1.1;
    padding: 3px 6px;
  }
  .ante-header {
    margin-bottom: 0;
    gap: 4px;
  }
  .ante-title { font-size: 10px; white-space: nowrap; }
  .ante-desc { display: none; }
  .switch { width: 30px; height: 16px; }
  .slider:before { height: 12px; width: 12px; left: 2px; bottom: 2px; }
  input:checked + .slider:before { transform: translateX(14px); }

  .global-mult-card {
    flex: 0.9;
    flex-direction: row;
    gap: 4px;
    align-items: center;
    padding: 3px 6px;
  }
  .mult-icon { font-size: 13px; }
  .mult-label { font-size: 9px; white-space: nowrap; }
  .mult-val { font-size: 13px; margin: 0; }
  .mult-hint { display: none; }

  .quick-bets-block { display: none; }

  /* 底部操控儀表板：完整適配 iOS Home Bar，右下角按鈕永不被遮擋或裁切 */
  .thor-dashboard {
    height: auto;
    min-height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-top: 4px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 12px));
    padding-left: max(8px, env(safe-area-inset-left, 8px));
    padding-right: max(12px, env(safe-area-inset-right, 12px));
    gap: 6px;
    box-sizing: border-box;
    width: 100%;
  }
  .bet-control-block .block-label { font-size: 8px; }
  .bet-stepper { height: 32px; }
  .btn-step { width: 26px; height: 30px; font-size: 13px; }
  .btn-step.max-btn { width: 32px; font-size: 9px; }
  .bet-display-value { font-size: 13px; min-width: 42px; padding: 0 4px; }

  .toggle-group-block {
    gap: 4px;
  }
  .dash-toggle-btn {
    padding: 4px 6px;
    font-size: 9px;
    min-width: 38px;
    height: 38px;
    border-radius: 6px;
  }
  .dash-toggle-btn .toggle-icon { font-size: 13px; }
  .dash-toggle-btn .toggle-text { font-size: 8px; }

  /* 旋轉按鈕：確保在任何手機上永遠是完美的圓形與適當大小，邊緣絕不被切到 */
  .spin-action-block {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 2px;
  }
  .thor-spin-btn {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1 !important;
    box-shadow: 0 0 16px rgba(0, 245, 255, 0.6), inset 0 0 10px rgba(0, 245, 255, 0.5) !important;
  }
  .thor-spin-btn .spin-inner-core {
    gap: 0;
  }
  .spin-infinity-icon {
    font-size: 18px !important;
    line-height: 1;
  }
  .spin-label {
    font-size: 9px !important;
    margin-top: 1px;
  }
}

/* 手機緊湊規格 (寬度 <= 480px 或 高度 <= 680px) */
@media (max-width: 480px), (max-height: 680px) {
  :root {
    --grid-cell-size: min(14.5vw, 6.8vh, 45px);
  }
  .thor-temple-arch {
    margin-bottom: 2px;
  }
  .hud-telemetry {
    font-size: 8px;
    padding: 1px 4px;
  }
  .thor-official-logo {
    max-height: 32px;
  }

  .round-status-bar {
    padding: 2px 6px;
    margin-top: 2px;
    gap: 6px;
  }
  .status-col .label { font-size: 7.5px; }
  .status-col .value { font-size: 11px; }
  .status-col.highlight .value { font-size: 12px; }
}

/* ============================================================
   音效與可調節音量滑桿懸浮窗 (Volume Slider Popover)
   ============================================================ */
.sound-control-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.volume-slider-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 170px;
  background: rgba(10, 16, 26, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 245, 255, 0.4);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 245, 255, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sound-control-wrapper:hover .volume-slider-popover,
.sound-control-wrapper:focus-within .volume-slider-popover,
.sound-control-wrapper.open .volume-slider-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.vol-pop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #d1d5db;
  letter-spacing: 0.5px;
}

.vol-pop-val {
  color: #00f5ff;
  font-family: 'JetBrains Mono', monospace, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.vol-pop-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vol-min-icon, .vol-max-icon {
  font-size: 12px;
  user-select: none;
  opacity: 0.85;
}

.vol-range-input {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.vol-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #00f5ff;
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(0, 245, 255, 0.8);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.vol-range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(0, 245, 255, 1);
}

.vol-range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #00f5ff;
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(0, 245, 255, 0.8);
  cursor: pointer;
}
