/* ========================================================
   易算彩票選碼與機率分析系統 - 樣式表 (Mobile First) v4.0
   東方玄學科技風 · 深色黑曜金曜質感 · 大按鈕大字體 · 即時速報
   ======================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-card: #151d30;
  --bg-card-hover: #1e2942;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --gold-accent: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.45);
  --purple-accent: #8b5cf6;
  --purple-glow: rgba(139, 92, 246, 0.4);
  --border-color: #2a3754;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

html {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 10px 40px;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

.app-container {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow-x: hidden;
  word-wrap: break-word;
}

/* ========================================================
   呼吸燈閃爍動態光暈 (Breathing Light Animation - 2.5s 循環)
   ======================================================== */
@keyframes forumBreathingLight {
  0% {
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.35), inset 0 0 4px rgba(251, 191, 36, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 20px rgba(251, 146, 60, 0.85), 0 0 32px rgba(245, 158, 11, 0.5), inset 0 0 8px rgba(251, 191, 36, 0.4);
    border-color: rgba(251, 191, 36, 0.95);
    transform: scale(1.012);
  }
  100% {
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.35), inset 0 0 4px rgba(251, 191, 36, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
    transform: scale(1);
  }
}

.breathing-forum-hero {
  animation: forumBreathingLight 2.5s infinite ease-in-out;
  background: linear-gradient(135deg, #1e293b 0%, #172033 50%, #0f172a 100%) !important;
  border-width: 1.8px !important;
  border-style: solid !important;
  position: relative;
  overflow: hidden;
}

.breathing-forum-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: shineSweep 4s infinite ease-in-out;
  pointer-events: none;
}

@keyframes shineSweep {
  0% { left: -100%; }
  35% { left: 150%; }
  100% { left: 150%; }
}

/* 頂部標題 */
.app-header {
  text-align: center;
  padding: 8px 6px 2px;
}

.header-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.badge-tag {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* 頂部即時訪客統計小膠囊 (深色半透明 ＋ 淡淡金光 ＋ 柔和呼吸綠點) */
.visitor-counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.38);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 10px rgba(245, 158, 11, 0.12);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: 0.2px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  user-select: none;
  transition: all 0.2s ease;
}

.visitor-live-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: liveDotPulse 2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes liveDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

@media (max-width: 480px) {
  .header-top-bar {
    justify-content: center;
    gap: 6px;
  }
  .badge-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
  }
  .visitor-counter-pill {
    font-size: 11px;
    padding: 2.5px 8px;
  }
}

.app-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.app-header-logo {
  height: 40px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.4));
}

.app-title-text {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 30%, #fbbf24 70%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* 重新載入最新版本極簡小按鈕 */
.btn-force-reload {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-force-reload:hover,
.btn-force-reload:active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #fbbf24;
  color: #fbbf24;
  transform: scale(0.97);
}

/* ==========================================
   首波公測「免費試用一個月」頂部黃金慶典橫幅
   ========================================== */
.trial-announcement-banner {
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(217, 119, 6, 0.28) 50%, rgba(139, 92, 246, 0.18) 100%);
  border: 1.5px solid #fbbf24;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: trialPulse 3s infinite ease-in-out;
}

@keyframes trialPulse {
  0%, 100% {
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.25);
    border-color: #fbbf24;
  }
  50% {
    box-shadow: 0 4px 24px rgba(245, 158, 11, 0.45);
    border-color: #fde047;
  }
}

.trial-banner-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.trial-banner-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trial-banner-title {
  color: #fef08a;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.3px;
  line-height: 1.35;
}

.trial-banner-sub {
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ==========================================
   📱 一鍵加到手機桌面（PWA 捷徑大按鈕）
   ========================================== */
.pwa-install-container {
  margin-top: 8px;
  width: 100%;
}

.btn-pwa-install {
  width: 100%;
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 50%, #450a0a 100%);
  border: 1.8px solid #fbbf24;
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(220, 38, 38, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: all 0.2s ease;
  text-align: left;
  outline: none;
}

.btn-pwa-install:active {
  transform: scale(0.98);
  filter: brightness(0.92);
}

.pwa-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 8px rgba(251, 191, 36, 0.4);
  border: 1px solid rgba(251, 191, 36, 0.6);
}

.pwa-btn-texts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pwa-btn-title {
  color: #fef08a;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.4px;
  line-height: 1.3;
}

.pwa-btn-sub {
  color: #fecdd3;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
}

.pwa-btn-arrow {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.3px;
}

/* iOS Safari 安裝導引彈窗樣式 */
.ios-modal-card {
  border-color: #ef4444 !important;
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.5), inset 0 0 15px rgba(239, 68, 68, 0.15) !important;
}

.ios-guide-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ios-guide-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1.5px solid #fbbf24;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.ios-steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0;
}

.ios-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ios-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ios-step-text {
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.45;
}

.ios-step-text strong {
  color: #fef08a;
}

/* ==========================================
   大樂透即時開獎金色流光彈窗 (出號即動)
   ========================================== */
.alert-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease forwards;
}

.alert-modal-card {
  width: 100%;
  max-width: 480px;
  background: #111827;
  border: 2px solid #fbbf24;
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.5), inset 0 0 15px rgba(245, 158, 11, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes zoomIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.alert-modal-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, transparent 60%);
  pointer-events: none;
  animation: rotateGlow 8s linear infinite;
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alert-badge-tag {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
}

.alert-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.alert-close-btn:hover {
  color: #fff;
}

.alert-headline {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.35rem;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 2px 10px rgba(251, 191, 36, 0.4);
  line-height: 1.3;
}

.alert-sub {
  font-size: 0.82rem;
  color: #cbd5e1;
}

.alert-balls-wrapper {
  background: #0b0f19;
  border: 1px solid #233554;
  border-radius: var(--radius-md);
  padding: 12px 8px;
}

.alert-balls-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.alert-bonus-block {
  background: rgba(120, 53, 15, 0.25);
  border: 1px dashed #d97706;
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bonus-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fde68a;
}

.bonus-sets-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: #fed7aa;
}

.alert-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-alert-action {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-alert-action.primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0f19;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
}

.btn-alert-action.primary:active {
  transform: scale(0.97);
}

.btn-alert-action.secondary {
  background: #1f2937;
  color: #cbd5e1;
  border: 1px solid #374151;
}

/* 539 & 大樂透 智慧動態同步監控列 */
.sync-status-card {
  background: linear-gradient(90deg, #111a2e 0%, #17233d 100%);
  border: 1px solid #233554;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sync-badge-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-green {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.dot-yellow {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
  animation: pulse-yellow 1.5s infinite;
}

.dot-purple {
  background: #a855f7;
  box-shadow: 0 0 10px #a855f7;
  animation: pulse-purple 1.5s infinite;
}

@keyframes pulse-yellow {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

@keyframes pulse-purple {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.sync-status-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-manual-sync {
  background: #1e293b;
  border: 1px solid #38bdf8;
  color: #7dd3fc;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-manual-sync:hover {
  background: #0284c7;
  color: #ffffff;
}

.btn-manual-sync:active {
  transform: scale(0.95);
}

.sync-spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================
   🎯 官方專屬 Logo 彩種切換選單 (Tab Navigation)
   ========================================== */
.lottery-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.85);
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  gap: 8px;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.lottery-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1 0 auto;
  flex-shrink: 0;
  min-width: 68px;
  background: rgba(30, 41, 59, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 8px 6px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.tab-btn:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: rgba(251, 191, 36, 0.4);
  transform: translateY(-2px);
}

.tab-btn:active {
  transform: scale(0.96);
}

.tab-lottery-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.tab-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.25;
}

.tab-btn .tab-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: 0.2px;
}

.tab-btn .tab-rule {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 1px;
}

/* 點選啟動態：微發光金色外框 ＋ 平滑放大動態 ＋ 尊貴金字 */
.tab-btn.active {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1.8px solid #fbbf24;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: scale(1.04);
}

.tab-btn.active .tab-lottery-logo {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 10px rgba(245, 158, 11, 0.5));
}

.tab-btn.active .tab-title {
  color: #fef08a;
  font-weight: 900;
}

.tab-btn.active .tab-rule {
  color: #fbbf24;
  font-weight: 700;
}

@media (max-width: 480px) {
  .lottery-tabs {
    padding: 5px;
    gap: 4px;
    justify-content: center;
  }
  .tab-btn {
    min-width: 54px;
    padding: 6px 2px;
  }
  .tab-lottery-logo {
    width: 32px;
    height: 32px;
  }
  .tab-btn .tab-title {
    font-size: 14px;
    font-weight: 800;
  }
  .tab-btn .tab-rule {
    font-size: 0.60rem;
  }
}
@media (max-width: 365px) {
  .lottery-tabs {
    gap: 2px;
    padding: 4px 2px;
  }
  .tab-btn {
    min-width: 48px;
    padding: 5px 1px;
  }
  .tab-lottery-logo {
    width: 28px;
    height: 28px;
  }
  .tab-btn .tab-title {
    font-size: 13px;
  }
}

/* 通用卡片容器 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.card-icon {
  font-size: 1.2rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  flex: 1;
}

.badge-sub {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
}

/* 首屏核心：最新官方開獎號碼卡片 */
.latest-official-draw-card,
.last-draw-card {
  padding: 14px 16px;
  background: linear-gradient(180deg, #131b2e 0%, #0f172a 100%);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), 0 0 15px rgba(245, 158, 11, 0.08);
}

.draw-balls-display-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 6px 0;
}

.draw-order-label {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  letter-spacing: 0.2px;
}

.last-draw-balls-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px 0;
}

/* 視覺化開出號碼大球 (立體 3D 質感、清晰大字) */
.mini-draw-ball {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.12rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.45), inset 0 -2px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
  user-select: none;
}

.mini-draw-ball:active {
  transform: scale(0.95);
}

.mini-draw-ball.special,
.mini-draw-ball.special-ball {
  border: 2.5px solid #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.45);
  position: relative;
}

.mini-draw-ball.bagua-ball {
  background: radial-gradient(circle at 35% 35%, #9333ea, #581c87);
  border: 2.5px solid #c084fc;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.45);
}

@media (max-width: 480px) {
  .mini-draw-ball {
    width: 38px;
    height: 38px;
    font-size: 1.02rem;
  }
}

.loading-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ==========================================
   🔮 神算推薦號碼「收合/展開手風琴（Accordion）」
   ========================================== */
.prediction-accordion-wrapper {
  margin-top: 14px;
  width: 100%;
}

.btn-toggle-prediction {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1.5px solid #fbbf24;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 12px rgba(245, 158, 11, 0.2);
  text-align: left;
}

.btn-toggle-prediction:hover {
  background: linear-gradient(135deg, rgba(51, 65, 85, 0.95) 0%, rgba(30, 41, 59, 0.98) 100%);
  border-color: #fde047;
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

.btn-toggle-prediction:active {
  transform: scale(0.99);
}

.btn-toggle-prediction.expanded {
  border-color: #a78bfa;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.92) 0%, rgba(15, 23, 42, 0.98) 100%);
  box-shadow: 0 4px 18px rgba(167, 139, 250, 0.3);
}

.toggle-pred-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-pred-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.toggle-pred-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-pred-title {
  color: #fef08a;
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: 0.2px;
  line-height: 1.35;
}

.toggle-pred-sub {
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
}

.toggle-pred-arrow {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 8px;
  padding: 5px 9px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-toggle-prediction.expanded .toggle-pred-arrow {
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.5);
  background: rgba(168, 85, 247, 0.15);
}

.prediction-collapsible-content {
  margin-top: 10px;
  animation: predSlideDown 0.28s ease-out;
}

@keyframes predSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.board-quick-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  justify-content: center;
}

.board-chip {
  font-size: 0.72rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.btn-sm {
  background: #1e293b;
  border: 1px solid #3b4252;
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-sm:active {
  background: #334155;
  color: #fff;
}

/* 日期時間輸入 */
.input-datetime {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border-color);
  color: #f1f5f9;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  text-align: center;
}

.input-datetime:focus {
  outline: none;
  border-color: var(--gold-accent);
  box-shadow: 0 0 10px var(--gold-glow);
}

/* 四柱八字展示區 */
.pillars-display {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.pillar-box {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pillar-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pillar-val {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.15rem;
  font-weight: 900;
  color: #fbbf24;
}

/* 能量狀態列 */
.energy-status-bar {
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #cbd5e1;
  border-left: 3px solid var(--gold-accent);
}

.energy-status-bar strong {
  color: #fbbf24;
}

/* 注數選擇列 */
.count-selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.count-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.count-pill-group {
  display: flex;
  gap: 8px;
}

.count-pill {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.count-pill.active {
  background: var(--gold-accent);
  color: #0b0f19;
  border-color: var(--gold-accent);
  font-weight: 900;
}

/* 六大選碼按鈕區 */
.action-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
  overflow: hidden;
}

.mode-btn:active {
  transform: scale(0.98);
}

.mode-icon {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
}

.mode-content {
  flex: 1;
}

.mode-name {
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.mode-desc {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.25;
}

/* 旗艦合體神算按鈕 */
.mode-fusion {
  background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 45%, #b45309 100%);
  color: #ffffff;
  border: 1.5px solid #a78bfa;
  box-shadow: 0 6px 20px rgba(109, 40, 217, 0.45);
}

/* 經典板路抓牌按鈕 */
.mode-board {
  background: linear-gradient(135deg, #0c2340 0%, #1e3a8a 50%, #0369a1 100%);
  color: #e0f2fe;
  border-color: #38bdf8;
  box-shadow: 0 6px 18px rgba(3, 105, 161, 0.35);
}

/* 威力彩專利八卦第2區按鈕 */
.mode-bagua {
  background: linear-gradient(135deg, #2e1065 0%, #581c87 50%, #7e22ce 100%);
  color: #fae8ff;
  border: 1.5px solid #c084fc;
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.35);
}

.mode-yisuan {
  background: linear-gradient(135deg, #78350f 0%, #b45309 50%, #d97706 100%);
  color: #fff;
  border-color: #f59e0b;
}

.pulse-btn {
  animation: subtle-pulse 2.2s infinite;
}

@keyframes subtle-pulse {
  0% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(167, 139, 250, 0); }
  100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0); }
}

.mode-hetu {
  background: linear-gradient(135deg, #1e1e38 0%, #2b2b52 100%);
  color: #e0e7ff;
  border-color: #4f46e5;
}

.mode-wuxing {
  background: linear-gradient(135deg, #3b1111 0%, #5c1818 100%);
  color: #fee2e2;
  border-color: #ef4444;
}

.mode-monte {
  background: linear-gradient(135deg, #092e20 0%, #0d4a34 100%);
  color: #d1fae5;
  border-color: #10b981;
}

/* 結果展示區 */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.results-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.results-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fbbf24;
}

.btn-copy {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: #fbbf24;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-copy:active {
  background: #334155;
}

/* 號碼注數卡片 */
.ticket-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  animation: fadeInUp 0.3s ease forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 8px;
}

.ticket-tag {
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
}

.ticket-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* 彩球容器與立體彩球視覺 */
.balls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.ball-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.lotto-ball {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 900;
  color: #ffffff;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5), inset 0 2px 5px rgba(255, 255, 255, 0.45);
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.ball-elem-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
}

.special-ball-wrapper {
  margin-left: 6px;
  padding-left: 6px;
  border-left: 2px dashed #475569;
}

.special-badge-label {
  font-size: 0.65rem;
  color: #ef4444;
  font-weight: 800;
}

.special-ball {
  border: 2px solid #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

/* 威力彩八卦第2區專屬金光閃爍 3D 視覺球 */
.special-ball.bagua-ball {
  background: radial-gradient(circle at 35% 30%, #fef08a 0%, #eab308 45%, #854d0e 85%, #422006 100%) !important;
  color: #1a0f00 !important;
  border: 2.5px solid #fde047 !important;
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.95), inset 0 2px 4px rgba(255, 255, 255, 0.8) !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  position: relative;
}

.bagua-symbol-overlay {
  font-size: 0.72rem;
  font-weight: 900;
  color: #451a03;
  margin-top: -2px;
  line-height: 1;
}

.special-badge-label.bagua-tag {
  color: #fbbf24 !important;
  border-color: #d97706 !important;
  background: #2b1800 !important;
  font-weight: 800;
}

/* 威力彩八卦第2區速查手風琴 */
.bagua-accordion {
  margin-top: 10px;
}

.bagua-grid-display {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.bagua-card-item {
  background: #131d36;
  border: 1px solid #233554;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bagua-card-item strong {
  font-size: 0.84rem;
  color: #fbbf24;
}

.bagua-card-item p {
  font-size: 0.72rem;
  color: #94a3b8;
  margin: 0;
}

.bg-symbol {
  font-size: 1.35rem;
  color: #c084fc;
  line-height: 1;
}

/* 板路透視專屬區塊 */
.board-insight-box {
  background: #0d1527;
  border: 1px solid #1e3a8a;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-left: 3px solid #38bdf8;
}

.board-insight-header {
  font-weight: 800;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.board-insight-item {
  color: #cbd5e1;
}

.board-insight-item strong {
  color: #93c5fd;
}

/* 雙核認證彩球流光與標章 */
.lotto-ball.dual-core-ball {
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.9), inset 0 2px 6px rgba(255, 255, 255, 0.7) !important;
  border: 2.5px solid #fbbf24 !important;
  position: relative;
  animation: dual-pulse 2.2s infinite alternate ease-in-out;
}

@keyframes dual-pulse {
  0% { box-shadow: 0 0 8px rgba(251, 191, 36, 0.6); }
  100% { box-shadow: 0 0 20px rgba(251, 191, 36, 1.0); }
}

.dual-core-mini-badge {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  background: linear-gradient(135deg, #b45309, #f59e0b);
  color: #0b0f19;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.ticket-badge.golden-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0f19;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
}

/* 雙核透視卡片 (Dual-Core Evidence Card) */
.dual-perspective-card {
  background: linear-gradient(180deg, #0e172a 0%, #090f1d 100%);
  border: 1px solid #293856;
  border-left: 3px solid #fbbf24;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.dual-perspective-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  font-weight: 800;
  color: #fbbf24;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 6px;
}

.dual-perspective-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dual-ball-reason-row {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.dual-ball-reason-row.is-dual {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(40, 26, 7, 0.35);
}

.dual-ball-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dual-ball-name {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dual-tag-pill {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
}

.dual-tag-pill.tag-gold {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid #d97706;
}

.dual-tag-pill.tag-silver {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid #475569;
}

.dual-reason-text {
  color: #cbd5e1;
}

.dual-reason-text strong {
  color: #93c5fd;
}

.dual-reason-text.yisuan strong {
  color: #34d399;
}

/* 易理解析說明框 */
.analysis-box {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #e2e8f0;
  border-left: 3px solid #10b981;
}

/* 河圖五行速查手風琴 */
.hetu-matrix-accordion {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.accordion-summary {
  padding: 14px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.accordion-body {
  padding: 12px 14px 16px;
  background: #0f172a;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.seven-rule-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #fed7aa;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.mini-ball {
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.mini-elem {
  font-size: 0.55rem;
  opacity: 0.9;
}

.mini-ball.has-seven {
  border: 1.5px solid #fbbf24;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.7);
}

/* 頁尾 */
.app-footer {
  text-align: center;
  font-size: 0.72rem;
  color: #64748b;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.disclaimer {
  opacity: 0.8;
  max-width: 440px;
  margin: 0 auto;
}

/* 商業授權安全狀態列與彈窗（前端隱藏標籤，底層照常驗證） */
.license-status-badge {
  display: none !important;
}

.license-status-badge.is-authorized {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(6, 95, 70, 0.25);
  color: #6ee7b7;
}

.license-status-badge.is-unauthorized {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(153, 27, 27, 0.25);
  color: #fca5a5;
}

.btn-license-config {
  background: none;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0 2px;
  transition: transform 0.2s;
}

.btn-license-config:hover {
  transform: scale(1.15);
}

.license-info-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lic-row {
  display: flex;
  justify-content: space-between;
}

/* VIP 授權門禁全屏鎖定 (未授權全屏攔截) */
.vip-lock-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #090d16 80%, #000 100%);
  backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.vip-lock-card {
  position: relative;
  background: linear-gradient(145deg, #111827 0%, #0f172a 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.vip-lock-icon {
  font-size: 3rem;
  background: rgba(245, 158, 11, 0.15);
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.vip-badge-pill {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.vip-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.45rem;
  font-weight: 900;
  color: #fbbf24;
  margin-top: -4px;
}

.vip-desc {
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.55;
  max-width: 380px;
}

.vip-device-box {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.76rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.vip-device-box .device-label {
  color: #94a3b8;
  font-weight: 600;
}

.vip-device-box .device-id-code {
  color: #38bdf8;
  font-family: monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

.vip-input-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.vip-serial-input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: #090d16;
  border: 1.5px solid #475569;
  color: #fff;
  font-size: 1rem;
  font-family: monospace;
  text-align: center;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.vip-serial-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

.btn-vip-submit {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border: none;
  color: #000;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
  transition: all 0.2s;
}

.btn-vip-submit:hover {
  background: linear-gradient(135deg, #b45309, #d97706);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.6);
}

.vip-error-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f87171;
  min-height: 20px;
}

.vip-footer-note {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.5;
  border-top: 1px solid #1e293b;
  padding-top: 12px;
  width: 100%;
}

/* 近 100 期開獎歷史大按鈕 */
.history-hero-btn-container {
  width: 100%;
}

.btn-view-history-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(245, 158, 11, 0.6);
  border-radius: var(--radius-md);
  color: #fde68a;
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(251, 191, 36, 0.2);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-view-history-hero:hover, .btn-view-history-hero:active {
  border-color: #fbbf24;
  background: linear-gradient(135deg, #1e293b, #334155);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

.btn-history-sparkle {
  font-size: 1.25rem;
}

.btn-history-label {
  font-size: 0.92rem;
  color: #fde68a;
  letter-spacing: 0.5px;
}

.btn-history-tag {
  font-size: 0.76rem;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* ========================================================
   今日時令與黃曆民俗指南卡片 (Mobile First 大字體大器排版)
   ======================================================== */
.almanac-card {
  background: linear-gradient(135deg, #0e172a 0%, #111e38 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(251, 191, 36, 0.2);
  position: relative;
  overflow: hidden;
}

.almanac-card::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.almanac-date-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.almanac-header-tag {
  display: block;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.almanac-solar-text {
  font-size: 23px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  text-align: center;
  gap: 8px;
  margin: 6px 0;
}

.almanac-lunar-text {
  font-size: 16px;
  font-weight: 800;
  color: #fde68a;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  text-align: center;
  gap: 6px;
}

.almanac-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.almanac-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.almanac-box.gold {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(40, 30, 15, 0.4));
}
.almanac-box.red {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(45, 15, 15, 0.4));
}
.almanac-box.blue {
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 30, 50, 0.4));
}
.almanac-box.green {
  border-color: rgba(52, 211, 153, 0.35);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 45, 30, 0.4));
}

.almanac-box-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.almanac-box-val {
  font-size: 1.05rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.3;
}
.almanac-box.gold .almanac-box-val { color: #fde68a; }
.almanac-box.red .almanac-box-val { color: #fca5a5; }
.almanac-box.blue .almanac-box-val { color: #7dd3fc; }
.almanac-box.green .almanac-box-val { color: #6ee7b7; }

.almanac-box-tip {
  font-size: 0.68rem;
  color: #64748b;
}

.almanac-yiji-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(11, 15, 25, 0.6);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.yiji-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.yiji-pill {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}
.yiji-pill.yi {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.yiji-pill.ji {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.yiji-text {
  font-weight: 600;
  color: #e2e8f0;
}

/* ========================================================
   五大熱門彩種大格子導覽面板 (Mobile First 大卡片方塊)
   ======================================================== */
.portal-section-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  padding: 0 4px;
}

.portal-section-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.portal-section-sub {
  font-size: 0.78rem;
  color: #94a3b8;
}

.lottery-grid-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lottery-grid-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px; /* 預留左右呼吸空間 */
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  background: linear-gradient(135deg, #131b2e 0%, #0f172a 100%);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.lottery-grid-card:active {
  transform: scale(0.975);
}

.lottery-grid-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
}

/* 🟥 大樂透 */
.lottery-grid-card.tile-lotto649 {
  border-color: rgba(239, 68, 68, 0.45);
}
.lottery-grid-card.tile-lotto649::after {
  background: linear-gradient(180deg, #ef4444, #b91c1c);
}
.lottery-grid-card.tile-lotto649:hover,
.lottery-grid-card.tile-lotto649:active {
  border-color: #ef4444;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

/* 🟦 威力彩 */
.lottery-grid-card.tile-superlotto {
  border-color: rgba(59, 130, 246, 0.45);
}
.lottery-grid-card.tile-superlotto::after {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}
.lottery-grid-card.tile-superlotto:hover,
.lottery-grid-card.tile-superlotto:active {
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

/* 🟩 539 */
.lottery-grid-card.tile-daily539 {
  border-color: rgba(16, 185, 129, 0.45);
}
.lottery-grid-card.tile-daily539::after {
  background: linear-gradient(180deg, #10b981, #047857);
}
.lottery-grid-card.tile-daily539:hover,
.lottery-grid-card.tile-daily539:active {
  border-color: #10b981;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

/* 🟨 六合彩 */
.lottery-grid-card.tile-marksix {
  border-color: rgba(245, 158, 11, 0.45);
}
.lottery-grid-card.tile-marksix::after {
  background: linear-gradient(180deg, #f59e0b, #b45309);
}
.lottery-grid-card.tile-marksix:hover,
.lottery-grid-card.tile-marksix:active {
  border-color: #f59e0b;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}

/* 🟪 天天樂 */
.lottery-grid-card.tile-california {
  border-color: rgba(168, 85, 247, 0.45);
}
.lottery-grid-card.tile-california::after {
  background: linear-gradient(180deg, #a855f7, #6b21a8);
}
.lottery-grid-card.tile-california:hover,
.lottery-grid-card.tile-california:active {
  border-color: #a855f7;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3);
}

.grid-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0; /* 關鍵：防止 flex 子元素在 Safari 溢出或擠壓 */
}

.grid-card-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.grid-card-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0; /* 關鍵：防止 flex 子元素在 Safari 溢出或擠壓 */
}

.grid-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.grid-card-title {
  white-space: nowrap; /* 嚴禁中文字被切半換行 */
  font-family: 'Noto Serif TC', serif;
  font-size: 21px; /* 20px ~ 22px 字體大器飽滿、加粗 */
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.grid-card-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0;
}

.grid-card-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* 在極小螢幕優雅省略，絕不強行撐破卡片 */
}

.grid-card-right {
  display: flex;
  align-items: center;
  flex-shrink: 0; /* 鎖死按鈕寬度，不可擠壓中間標題 */
}

.grid-card-btn-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ========================================================
   返回彩種首頁大按鈕與 Workspace 專區樣式
   ======================================================== */
.btn-back-portal {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1.5px solid #fbbf24;
  color: #fbbf24;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(251, 191, 36, 0.25);
  transition: all 0.2s ease;
  user-select: none;
}

.btn-back-portal:hover,
.btn-back-portal:active {
  background: #fbbf24;
  color: #0b0f19;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.4);
}

.workspace-active-banner {
  background: linear-gradient(135deg, #131b2e 0%, #1e293b 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.workspace-banner-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.workspace-banner-rule {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  padding: 2px 8px;
  border-radius: 12px;
}

/* ==========================================
   🌟 官方專屬 Logo 圖片自適應呈現
   ========================================== */
.workspace-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.grid-card-logo-img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.lottery-grid-card:hover .grid-card-logo-img {
  transform: scale(1.08) rotate(2deg);
}

@media (max-width: 480px) {
  .lottery-grid-card {
    padding: 12px 10px;
    gap: 8px;
  }
  .grid-card-left {
    gap: 8px;
  }
  .grid-card-logo-img {
    width: 42px;
    height: 42px;
  }
  .workspace-logo-img {
    width: 28px;
    height: 28px;
  }
  .grid-card-title {
    font-size: 19px;
  }
  .grid-card-btn-badge {
    padding: 7px 11px;
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .lottery-grid-card {
    padding: 10px 8px;
    gap: 6px;
  }
  .grid-card-left {
    gap: 6px;
  }
  .grid-card-logo-img {
    width: 36px;
    height: 36px;
  }
  .grid-card-title {
    font-size: 17px;
  }
  .grid-card-pill {
    font-size: 0.65rem;
    padding: 1px 5px;
  }
  .grid-card-btn-badge {
    padding: 6px 8px;
    font-size: 11px;
  }
}

/* ========================================================
   Mobile RWD 強制單欄自適應與置中優化 (max-width: 768px)
   ======================================================== */
@media screen and (max-width: 768px) {
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  body {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }
  .app-container {
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 auto !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    box-sizing: border-box !important;
  }
}
