/* ============================================================================
   BOF HUD v2: แถบควบคุมในเกม · หน้าจบเกม · ประวัติการต่อสู้
   ไอคอนเส้นจาก js/bof-icons.js (currentColor) · โมชั่นด้วย transform/opacity · เคารพ reduced motion
   กฎเฉพาะมือถืออยู่ใน css/mobile.css (โหลดหลังไฟล์นี้) — ไฟล์นี้ใช้ได้ทั้ง PC และมือถือ
   ============================================================================ */
.bof-i { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -.15em; overflow: visible; }

/* ---------------------------------------------------------------------------
   1. แถบควบคุมกลางกระดาน (Center Control Bar Refined)
   --------------------------------------------------------------------------- */
.center-bar {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 10px 14px !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, rgba(20, 26, 54, 0.95), rgba(10, 14, 32, 0.95)) !important;
  border: 1px solid rgba(160, 175, 255, 0.22) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

.center-bar-top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  gap: 12px !important;
  padding-bottom: 7px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.control-btn-group {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  gap: 8px !important;
}

/* ตาเรา: จุดเขียวเต้นหน้าข้อความเทิร์น */
.turn-phase-group #turn-indicator { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; }
.turn-phase-group #turn-indicator::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: #64748b; box-shadow: 0 0 0 0 rgba(94, 242, 160, 0); transition: background .3s;
}
.turn-phase-group.is-my-turn #turn-indicator::before { background: #5ef2a0; animation: hud-dot 1.6s ease-out infinite; }
@keyframes hud-dot { 0% { box-shadow: 0 0 0 0 rgba(94, 242, 160, .7); } 100% { box-shadow: 0 0 0 9px rgba(94, 242, 160, 0); } }

/* ป้ายเฟส: ไอคอน + ชื่อเฟส · สีตามเฟส */
#phase-indicator {
  display: inline-flex; align-items: center; gap: 6px; transition: color .3s, border-color .3s, background .3s;
  background: rgba(56, 189, 248, .1) !important; color: #7dd3fc !important; border: 1px solid rgba(56, 189, 248, .45) !important;
  border-radius: 8px !important; padding: 3px 10px !important; font-size: 12px !important; font-weight: 700 !important;
}
#phase-indicator .bof-i { font-size: 1.15em; }
#phase-indicator[data-phase="battle"] { background: rgba(251, 146, 60, .12) !important; color: #fdba74 !important; border-color: rgba(251, 146, 60, .55) !important; }
#phase-indicator[data-phase="battle"] .bof-i { animation: hud-clash .5s cubic-bezier(.3, 1.6, .5, 1) both; }
#phase-indicator[data-phase="other"] { background: rgba(148, 163, 184, .1) !important; color: #cbd5e1 !important; border-color: rgba(148, 163, 184, .35) !important; }
@keyframes hud-clash { from { transform: scale(.4) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* โควตาเวท: ไอคอน + ตัวนับ · ยังใช้ได้ = ไอคอนเรือง · ใช้แล้ว = จาง */
.quota-badges { display: flex; align-items: center; gap: 8px; }
.quota-badges span {
  display: inline-flex !important; align-items: center; gap: 5px;
  background: rgba(255, 255, 255, .05) !important; border: 1px solid rgba(160, 175, 255, .18) !important; border-radius: 8px !important;
  color: #e2e6f8; transition: opacity .3s, border-color .3s; padding: 4px 10px !important; font-size: 11.5px !important;
}
.quota-badges span b { font-weight: 800; font-variant-numeric: tabular-nums; }
.quota-badges .q-label:empty { display: none; }
.quota-badges .q-label { color: #aab1d8; font-size: .92em; font-weight: 600; }
#normal-spell-quota .bof-i { color: #ffd77a; filter: drop-shadow(0 0 4px rgba(255, 215, 122, .7)); animation: hud-twinkle 2.6s ease-in-out infinite; }
#reaction-spell-quota .bof-i { color: #7fd3ff; filter: drop-shadow(0 0 4px rgba(127, 211, 255, .7)); }
.quota-badges span.is-spent { opacity: .5; }
.quota-badges span.is-spent .bof-i { filter: grayscale(1); animation: none; }
@keyframes hud-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.18) rotate(12deg); } }

/* เสียง: คลื่นเสียงกระเพื่อม */
#btn-toggle-sound {
  display: inline-grid !important; place-items: center; color: #e2e6f8;
  width: 38px !important; height: 38px !important; border-radius: 9px !important; flex: none !important;
  background: rgba(255, 255, 255, .06) !important; border: 1px solid rgba(160, 175, 255, .2) !important;
  transition: transform .15s, background .2s, border-color .2s;
}
#btn-toggle-sound:hover { background: rgba(255, 255, 255, .12) !important; transform: translateY(-1px); }
#btn-toggle-sound .bof-i { font-size: 1.35em; }
#btn-toggle-sound .i-wave { animation: hud-wave 1.8s ease-in-out infinite; }
#btn-toggle-sound .i-w2 { animation-delay: .25s; }
#btn-toggle-sound.is-muted { color: #fca5a5; background: rgba(127, 29, 29, .35) !important; border-color: rgba(248, 113, 113, .45) !important; }
@keyframes hud-wave { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ยอมแพ้: อยู่ฝั่งซ้ายข้างปุ่มเสียง */
#btn-surrender-match {
  display: inline-flex !important; align-items: center; justify-content: center; gap: 6px; color: #fca5a5 !important;
  height: 38px !important; padding: 0 12px !important; border-radius: 9px !important; font-size: 12px !important; font-weight: 600 !important;
  background: rgba(239, 68, 68, .08) !important; border: 1px solid rgba(248, 113, 113, .35) !important;
  transition: all .2s; flex: none !important;
}
#btn-surrender-match:hover {
  background: rgba(239, 68, 68, .2) !important; border-color: rgba(248, 113, 113, .6) !important; color: #fff !important; transform: translateY(-1px);
}
#btn-surrender-match .bof-i { font-size: 1.2em; }
#btn-surrender-match:hover .i-cloth, #btn-surrender-match:active .i-cloth { animation: hud-wave-flag .6s ease-in-out infinite alternate; transform-origin: 0 50%; }
@keyframes hud-wave-flag { to { transform: skewY(-6deg) scaleX(.92); } }

/* ป้ายการ์ดล่าสุดที่ทำงาน */
#btn-last-card-pill {
  display: inline-flex !important; align-items: center; gap: 6px;
  height: 38px !important; padding: 3px 10px 3px 6px !important; border-radius: 9px !important;
  background: rgba(15, 23, 42, 0.75) !important; border: 1px solid rgba(56, 189, 248, 0.35) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important; flex: none !important; max-width: 190px !important;
  transition: all 0.2s;
}
#btn-last-card-pill:hover { border-color: rgba(56, 189, 248, 0.7) !important; transform: translateY(-1px); }
.last-card-pill-img { width: 22px !important; height: 28px !important; border-radius: 4px !important; border: 1px solid rgba(255, 255, 255, 0.3) !important; object-fit: cover; }

/* ปุ่มทดสอบสกิล (Sandbox) */
#btn-open-sandbox {
  height: 38px !important; padding: 0 12px !important; border-radius: 9px !important;
  font-size: 12px !important; font-weight: 600 !important; color: #e9d5ff !important;
  background: rgba(147, 51, 234, 0.18) !important; border: 1px solid rgba(168, 85, 247, 0.45) !important;
  transition: all 0.2s !important; flex: none !important;
}
#btn-open-sandbox:hover { background: rgba(147, 51, 234, 0.35) !important; border-color: #a855f7 !important; color: #fff !important; transform: translateY(-1px); }

/* ปุ่มเฟส/จบเทิร์น: อยู่ฝั่งขวาสุด ใหญ่ เด่น สง่างาม */
#btn-pass-turn-inline {
  display: inline-flex !important; align-items: center; justify-content: center; gap: 8px;
  margin-left: 0 !important; height: 38px !important; min-width: 200px !important; padding: 0 20px !important;
  border-radius: 9px !important; font-size: 13.5px !important; font-weight: 800 !important;
  letter-spacing: .01em; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); color: #fff !important; border: 0 !important;
  background: linear-gradient(135deg, #38bdf8, #0369a1) !important;
  box-shadow: 0 6px 18px rgba(2, 132, 199, .35), inset 0 1px 0 rgba(255, 255, 255, .3) !important;
  transition: transform .12s ease, filter .2s, box-shadow .3s; flex: none !important;
}
#btn-pass-turn-inline[data-state="battle"] {
  background: linear-gradient(135deg, #fbbf24, #ea580c) !important;
  box-shadow: 0 6px 18px rgba(234, 88, 12, .4), inset 0 1px 0 rgba(255, 255, 255, .35) !important;
}
#btn-pass-turn-inline[data-state="wait"], #btn-pass-turn-inline:disabled {
  background: linear-gradient(135deg, #475569, #273244) !important; box-shadow: none !important; color: #cbd5e1 !important;
}
#btn-pass-turn-inline:not(:disabled):hover { filter: brightness(1.08); transform: translateY(-1px); }
#btn-pass-turn-inline:not(:disabled):active { transform: scale(.97); }
#btn-pass-turn-inline .pb-ico { display: inline-grid; place-items: center; font-size: 1.3em; line-height: 0; }
#btn-pass-turn-inline .pb-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#btn-pass-turn-inline .pb-shine {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
  transform: translateX(-100%);
}
#btn-pass-turn-inline:not(:disabled) .pb-shine { opacity: 1; animation: hud-shine 3.2s ease-in-out infinite; }
#btn-pass-turn-inline[data-state="main"]:not(:disabled) .bof-i-sword { animation: hud-swing 2.4s ease-in-out infinite; transform-origin: 50% 85%; }
#btn-pass-turn-inline[data-state="battle"]:not(:disabled) .i-a1 { animation: hud-nudge 1.2s ease-in-out infinite; }
#btn-pass-turn-inline[data-state="battle"]:not(:disabled) .i-a2 { animation: hud-nudge 1.2s ease-in-out .12s infinite; }
#btn-pass-turn-inline .bof-i-hourglass { animation: hud-flip 2.4s cubic-bezier(.6, 0, .3, 1) infinite; }

/* ---------------------------------------------------------------------------
   2. หน้าจบเกม (#custom-choice-modal.um-end) — ต่อยอด css/choice-ui.css
   --------------------------------------------------------------------------- */
#custom-choice-modal.um-end .um-emblem {
  --c: 243, 201, 105; width: 124px; height: 124px; margin: 0 auto 10px; font-size: 58px;
  background: radial-gradient(circle at 50% 38%, rgba(var(--c), .3), rgba(10, 12, 28, .96) 68%);
  border: 0; box-shadow: 0 0 46px rgba(var(--c), .35), 0 12px 30px rgba(0, 0, 0, .55);
}
#custom-choice-modal.um-defeat .um-emblem { --c: 248, 92, 92; }
.um-emblem .em-core { position: relative; z-index: 2; display: inline-grid; place-items: center; line-height: 0; color: rgb(var(--c)); filter: drop-shadow(0 0 10px rgba(var(--c), .8)); }
.um-victory .um-emblem .em-core { color: #ffe39a; }
.um-emblem .em-ring { position: absolute; inset: -12px; width: calc(100% + 24px); height: calc(100% + 24px); z-index: 1; overflow: visible; }
.um-emblem .em-ring circle { fill: none; stroke: rgb(var(--c)); }
.um-emblem .em-r1 { stroke-width: 1.4; stroke-dasharray: 3 6; opacity: .7; transform-box: fill-box; transform-origin: center; animation: em-spin 18s linear infinite; }
.um-emblem .em-r2 { stroke-width: 2.6; stroke-dasharray: 296; stroke-dashoffset: 296; animation: em-draw .9s cubic-bezier(.6, 0, .2, 1) .15s forwards; filter: drop-shadow(0 0 4px rgba(var(--c), .9)); }
.um-emblem .em-ticks { fill: rgb(var(--c)); transform-box: view-box; transform-origin: 60px 60px; animation: em-spin 26s linear infinite reverse; }
.um-emblem .em-crack { fill: none; stroke: #ffd0d0; stroke-width: 2.4; stroke-linejoin: round; stroke-dasharray: 120; stroke-dashoffset: 120;
  filter: drop-shadow(0 0 4px rgba(255, 60, 60, .95)); animation: em-draw .35s ease-in .6s forwards; }
.um-emblem .em-rays {
  position: absolute; inset: -70%; z-index: 0; border-radius: 50%; pointer-events: none; opacity: .55;
  background: repeating-conic-gradient(from 0deg, rgba(255, 227, 154, .35) 0 6deg, transparent 6deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%); mask: radial-gradient(circle, #000 18%, transparent 62%);
  animation: em-spin 22s linear infinite;
}
@keyframes em-spin { to { transform: rotate(360deg); } }
@keyframes em-draw { to { stroke-dashoffset: 0; } }

/* แผงสรุปผล */
.um-end-panel {
  --c: 243, 201, 105; position: relative; margin: 14px auto 0; max-width: 560px; padding: 20px 22px 18px; border-radius: 20px; overflow: hidden;
  background: linear-gradient(180deg, rgba(24, 28, 60, .88), rgba(10, 12, 28, .94));
  border: 1px solid rgba(var(--c), .3); box-shadow: 0 18px 50px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.um-defeat .um-end-panel { --c: 248, 113, 113; }
.um-end-panel::before { /* เส้นแสงขอบบนวิ่งผ่าน */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(var(--c), .95), transparent); background-size: 50% 100%; background-repeat: no-repeat;
  animation: um-edge-run 3.4s ease-in-out infinite;
}
@keyframes um-edge-run { from { background-position: -60% 0; } to { background-position: 160% 0; } }
#custom-choice-modal.um-end .um-end-panel #choice-modal-title { margin: 0 0 4px; font-size: 21px; }
#custom-choice-modal.um-end .um-end-panel #choice-modal-desc { margin: 0 0 14px; font-size: 14px; line-height: 1.55; }
.um-end-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.um-stat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 6px; border-radius: 14px;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(160, 175, 255, .14);
}
.um-stat-tile b { font: 800 22px/1 var(--font-display, system-ui); color: #fff; font-variant-numeric: tabular-nums; }
.um-stat-tile b small { font-size: .55em; color: #8b93bf; font-weight: 600; }
.um-stat-tile span { font-size: 11.5px; color: #aab1d8; }
.um-stat-tile.is-me b { color: #5ef2a0; } .um-stat-tile.is-foe b { color: #ff8a9a; }
.um-end-reward {
  display: inline-flex; align-items: center; gap: 7px; margin: 0 auto 14px; padding: 6px 14px 6px 8px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 215, 122, .18), rgba(255, 170, 60, .08)); border: 1px solid rgba(255, 215, 122, .5);
  color: #ffe39a; font-weight: 800;
}
.um-end-reward .bof-i { font-size: 22px; animation: um-coin 2.6s ease-in-out 1s infinite; }
.um-end-reward b { font-size: 18px; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.um-end-reward span { font-size: 13px; color: #f3d48a; font-weight: 600; }
@keyframes um-coin { 0%, 70%, 100% { transform: rotateY(0); } 85% { transform: rotateY(180deg); } }
.um-end-panel { text-align: center; }
#custom-choice-modal.um-end .um-end-panel #choice-modal-buttons { margin-top: 0; }
#custom-choice-modal.um-end #choice-modal-buttons .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.um-end-ico { display: inline-grid; place-items: center; font-size: 1.25em; line-height: 0; transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); }
#choice-modal-buttons .btn:hover .um-end-ico { transform: rotate(-25deg) scale(1.1); }
#choice-modal-buttons .btn:hover .bof-i-home { transform: none; }
#choice-modal-buttons .btn:hover .um-end-ico:has(.bof-i-rematch) { transform: rotate(-180deg); }

/* ---------------------------------------------------------------------------
   3. ประวัติการต่อสู้ (#combat-log-modal .cl-v2)
   --------------------------------------------------------------------------- */
#combat-log-modal .cl-v2 {
  max-width: 920px; width: 95%; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  padding: 0 !important; border-radius: 22px !important; color: #e2e6f8; text-align: left;
  background: linear-gradient(180deg, #141838, #0a0c20) !important; border: 1px solid rgba(243, 201, 105, .28) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7) !important;
}
.cl-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 12px; border-bottom: 1px solid rgba(160, 175, 255, 0.1); }
.cl-head-ico {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; color: #ffe39a;
  background: radial-gradient(circle at 50% 30%, rgba(243, 201, 105, .35), rgba(243, 201, 105, .08)); border: 1px solid rgba(243, 201, 105, .45);
}
.cl-head-text { flex: 1; min-width: 0; }
.cl-head h2 { margin: 0; font: 700 18px/1.2 var(--font-display, system-ui); color: #fff; }
.cl-head small { display: block; margin-top: 2px; font-size: 12px; color: #8b93bf; }
.cl-close {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; flex: none; cursor: pointer;
  color: #aab1d8; background: rgba(255, 255, 255, .06); border: 1px solid rgba(160, 175, 255, .16); transition: transform .2s, color .2s, background .2s;
}
.cl-close:hover { color: #fff; background: rgba(255, 255, 255, .12); transform: rotate(90deg); }

/* Layout 2 ฝั่ง: ซ้ายแสดงการ์ด (Spotlight) / ขวาแสดง Log */
.cl-layout {
  display: flex; flex: 1; min-height: 0; overflow: hidden;
}

/* ฝั่งซ้าย: โชว์การ์ดเด่นเต็มใบ */
.cl-left-col {
  width: 300px; flex-shrink: 0; padding: 14px 16px 16px; border-right: 1px solid rgba(160, 175, 255, 0.12);
  display: flex; flex-direction: column; background: rgba(10, 14, 34, 0.6); overflow-y: auto;
}
.cl-spot {
  --side: 56, 189, 248; position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%;
}
.cl-spot.is-ai { --side: 244, 63, 94; }
.cl-spot-art {
  position: relative; padding: 0; border: 0; background: none; cursor: zoom-in;
  width: 145px; height: 203px; border-radius: 12px; overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7), 0 0 16px rgba(var(--side), 0.35);
  border: 2px solid rgba(var(--side), 0.55); flex-shrink: 0;
}
.cl-spot-art img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.cl-spot-art:hover img { transform: scale(1.06); }
.cl-spot-zoom {
  position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; color: #fff; background: rgba(11, 14, 36, .85);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.cl-spot-body {
  width: 100%; display: flex; flex-direction: column; gap: 6px; text-align: left;
}
.cl-spot-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.cl-side { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: rgb(var(--side)); background: rgba(var(--side), .14); }
.cl-rarity { font: 800 10.5px/1 system-ui; padding: 3px 7px; border-radius: 6px; color: #fff; background: #475569; letter-spacing: .04em; }
.cl-rarity.rarity-R { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.cl-rarity.rarity-SR { background: linear-gradient(135deg, #c084fc, #7c3aed); }
.cl-rarity.rarity-SSR, .cl-rarity.rarity-Legend { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #2a1a00; }
.cl-spot-name {
  font: 700 16px/1.3 var(--font-display, system-ui); color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5); word-break: break-word;
}
.cl-spot-stat {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05); padding: 3px 8px; border-radius: 6px; width: fit-content;
}
.cl-spot-stat b { color: #facc15; }
.cl-spot-skill {
  margin: 2px 0 0; font-size: 12px; line-height: 1.55; color: #94a3b8;
  background: rgba(15, 23, 42, 0.65); padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.08);
  max-height: 160px; overflow-y: auto; white-space: pre-wrap;
}
.cl-spot-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 260px;
  color: #64748b; text-align: center; gap: 10px; font-size: 13px;
}
.cl-spot-ph-icon { font-size: 42px; opacity: 0.6; }

/* ฝั่งขวา: ฟิลเตอร์ + รายการ Log */
.cl-right-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
#combat-log-modal .combat-log-filters {
  display: flex; gap: 6px; padding: 10px 14px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid rgba(160, 175, 255, 0.08) !important; flex-shrink: 0;
}
#combat-log-modal .combat-log-filters::-webkit-scrollbar { display: none; }
.combat-filter-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 32px; padding: 0 10px 0 12px; border-radius: 999px; cursor: pointer;
  font: 600 12.5px/1 inherit; color: #c9cde6; background: rgba(255, 255, 255, .05); border: 1px solid rgba(160, 175, 255, .16);
  transition: background .2s, color .2s, border-color .2s, transform .12s;
}
.combat-filter-btn .bof-i { font-size: 1.1em; }
.combat-filter-btn:active { transform: scale(.96); }
.combat-filter-btn .cl-count { min-width: 20px; padding: 2px 6px; border-radius: 999px; font-size: 11px; text-align: center; background: rgba(255, 255, 255, .1); }
.combat-filter-btn.is-active { color: #1a1405; border-color: transparent; background: linear-gradient(135deg, #f7d77f, #e0a83c); box-shadow: 0 4px 14px rgba(243, 201, 105, .3); }
.combat-filter-btn.is-active .cl-count { background: rgba(26, 20, 5, .18); }
.combat-filter-btn.is-empty:not(.is-active) { opacity: .5; }

@media (max-width: 720px) {
  .cl-layout { flex-direction: column; }
  .cl-left-col {
    width: 100%; border-right: 0; border-bottom: 1px solid rgba(160, 175, 255, 0.12);
    padding: 8px 12px; max-height: 120px; overflow: hidden;
  }
  .cl-spot { flex-direction: row; align-items: center; gap: 10px; }
  .cl-spot-art { width: 50px; height: 70px; }
  .cl-spot-skill { display: none; }
  .cl-spot-placeholder { min-height: 50px; flex-direction: row; gap: 6px; font-size: 11px; }
  .cl-spot-ph-icon { font-size: 22px; }
}

/* ---------------------------------------------------------------------------
   รายการประวัติการต่อสู้ (สไตล์ที่ 1: Timeline Action Cards)
   --------------------------------------------------------------------------- */
#combat-log-list {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 14px 18px; min-height: 220px;
  display: flex; flex-direction: column; gap: 8px; border-top: 1px solid rgba(160, 175, 255, .1);
}
.cl-turn {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 0 4px;
  font: 700 11px/1 var(--font-display, system-ui); letter-spacing: .05em;
  background: linear-gradient(180deg, #121636 75%, rgba(18, 22, 54, 0));
}
.cl-turn::before, .cl-turn::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, .35), transparent);
}
.cl-turn span {
  padding: 3px 12px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: #38bdf8; background: rgba(56, 189, 248, .12); border: 1px solid rgba(56, 189, 248, .3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.cl-row {
  --side: 56, 189, 248; --side-bg: rgba(56, 189, 248, 0.07); --border-tint: rgba(56, 189, 248, 0.22);
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px; border-radius: 14px; text-align: left; color: inherit; font: inherit;
  background: linear-gradient(90deg, var(--side-bg) 0%, rgba(15, 23, 42, 0.8) 50%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid var(--border-tint);
  border-left: 4px solid rgb(var(--side));
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  transition: transform .15s, border-color .2s, background .2s, box-shadow .2s;
}
.cl-row.is-ai {
  --side: 244, 63, 94; --side-bg: rgba(244, 63, 94, 0.07); --border-tint: rgba(244, 63, 94, 0.22);
}
.cl-row:hover {
  background: linear-gradient(90deg, var(--side-bg) 0%, rgba(30, 41, 59, 0.9) 60%, rgba(30, 41, 59, 0.7) 100%);
  border-color: rgba(var(--side), 0.5);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.45);
}
.cl-row.is-selected {
  border-color: #f3c969 !important;
  border-left-color: #f3c969 !important;
  background: linear-gradient(90deg, rgba(243, 201, 105, 0.16) 0%, rgba(30, 41, 59, 0.92) 60%) !important;
  box-shadow: 0 0 16px rgba(243, 201, 105, 0.28) !important;
}

.cl-thumb {
  width: 42px; height: 58px; border-radius: 8px; object-fit: cover; flex: none;
  border: 1.5px solid rgba(255, 255, 255, 0.2); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
  transition: transform .2s, border-color .2s;
}
.cl-row:hover .cl-thumb {
  transform: scale(1.06);
  border-color: rgb(var(--side));
}
.cl-thumb-fallback {
  width: 42px; height: 58px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-size: 20px; color: rgb(var(--side));
  background: rgba(var(--side), 0.12); border: 1.5px dashed rgba(var(--side), 0.35);
}

.cl-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cl-row-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cl-side-pill {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  letter-spacing: .02em; display: inline-flex; align-items: center; gap: 4px;
}
.cl-side-pill.is-player {
  background: rgba(56, 189, 248, 0.2); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.35);
}
.cl-side-pill.is-ai {
  background: rgba(244, 63, 94, 0.2); color: #fca5a5; border: 1px solid rgba(244, 63, 94, 0.35);
}

.cl-cat-pill {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 6px;
}
.cl-cat-pill.cat-spell { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.3); }
.cl-cat-pill.cat-attack { background: rgba(249, 115, 22, 0.2); color: #fdba74; border: 1px solid rgba(249, 115, 22, 0.3); }
.cl-cat-pill.cat-summon { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.cl-cat-pill.cat-other { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

.cl-time { font-size: 10.5px; color: #64748b; margin-left: auto; font-family: ui-monospace, monospace; }
.cl-msg { font-size: 13px; line-height: 1.5; color: #f1f5f9; overflow-wrap: anywhere; }
.cl-card-hl {
  font-weight: 700; color: #38bdf8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}
.cl-row.is-ai .cl-card-hl {
  color: #fb7185;
  text-shadow: 0 0 10px rgba(251, 113, 133, 0.35);
}
.cl-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 0; color: #64748b; font-size: 14px; }
.cl-empty .bof-i { font-size: 34px; }

/* ============================================================================
   LIVE BATTLE ACTION TICKER (แถบ Action Log เรียลไทม์กลางกระดาน)
   ============================================================================ */
.live-battle-ticker {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
  height: 38px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.88) 0%, rgba(24, 32, 60, 0.82) 100%) !important;
  border: 1px solid rgba(160, 175, 255, 0.22) !important;
  border-radius: 9px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  user-select: none !important;
}
.live-battle-ticker:hover {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.95) 0%, rgba(45, 55, 95, 0.92) 100%) !important;
  border-color: rgba(56, 189, 248, 0.6) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 14px rgba(56, 189, 248, 0.25) !important;
  transform: translateY(-1px) !important;
}
.live-battle-ticker.ticker-bump {
  animation: tickerPulse 0.45s ease-out;
}
@keyframes tickerPulse {
  0% { transform: scale(0.98); border-color: #38bdf8; box-shadow: 0 0 16px rgba(56, 189, 248, 0.6); }
  50% { transform: scale(1.01); border-color: #fbbf24; box-shadow: 0 0 20px rgba(251, 191, 36, 0.6); }
  100% { transform: scale(1); }
}
.ticker-badge {
  font-size: 11px !important;
  font-weight: 800 !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  white-space: nowrap !important;
  letter-spacing: 0.3px !important;
  color: #fff !important;
  background: #0284c7;
  flex-shrink: 0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
  transition: background 0.2s ease !important;
}
.ticker-content {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  font-size: 12.5px !important;
  line-height: 1.4 !important;
  color: #f1f5f9 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  letter-spacing: 0.2px !important;
}
.ticker-history-hint {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #f3c969 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding-left: 8px !important;
  border-left: 1px solid rgba(255, 255, 255, 0.12) !important;
  opacity: 0.9 !important;
  transition: opacity 0.2s, transform 0.2s !important;
}
.live-battle-ticker:hover .ticker-history-hint {
  opacity: 1 !important;
  transform: translateX(2px) !important;
  color: #ffe39a !important;
}

/* ============================================================================
   SKILL CUT-IN SHOWCASE BANNER (แบนเนอร์แจ้งเตือนสกิลเริ่มทำงานแบบพรีเมียม)
   ============================================================================ */
@keyframes bannerGlowFlare {
  0% { box-shadow: 0 20px 50px rgba(0,0,0,0.85), 0 0 20px var(--banner-theme, #fbbf24); }
  50% { box-shadow: 0 25px 65px rgba(0,0,0,0.95), 0 0 50px var(--banner-theme, #fbbf24), 0 0 25px #ffffff; }
  100% { box-shadow: 0 20px 50px rgba(0,0,0,0.85), 0 0 25px var(--banner-theme, #fbbf24); }
}
@keyframes bannerEntrySlide {
  0% {
    opacity: 0;
    transform: translate(-50%, -62%) scale(0.8);
    filter: brightness(2);
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -49%) scale(1.03);
    filter: brightness(1.2);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1);
  }
}
#fx-card-cutin-banner {
  position: fixed;
  top: 36%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 500;
  background: linear-gradient(135deg, rgba(12, 16, 38, 0.97), rgba(24, 30, 64, 0.96));
  border: 2px solid var(--banner-theme, #fbbf24);
  border-radius: 18px;
  padding: 14px 22px;
  display: none;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.9), 0 0 35px var(--banner-theme, rgba(251, 191, 36, 0.5));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: none;
  opacity: 0;
  min-width: 320px;
  max-width: min(92vw, 540px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#fx-card-cutin-banner.show {
  display: flex !important;
  opacity: 1;
  animation: bannerEntrySlide 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards, bannerGlowFlare 1.4s ease-in-out infinite alternate;
}
#fx-card-cutin-banner img {
  width: 72px;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--banner-theme, #38bdf8);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65);
  flex-shrink: 0;
}
.cutin-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.cutin-info-actor {
  font-size: 11.5px;
  font-weight: 800;
  padding: 2.5px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--banner-theme-bg, rgba(56, 189, 248, 0.25));
  border: 1px solid var(--banner-theme, rgba(56, 189, 248, 0.5));
  letter-spacing: 0.3px;
}
.cutin-turn-badge {
  font-size: 11px;
  color: #f3c969;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.cutin-info-title {
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}
.cutin-info-sub {
  font-size: 13px;
  line-height: 1.45;
  color: #e2e8f0;
  word-break: break-word;
}

@media (prefers-reduced-motion: reduce) {
  .turn-phase-group.is-my-turn #turn-indicator::before, #normal-spell-quota .bof-i, #btn-pass-turn-inline .pb-shine,
  #btn-pass-turn-inline .bof-i, #btn-pass-turn-inline .bof-i *, #btn-toggle-sound .i-wave, #phase-indicator .bof-i,
  .um-emblem .em-r1, .um-emblem .em-ticks, .um-emblem .em-rays, .um-end-panel::before, .um-end-reward .bof-i { animation: none !important; }
  .um-emblem .em-r2, .um-emblem .em-crack { animation: none; stroke-dashoffset: 0; }
}
