/* ═══════════════════════════════════════════════════════════════════════
   小丑牌（Balatro-like）復古像素＋CRT 風格
   自製美術：深色絨布桌面、霓虹計分、掃描線、像素邊框
   ═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&display=swap');

.balatro-container {
  --bl-bg: #17212b;
  --bl-felt: #2a4038;
  --bl-panel: #1f2c38;
  --bl-panel-lite: #2a3a49;
  --bl-border: #0d141b;
  --bl-chips: #33a7ff;
  --bl-mult: #ff4d55;
  --bl-gold: #ffbf3d;
  --bl-accent: #38e0a6;
  --bl-danger: #ff4d6d;
  --bl-text: #e8ecf1;
  --bl-dim: #93a4b5;
  --bl-pix: 3px;
  position: relative;
  width: 100%;
  min-height: 78vh;
  background: var(--bl-bg);
  color: var(--bl-text);
  font-family: inherit;
  border-radius: 8px;
  overflow: hidden;
}

/* ── CRT 效果（簽名元素）───────────────────────────────────────────── */
.bl-crt {
  position: relative;
  min-height: 78vh;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(80, 200, 160, 0.10), transparent 60%),
    repeating-conic-gradient(from 45deg, #223a33 0deg 90deg, #1f362f 90deg 180deg) 0 0/28px 28px,
    var(--bl-felt);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.75);
}
.bl-scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg,
    rgba(0, 0, 0, 0.16) 0px, rgba(0, 0, 0, 0.16) 1px,
    transparent 1px, transparent 3px);
  mix-blend-mode: multiply;
  z-index: 40;
}
@media (prefers-reduced-motion: no-preference) {
  .bl-scanlines::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.035) 50%, transparent 100%);
    background-size: 100% 220px;
    animation: bl-crt-roll 9s linear infinite;
  }
}
@keyframes bl-crt-roll { from { background-position-y: -220px; } to { background-position-y: 100vh; } }

/* ── 版面 ─────────────────────────────────────────────────────────── */
.bl-layout {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 14px;
  z-index: 1;
  min-height: 78vh;
}

/* 競速模式看對手時的簡化計分板（不顯示牌面內容，避免抄牌） */
.bl-opponent-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.bl-opponent-lock {
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--bl-border);
  border-radius: 8px;
  padding: 8px 16px;
  color: var(--bl-gold);
  font-size: 0.85rem;
  max-width: 420px;
}
.bl-opp-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  background: var(--bl-panel);
  border: var(--bl-pix) solid var(--bl-border);
  border-radius: 8px;
  padding: 18px 26px;
}
.bl-opp-stat { display: flex; flex-direction: column; gap: 4px; }
.bl-opp-stat span { font-size: 0.7rem; color: var(--bl-dim); letter-spacing: 1px; }
.bl-opp-stat b { font-family: 'Silkscreen', monospace; font-size: 1.3rem; color: #fff; }
.bl-opp-result { font-size: 1.3rem; font-weight: 700; }
.bl-opp-result.bl-opp-won { color: var(--bl-gold); }
.bl-opp-result.bl-opp-lost { color: var(--bl-danger); }

/* ── 對局歷史（沿用全站 .history-table，這裡只補小丑牌專屬的儲存格內容樣式）── */
.bl-hist-cell { text-align: center; line-height: 1.5; }
.bl-hist-result { font-weight: 700; }
.bl-hist-detail { font-size: 0.78em; opacity: 0.75; }
.bl-history-empty { padding: 12px; text-align: center; opacity: 0.7; }
.bl-sidebar {
  flex: 0 0 210px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bl-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* ── 像素面板通用 ─────────────────────────────────────────────────── */
.bl-score-panel, .bl-stats, .bl-blind-chip, .bl-vouchers-owned, .bl-tags-owned,
.bl-shop, .bl-modal, .bl-blind-card, .bl-cashout, .bl-endscreen, .bl-race-bar {
  background: var(--bl-panel);
  border: var(--bl-pix) solid var(--bl-border);
  box-shadow:
    0 var(--bl-pix) 0 var(--bl-border),
    inset 0 2px 0 rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

/* ── 側欄：Blind 資訊 ─────────────────────────────────────────────── */
.bl-blind-chip { padding: 10px; text-align: center; cursor: pointer; }
.bl-blind-chip.small { border-top: 4px solid var(--bl-chips); }
.bl-blind-chip.big { border-top: 4px solid var(--bl-gold); }
.bl-blind-chip.boss { border-top: 4px solid var(--bl-danger); background: #2c1b26; }
.bl-blind-chip.idle { opacity: 0.75; }
.bl-blind-name { font-weight: 700; letter-spacing: 1px; }
.bl-blind-desc { font-size: 0.72rem; color: var(--bl-dim); margin-top: 4px; line-height: 1.35; }
.bl-blind-target {
  margin-top: 6px;
  font-family: 'Silkscreen', monospace;
  font-size: 1.05rem;
  color: var(--bl-gold);
}

/* ── 側欄：接下來的盲注預覽 ───────────────────────────────────────── */
.bl-upcoming { padding: 6px 8px; display: flex; flex-direction: column; gap: 5px; text-align: left; }
.bl-upcoming-item { border-left: 3px solid var(--bl-dim); padding-left: 6px; }
.bl-upcoming-item.bl-upcoming-big { border-left-color: var(--bl-gold); }
.bl-upcoming-item.bl-upcoming-boss { border-left-color: var(--bl-danger); }
.bl-upcoming-item.bl-upcoming-current { background: rgba(255, 255, 255, 0.06); border-radius: 4px; padding: 4px 6px; }
.bl-upcoming-head { display: flex; justify-content: space-between; font-size: 0.76rem; }
.bl-upcoming-target { font-family: 'Silkscreen', monospace; color: var(--bl-gold); }
.bl-upcoming-desc { font-size: 0.66rem; color: var(--bl-dim); line-height: 1.3; margin-top: 1px; }

/* ── 側欄：計分面板 ───────────────────────────────────────────────── */
.bl-score-panel { padding: 10px; text-align: center; }
.bl-score-label { font-size: 0.7rem; color: var(--bl-dim); letter-spacing: 2px; }
.bl-score-value {
  font-family: 'Silkscreen', monospace;
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 0 12px rgba(56, 224, 166, 0.65);
  transition: transform 0.15s;
}
.bl-score-pop { animation: bl-pop-big 0.5s ease-out; }
@keyframes bl-pop-big { 30% { transform: scale(1.35); } }
.bl-chipmult {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-family: 'Silkscreen', monospace;
  font-size: 1.15rem;
}
.bl-chips {
  background: var(--bl-chips);
  color: #06121c;
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 46px;
  box-shadow: 0 3px 0 #1a5f96;
}
.bl-mult {
  background: var(--bl-mult);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 46px;
  box-shadow: 0 3px 0 #98232a;
}
.bl-x { color: var(--bl-dim); font-weight: 700; }
.bl-hand-name { margin-top: 6px; min-height: 20px; font-weight: 700; color: var(--bl-accent); }
.bl-lv { font-size: 0.7rem; color: var(--bl-gold); }

/* ── 側欄：統計 ───────────────────────────────────────────────────── */
.bl-stats { padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.bl-stat { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--bl-dim); }
.bl-stat b { font-family: 'Silkscreen', monospace; color: var(--bl-text); }
.bl-stat.bl-money b { color: var(--bl-gold); }
.bl-stat-hands { color: var(--bl-chips) !important; }
.bl-stat-discards { color: var(--bl-mult) !important; }
.bl-section-label { font-size: 0.68rem; letter-spacing: 2px; color: var(--bl-dim); margin-bottom: 4px; }
.bl-vouchers-owned, .bl-tags-owned { padding: 8px 10px; }
.bl-voucher-pip, .bl-tag-pip { font-size: 1.05rem; margin-right: 2px; cursor: pointer; }
.bl-deck-count {
  margin-top: auto;
  text-align: right;
  font-family: 'Silkscreen', monospace;
  color: var(--bl-dim);
  font-size: 0.85rem;
}
.bl-spectator-badge {
  background: #3d2f14;
  border: var(--bl-pix) solid var(--bl-border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.78rem;
  color: var(--bl-gold);
  text-align: center;
}

/* ── 按鈕 ─────────────────────────────────────────────────────────── */
.bl-btn {
  font-family: inherit;
  font-weight: 700;
  border: var(--bl-pix) solid var(--bl-border);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  background: var(--bl-panel-lite);
  color: var(--bl-text);
  box-shadow: 0 4px 0 var(--bl-border);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.1s;
  user-select: none;
}
.bl-btn:hover:not(:disabled) { filter: brightness(1.12); }
.bl-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--bl-border); }
.bl-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.bl-btn:focus-visible { outline: 2px solid var(--bl-accent); outline-offset: 2px; }
.bl-btn-primary { background: var(--bl-accent); color: #04241a; box-shadow: 0 4px 0 #1a7a5c; }
.bl-btn-play { background: var(--bl-chips); color: #06121c; box-shadow: 0 4px 0 #1a5f96; font-size: 1.02rem; }
.bl-btn-discard { background: var(--bl-mult); color: #fff; box-shadow: 0 4px 0 #98232a; font-size: 1.02rem; }
.bl-btn-danger { background: var(--bl-danger); color: #fff; box-shadow: 0 4px 0 #8d2038; }
.bl-btn-ghost { background: transparent; }
.bl-btn-reroll { background: #58469b; color: #fff; box-shadow: 0 4px 0 #2f2361; }
.bl-btn-big { font-size: 1.15rem; padding: 12px 26px; }
.bl-btn-info { font-size: 0.8rem; padding: 6px 10px; }
.bl-mini-btn {
  font-family: inherit;
  font-size: 0.72rem;
  border: 2px solid var(--bl-border);
  border-radius: 4px;
  background: var(--bl-panel-lite);
  color: var(--bl-text);
  padding: 2px 8px;
  cursor: pointer;
}
.bl-mini-btn.active { background: var(--bl-accent); color: #04241a; }
.bl-price-btn {
  background: var(--bl-gold);
  color: #3a2800;
  box-shadow: 0 3px 0 #9c711a;
  padding: 4px 10px;
  font-family: 'Silkscreen', monospace;
  font-size: 0.8rem;
}
.bl-price-tag { font-family: 'Silkscreen', monospace; color: var(--bl-gold); }

/* ── 上排：小丑與消耗牌 ───────────────────────────────────────────── */
/* 上方留一點空間，讓計分時飄起的 +籌碼/+倍率徽章有地方顯示，不會貼齊框緣 */
.bl-top-row { display: flex; justify-content: space-between; gap: 12px; padding-top: 26px; }
.bl-jokers, .bl-consumables { display: flex; gap: 8px; flex-wrap: wrap; }
.bl-joker, .bl-slot-empty, .bl-consumable {
  width: 76px;
  height: 100px;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  text-align: center;
}
.bl-joker {
  background: linear-gradient(160deg, #f4eede 0%, #ddd2b8 100%);
  color: #33261a;
  border: var(--bl-pix) solid #241a10;
  box-shadow: 0 4px 0 #241a10;
  cursor: pointer;
  transition: transform 0.1s;
}
.bl-joker:hover { transform: translateY(-4px) rotate(-1.5deg); }
.bl-joker.bl-disabled { filter: grayscale(1) brightness(0.6); }
.bl-joker.bl-facedown { background: repeating-linear-gradient(45deg, #58469b 0 8px, #4a3a85 8px 16px); }
.bl-joker-icon { font-size: 1.7rem; line-height: 1; }
.bl-joker-name { font-size: 0.58rem; font-weight: 700; line-height: 1.15; padding: 0 3px; }
.bl-joker-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: var(--bl-mult);
  color: #fff;
  border: 2px solid var(--bl-border);
  border-radius: 8px;
  font-family: 'Silkscreen', monospace;
  font-size: 0.62rem;
  padding: 1px 5px;
}
.bl-badge-chips { background: var(--bl-chips); color: #06121c; }
.bl-badge-gold { background: var(--bl-gold); color: #3a2800; }

/* Stake 貼紙（永恆⭐/易逝⏳/租賃💰） */
.bl-sticker-row {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
}
.bl-sticker {
  font-size: 0.6rem;
  line-height: 1;
  border-radius: 6px;
  padding: 1px 3px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  white-space: nowrap;
}
/* 說明選單/商店卡片頭：不在 .bl-joker 方塊內，改用靜態排列 */
.bl-joker-menu-head .bl-sticker-row,
.bl-shop-item .bl-sticker-row {
  position: static;
  transform: none;
  margin-left: 4px;
}
.bl-sticker-eternal { color: #ffd54a; }
.bl-sticker-perishable { color: #ff8a5c; }
.bl-sticker-rental { color: #7ee787; }
.bl-slot-empty {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.18);
}
.bl-consumable {
  background: linear-gradient(160deg, #2f3d54 0%, #222d40 100%);
  border: var(--bl-pix) solid var(--bl-border);
  box-shadow: 0 4px 0 var(--bl-border);
  cursor: pointer;
}
.bl-consumable.bl-kind-tarot { border-top: 4px solid #b07cff; }
.bl-consumable.bl-kind-planet { border-top: 4px solid #4fd8e8; }
.bl-consumable.bl-kind-spectral { border-top: 4px solid #7ce4ff; background: linear-gradient(160deg, #223a4d, #1a2c3d); }
.bl-cons-icon { font-size: 1.5rem; }
.bl-cons-name { font-size: 0.58rem; font-weight: 700; line-height: 1.15; padding: 0 3px; }

/* 版本（editions）效果 */
.bl-ed-foil { box-shadow: 0 4px 0 var(--bl-border), inset 0 0 14px rgba(80, 190, 255, 0.75) !important; }
.bl-ed-holo { box-shadow: 0 4px 0 var(--bl-border), inset 0 0 14px rgba(255, 110, 220, 0.7) !important; }
.bl-ed-poly {
  background-image: linear-gradient(120deg,
    rgba(255, 90, 90, 0.28), rgba(255, 200, 60, 0.28), rgba(90, 255, 140, 0.28),
    rgba(80, 170, 255, 0.28), rgba(200, 110, 255, 0.28)) !important;
  background-blend-mode: overlay;
}
.bl-ed-negative { filter: invert(0.88) hue-rotate(180deg); }

/* ── 撲克牌 ───────────────────────────────────────────────────────── */
.bl-hand { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 96px; }
.bl-card {
  width: 62px;
  height: 88px;
  background: #f8f4ea;
  border: var(--bl-pix) solid #262019;
  border-radius: 6px;
  box-shadow: 0 4px 0 #262019;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Silkscreen', monospace;
  transition: transform 0.1s;
  flex: 0 0 auto;
}
.bl-card.selectable { cursor: pointer; }
.bl-card.selectable:hover { transform: translateY(-6px); }
.bl-card.selected { transform: translateY(-16px); box-shadow: 0 4px 0 #262019, 0 0 12px var(--bl-accent); }
.bl-card-sm { width: 46px; height: 66px; }
.bl-card-sm .bl-card-rank { font-size: 0.95rem; }
.bl-card-sm .bl-card-suit { font-size: 1.05rem; }
.bl-card-rank { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.bl-card-suit { font-size: 1.35rem; line-height: 1; }
.bl-suit-s .bl-card-rank, .bl-suit-s .bl-card-suit { color: #2b2b33; }
.bl-suit-c .bl-card-rank, .bl-suit-c .bl-card-suit { color: #1f5e4f; }
.bl-suit-h .bl-card-rank, .bl-suit-h .bl-card-suit { color: #c92f39; }
.bl-suit-d .bl-card-rank, .bl-suit-d .bl-card-suit { color: #d9702a; }
.bl-card-back {
  background: repeating-linear-gradient(45deg, #7145d6 0 8px, #5c37b5 8px 16px);
  border-color: #241a4a;
}
.bl-card-stone { font-size: 1.8rem; }
.bl-forced { outline: 3px solid var(--bl-gold); }
.bl-debuffed { filter: grayscale(0.9) brightness(0.62); }
.bl-not-scoring { opacity: 0.42; }

/* 強化（enhancements） */
.bl-enh-bonus { background: linear-gradient(180deg, #e7f1ff, #bcd8ff); }
.bl-enh-mult { background: linear-gradient(180deg, #ffe3e0, #ffb9b3); }
.bl-enh-wild { background: linear-gradient(120deg, #ffe6ba, #c9f3c4, #bcd8ff, #eec4f5); }
.bl-enh-glass { background: rgba(226, 244, 255, 0.55); backdrop-filter: blur(1px); }
.bl-enh-steel { background: linear-gradient(180deg, #dfe3ea, #aeb6c4); }
.bl-enh-stone { background: linear-gradient(180deg, #9b978f, #6f6b63); }
.bl-enh-gold { background: linear-gradient(180deg, #ffe9ad, #f2c94c); }
.bl-enh-lucky { background: linear-gradient(180deg, #e2ffe4, #b1f0b6); }

/* 封蠟（seals） */
.bl-seal {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.45);
}
.bl-seal-gold { background: #f2b73a; }
.bl-seal-red { background: #e2453e; }
.bl-seal-blue { background: #3f8ce8; }
.bl-seal-purple { background: #9b59d0; }
.bl-card-bonus {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 0.55rem;
  color: #1a5f96;
}

/* ── 出牌區 ───────────────────────────────────────────────────────── */
.bl-play-area { display: flex; flex-direction: column; gap: 12px; flex: 1; justify-content: flex-end; }
.bl-played-zone { display: flex; gap: 8px; justify-content: center; min-height: 96px; align-items: center; }
.bl-preview-note { display: block; font-size: 0.7rem; font-weight: 400; color: var(--bl-dim); }
.bl-actions { display: flex; justify-content: center; align-items: center; gap: 14px; padding-bottom: 6px; }
.bl-sort-group { display: flex; flex-direction: column; gap: 4px; }
.bl-targeting-hint {
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  padding: 6px;
  color: var(--bl-gold);
}
.bl-spectator-note { color: var(--bl-dim); }

/* 觸發動畫 */
.bl-trigger { animation: bl-jiggle 0.3s ease-out; }
@keyframes bl-jiggle { 30% { transform: translateY(-8px) scale(1.06); } }

/* 特效層：固定於 body，pop 數字用 JS 定位在觸發來源正上方，不受任何父層 overflow 裁切 */
.bl-fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
}
.bl-pop {
  position: fixed;
  transform: translate(-50%, -100%);
  font-family: 'Silkscreen', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  animation: bl-pop-rise 0.9s ease-out forwards;
  pointer-events: none;
  white-space: nowrap;
  /* 彩色文字＋白色外框，不論疊在什麼背景上都看得清楚 */
  text-shadow:
    1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff,
    2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff;
}
@keyframes bl-pop-rise {
  from { transform: translate(-50%, -100%); opacity: 1; }
  to { transform: translate(-50%, -160%); opacity: 0; }
}
.bl-pop-chips { color: var(--bl-chips); }
.bl-pop-mult, .bl-pop-xmult { color: var(--bl-mult); }
.bl-pop-money { color: var(--bl-gold); }

/* ── 選 Blind 畫面 ────────────────────────────────────────────────── */
.bl-screen-title {
  text-align: center;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.55);
  margin: 8px 0;
}
.bl-blind-select { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.bl-blind-cards { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.bl-blind-card {
  width: 210px;
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.bl-blind-card.small { border-top: 6px solid var(--bl-chips); }
.bl-blind-card.big { border-top: 6px solid var(--bl-gold); }
.bl-blind-card.boss { border-top: 6px solid var(--bl-danger); background: #2c1b26; }
.bl-blind-card.defeated, .bl-blind-card.skipped { opacity: 0.5; }
.bl-blind-card.current { outline: 3px solid var(--bl-accent); transform: scale(1.04); }
.bl-blind-card-name { font-weight: 700; font-size: 1.05rem; }
.bl-blind-card-desc { font-size: 0.75rem; color: var(--bl-dim); line-height: 1.4; min-height: 32px; }
.bl-blind-card-target { font-family: 'Silkscreen', monospace; color: var(--bl-gold); font-size: 1.1rem; }
.bl-blind-card-reward { color: var(--bl-gold); letter-spacing: 2px; }
.bl-blind-done { color: var(--bl-accent); font-weight: 700; }
.bl-tag-received[data-tag-key]:not([data-tag-key=""]) { cursor: pointer; }
.bl-pending-tag-hint { font-size: 0.66rem; font-weight: 400; color: var(--bl-dim); text-decoration: underline; margin-top: -4px; }

/* ── 結算 ─────────────────────────────────────────────────────────── */
.bl-cashout { max-width: 420px; margin: auto; padding: 20px; text-align: center; }
.bl-cashout-lines { margin: 12px 0; }
.bl-cashout-line {
  display: flex;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
}
.bl-cashout-line b { color: var(--bl-gold); font-family: 'Silkscreen', monospace; }
.bl-cashout-line.bl-cashout-negative b { color: var(--bl-danger); }

/* ── 商店 ─────────────────────────────────────────────────────────── */
.bl-shop { padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.bl-shop-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.bl-shop-controls { display: flex; gap: 10px; }
.bl-shop-row { display: flex; gap: 10px; flex-wrap: wrap; }
.bl-shop-cards { min-height: 120px; }
.bl-shop-item {
  background: var(--bl-panel-lite);
  border: var(--bl-pix) solid var(--bl-border);
  border-radius: 7px;
  box-shadow: 0 4px 0 var(--bl-border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 110px;
  cursor: pointer;
  position: relative;
}
.bl-shop-item-name { font-size: 0.72rem; font-weight: 700; text-align: center; }
.bl-shop-item .bl-joker-icon, .bl-shop-item .bl-cons-icon { font-size: 2rem; }
.bl-shop-empty { color: var(--bl-dim); padding: 20px; }
.bl-shop-lower { display: flex; gap: 16px; align-items: flex-start; }
.bl-shop-packs, .bl-shop-vouchers { display: flex; gap: 10px; flex-wrap: wrap; }
.bl-shop-pack {
  background: #37294f;
  border: var(--bl-pix) solid var(--bl-border);
  border-radius: 7px;
  box-shadow: 0 4px 0 var(--bl-border);
  padding: 10px;
  width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.bl-pack-icon { font-size: 1.9rem; }
.bl-pack-name { font-size: 0.75rem; font-weight: 700; }
.bl-pack-info { font-size: 0.65rem; color: var(--bl-dim); }
.bl-shop-voucher {
  background: #14383d;
  border: var(--bl-pix) solid var(--bl-border);
  border-radius: 7px;
  box-shadow: 0 4px 0 var(--bl-border);
  padding: 10px;
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  cursor: pointer;
  position: relative;
}
.bl-voucher-icon { font-size: 1.6rem; }
.bl-voucher-name { font-weight: 700; font-size: 0.8rem; }

/* ── 開包 ─────────────────────────────────────────────────────────── */
.bl-pack-open { flex: 1; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 10px; }
.bl-pack-items { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.bl-pack-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: bl-deal 0.35s ease-out backwards;
  cursor: pointer;
}
.bl-tap-hint { text-align: center; font-size: 0.68rem; color: var(--bl-dim); }
.bl-pack-item:nth-child(2) { animation-delay: 0.07s; }
.bl-pack-item:nth-child(3) { animation-delay: 0.14s; }
.bl-pack-item:nth-child(4) { animation-delay: 0.21s; }
.bl-pack-item:nth-child(5) { animation-delay: 0.28s; }
@keyframes bl-deal { from { transform: translateY(-30px) scale(0.6); opacity: 0; } }
.bl-pack-hand { opacity: 0.95; }

/* ── 結束畫面 ─────────────────────────────────────────────────────── */
.bl-endscreen {
  max-width: 460px;
  margin: auto;
  padding: 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.bl-endscreen.bl-lose { border-top: 6px solid var(--bl-danger); }
.bl-endscreen.bl-win { border-top: 6px solid var(--bl-gold); }
.bl-end-stats { display: flex; flex-direction: column; gap: 6px; color: var(--bl-dim); }
.bl-end-stats b { color: var(--bl-text); font-family: 'Silkscreen', monospace; }

/* ── Modal ────────────────────────────────────────────────────────── */
.bl-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.bl-modal {
  padding: 18px;
  max-width: 380px;
  width: 92%;
  max-height: 82%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.bl-levels-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.bl-levels-table th, .bl-levels-table td {
  padding: 3px 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.14);
  text-align: left;
}
.bl-levels-table td:nth-child(2), .bl-levels-table th:nth-child(2) { color: var(--bl-gold); }
.bl-joker-menu-head { display: flex; align-items: center; gap: 10px; justify-content: center; }
.bl-joker-menu-desc { color: var(--bl-dim); font-size: 0.85rem; line-height: 1.5; white-space: pre-line; }
.bl-joker-menu-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ── 競速模式 ─────────────────────────────────────────────────────── */
.bl-race-bar {
  display: flex;
  gap: 6px;
  padding: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.bl-race-tab {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  border: 2px solid var(--bl-border);
  border-radius: 6px;
  background: var(--bl-panel-lite);
  color: var(--bl-text);
  padding: 5px 10px;
  cursor: pointer;
  display: flex;
  gap: 6px;
  align-items: center;
}
.bl-race-tab.active { background: var(--bl-accent); color: #04241a; }
.bl-race-tab.me { border-color: var(--bl-gold); }
.bl-race-tab .bl-race-progress { font-family: 'Silkscreen', monospace; font-size: 0.7rem; }
.bl-race-tab.dead { opacity: 0.55; text-decoration: line-through; }
.bl-race-rank {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--bl-dim);
}
.bl-readonly-note {
  text-align: center;
  color: var(--bl-gold);
  font-size: 0.78rem;
  padding: 4px;
}

/* ── 稀有度 ───────────────────────────────────────────────────────── */
.bl-rarity-1 { border-color: #2a5f8f !important; }
.bl-rarity-2 { border-color: #1f8a54 !important; box-shadow: 0 4px 0 #1f8a54; }
.bl-rarity-3 { border-color: #b03535 !important; box-shadow: 0 4px 0 #b03535; }
.bl-rarity-4 { border-color: #7b3fbf !important; box-shadow: 0 4px 0 #7b3fbf, 0 0 10px rgba(160, 90, 255, 0.55); }
.bl-rarity-chip {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  color: #fff;
}
.bl-rarity-chip-1 { background: #2a5f8f; }
.bl-rarity-chip-2 { background: #1f8a54; }
.bl-rarity-chip-3 { background: #b03535; }
.bl-rarity-chip-4 { background: #7b3fbf; }

/* 說明選單裡的「已蒐集/尚未蒐集」標記 */
.bl-discovered-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 4px;
}
.bl-discovered-yes { background: rgba(56, 224, 166, 0.18); color: var(--bl-accent); }
.bl-discovered-no { background: rgba(255, 191, 61, 0.18); color: var(--bl-gold); }

/* 商店貨架小卡右上角的「新」提示 */
.bl-new-pip {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--bl-gold);
  color: #3a2800;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 6px;
  border: 2px solid var(--bl-border);
  z-index: 1;
}

/* ── 側欄資訊按鈕群 ───────────────────────────────────────────────── */
.bl-info-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bl-deck-count {
  margin-top: auto;
  text-align: center;
  font-family: 'Silkscreen', monospace;
  color: var(--bl-dim);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid var(--bl-border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.bl-deck-count:hover { color: var(--bl-text); }

/* ── 牌組檢視 ─────────────────────────────────────────────────────── */
.bl-modal-wide { max-width: 640px; text-align: left; }
.bl-deck-summary { color: var(--bl-gold); font-family: 'Silkscreen', monospace; text-align: center; }
.bl-deck-grid { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.bl-deck-suit-row { display: flex; gap: 3px; flex-wrap: wrap; }
.bl-deck-cell .bl-card { width: 34px; height: 48px; box-shadow: 0 2px 0 #262019; }
.bl-deck-cell .bl-card .bl-card-rank { font-size: 0.75rem; }
.bl-deck-cell .bl-card .bl-card-suit { font-size: 0.8rem; }
.bl-deck-cell .bl-card .bl-seal { width: 8px; height: 8px; top: 2px; right: 2px; }
.bl-deck-used { opacity: 0.28; filter: grayscale(0.6); }
.bl-deck-legend { font-size: 0.72rem; color: var(--bl-dim); text-align: center; }

/* ── 圖鑑（帳號跨對局蒐集進度）────────────────────────────────────── */
.bl-collection-modal { max-height: 82vh; display: flex; flex-direction: column; }
.bl-coll-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.bl-coll-tab {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  border: 2px solid var(--bl-border);
  border-radius: 6px;
  background: var(--bl-panel-lite);
  color: var(--bl-dim);
  padding: 5px 9px;
  cursor: pointer;
}
.bl-coll-tab.active { background: var(--bl-accent); color: #04241a; }
.bl-coll-body { overflow-y: auto; flex: 1; }
.bl-coll-count {
  text-align: center;
  font-family: 'Silkscreen', monospace;
  color: var(--bl-gold);
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.bl-coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.bl-coll-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  text-align: center;
}
.bl-coll-item.bl-coll-got { cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.12); }
.bl-coll-item.bl-coll-got:hover { background: rgba(255, 255, 255, 0.08); }
.bl-coll-item.bl-coll-locked { opacity: 0.4; filter: grayscale(1); }
.bl-coll-icon { font-size: 1.5rem; }
.bl-coll-name { font-size: 0.6rem; color: var(--bl-text); line-height: 1.2; }
.bl-coll-locked .bl-coll-name { color: var(--bl-dim); }

.bl-coll-decks-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.bl-coll-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.22);
  text-align: center;
}
.bl-coll-deck.bl-coll-locked { opacity: 0.55; }
.bl-coll-deck-icon { font-size: 1.7rem; }
.bl-coll-deck-name { font-weight: 700; font-size: 0.8rem; }
.bl-coll-deck-desc { font-size: 0.66rem; color: var(--bl-dim); line-height: 1.35; }
.bl-coll-deck-unlock { font-size: 0.66rem; color: var(--bl-gold); line-height: 1.35; }

/* ── 規則說明 ─────────────────────────────────────────────────────── */
.bl-rules { text-align: left; max-height: 56vh; overflow-y: auto; padding-right: 6px; }
.bl-rules h4 { color: var(--bl-accent); margin: 10px 0 4px; }
.bl-rules p { color: var(--bl-text); font-size: 0.85rem; line-height: 1.65; margin: 0; }
.bl-glossary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 4px; }
.bl-glossary-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--bl-dim);
}
.bl-glossary-item b { color: var(--bl-text); font-size: 0.78rem; }
.bl-glossary-icon { font-size: 1.2rem; line-height: 1; flex: 0 0 auto; }
.bl-ed-swatch { width: 20px; height: 20px; border-radius: 4px; flex: 0 0 auto; border: 2px solid var(--bl-border); background: #444; }
.bl-seal-static { position: static; margin-top: 2px; }
.bl-levels-table .bl-tbl-chips { color: var(--bl-chips); font-family: 'Silkscreen', monospace; }
.bl-levels-table .bl-tbl-mult { color: var(--bl-mult); font-family: 'Silkscreen', monospace; }

/* ── Fever 效果（計分中依倍率升級）────────────────────────────────── */
/* Tier 1：計分面板發光脈動 */
.bl-crt.bl-fever-1 .bl-score-panel,
.bl-crt.bl-fever-2 .bl-score-panel,
.bl-crt.bl-fever-3 .bl-score-panel {
  animation: bl-fever-glow 0.6s ease-in-out infinite alternate;
}
@keyframes bl-fever-glow {
  from { box-shadow: 0 var(--bl-pix) 0 var(--bl-border), 0 0 10px rgba(255, 77, 85, 0.5); }
  to { box-shadow: 0 var(--bl-pix) 0 var(--bl-border), 0 0 26px rgba(255, 77, 85, 0.95), 0 0 44px rgba(255, 191, 61, 0.55); }
}

/* Tier 2：火光暈影 + 螢幕震動 */
.bl-crt.bl-fever-2::before,
.bl-crt.bl-fever-3::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 35;
  box-shadow: inset 0 0 90px rgba(255, 100, 40, 0.55), inset 0 0 200px rgba(255, 60, 60, 0.3);
  animation: bl-fever-flame 0.45s ease-in-out infinite alternate;
}
@keyframes bl-fever-flame {
  from { opacity: 0.55; }
  to { opacity: 1; }
}
.bl-crt.bl-fever-2 .bl-layout { animation: bl-shake 0.32s linear infinite; }
@keyframes bl-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, -2px); }
  100% { transform: translate(1px, 2px); }
}

/* Tier 3：彩虹脈動 + 強烈震動 + FEVER 字樣 */
.bl-crt.bl-fever-3::before {
  box-shadow: inset 0 0 110px rgba(255, 80, 160, 0.6), inset 0 0 240px rgba(120, 80, 255, 0.4);
  animation: bl-fever-flame 0.3s ease-in-out infinite alternate, bl-fever-hue 1.2s linear infinite;
}
@keyframes bl-fever-hue {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}
.bl-crt.bl-fever-3 .bl-layout { animation: bl-shake-hard 0.22s linear infinite; }
@keyframes bl-shake-hard {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-4px, 2px) rotate(-0.3deg); }
  50% { transform: translate(4px, -2px) rotate(0.3deg); }
  75% { transform: translate(-2px, -3px) rotate(-0.2deg); }
  100% { transform: translate(3px, 3px) rotate(0.2deg); }
}
.bl-crt.bl-fever-3::after {
  content: 'FEVER!!';
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%) rotate(-4deg);
  z-index: 36;
  pointer-events: none;
  font-family: 'Silkscreen', monospace;
  font-size: 2.6rem;
  font-weight: 700;
  color: #fff;
  text-shadow:
    3px 3px 0 #ff4d55, -3px -3px 0 #33a7ff,
    0 0 24px rgba(255, 191, 61, 0.9);
  animation: bl-fever-text 0.5s ease-in-out infinite alternate;
}
@keyframes bl-fever-text {
  from { transform: translateX(-50%) rotate(-4deg) scale(1); }
  to { transform: translateX(-50%) rotate(3deg) scale(1.14); }
}

@media (prefers-reduced-motion: reduce) {
  .bl-crt.bl-fever-2 .bl-layout,
  .bl-crt.bl-fever-3 .bl-layout,
  .bl-crt.bl-fever-3::after { animation: none; }
}

/* ── 響應式（橫式窄螢幕）──────────────────────────────────────────── */
@media (max-width: 860px) {
  .bl-layout { flex-direction: column; padding: 8px; gap: 8px; }
  .bl-sidebar { flex: none; flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 6px; }
  .bl-sidebar > * { flex: 1 1 140px; }
  .bl-deck-count { margin-top: 0; align-self: center; }
  .bl-card { width: 50px; height: 72px; }
  .bl-card .bl-card-rank { font-size: 1rem; }
  .bl-card .bl-card-suit { font-size: 1.1rem; }
  .bl-joker, .bl-slot-empty, .bl-consumable { width: 62px; height: 86px; }
  .bl-joker-icon { font-size: 1.4rem; }
  .bl-top-row { flex-direction: column; }
  .bl-blind-card { width: 100%; }
}

/* ── 直式手機布局 ─────────────────────────────────────────────────── */
@media (max-width: 600px) and (orientation: portrait) {
  .bl-crt { min-height: calc(100dvh - 120px); }
  .bl-layout { padding: 6px; gap: 6px; min-height: calc(100dvh - 120px); }

  /* 側欄壓縮成兩列資訊條 */
  .bl-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }
  .bl-sidebar .bl-spectator-badge { grid-column: 1 / -1; }
  .bl-blind-chip { padding: 6px; }
  .bl-blind-name { font-size: 0.8rem; }
  .bl-blind-desc { font-size: 0.62rem; }
  .bl-blind-target { font-size: 0.9rem; margin-top: 2px; }
  .bl-score-panel { padding: 6px; }
  .bl-score-value { font-size: 1.1rem; }
  .bl-chipmult { font-size: 0.9rem; margin-top: 4px; }
  .bl-stats { grid-column: 1 / -1; grid-template-columns: repeat(5, 1fr); padding: 5px 6px; }
  .bl-stat { flex-direction: column; align-items: center; font-size: 0.62rem; gap: 0; }
  .bl-info-btns { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
  .bl-btn-info { font-size: 0.62rem; padding: 4px 2px; }
  .bl-vouchers-owned, .bl-tags-owned { padding: 4px 6px; }
  .bl-hand-name { font-size: 0.78rem; min-height: 16px; }

  /* 小丑/消耗牌各自獨立一列、各自橫向捲動，不再左右分欄——欄位一多兩邊都會
     被擠壓變形。改成上下兩列後每列都拿到完整寬度，也不需要 min-width:0 這種
     flex 子項縮小的技巧（column 排列下每列本來就是 100% 寬）。 */
  .bl-top-row { flex-direction: column; gap: 6px; align-items: stretch; }
  .bl-jokers, .bl-consumables {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    /* 上方多留 16px：小丑牌右上角的數值徽章會探出卡片外，
       overflow-x:auto 會讓瀏覽器連同 overflow-y 一起裁切，沒有這段留白就會被切掉 */
    padding: 16px 4px 4px;
  }
  .bl-consumables { border-top: 2px solid rgba(255, 255, 255, 0.14); padding-top: 12px; }
  .bl-joker, .bl-slot-empty, .bl-consumable { width: 58px; height: 80px; flex: 0 0 auto; }
  .bl-joker-name, .bl-cons-name { font-size: 0.52rem; }

  /* 手牌重疊扇形排列，一排放得下 */
  .bl-hand { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: 18px 8px 4px; }
  .bl-hand .bl-card { margin-left: -18px; }
  .bl-hand .bl-card:first-child { margin-left: 0; }
  .bl-card { width: 48px; height: 70px; }
  .bl-card.selected { transform: translateY(-12px); }

  .bl-actions { gap: 8px; flex-wrap: wrap; }
  .bl-btn-play, .bl-btn-discard { font-size: 0.9rem; padding: 8px 10px; flex: 1 1 38%; }
  .bl-sort-group { flex-direction: row; order: 3; }

  .bl-played-zone { min-height: 76px; }
  .bl-blind-cards { gap: 8px; }
  .bl-shop-item { min-width: 90px; padding: 6px; }
  .bl-shop-pack, .bl-shop-voucher { width: calc(50% - 6px); }
  .bl-race-bar { padding: 5px; gap: 4px; }
  .bl-race-tab { font-size: 0.68rem; padding: 3px 6px; flex-direction: column; gap: 0; }
  .bl-race-rank { display: none; }
  .bl-modal { max-width: 96%; padding: 12px; }
}
