/* =============================================
   喵彩 — Base Styles
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* 由 screen 控制滾動 */
}

/* ── SPA Screen 系統 ──────────────────────── */

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  bottom: calc(var(--nav-height) + var(--footer-height));
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-base);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity var(--dur-normal) var(--ease-out),
    transform var(--dur-normal) var(--ease-out);
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.screen.slide-out {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

/* ── Bottom Nav ──────────────────────────── */

#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-surface);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: stretch;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-family: var(--font-base);
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 2px;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: transparent;
  transition: background var(--dur-fast);
}
.nav-btn.active { color: var(--lotto-gold); }
.nav-btn.active::before { background: var(--lotto-gold); }
.nav-btn.active.power { color: var(--power-red); }
.nav-btn.active.power::before { background: var(--power-red); }

.nav-icon { font-size: 20px; line-height: 1; }
.nav-label { line-height: 1; }

/* ── Content Wrapper ─────────────────────── */

.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--content-pad);
}

/* ── Card ────────────────────────────────── */

.card {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: var(--sp-4); }
.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
}
.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}

/* ── Section Title ───────────────────────── */

.section-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ── Tab Bar ─────────────────────────────── */

.tab-bar {
  display: flex;
  gap: var(--sp-1);
  background: var(--bg-raised);
  border-radius: var(--r-md);
  padding: var(--sp-1);
  margin-bottom: var(--sp-6);
  overflow-x: auto;
  /* 隱藏捲軸但保留捲動能力（tab 超過螢幕寬時可橫滑） */
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 0 0 auto;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  font-family: var(--font-base);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--bg-overlay);
  color: var(--text-primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Number Ball ─────────────────────────── */

.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: var(--r-full);
  font-family: var(--font-num);
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  flex-shrink: 0;
}
.ball-sm { width: 34px; height: 34px; font-size: var(--text-sm); font-weight: var(--weight-bold); }
.ball-lg { width: 54px; height: 54px; font-size: var(--text-xl); font-weight: var(--weight-black); }

/* 遊戲顏色球 */
.ball-gold {
  background: var(--lotto-gold);
  color: #000;
  box-shadow: var(--lotto-gold-glow);
}
.ball-red {
  background: var(--power-red);
  color: #fff;
  box-shadow: var(--power-red-glow);
}
.ball-power {
  background: var(--power-ball);
  color: #000;
}
.ball-bonus {
  background: rgba(255,215,0,0.25);
  color: var(--lotto-gold);
  border: 1.5px solid var(--lotto-gold-border);
}

/* 熱度球 */
.ball[data-heat="0"] { background: var(--heat-0); color: var(--heat-0-text); }
.ball[data-heat="1"] { background: var(--heat-1); color: var(--heat-1-text); }
.ball[data-heat="2"] { background: var(--heat-2); color: var(--heat-2-text); }
.ball[data-heat="3"] { background: var(--heat-3); color: var(--heat-3-text); }
.ball[data-heat="4"] { background: var(--heat-4); color: var(--heat-4-text); }
.ball[data-heat="5"] { background: var(--heat-5); color: var(--heat-5-text); }

/* ── Draw Row（開獎號碼列） ─────────────── */

.draw-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.draw-row .balls {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.draw-row .sep {
  color: var(--text-muted);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

/* ── Stat Badge ──────────────────────────── */

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.stat-badge.hot  { background: rgba(196,48,32,0.2); color: #FF7055; }
.stat-badge.cold { background: rgba(13,74,122,0.3); color: #6AACDC; }
.stat-badge.due  { background: rgba(243,156,18,0.2);color: #F39C12; }

/* ── Button ──────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border: none;
  border-radius: var(--r-md);
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--lotto-gold);
  color: #000;
}
.btn-primary:hover { opacity: 0.88; }
.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-secondary:hover { background: var(--bg-overlay); }
.btn-sm { padding: var(--sp-2) var(--sp-4); font-size: var(--text-sm); }
.btn-full { width: 100%; }

/* ── Grid Layouts ────────────────────────── */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Loading Skeleton ────────────────────── */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-raised) 25%,
    var(--bg-overlay) 50%,
    var(--bg-raised) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Pill Tags ───────────────────────────── */

.pill {
  display: inline-block;
  padding: 3px var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: var(--bg-overlay);
  color: var(--text-secondary);
}
.pill.active {
  background: var(--lotto-gold-dim);
  color: var(--lotto-gold);
  border: 1px solid var(--lotto-gold-border);
}

/* ── Misc Utilities ──────────────────────── */

.text-gold   { color: var(--lotto-gold); }
.text-red    { color: var(--power-red); }
.text-green  { color: #4CAF50; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.text-bold   { font-weight: var(--weight-bold); }
.text-num    { font-family: var(--font-num); }
.text-center { text-align: center; }
.mt-2  { margin-top: var(--sp-2); }
.mt-4  { margin-top: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mb-4  { margin-bottom: var(--sp-4); }
.flex  { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }

/* ── Scrollbar ───────────────────────────── */

.screen::-webkit-scrollbar { width: 4px; }
.screen::-webkit-scrollbar-track { background: transparent; }
.screen::-webkit-scrollbar-thumb {
  background: var(--bg-overlay);
  border-radius: var(--r-full);
}

/* ── Page Header ─────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--content-pad) var(--sp-4);
  max-width: var(--content-max);
  margin: 0 auto;
}
.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  flex: 1;
}
.page-header .badge {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Divider ─────────────────────────────── */

.divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: var(--sp-4) 0;
}

/* ── Empty State ─────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-4);
  color: var(--text-muted);
}
.empty-state .icon { font-size: 40px; margin-bottom: var(--sp-3); }
.empty-state p { font-size: var(--text-sm); }

/* =============================================
   喵彩特效庫 — 分級發光策略
   ============================================= */

/* ── .card-hover-glow
   一般卡片 hover 時亮起科技藍光暈
   ─────────────────────────────────────────── */
.card-hover-glow {
  border: 1px solid rgba(56, 139, 253, 0.15);
  transition:
    border-color 0.3s var(--ease-out),
    box-shadow   0.3s var(--ease-out);
}
.card-hover-glow:hover {
  border-color: rgba(56, 139, 253, 0.55);
  box-shadow:
    0 0 0 1px rgba(56, 139, 253, 0.20),
    0 0 18px rgba(56, 139, 253, 0.25),
    0 0 40px rgba(56, 139, 253, 0.10);
}

/* ── .btn-pulse
   按鈕呼吸燈：box-shadow 以 3s 為週期緩慢脹縮
   ─────────────────────────────────────────── */
.btn-pulse {
  animation: btnPulse 3s ease-in-out infinite;
}
@keyframes btnPulse {
  0%, 100% {
    box-shadow:
      0 0  6px rgba(56, 139, 253, 0.30),
      0 0 12px rgba(56, 139, 253, 0.15);
  }
  50% {
    box-shadow:
      0 0 14px rgba(56, 139, 253, 0.65),
      0 0 28px rgba(56, 139, 253, 0.30),
      0 0 48px rgba(56, 139, 253, 0.12);
  }
}

/* ── .card-premium-charge
   VIP 卡片：金黃色光線繞圈掃描充能特效
   需搭配 position:relative + overflow:hidden 的父容器
   用法：在父元素上加此 class（padding:2px 當邊框厚度）
   ─────────────────────────────────────────── */
.card-premium-charge {
  position: relative;
  padding: 2px;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-premium-charge::before {
  content: '';
  position: absolute;
  inset: -55%;
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    transparent   0deg,
    transparent  55deg,
    #B8860B      70deg,
    #FFD700      85deg,
    #FFF176     100deg,
    #FFD700     115deg,
    #B8860B     130deg,
    transparent 155deg,
    transparent 360deg
  );
  animation: premiumCharge 3s linear infinite;
  border-radius: 50%;
}
@keyframes premiumCharge {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── .text-neon
   霓虹文字：多層 text-shadow 製造發光暈染感
   ─────────────────────────────────────────── */
.text-neon {
  text-shadow:
    0 0  4px rgba(110, 231, 247, 0.80),
    0 0 10px rgba(110, 231, 247, 0.50),
    0 0 20px rgba(110, 231, 247, 0.25);
}
