/* 資本大亨模擬競賽遊戲｜全站深色金融終端樣式表 (V2.8.2 正式版) */
html, body {
  background-color: #0b0e14 !important;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* 禁止手機長按卡牌與遊戲圖片彈出系統圖片預覽／儲存選單 */
img {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
  user-drag: none !important;
}
#page-cards_shop img,
#playerStocksCardBattlePanel img,
.card-play-stage img,
.no-longpress-img {
  pointer-events: none !important;
}
#page-cards_shop button,
#playerStocksCardBattlePanel button {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

/* 手機與平板端全域防裁切與順暢滑動優化 */
@media (max-width: 768px) {
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  main {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
}

.font-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* 台股紅漲綠跌配色 */
.tw-up { color: #ff3b30 !important; }
.tw-down { color: #00c853 !important; }
.tw-flat { color: #94a3b8 !important; }
.tw-up-bg { background-color: rgba(255, 59, 48, 0.18); color: #ff6b63; border: 1px solid rgba(255, 59, 48, 0.35); }
.tw-down-bg { background-color: rgba(0, 200, 83, 0.16); color: #34d399; border: 1px solid rgba(0, 200, 83, 0.32); }

/* Mitrade 交易室面板 */
.mitrade-panel {
  background-color: #131722;
  border: 1px solid #2a2e39;
}
.mitrade-btn-buy {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
.mitrade-btn-buy:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}
.mitrade-btn-sell {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}
.mitrade-btn-sell:hover {
  background: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
}

/* 人生補償系統 HUD 主題 */
.host-hud-theme {
  background: radial-gradient(circle at top right, rgba(14, 165, 233, 0.16), transparent 55%),
              linear-gradient(180deg, #0d1626 0%, #090d16 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 40px rgba(14, 165, 233, 0.12);
}

/* 跑馬燈 */
.marquee-wrapper {
  position: relative;
  overflow: hidden;
}
.marquee-track-live {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
}


/* 聊天室氣泡與訊息彈入動畫 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-fadeIn {
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes bubbleFloatPulse {
  0%, 100% { transform: translateY(0px); box-shadow: 0 10px 30px rgba(14, 165, 233, 0.45); }
  50% { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(99, 102, 241, 0.65); }
}
.chat-bubble-float {
  animation: bubbleFloatPulse 3.2s ease-in-out infinite;
}

/* 自訂捲軸 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #0b0e14;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* ==================== 市場對戰卡牌・出牌動態特效系統 ==================== */
@keyframes cardImpactOverlayFade {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  78%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes cardSlamIn {
  0%   { opacity: 0; transform: perspective(900px) translateY(110px) scale(0.45) rotateX(26deg) rotateZ(-8deg); filter: brightness(1.6); }
  22%  { opacity: 1; transform: perspective(900px) translateY(-10px) scale(1.14) rotateX(-4deg) rotateZ(2deg); filter: brightness(1.25); }
  36%  { opacity: 1; transform: perspective(900px) translateY(0px) scale(1.0) rotateX(0deg) rotateZ(0deg); filter: brightness(1); }
  78%  { opacity: 1; transform: perspective(900px) translateY(-4px) scale(1.03) rotateX(0deg) rotateZ(0deg); filter: brightness(1.05); }
  100% { opacity: 0; transform: perspective(900px) translateY(-42px) scale(1.18) rotateX(-10deg); filter: brightness(1.35); }
}

@keyframes cardSlamReverseSpin {
  0%   { opacity: 0; transform: perspective(900px) translateY(100px) scale(0.45) rotateY(-180deg); }
  28%  { opacity: 1; transform: perspective(900px) translateY(-8px) scale(1.12) rotateY(15deg); }
  42%  { opacity: 1; transform: perspective(900px) translateY(0px) scale(1.0) rotateY(0deg); }
  80%  { opacity: 1; transform: perspective(900px) translateY(-4px) scale(1.03) rotateY(0deg); }
  100% { opacity: 0; transform: perspective(900px) translateY(-40px) scale(1.16) rotateY(25deg); }
}

@keyframes cardShockwaveRing {
  0%   { opacity: 0.95; transform: scale(0.25); border-width: 6px; }
  55%  { opacity: 0.55; transform: scale(2.15); border-width: 3px; }
  100% { opacity: 0; transform: scale(3.1); border-width: 1px; }
}

@keyframes cardSheenSweep {
  0%   { transform: translateX(-140%) skewX(-24deg); opacity: 0; }
  30%  { opacity: 0.85; }
  100% { transform: translateX(220%) skewX(-24deg); opacity: 0; }
}

@keyframes cardBannerPop {
  0%   { opacity: 0; transform: translateY(18px) scale(0.82); }
  22%  { opacity: 1; transform: translateY(0px) scale(1.04); }
  34%  { opacity: 1; transform: translateY(0px) scale(1); }
  80%  { opacity: 1; transform: translateY(0px) scale(1); }
  100% { opacity: 0; transform: translateY(-16px) scale(0.95); }
}

@keyframes cardScreenFlash {
  0%   { opacity: 0; }
  16%  { opacity: 0.42; }
  100% { opacity: 0; }
}

@keyframes cardScreenShakeSm {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-4px, 2px, 0); }
  35% { transform: translate3d(4px, -2px, 0); }
  55% { transform: translate3d(-3px, -1px, 0); }
  75% { transform: translate3d(2px, 1px, 0); }
}

@keyframes cardScreenShakeLg {
  0%, 100% { transform: translate3d(0, 0, 0); }
  10% { transform: translate3d(-8px, 4px, 0); }
  22% { transform: translate3d(8px, -5px, 0); }
  34% { transform: translate3d(-7px, -3px, 0); }
  46% { transform: translate3d(6px, 4px, 0); }
  58% { transform: translate3d(-4px, 2px, 0); }
  72% { transform: translate3d(3px, -2px, 0); }
}

.card-impact-shake-sm {
  animation: cardScreenShakeSm 0.34s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.card-impact-shake-lg {
  animation: cardScreenShakeLg 0.48s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.card-play-stage {
  position: fixed;
  inset: 0;
  z-index: 9995;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: cardImpactOverlayFade var(--card-fx-dur, 1180ms) ease-out forwards;
}

.card-play-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--card-fx-glow, rgba(251, 191, 36, 0.45)) 0%, transparent 70%);
  animation: cardScreenFlash 0.55s ease-out forwards;
}

.card-play-ring {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 9999px;
  border: 5px solid var(--card-fx-color, #fbbf24);
  box-shadow: 0 0 28px var(--card-fx-glow, rgba(251, 191, 36, 0.7));
  animation: cardShockwaveRing 0.72s cubic-bezier(0.12, 0.8, 0.28, 1) forwards;
}

.card-play-ring-2 {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 9999px;
  border: 3px solid #ffffff;
  opacity: 0;
  animation: cardShockwaveRing 0.85s 0.1s cubic-bezier(0.12, 0.8, 0.28, 1) forwards;
}

.card-play-hero {
  position: relative;
  width: 164px;
  border-radius: 18px;
  overflow: hidden;
  border: 2.5px solid var(--card-fx-color, #fbbf24);
  background: #0b0f1a;
  box-shadow: 0 0 36px var(--card-fx-glow, rgba(251, 191, 36, 0.75)), 0 22px 50px rgba(0, 0, 0, 0.8);
  animation: cardSlamIn var(--card-fx-dur, 1180ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.card-play-hero.card-play-spin {
  animation-name: cardSlamReverseSpin;
}

.card-play-sheen {
  position: absolute;
  inset: 0;
  width: 55%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: cardSheenSweep 0.75s 0.14s ease-out forwards;
}

.card-play-banner {
  margin-top: 14px;
  padding: 8px 18px;
  border-radius: 9999px;
  background: rgba(9, 13, 24, 0.92);
  border: 1.5px solid var(--card-fx-color, #fbbf24);
  box-shadow: 0 0 24px var(--card-fx-glow, rgba(251, 191, 36, 0.55)), 0 10px 28px rgba(0, 0, 0, 0.7);
  text-align: center;
  max-width: 90vw;
  animation: cardBannerPop var(--card-fx-dur, 1180ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.card-play-combo-pill {
  position: absolute;
  top: -12px;
  right: -12px;
  padding: 3px 10px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  border: 2px solid #fef08a;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.7);
}
