/* =============================================
   聰明包牌引擎 (wheeling.css)
   ============================================= */

/* ── 外層容器 ────────────────────────────────── */

.wh-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  padding-bottom: var(--sp-8);
}

/* ── 標題區 ──────────────────────────────────── */

.wh-header {
  margin-bottom: var(--sp-1);
}

.wh-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.wh-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── 說明提示框 ──────────────────────────────── */

.wh-notice {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  background: rgba(123,170,247,0.07);
  border: 1px solid rgba(123,170,247,0.18);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.wh-notice-icon { flex-shrink: 0; margin-top: 1px; }
.wh-notice strong { color: var(--text-primary); }

/* ══════════════════════════════════════════════════
   進階包牌運算室（card-premium-charge 金邊外框）
   ══════════════════════════════════════════════════ */

.wh-command-outer {
  border-radius: var(--r-lg);
  position: relative; /* 供遮罩絕對定位 */
}

/* 進階會員解鎖後：改為靜態金色邊框，無旋轉特效 */
.wh-command-outer--unlocked {
  border-radius: var(--r-lg);
  position: relative;
  border: 1px solid var(--lotto-gold-border);
  box-shadow: var(--lotto-gold-glow);
}

/* ── 付費牆遮罩 ──────────────────────────────── */

.wh-paywall {
  position: absolute;
  inset: 0;
  z-index: 10;
  border-radius: calc(var(--r-lg) - 2px);
  /* 毛玻璃：模糊底下的運算室，製造半透明感 */
  backdrop-filter: blur(6px) brightness(0.55);
  -webkit-backdrop-filter: blur(6px) brightness(0.55);
  background: rgba(10, 18, 36, 0.60);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}

.wh-paywall-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  text-align: center;
  max-width: 340px;
}

.wh-paywall-lock {
  font-size: 2.6rem;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255,215,0,0.5));
  animation: wh-lock-pulse 2.4s ease-in-out infinite;
}

@keyframes wh-lock-pulse {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255,215,0,0.35)); }
  50%       { filter: drop-shadow(0 0 20px rgba(255,215,0,0.75)); }
}

.wh-paywall-headline {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
}

.wh-paywall-accent {
  color: var(--lotto-gold);
  font-size: 1.4em;
  font-family: var(--font-num);
  text-shadow:
    0 0  6px rgba(255,215,0,0.8),
    0 0 14px rgba(255,215,0,0.4);
}

.wh-paywall-sub {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}

.wh-paywall-btn {
  margin-top: var(--sp-1);
  padding: 10px 28px;
  border-radius: var(--r-full);
  border: 1px solid var(--lotto-gold-border);
  background: linear-gradient(135deg, #b8860b, #f6c90e);
  color: #1a1506;
  font-size: 14px;
  font-family: var(--font-base);
  font-weight: var(--weight-bold);
  cursor: pointer;
  box-shadow: var(--lotto-gold-glow);
  transition: filter 0.15s, transform 0.1s;
  white-space: nowrap;
}

.wh-paywall-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.wh-paywall-btn:active {
  transform: translateY(0);
}

.wh-command-inner {
  background: var(--bg-surface);
  border-radius: calc(var(--r-lg) - 2px);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* 標頭列 */
.wh-cmd-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid rgba(255,215,0,0.12);
}

.wh-cmd-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--lotto-gold);
  letter-spacing: 0.04em;
}

.wh-cmd-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--lotto-gold-dim);
  color: var(--lotto-gold);
  font-weight: var(--weight-bold);
  border: 1px solid var(--lotto-gold-border);
}

/* 三欄控制 Grid */
.wh-cmd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-4);
}

.wh-cmd-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.wh-cmd-col-label {
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── 號碼池顯示 ──────────────────────────────── */

.wh-pool-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.wh-pool-count {
  font-size: 2.4rem;
  font-family: var(--font-num);
  font-weight: var(--weight-bold);
  color: #6ee7f7;
  line-height: 1;
}

.wh-pool-unit {
  font-size: 13px;
  color: var(--text-muted);
}

.wh-pool-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 22px;
}

.wh-pool-empty {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  align-self: center;
}

/* .ball-xs — 比 ball-sm 更小，用於號碼池摘要列 */
.ball-xs {
  width: 22px !important;
  height: 22px !important;
  font-size: 10px !important;
}

/* ── 策略下拉 ────────────────────────────────── */

.wh-strategy-select {
  background: var(--bg-raised);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-base);
  padding: 6px 10px;
  cursor: pointer;
  width: 100%;
  appearance: auto;
}

.wh-strategy-select:focus {
  outline: none;
  border-color: rgba(255,215,0,0.5);
}

.wh-strategy-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  min-height: 16px;
}

/* ── 成本試算面板 ────────────────────────────── */

.wh-cost-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.wh-cost-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}

.wh-cost-key {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 56px;
  flex-shrink: 0;
}

.wh-cost-val {
  font-size: 1.1rem;
  font-family: var(--font-num);
  font-weight: var(--weight-bold);
  color: #6ee7f7;
}

.wh-cost-saving {
  font-size: 11px;
  color: #81c995;
  background: rgba(129,201,149,0.1);
  border: 1px solid rgba(129,201,149,0.2);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  margin-top: var(--sp-1);
  line-height: 1.5;
}

/* ── 運算室底部（遊戲切換 + 過濾器） ────────── */

.wh-cmd-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.wh-filters-inline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

/* ── 通用設定列元件 ──────────────────────────── */

.wh-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.wh-ctrl-label {
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wh-segs {
  display: flex;
  gap: 4px;
  background: var(--bg-raised);
  border-radius: var(--r-md);
  padding: 3px;
}

.wh-seg {
  padding: 5px 14px;
  border-radius: calc(var(--r-md) - 2px);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-base);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.wh-seg.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.wh-filter-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.wh-filter-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #7baaf7;
  cursor: pointer;
}

.wh-select {
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 2px 6px;
  cursor: pointer;
}

.wh-select:disabled { opacity: 0.4; }

/* ── 選號格 ──────────────────────────────────── */

.wh-picker-wrap {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}

.wh-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--sp-3);
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.wh-picker-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.wh-pool-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.wh-pool-hint--full { color: var(--lotto-gold); }

/* ── 號碼格上方遊戲切換 tabs ───────────────────────────────────────────── */
.wh-game-tabs {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.wh-game-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2) var(--sp-1);
  border-radius: var(--r-md);
  border: 1.5px solid rgba(255,255,255,0.08);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.3;
}

.wh-game-tab-icon { font-size: 18px; }
.wh-game-tab-sub  { font-size: 10px; font-weight: var(--weight-normal); color: var(--text-muted); }

.wh-game-tab:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--text-primary);
}

.wh-game-tab.active[data-game="big_lotto"] {
  background: rgba(212,175,55,0.15);
  border-color: var(--lotto-gold);
  color: var(--lotto-gold);
}
.wh-game-tab.active[data-game="big_lotto"] .wh-ball.active { background: var(--lotto-gold); border-color: var(--lotto-gold); }

.wh-game-tab.active[data-game="power_lottery"] {
  background: rgba(229,57,53,0.12);
  border-color: var(--lotto-red, #e53935);
  color: var(--lotto-red, #e53935);
}

.wh-game-tab.active[data-game="jcai_539"] {
  background: rgba(76,175,80,0.12);
  border-color: #4caf50;
  color: #4caf50;
}
.wh-game-tab.active[data-game="jcai_539"] .wh-game-tab-sub { color: inherit; opacity: 0.7; }

/* 依遊戲主題改 wh-ball.active 顏色 */
.wh-picker-wrap[data-game="power_lottery"] .wh-ball.active {
  background: var(--lotto-red, #e53935);
  border-color: var(--lotto-red, #e53935);
  color: #fff;
}
.wh-picker-wrap[data-game="jcai_539"] .wh-ball.active {
  background: #4caf50;
  border-color: #4caf50;
  color: #fff;
}

.wh-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--sp-4);
}

.wh-ball {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-num);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wh-ball:hover {
  border-color: rgba(255,255,255,0.28);
  color: var(--text-primary);
  transform: scale(1.08);
}

.wh-ball.active {
  background: var(--lotto-gold);
  border-color: var(--lotto-gold);
  color: #1a1506;
  transform: scale(1.1);
}

.wh-picker-actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}

.wh-btn {
  padding: 8px 20px;
  border-radius: var(--r-full);
  border: none;
  font-size: 13px;
  font-family: var(--font-base);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, color 0.3s, border-color 0.3s;
}

.wh-btn-clear {
  background: var(--bg-raised);
  color: var(--text-muted);
}

.wh-btn-clear:hover { color: var(--text-secondary); }

.wh-btn-generate {
  background: linear-gradient(135deg, #d4a017, #f6c90e);
  color: #1a1506;
}

.wh-btn-generate:hover:not(:disabled) { filter: brightness(1.1); }

.wh-btn-generate:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── 結果區 ──────────────────────────────────── */

.wh-result-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.wh-result-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.wh-result-title {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.wh-result-stats {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}

.wh-stat {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 10px;
  background: var(--bg-raised);
  border-radius: var(--r-full);
}

.wh-stat strong {
  color: var(--text-primary);
  font-family: var(--font-num);
}

.wh-stat--price {
  background: rgba(255,215,0,0.08);
  color: var(--lotto-gold);
  border: 1px solid rgba(255,215,0,0.18);
}

.wh-stat--price strong { color: var(--lotto-gold); }

.wh-stat--save {
  background: rgba(129,201,149,0.12);
  color: #81c995;
  border: 1px solid rgba(129,201,149,0.2);
}

/* 組合 Grid 排版 */
.wh-combos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-3);
}

.wh-combo-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: border-color 0.15s;
}

.wh-combo-card:hover {
  border-color: rgba(255,255,255,0.14);
}

.wh-combo-card-num {
  font-size: 10px;
  font-family: var(--font-num);
  color: var(--text-muted);
}

.wh-combo-card-balls {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.wh-combo-card-meta {
  display: flex;
  gap: 4px;
}

.wh-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: var(--bg-raised);
  color: var(--text-muted);
  white-space: nowrap;
}

.wh-badge--consec {
  background: rgba(246,201,14,0.12);
  color: #f6c90e;
  border: 1px solid rgba(246,201,14,0.2);
}

/* 過濾警告 */
.wh-filter-warn {
  font-size: 12px;
  color: #f28b82;
  background: rgba(242,139,130,0.08);
  border: 1px solid rgba(242,139,130,0.2);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  line-height: 1.6;
}

/* ── 批次匯入列 ──────────────────────────────── */

.wh-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}

.wh-batch-info {
  font-size: 12px;
  color: var(--text-muted);
}

.wh-btn-batch {
  padding: 8px 20px;
  border-radius: var(--r-full);
  border: 1px solid rgba(123,170,247,0.3);
  background: rgba(123,170,247,0.1);
  color: #7baaf7;
  font-size: 13px;
  font-family: var(--font-base);
  font-weight: var(--weight-bold);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.3s, border-color 0.3s;
}

.wh-btn-batch:hover {
  background: rgba(123,170,247,0.18);
}

/* 免責聲明 */
.wh-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-raised);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4);
  line-height: 1.7;
  text-align: center;
}

/* ── 響應式 ──────────────────────────────────── */

@media (max-width: 600px) {
  .wh-cmd-grid {
    grid-template-columns: 1fr 1fr;
  }
  .wh-cmd-col:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .wh-cmd-grid {
    grid-template-columns: 1fr;
  }
  .wh-ball {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }
  .wh-combos-grid {
    grid-template-columns: 1fr;
  }
  .wh-picker-actions {
    flex-direction: column;
  }
  .wh-btn {
    width: 100%;
    text-align: center;
  }
  .wh-batch-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .wh-btn-batch {
    text-align: center;
  }
}
