/* 1. 基礎佈局：讓內容靠左 */
.pbp-live-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px;
  gap: 0px;
  /* 縮小間距 */
}

/* 2. 球場主體 */
.stadium-container {
  width: 330px;
  height: 330px;
  position: relative;
  background: radial-gradient(circle at bottom left, 
    #2e7d32 290px,        
    #a1887f 290px, 298px, 
    #fdec01 298px, 300px, 
    #424242 300px         
  );
  border-radius: 0 330px 0 0;
  transform: rotate(-45deg);
  /* 🌟 單獨加回左邊與下面的邊框，作為三壘與一壘的界外邊線 */
  border-left: 4px solid #a1887f;
  border-bottom: 4px solid #a1887f;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin-left: 60px;
  margin-top: 65px;
  position: relative;
  overflow: hidden;
}

/* 內野紅土 */
.infield {
  position: absolute;
  bottom: -105px;
  left: -105px;
  width: 250px;
  height: 250px;
  background: #be8975;
  border-radius: 50%;
  border: 2px solid #be8975;
}

/* 3. 壘包系統 */
.bases-container {
  position: absolute;
  bottom: 0px;
  left: 0px;
  width: 90px;
  height: 90px;
  z-index: 20;
}

.home-plate {
  position: absolute;
  bottom: 0px;
  left: 0%;
  width: 18px;
  height: 18px;
  background: #f5f5f5;
  border: 2px solid #bdbdbd;
  z-index: 4;
}

.base-path {
  position: absolute;
  left: 0%;
  bottom: 0px;
  width: 98px;
  height: 98px;
  border: 2px solid rgba(255, 255, 255, 0.28);

  transform-origin: center center;

  z-index: 2;
  pointer-events: none;
  transition: all 0.3s;
}

.foul-line {
  position: absolute;
  bottom: 0px;
  left: -0.5%;
  width: 3px;
  height: 300px;
  background: rgba(255, 255, 255, 0.7);
  transform-origin: bottom center;
  z-index: 1;
  pointer-events: none;
}

.foul-right {
  transform: translateX(-50%) rotate(90deg);
}

/* 內野壘線菱形 */
.base {
  position: absolute;
  width: 15px;
  height: 15px;
  background: #fdfdfd;
  border: 2px solid rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
}

#base_1 {
  bottom: 0;
  left: 100%;
}

#base_2 {
  top: auto !important;
  right: auto !important;
  bottom: 98%;
  left: 98%;
}

#base_3 {
  bottom: 100%;
  left: 0;
}

.base.active {
  background: #ff3b30 !important;
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.85);
}

/* 4. 擊球點動畫 */
.dot {
  position: absolute;
  border-radius: 50%;
  z-index: 10;
  pointer-events: none;
}

@keyframes pop {
  0% {
    transform: scale(0) rotate(45deg);
    opacity: 0;
  }

  100% {
    transform: scale(1) rotate(45deg);
    opacity: 1;
  }
}

/* 5. 專業轉播計分板 (Score Bug) */
.broadcast-scoreboard {
  display: flex;
  width: 320px;
  height: 70px;
  background: #1a1a1a;
  color: #fff;
  font-family: 'Arial', sans-serif;
  border: 1px solid #333;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  border-radius: 4px;

  /* 🌟 放大與位移調整 */
  transform: scale(1.4);
  transform-origin: left top;
  margin-top: -395px;
  /* 往上拉近球場 */
  margin-left: 0px;
  /* 對準中心 */
  z-index: 100;
}

/* 計分板內部細節 (縮寫版) */
.matchup-box {
  flex: 1.2;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 10px;
  border-right: 1px solid #444;
}

.player-slot {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
}

.vs-label {
  font-size: 9px;
  color: #919191;
  text-align: center;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
  margin: 2px 0;
}

.score-box {
  flex: 1;
  display: flex;
}

.inning-block {
  width: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #eee;
  color: #111;
  font-weight: bold;
}

.teams-block {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  height: 35px;
}

.team-row.away {
  background: #333;
}

.team-row.home {
  background: #444;
}

.bso-box {
  width: 80px;
  background: #111;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bso-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bso-label {
  font-size: 14px;
  color: #919191;
  width: 10px;
  margin-left: 6px;
}

.bso-dots {
  display: flex;
  gap: 4px;
}

.bso-dots span {
  width: 8px;
  height: 8px;
  background: #444444;
  border-radius: 50%;
}

/* 燈號啟動狀態 */
.bso-dots span.active {
  background: #4caf50 !important;
  box-shadow: 0 0 5px #4caf50;
}

/* Ball */
.strike span.active {
  background: #ffc107 !important;
  box-shadow: 0 0 5px #ffc107;
}

.out span.active {
  background: #f44336 !important;
  box-shadow: 0 0 5px #f44336;
}

/* 向上箭頭 (上半局) */
.arrow-up {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 9px solid #ff5252;
  /* 醒目的紅色指標 */
  margin-bottom: 2px;
}

/* 向下箭頭 (下半局) */
.arrow-down {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid #ff5252;
  margin-top: 2px;
}

/* 2. 九局計分板：移除原本在球場下方的位移 */
.line-score-container {
  width: 105% !important;
  margin: 0 !important;
  /* 🌟 核心：移除 margin-top: 60px 那些舊設定 */
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  position: relative;
  transform: scale(0.95);
  /* 稍微縮小一點以適應右側寬度，若不需要可刪除 */
  transform-origin: top left;
}

.line-score-table {
  width: 100%;
  border-collapse: collapse;
  color: #eee;
  font-size: 14px;
  text-align: center;
}

.line-score-table th {
  color: #888;
  font-size: 11px;
  font-weight: normal;
  padding: 4px 0;
  border-bottom: 1px solid #333;
}

.line-score-table td {
  padding: 6px 0;
  width: 25px;
  border-bottom: 1px solid #222;
}

.line-score-table .team-name {
  width: 80px;
  text-align: left;
  padding-left: 10px;
  font-weight: bold;
  color: #fff;
  border-right: 1px solid #333;
}

.line-score-table .total-col {
  color: #aaa;
  width: 30px;
}

.line-score-table .total-val {
  font-weight: bold;
  color: #ffeb3b;
  /* RHE 使用醒目的黃色 */
  background: rgba(255, 255, 255, 0.05);
  border-left: 1px solid #333;
}

/* 當前進攻局數的高亮效果 */
.current-inning {
  background: rgba(255, 82, 82, 0.2);
  color: #ff5252;
}

/* 1. 右側面板：讓計分板與文字箱緊湊排列 */
.pbp-right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px !important;
  /* 🌟 縮短兩者間距 */
  min-width: 420px;
}

/* 1. 對戰組合區樣式 */
.matchup-header-box {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 25px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.team-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.team-logo-big {
  width: 90px;
  height: 90px;
  background: #222;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
  font-weight: 900;
  color: #616161;
  border: 4px solid #444;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}


/* 2. 實況文字箱樣式 */
.pbp-main-layout {
  display: flex !important;
  align-items: flex-start;
  gap: 40px;
  padding: 0px;
}

.pbp-visual-section {
  flex: 0 0 450px;
  /* 左邊視覺區寬度固定 */
  display: flex;
  flex-direction: column;

}

.pbp-right-panel {
  flex: 1;
  /* 右邊自動佔滿剩餘空間 */
  display: flex;
  flex-direction: column;
}

/* 3. 文字實況箱：鎖定高度，避免無限向下拉長 */
.broadcast-log-box {
  flex: 1;
  height: 600px !important;
  max-height: 600px !important;
  background: rgba(10, 10, 10, 0.95);
  border: 2px solid #333;
  border-radius: 4px;
  overflow: hidden !important;
  /* 🌟 確保內容只在內部捲動 */
}

/* 讓內部內容超過空間時，自動產生垂直捲軸 */
.log-content {
  flex: 1;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#pbp_log {
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  box-sizing: border-box;
}

.log-entry {
  font-size: 15px;
  color: #bbb;
  line-height: 1.15;
  padding: 3px 0 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  animation: fadeInLog 0.4s ease-out;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: block;
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
  letter-spacing: 0.2px;
}

@keyframes fadeInLog {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 捲軸 */
.log-content::-webkit-scrollbar {
  width: 5px;
}

.log-content::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 10px;
}

/* 2. 核心修正：將名單區塊往下推 */
.pbp-lineup-container {
  display: flex;
  gap: 0;
  /* 移除間距，讓兩個黑框靠在一起 */
  width: 450px;
  margin-top: 120px !important;
  /* 🌟 確保它移到球場下方，數字可依需求調整 */
  background: #ffffff !important;
  border: 2px solid #000000 !important;
  padding: 0 !important;
  /* 移除內距，由內部欄位控制 */
  border-radius: 4px;
  box-shadow: none !important;
  /* 🌟 調整這裡：數字越大，名單就越往下移 */
  /* 建議設定在 80px ~ 120px 之間，視你的計分板高度而定 */
  margin-top: 410px !important;
}

/* 2. 左右兩欄：加一條中線 */
.lineup-column {
  flex: 1;
  padding: 10px;
  border-right: 1px solid #000;
  /* 兩隊中間的隔線 */
}

.lineup-column:last-child {
  border-right: none;
}

/* 3. 標題：黑字下底線 */
.lineup-header {
  font-size: 14px;
  color: #000000 !important;
  font-weight: bold;
  text-align: center;
  border-bottom: 2px solid #000 !important;
  padding-bottom: 5px;
  margin-bottom: 10px;
}

/* 4. 名單文字：純黑字 */
.lineup-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.lineup-list li,
.lineup-list li span {
  color: #000000 !important;
  /* 🌟 強制所有文字變黑 */
  font-size: 13px;
  font-family: "微軟正黑體", sans-serif;
  background: transparent !important;
  text-shadow: none !important;
  /* 移除任何陰影 */
}

.lineup-list li {
  padding: 2px 0;

}

/* ==========================================
   🌟 視覺特效：得分與全壘打 (實心紅閃強化版)
   ========================================== */

/* 核心動畫：快速紅閃 3 下 (背景變紅 + 發光 + 縮放) */
@keyframes red-flash-solid-3 {
  0%, 100% { 
    background-color: #ffffff; 
    box-shadow: none;
    transform: scale(1);
  }
  50% { 
    background-color: #d32f2f; /* 熱血紅 */
    box-shadow: 0 0 20px #d32f2f, 0 0 40px #d32f2f;
    transform: scale(1.2); 
  }
}

/* 應用於得分 (本壘) */
.home-plate.score-pulse {
  animation: red-flash-solid-3 0.2s ease-in-out 3;
  z-index: 100;
}

/* 應用於全壘打 (四個壘包) */
.base.hr-active, .home-plate.hr-active {
  /* 為了讓全壘打更有質感，我們讓它閃 5 下，時間稍微拉長一點點 */
  animation: red-flash-solid-3 0.25s ease-in-out 5;
  z-index: 101;
}