* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #090d16;
  color: #f8fafc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

#game-app {
  width: 100%;
  max-width: 1100px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 50px;
}

/* CÁC MÀN HÌNH */
.screen {
  display: none;
  width: 100%;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* =========================================
   1. MÀN HÌNH GIỚI THIỆU THỬ THÁCH
   ========================================= */
.selection-screen {
  padding: 50px 20px;
  text-align: center;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e293b 0%, #090d16 100%);
}

.game-title {
  font-size: 2.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.game-subtitle {
  font-size: 1.05rem;
  color: #94a3b8;
  margin-bottom: 35px;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
  width: 100%;
  max-width: 920px;
}

.player-card {
  background: rgba(30, 41, 59, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.player-card:hover {
  transform: translateY(-5px);
  border-color: var(--player-color, #38bdf8);
}

.player-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--player-color, #38bdf8);
}

.player-card .avatar-box {
  width: 110px;
  height: 110px;
  margin-bottom: 14px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--player-color, #38bdf8);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  background: #1e293b;
}

.avatar-box svg,
.avatar-box img,
.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.player-card .country-tag {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 14px;
}

.stats-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.82rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-bar {
  width: 55%;
  height: 6px;
  background: #334155;
  border-radius: 4px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: var(--player-color, #38bdf8);
  border-radius: 4px;
}

/* =========================================
   2. MÀN HÌNH THI ĐẤU
   ========================================= */
.match-screen {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* HUD BẢNG THÔNG SỐ VÀ TỶ SỐ */
.hud-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 60;
  flex-wrap: wrap;
  gap: 12px;
}

.hud-player-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hud-avatar {
  width: 76px;
  height: 76px;
  min-width: 76px;
  border-radius: 50%;
  overflow: hidden;
  background: #1e293b;
  border: 3px solid #f59e0b;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}

.hud-avatar svg,
.hud-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hud-player-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-role-tag {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #f59e0b;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.hud-name {
  font-weight: 900;
  font-size: 1.35rem;
  color: #ffffff;
  line-height: 1.2;
}

.hud-round {
  font-size: 0.95rem;
  color: #38bdf8;
  font-weight: 800;
}

.hud-conditions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.condition-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 8px 18px;
  min-width: 125px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
}

.condition-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.condition-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.condition-card-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 1.3rem;
  font-weight: 800;
  color: #f8fafc;
}

#hud-wind-val {
  color: #38bdf8;
}

.wind-arrow {
  display: inline-block;
  font-size: 0.95rem;
  color: #7dd3fc;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  padding: 2px 7px;
  border-radius: 6px;
}

#hud-temp-val {
  color: #fb923c;
}

.position-tag {
  color: #facc15;
  font-weight: 800;
}



/* NÚT LÀM MỚI (REFRESH) */
.btn-refresh {
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 7px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-refresh:hover {
  background: #475569;
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-1px);
}

.btn-refresh:active {
  transform: translateY(1px);
}

/* SÂN BÓNG VIỄN CẢNH */
.stadium-pitch {
  position: relative;
  min-height: 520px;
  background: radial-gradient(ellipse at 50% 25%, #15803d 0%, #14532d 70%, #052e16 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

/* Vạch kẻ sân */
.pitch-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.penalty-box {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 270px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top: none;
}

.goal-box {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  height: 125px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top: none;
}

.penalty-spot {
  position: absolute;
  top: 225px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-radius: 50%;
}

.penalty-arc {
  position: absolute;
  top: 225px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 70px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top: none;
  border-radius: 0 0 70px 70px;
}

/* CẦU MÔN 3D */
.goal-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 220px;
  z-index: 10;
}

.goal-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

.goal-shaking {
  animation: netShake 0.6s ease-in-out;
}

@keyframes netShake {
  0% { transform: scale(1) translate(0, 0); }
  20% { transform: scale(1.03) translate(-4px, 3px); }
  40% { transform: scale(0.98) translate(4px, -3px); }
  60% { transform: scale(1.02) translate(-2px, 2px); }
  80% { transform: scale(1) translate(2px, -1px); }
  100% { transform: scale(1) translate(0, 0); }
}

/* THỦ MÔN (NGƯỜI CHƠI) */
.goalkeeper-wrapper {
  position: absolute;
  top: 105px;
  left: 50%;
  transform: translateX(-50%);
  width: 95px;
  height: 115px;
  z-index: 20;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.gk-figure {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.55));
}

.gk-dive-left {
  transform: translate(-130px, -10px) rotate(-35deg) scale(1.05);
}

.gk-dive-right {
  transform: translate(130px, -10px) rotate(35deg) scale(1.05);
}

.gk-catch-center {
  transform: translate(0px, -15px) scale(1.1);
}

/* QUẢ BÓNG */
.ball-container {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  z-index: 25;
  transition: none;
  pointer-events: none;
}

.ball-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6));
}

/* CẦU THỦ SÚT */
.player-wrapper {
  position: absolute;
  bottom: 50px;
  width: 130px;
  height: 180px;
  z-index: 30;
  transition: all 0.4s ease;
}

.player-wrapper.pos-left {
  left: calc(50% - 150px);
}

.player-wrapper.pos-right {
  left: calc(50% + 20px);
}

.player-figure,
.player-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.55));
  pointer-events: none;
  display: block;
}

.player-wrapper.kicking-left {
  animation: runKickLeft 0.5s forwards cubic-bezier(0.25, 1, 0.5, 1);
}

.player-wrapper.kicking-right {
  animation: runKickRight 0.5s forwards cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes runKickLeft {
  0% { transform: translateY(0); }
  50% { transform: translate(32px, -20px); }
  100% { transform: translate(52px, -24px); }
}

@keyframes runKickRight {
  0% { transform: translateY(0); }
  50% { transform: translate(-32px, -20px); }
  100% { transform: translate(-52px, -24px); }
}

/* BANNER KẾT QUẢ */
.shot-result-banner {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  padding: 16px 36px;
  border-radius: 20px;
  font-size: 2.2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shot-result-banner.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.shot-result-banner.save {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #ffffff;
  box-shadow: 0 0 35px rgba(34, 197, 94, 0.7);
}

.shot-result-banner.goal {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #ffffff;
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.7);
}

/* THANH ĐIỀU KHIỂN BẮT BÓNG */
.control-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 16px 20px;
  background: #090d16;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 60;
  flex-wrap: wrap;
}

.kick-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  color: #ffffff;
}

.dive-left-btn {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.catch-center-btn {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.dive-right-btn {
  background: linear-gradient(135deg, #ea580c, #f97316);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

.auto-mode-btn {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  box-shadow: 0 4px 14px rgba(147, 51, 234, 0.35);
  border: 1.5px solid rgba(216, 180, 254, 0.4);
}

.kick-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.kick-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.kick-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* =========================================
   3. KHU VỰC THỐNG KÊ VÀ BỘ LỌC DỮ LIỆU
   ========================================= */
.live-results-container {
  margin: 20px 14px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 22px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* THẺ TỔNG QUAN TỶ LỆ BẮT TRÚNG */
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-card-overall::before { background: #22c55e; }
.stat-card-ronaldo::before { background: #ef4444; }
.stat-card-messi::before { background: #38bdf8; }
.stat-card-neymar::before { background: #eab308; }

.stat-card-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.stat-card-val {
  font-size: 2.1rem;
  font-weight: 900;
  margin-bottom: 4px;
}

.stat-card-overall .stat-card-val { color: #22c55e; }
.stat-card-ronaldo .stat-card-val { color: #f87171; }
.stat-card-messi .stat-card-val { color: #38bdf8; }
.stat-card-neymar .stat-card-val { color: #facc15; }

.stat-card-sub {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.stat-progress-bar {
  width: 100%;
  height: 6px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
}

.stat-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.stat-card-overall .stat-progress-fill { background: #22c55e; }
.stat-card-ronaldo .stat-progress-fill { background: #ef4444; }
.stat-card-messi .stat-progress-fill { background: #38bdf8; }
.stat-card-neymar .stat-progress-fill { background: #eab308; }

/* =========================================
   THANH CÔNG CỤ BỘ LỌC (1 HÀNG NGANG DUY NHẤT)
   ========================================= */
.filter-toolbar {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* HEADER CÓ HUY HIỆU THỐNG SỐ TO NỔI BẬT */
.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #facc15;
  letter-spacing: 0.5px;
}

/* HUY HIỆU THỐNG SỐ TO VÀ NỔI BẬT */
.filter-summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  padding: 4px 14px;
  border-radius: 20px;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.2);
}

.filter-stat-ratio {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
}

.filter-stat-divider {
  color: #64748b;
  font-size: 0.95rem;
}

.filter-stat-pct {
  font-size: 1.35rem;
  font-weight: 900;
  color: #38bdf8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.filter-stat-detail {
  font-size: 0.95rem;
  font-weight: 700;
  color: #cbd5e1;
}

.btn-filter-reset {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-filter-reset:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: #ef4444;
}

/* LƯỚI 5 CỘT TRÊN 1 HÀNG NGANG */
.filter-controls-grid {
  display: grid;
  grid-template-columns: 145px 130px 130px 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

/* KHỐI CHỌN THU GỌN (CẦU THỦ & VỊ TRÍ) */
.filter-group-compact {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.filter-group-compact label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.filter-group-compact .filter-select {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 7px 10px;
  color: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  width: 100%;
}

.filter-group-compact .filter-select:focus {
  border-color: #38bdf8;
}

/* KHỐI THANH KÉO (SLIDER) */
.filter-slider-group {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.slider-header-row label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
}

.slider-val-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.filter-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #334155;
  outline: none;
  margin: 6px 0 8px;
  cursor: pointer;
}

.filter-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
  border: 2px solid #ffffff;
  transition: transform 0.1s;
}

.filter-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* NÚT CHỌN BÊN RÚT GỌN */
.side-selector-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 4px;
}

.side-btn {
  padding: 5px 6px;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1e293b;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-btn:hover:not(.active) {
  background: #334155;
  color: #f8fafc;
}

.side-btn.active {
  font-weight: 900;
  color: #ffffff;
}

.side-left.active {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.75);
}

.side-all.active {
  background: #475569;
  border-color: #cbd5e1;
  color: #f8fafc;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

.side-right.active {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border-color: #facc15;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.75);
}

/* BẢNG LỊCH SỬ KẾT QUẢ */
.live-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
  gap: 12px;
}

.results-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.results-title-group h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #facc15;
  margin: 0;
  white-space: nowrap;
}

.shot-distribution-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dist-pill {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.dist-pill strong {
  font-weight: 900;
  font-size: 0.95rem;
}

.dist-pill-left {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
}

.dist-pill-center {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.1);
}

.dist-pill-right {
  color: #fb923c;
  border-color: rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.1);
}

.table-scroll-wrapper {
  height: 420px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0f172a;
  overscroll-behavior: contain;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.92rem;
}

.summary-table th {
  position: sticky;
  top: 0;
  background: #1e293b;
  padding: 12px 14px;
  color: #94a3b8;
  font-weight: 700;
  border-bottom: 2px solid #334155;
  z-index: 5;
}

.summary-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.row-new {
  animation: rowHighlight 1.5s ease-out;
}

@keyframes rowHighlight {
  0% { background: rgba(56, 189, 248, 0.35); }
  100% { background: transparent; }
}

.badge-goal {
  color: #ef4444;
  font-weight: 800;
}

.badge-save {
  color: #22c55e;
  font-weight: 800;
}

.play-again-btn {
  padding: 14px 44px;
  font-size: 1.15rem;
  font-weight: 800;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transition: all 0.2s;
}

.play-again-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

/* RESPONSIVE CHO MÀN HÌNH NHỎ */
@media (max-width: 860px) {
  .filter-controls-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* =========================================
   4. MODAL VÀ THANH TIẾN TRÌNH CHẾ ĐỘ TỰ ĐỘNG
   ========================================= */
.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-box {
  background: #1e293b;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #c084fc;
}

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

.modal-close-icon:hover {
  color: #ffffff;
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-form-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f8fafc;
}

/* Strategy Selector */
.strategy-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

/* DT Builder Styles */
.dt-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dt-builder-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 2px;
}

.btn-preset-dt {
  background: #334155;
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preset-dt:hover {
  background: #475569;
  border-color: #c084fc;
  color: #ffffff;
}

.dt-header-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-reset-tree-style {
  background: #334155;
  border-color: #64748b;
  color: #cbd5e1;
}

.btn-reset-tree-style:hover {
  background: #475569;
  color: #ffffff;
  border-color: #94a3b8;
}

.btn-save-tree-style {
  background: #064e3b;
  border-color: #059669;
  color: #a7f3d0;
}

.btn-save-tree-style:hover {
  background: #047857;
  border-color: #10b981;
  color: #ffffff;
}

.btn-load-tree-style {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #bfdbfe;
}

.btn-load-tree-style:hover {
  background: #1d4ed8;
  border-color: #60a5fa;
  color: #ffffff;
}

.btn-prob-tree-style {
  background: #431407;
  border-color: #f97316;
  color: #fed7aa;
}

.btn-prob-tree-style:hover {
  background: #7c2d12;
  border-color: #fb923c;
  color: #ffffff;
}

.btn-prob-tree-style.active {
  background: linear-gradient(135deg, #c2410c, #ea580c);
  border-color: #fdba74;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.5);
}

.btn-fit-tree-style {
  background: #1e1b4b;
  border-color: #6366f1;
  color: #c7d2fe;
}

.btn-fit-tree-style:hover {
  background: #312e81;
  border-color: #818cf8;
  color: #ffffff;
}

/* KHUNG CHỨA CÂY CHIẾN LƯỢC TRỰC QUAN */
.tree-builder-container {
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  padding: 14px;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  min-height: 180px;
}

/* NÚT TRONG CÂY */
.tree-node {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* THẺ HIỂN THỊ CỦA NÚT */
.tree-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
  z-index: 2;
}

.tree-card-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* Thẻ quyết định ngay (Nút lá) */
.tree-card-action {
  background: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
  border: 1.5px solid #10b981;
  color: #ecfdf5;
}

/* Thẻ nạp dữ kiện điều kiện (Nút nhánh) */
.tree-card-condition {
  background: linear-gradient(135deg, #3b0764 0%, #1e1b4b 100%);
  border: 1.5px solid #a855f7;
  color: #faf5ff;
}

.tree-card-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.tree-card-action .tree-card-badge {
  background: rgba(160, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.tree-card-condition .tree-card-badge {
  background: rgba(168, 85, 247, 0.25);
  color: #c084fc;
}

/* DẢI 10 NÚT XÁC SUẤT MINI NẰM BÊN DƯỚI NÚT */
.prob-dots-grid.prob-dots-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 0 1px 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.prob-dots-mini .prob-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.prob-dots-mini .prob-dot:hover {
  transform: scale(1.6);
  z-index: 5;
}

.prob-dots-mini .prob-dot-left {
  background: #38bdf8;
  border-color: #bae6fd;
  box-shadow: 0 0 5px rgba(56, 189, 248, 0.7);
}

.prob-dots-mini .prob-dot-center {
  background: #4ade80;
  border-color: #bbf7d0;
  box-shadow: 0 0 5px rgba(74, 222, 128, 0.7);
}

.prob-dots-mini .prob-dot-right {
  background: #fb923c;
  border-color: #fed7aa;
  box-shadow: 0 0 5px rgba(251, 146, 60, 0.7);
}

.prob-counts-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #94a3b8;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.prob-counts-tag .cnt-left {
  color: #38bdf8;
}

.prob-counts-tag .cnt-center {
  color: #4ade80;
}

.prob-counts-tag .cnt-right {
  color: #fb923c;
}

.prob-counts-tag .cnt-total {
  color: #f8fafc;
}

.prob-dot-empty {
  background: #334155;
  border-color: #64748b;
}

.tree-select {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.tree-select:focus {
  border-color: #38bdf8;
}

.tree-action-select {
  border-color: #10b981;
  color: #34d399;
  font-weight: 800;
}

/* THANH TRƯỢT MỐC ĐIỀU KIỆN (TỐC ĐỘ GIÓ / NHIỆT ĐỘ) */
.node-thresh-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.node-thresh-label {
  font-size: 0.74rem;
  color: #94a3b8;
  font-weight: 700;
}

.node-slider-badge {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 58px;
  text-align: center;
}

.node-thresh-slider {
  width: 90px;
  height: 4px;
  cursor: pointer;
  accent-color: #38bdf8;
}

.btn-tree-action {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-tree-action:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-icon-only {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 6px;
  line-height: 1;
}

.btn-add-feature {
  background: rgba(168, 85, 247, 0.2);
  border-color: #a855f7;
  color: #d8b4fe;
}

.btn-add-feature:hover {
  background: rgba(168, 85, 247, 0.4);
  color: #ffffff;
}

.btn-collapse-node {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-collapse-node:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}

/* BẢNG LỰA CHỌN DỮ KIỆN KHI BẤM DẤU CỘNG */
.tree-node:has(.active-picker),
.tree-branch:has(.active-picker) {
  z-index: 100 !important;
}

.tree-card.active-picker {
  z-index: 101 !important;
  box-shadow: 0 0 0 2px #a855f7, 0 8px 24px rgba(0, 0, 0, 0.6) !important;
}

.feature-picker-wrap {
  position: relative;
  display: inline-flex;
  z-index: 102;
}

.feature-picker-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #0f172a;
  border: 1.5px solid #a855f7;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 175px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(168, 85, 247, 0.3);
  z-index: 1000;
  animation: fadeInPopover 0.15s ease-out;
}

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

.feature-picker-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #c084fc;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 2px;
}

.feature-picker-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.feature-picker-item:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: #a855f7;
  color: #ffffff;
  transform: translateX(2px);
}

/* CÁC NHÁNH CON */
.tree-children {
  margin-left: 20px;
  padding-left: 18px;
  border-left: 2px dashed rgba(168, 85, 247, 0.4);
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
  position: relative;
}

.tree-branch {
  display: flex;
  flex-direction: column;
  position: relative;
}

.tree-branch-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  position: relative;
}

.tree-branch-header::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 50%;
  width: 14px;
  height: 2px;
  border-top: 2px dashed rgba(168, 85, 247, 0.4);
}

.tree-branch-pill {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.strategy-card {
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: #0f172a;
  border-radius: 14px;
  padding: 14px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s;
  position: relative;
}

.strategy-card input[type="radio"] {
  display: none;
}

.strategy-card:hover {
  border-color: rgba(168, 85, 247, 0.5);
  transform: translateY(-2px);
}

.strategy-card.active {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.25);
}

.strat-title {
  font-size: 1rem;
  font-weight: 800;
  color: #f8fafc;
}

.strategy-card.active .strat-title {
  color: #c084fc;
}

.strat-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.35;
}

/* EASTER EGG: HIỆU ỨNG NỔ & CHẾ ĐỘ VÀNG CHO CHIẾN LƯỢC TỐI ƯU */
@keyframes cardExplode {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(251, 191, 36, 0);
  }
  30% {
    transform: scale(0.92);
    filter: brightness(1.5);
  }
  60% {
    transform: scale(1.15);
    box-shadow: 0 0 50px #fbbf24, 0 0 100px #f59e0b, inset 0 0 30px #ffffff;
    filter: brightness(2.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.7);
    filter: brightness(1);
  }
}

.strategy-card.exploding {
  animation: cardExplode 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.strategy-card.gold-optimal {
  background: linear-gradient(135deg, #451a03 0%, #78350f 50%, #b45309 100%) !important;
  border: 2px solid #fde047 !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.6), inset 0 0 15px rgba(253, 224, 71, 0.3) !important;
  animation: goldPulse 2s infinite alternate ease-in-out;
  position: relative;
  overflow: hidden;
}

.strategy-card.gold-optimal::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(253, 224, 71, 0.2) 0%, transparent 60%);
  pointer-events: none;
  animation: goldShine 3s infinite linear;
}

@keyframes goldPulse {
  0% {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5), inset 0 0 10px rgba(253, 224, 71, 0.2);
    border-color: #facc15;
  }
  100% {
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.9), inset 0 0 20px rgba(253, 224, 71, 0.4);
    border-color: #fef08a;
  }
}

@keyframes goldShine {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.strategy-card.gold-optimal .strat-title {
  color: #fef08a !important;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.8);
}

.strategy-card.gold-optimal .strat-desc {
  color: #fef3c7 !important;
  font-weight: 600;
}

/* Fixed Pos Selector */
.fixed-pos-selector {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.btn-pos-choice {
  padding: 10px;
  border-radius: 10px;
  background: #0f172a;
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pos-choice:hover {
  border-color: #38bdf8;
  color: #ffffff;
}

.btn-pos-choice.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* Rounds Input */
.rounds-input-container {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rounds-number-input {
  width: 140px;
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 10px;
  color: #38bdf8;
  font-size: 1.25rem;
  font-weight: 800;
  padding: 8px 12px;
  text-align: center;
  outline: none;
}

.rounds-number-input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.rounds-quick-pills {
  display: flex;
  gap: 8px;
}

.btn-pill-round {
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pill-round:hover {
  background: #475569;
  border-color: #a855f7;
  color: #c084fc;
}

.modal-notice {
  background: rgba(15, 23, 42, 0.7);
  border-left: 3px solid #a855f7;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 22px;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-secondary-btn {
  background: #334155;
  border: none;
  padding: 11px 20px;
  border-radius: 10px;
  color: #cbd5e1;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-secondary-btn:hover {
  background: #475569;
  color: #ffffff;
}

.modal-restart-btn {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  border: none;
  padding: 11px 22px;
  border-radius: 10px;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.98rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.4);
  transition: all 0.2s;
}

.modal-restart-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.6);
}

.modal-primary-btn {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  border: none;
  padding: 11px 26px;
  border-radius: 10px;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.98rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.4);
  transition: all 0.2s;
}

.modal-primary-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* OVERLAY TIẾN TRÌNH */
.progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.progress-dialog {
  background: #1e293b;
  border: 2px solid #a855f7;
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.4);
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  padding: 32px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.progress-spinner-icon {
  font-size: 2.8rem;
  animation: pulseSpin 1.5s infinite;
}

@keyframes pulseSpin {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

.progress-dialog-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
}

.progress-dialog-sub {
  font-size: 0.92rem;
  color: #94a3b8;
}

.progress-bar-container {
  width: 100%;
  height: 14px;
  background: #0f172a;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #a855f7, #ec4899);
  background-size: 200% 100%;
  animation: gradientSlide 1.5s linear infinite;
  border-radius: 10px;
  transition: width 0.1s linear;
}

@keyframes gradientSlide {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.progress-status-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 700;
  color: #38bdf8;
}

/* ==========================================================================
   MODAL QUẢN LÝ CHIẾN LƯỢC (LƯU & NẠP TỪ MÁY CHỦ)
   ========================================================================== */
.strat-manager-modal-box {
  max-width: 680px;
}

.strat-modal-tabs {
  display: flex;
  background: #090d16;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.strat-tab-btn {
  flex: 1;
  padding: 13px 18px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
}

.strat-tab-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.03);
}

.strat-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.strat-modal-body {
  min-height: 280px;
  padding: 20px;
}

.strat-tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.strat-tab-panel.active {
  display: flex;
}

.strat-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.strat-section-sub {
  font-size: 0.88rem;
  color: #94a3b8;
}

.strat-top-btns {
  display: flex;
  gap: 8px;
}

.btn-strat-action {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-strat-action:hover {
  background: #334155;
  color: #ffffff;
  border-color: #64748b;
}

.strat-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.strat-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.15s ease;
}

.strat-item-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
  background: #0e1626;
}

.strat-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.strat-item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.strat-item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #f1f5f9;
}

.strat-server-badge {
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 6px;
  padding: 2px 6px;
}

.strat-item-meta {
  font-size: 0.78rem;
  color: #64748b;
  display: flex;
  gap: 12px;
}

.strat-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-apply-strat {
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-apply-strat:hover {
  background: #0369a1;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.btn-download-strat {
  background: #334155;
  color: #94a3b8;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-download-strat:hover {
  background: #475569;
  color: #ffffff;
}

.btn-delete-strat {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-delete-strat:hover {
  background: #ef4444;
  color: #ffffff;
}

.strat-empty-state {
  text-align: center;
  padding: 30px;
  color: #64748b;
  font-style: italic;
  font-size: 0.9rem;
}

/* FORM LƯU CHIẾN LƯỢC */
.strat-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strat-text-input {
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 10px 14px;
  color: #f8fafc;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.strat-text-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.strat-save-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.btn-save-server {
  background: linear-gradient(135deg, #059669, #0284c7);
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}

.btn-save-server:hover {
  background: linear-gradient(135deg, #047857, #0369a1);
}

.btn-strat-secondary {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  border-radius: 10px;
  padding: 11px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-strat-secondary:hover {
  background: #334155;
  color: #ffffff;
}

.strat-save-status-msg {
  font-size: 0.88rem;
  text-align: center;
  font-weight: 600;
  min-height: 22px;
}

.strat-status-success {
  color: #4ade80;
}

.strat-status-error {
  color: #f87171;
}

/* =================================================== */
/* MODAL XEM TOÀN BỘ CÂY QUYẾT ĐỊNH (GÓI GỌN MÀN HÌNH) */
/* =================================================== */
#tree-fullscreen-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(3, 7, 18, 0.97);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
}

#tree-fullscreen-modal.hidden {
  display: none !important;
}

.tree-fullscreen-box {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.tree-fullscreen-header {
  height: 56px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
}

.tree-fullscreen-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
}

.tree-zoom-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.tree-fullscreen-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-fullscreen-viewport {
  flex: 1;
  width: 100%;
  height: calc(100vh - 56px);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  cursor: grab;
  user-select: none;
}

.tree-fullscreen-viewport.is-dragging {
  cursor: grabbing !important;
}

.tree-fullscreen-content {
  display: inline-block;
  transform-origin: center center;
  transition: transform 0.1s ease-out;
  will-change: transform;
}

.tree-fullscreen-viewport.is-dragging .tree-fullscreen-content {
  transition: none !important;
}

/* ==========================================================================
   TỐI ƯU GIAO DIỆN CÂY QUYẾT ĐỊNH & THỐNG KÊ TRÊN THIẾT BỊ DI ĐỘNG (MOBILE)
   ========================================================================== */

@media (max-width: 860px) {
  .filter-controls-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .filter-slider-group:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  /* KHU VỰC THỐNG KÊ TỶ LỆ */
  .live-results-container {
    margin: 14px 8px;
    padding: 14px;
    border-radius: 14px;
  }

  .stats-overview-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 12px 14px;
    border-radius: 12px;
  }

  .stat-card-title {
    font-size: 0.74rem;
    margin-bottom: 4px;
  }

  .stat-card-val {
    font-size: 1.7rem;
    margin-bottom: 2px;
  }

  .stat-card-sub {
    font-size: 0.76rem;
    margin-bottom: 6px;
  }

  /* THANH BỘ LỌC DỮ LIỆU */
  .filter-toolbar {
    padding: 12px 14px;
    border-radius: 14px;
    gap: 10px;
  }

  .filter-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .filter-header-left {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .filter-title {
    font-size: 0.88rem;
  }

  .filter-summary-badge {
    padding: 3px 10px;
    gap: 6px;
  }

  .filter-stat-ratio { font-size: 0.95rem; }
  .filter-stat-pct { font-size: 1.15rem; }
  .filter-stat-detail { font-size: 0.82rem; }

  .btn-filter-reset {
    width: 100%;
    text-align: center;
    padding: 6px 10px;
  }

  /* BẢNG LỊCH SỬ KẾT QUẢ */
  .live-results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .results-title-group {
    width: 100%;
    justify-content: space-between;
  }

  .shot-distribution-pills {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .dist-pill {
    flex: 1;
    justify-content: center;
    padding: 4px 6px;
    font-size: 0.74rem;
  }

  .table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .history-table {
    min-width: 580px;
  }

  /* CỬA SỔ MODAL CẤU HÌNH TỰ ĐỘNG */
  .modal-overlay {
    padding: 8px;
  }

  .modal-box {
    max-width: 98%;
    width: 98%;
    max-height: 94vh;
    border-radius: 14px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-title {
    font-size: 1.05rem;
  }

  .modal-body {
    padding: 14px 14px;
    max-height: calc(94vh - 125px);
    gap: 14px;
  }

  .strategy-selector {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .strategy-card {
    padding: 10px 12px;
  }

  .strat-title {
    font-size: 0.92rem;
  }

  .strat-desc {
    font-size: 0.78rem;
  }

  .modal-footer {
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    padding: 10px 14px;
  }

  .modal-secondary-btn,
  .modal-restart-btn,
  .modal-primary-btn {
    width: 100%;
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
  }

  /* THANH CÔNG CỤ CÂY QUYẾT ĐỊNH */
  .dt-builder-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .dt-header-btns {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    gap: 6px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .btn-preset-dt {
    padding: 6px 10px;
    font-size: 0.76rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* KHUNG CÂY QUYẾT ĐỊNH */
  .tree-builder-container {
    padding: 10px 8px;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    max-height: 420px;
  }

  .tree-card {
    padding: 6px 10px;
    gap: 4px;
    font-size: 0.76rem;
  }

  .tree-card-row {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .tree-select {
    padding: 4px 6px;
    font-size: 0.76rem;
    max-width: 125px;
  }

  .node-thresh-slider {
    width: 60px;
  }

  .node-slider-badge {
    font-size: 0.7rem;
    min-width: 48px;
    padding: 1px 4px;
  }

  .prob-dots-mini .prob-dot {
    width: 7.5px;
    height: 7.5px;
  }

  .prob-counts-tag {
    font-size: 0.65rem;
    margin-left: 4px;
  }

  .tree-children {
    margin-left: 12px;
    padding-left: 10px;
    gap: 10px;
  }

  .tree-branch-header::before {
    left: -10px;
    width: 8px;
  }

  .tree-branch-pill {
    font-size: 0.7rem;
    padding: 1px 6px;
  }

  /* MODAL TOÀN MÀN HÌNH CÂY */
  .tree-fullscreen-header {
    height: auto;
    min-height: 50px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .tree-fullscreen-title {
    font-size: 0.85rem;
    gap: 6px;
  }

  .tree-fullscreen-actions {
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
  }

  .tree-fullscreen-actions .btn-preset-dt {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .tree-fullscreen-viewport {
    height: calc(100vh - 65px);
    padding: 10px;
  }

  /* ĐIỀU KHIỂN BẮT BÓNG TRÊN SÂN */
  .control-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 10px 8px;
  }

  .kick-btn {
    padding: 9px 4px;
    font-size: 0.78rem;
    border-radius: 9px;
    justify-content: center;
    text-align: center;
  }

  .auto-mode-btn {
    grid-column: span 3;
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .stat-card-val {
    font-size: 1.5rem;
  }

  .stat-card {
    padding: 10px 10px;
  }

  .filter-controls-grid {
    grid-template-columns: 1fr;
  }

  .filter-slider-group:last-child {
    grid-column: span 1;
  }

  .tree-card {
    padding: 5px 8px;
  }

  .tree-select {
    max-width: 110px;
    font-size: 0.72rem;
  }
}


