/* ===========================================================================
   야구 중계 오버레이 — OBS 브라우저 소스용 스타일
   구성/치수는 레퍼런스 보드(MBO)와 동일한 값을 사용한다.
   테마: default(박스) / bar(하단 와이드 바) / theme6(하단 스트립)
   =========================================================================== */

/* display 를 가진 요소에도 hidden 속성이 먹어야 한다 (패널/배지 토글) */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: transparent; /* OBS 크로마 없이 그대로 합성 */
  overflow: hidden;
  font-family: var(--font-main);
}

#mo-app {
  --font-main: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --score-font: 'Oswald', 'Noto Sans KR', sans-serif;
  --accent-color: #ffcc00;
  --text-color: #ffffff;
  --border-color: rgba(255, 255, 255, 0.15);
  --border-radius: 13px;
  --bg-grad: linear-gradient(180deg, rgba(30, 40, 55, 0.97) 0%, rgba(10, 14, 20, 0.97) 100%);
  --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  --away-bg: rgba(255, 255, 255, 0.03);
  --home-bg: rgba(255, 255, 255, 0.07);
  --away-text: #ffffff;
  --home-text: #ffffff;
  --base-color-inactive: #4a5568;
  --base-color-active: #ffcc00;
  --panel-accent-color: #c3002f;
}

#mo-app .obs-layer {
  width: 100%;
  height: 100vh;
  position: relative;
  pointer-events: none;
}

#mo-app #movableWrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: fit-content;
  height: fit-content;
  z-index: 100;
  transform-origin: top left;
  transition: opacity 0.4s ease;
}
#mo-app.hidden-board #movableWrapper {
  opacity: 0;
}

/* --------------------------------- 공통 부품 -------------------------------- */
#mo-app .scoreboard {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--bg-grad);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  box-shadow: var(--box-shadow);
  width: fit-content;
  user-select: none;
  overflow: hidden;
  border-radius: var(--border-radius);
}

#mo-app .league-box {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(60, 60, 60, 0.95) 0%, rgba(10, 10, 10, 0.95) 100%);
  color: var(--text-color);
  font-family: var(--font-main);
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
  padding: 8px 0;
  width: 0;
  min-width: 100%;
  box-sizing: border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  border-top-left-radius: calc(var(--border-radius) - 1px);
  border-top-right-radius: calc(var(--border-radius) - 1px);
  z-index: 5;
  position: relative;
  white-space: pre-wrap;
  word-break: keep-all;
  line-height: 1.2;
  text-align: center;
}

#mo-app .scoreboard-body {
  display: grid;
  grid-template-columns: 1fr 80px;
  grid-template-rows: 1fr 1fr;
  height: 200px;
  grid-template-areas:
    'away status'
    'home status';
}

#mo-app .team {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  width: 340px;
  min-width: 340px;
  padding-right: 10px;
  padding-left: 5px;
  position: relative;
  gap: 5px;
  padding-bottom: 3px;
}
#mo-app .team.away {
  grid-area: away;
  background: var(--away-bg);
  color: var(--away-text);
}
#mo-app .team.home {
  grid-area: home;
  background: var(--home-bg);
  color: var(--home-text);
}

#mo-app .team-logo {
  width: 85px;
  height: 85px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
  display: none; /* 로고가 있을 때만 JS 가 켠다 */
}

#mo-app .team-name-wrapper {
  width: auto;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  overflow: hidden;
  padding-left: 10px;
}

#mo-app .team-name-text {
  flex: 1;
  display: inline-block;
  font-size: 27px;
  font-weight: 700;
  text-transform: uppercase;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
  max-width: 100%;
  margin-top: 3px;
  margin-bottom: 5px;
  word-break: break-all;
}

#mo-app .team-score {
  font-family: var(--score-font);
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  display: inline-block;
  min-width: 50px;
  text-align: center;
}

#mo-app .player-stats {
  flex: 1;
  width: 210px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0 4px;
  box-sizing: border-box;
}
#mo-app .stat-row {
  display: flex;
  align-items: center;
  font-size: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
}
#mo-app .stat-label {
  color: var(--accent-color);
  font-weight: bold;
  margin-right: 4px;
  width: 10px;
}
#mo-app .stat-text {
  color: #ddd;
  font-weight: 500;
  text-overflow: ellipsis;
  overflow: hidden;
  width: 200px;
}

/* 우측 상태창 */
#mo-app .status-wrapper {
  grid-area: status;
  display: flex;
  flex-direction: column;
  width: 80px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(0, 0, 0, 0.2);
  justify-content: center;
}

#mo-app .bases-box {
  width: 100%;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
#mo-app .diamond-wrapper {
  top: 15px;
  position: relative;
  width: 50px;
  height: 50px;
  transform: rotate(45deg) scale(0.75);
}
#mo-app .base {
  position: absolute;
  width: 25px;
  height: 25px;
  background-color: var(--base-color-inactive);
  border: 1px solid rgba(0, 0, 0, 0.5);
  transition: background-color 0.2s, box-shadow 0.2s;
}
#mo-app .base.b1 { right: 10px; top: -20px; }
#mo-app .base.b2 { left: -20px; top: -20px; }
#mo-app .base.b3 { left: -20px; bottom: 10px; }
#mo-app .base.active {
  background-color: var(--base-color-active);
  box-shadow: 0 0 6px var(--base-color-active);
  z-index: 1;
}

#mo-app .inning-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 35px;
}
#mo-app .inning-arrow {
  font-size: 18px;
  color: var(--accent-color);
  line-height: 1;
}
#mo-app .inning-num {
  font-family: var(--score-font);
  font-size: 20px;
  line-height: 1;
  padding-left: 6px;
}

#mo-app .bso-box {
  width: 100%;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 5px;
  box-sizing: border-box;
}
#mo-app .bso-row {
  display: flex;
  align-items: center;
  justify-content: left;
  width: 100%;
}
#mo-app .bso-label {
  font-size: 15px;
  width: 9px;
  font-weight: 900;
  margin-right: 6px;
  opacity: 0.8;
  text-align: center;
}
#mo-app .dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background-color: #444;
  margin-right: 4px;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
  transition: background-color 0.2s;
}
#mo-app .dot.ball.active { background-color: #2ecc71; box-shadow: 0 0 5px #2ecc71; }
#mo-app .dot.strike.active { background-color: #f1c40f; box-shadow: 0 0 5px #f1c40f; }
#mo-app .dot.out.active { background-color: #e74c3c; box-shadow: 0 0 5px #e74c3c; }

/* 점수 변경 애니메이션 */
@keyframes flipIn {
  0% { transform: rotateX(-90deg); opacity: 0; }
  100% { transform: rotateX(0); opacity: 1; }
}
#mo-app .team-score.bump,
#mo-app .score.bump {
  animation: flipIn 0.35s ease-out;
}

/* ------------------------------- bar 테마 -------------------------------- */
#mo-app[data-theme='bar'] .scoreboard {
  flex-direction: row;
  align-items: center;
  height: 100px;
  border-bottom: 2px solid var(--accent-color);
  border-radius: 0;
  padding: 0;
}
#mo-app[data-theme='bar'] .scoreboard-body {
  display: flex;
  height: 100%;
  align-items: center;
  position: relative;
}
#mo-app[data-theme='bar'] .league-box {
  height: 100%;
  width: auto;
  min-width: 450px;
  background: #fff;
  color: #000;
  font-weight: 900;
  font-size: 35px;
  clip-path: polygon(0 0, 100% 0, 90% 100%, 0% 100%);
  padding-right: 40px;
  padding-left: 10px;
  letter-spacing: 0;
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
}
#mo-app[data-theme='bar'] .team {
  width: auto;
  min-width: 400px;
  height: 98%;
  flex-direction: row-reverse;
}
#mo-app[data-theme='bar'] .team.home { flex-direction: row; }
#mo-app[data-theme='bar'] .team-name-wrapper { width: auto; justify-content: center; }
#mo-app[data-theme='bar'] .team-score { font-size: 60px; }
#mo-app[data-theme='bar'] .status-wrapper {
  flex-direction: row;
  width: auto;
  height: 100%;
  border: none;
  background: transparent;
}
#mo-app[data-theme='bar'] .bases-box {
  width: 100px;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}
#mo-app[data-theme='bar'] .diamond-wrapper { transform: scale(0.84) rotate(45deg); margin-top: 15px; }
#mo-app[data-theme='bar'] .inning-box {
  width: 65px;
  height: 100%;
  padding: 0 5px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}
#mo-app[data-theme='bar'] .inning-num { font-size: 24px; }
#mo-app[data-theme='bar'] .bso-box {
  flex-direction: column;
  padding-left: 10px;
  justify-content: center;
  align-items: flex-start;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  height: 100%;
  width: 130px;
}
#mo-app[data-theme='bar'] .bso-row { width: 98px; justify-content: flex-start; margin: 0; }
#mo-app[data-theme='bar'] .bso-label { font-size: 18px; width: 14px; margin-right: 9px; }
#mo-app[data-theme='bar'] .dot { width: 18px; height: 18px; margin-right: 5px; }
#mo-app[data-theme='bar'] .stat-row { background: transparent; padding: 0; font-size: 15px; }
#mo-app[data-theme='bar'] .stat-label { width: 15px; text-align: center; }

/* ------------------------------ theme6 스트립 ----------------------------- */
#mo-app .scoreboard-theme6 {
  display: flex;
  height: 50px;
  background-color: #ffffff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  font-family: var(--font-main);
}
#mo-app[data-theme='theme6'] .event-name {
  background-color: #141f36;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  font-size: 20px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.5px;
  min-width: fit-content;
}
#mo-app[data-theme='theme6'] .team {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 0 15px;
  font-size: 22px;
  font-weight: 700;
  color: #000;
  min-width: fit-content;
  width: 200px;
  background: none;
  height: auto;
}
#mo-app[data-theme='theme6'] .team .name { white-space: nowrap; }
#mo-app[data-theme='theme6'] .team-away { justify-content: flex-start; }
#mo-app[data-theme='theme6'] .team-home { justify-content: flex-end; }
#mo-app[data-theme='theme6'] .logo { display: inline-block; margin: 0 8px; width: 40px; height: 40px; object-fit: contain; }
#mo-app[data-theme='theme6'] .score-board {
  display: flex;
  background-color: #141f36;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}
#mo-app[data-theme='theme6'] .score {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
}
#mo-app[data-theme='theme6'] .score:first-child { border-right: 1px solid #fff; }
#mo-app[data-theme='theme6'] .game-state {
  background-color: #222;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
}
#mo-app[data-theme='theme6'] .inning {
  display: flex;
  align-items: center;
  font-weight: 900;
  margin-right: 15px;
  font-size: 20px;
}
#mo-app[data-theme='theme6'] .arrow-up,
#mo-app[data-theme='theme6'] .arrow-down { color: #ff3366; font-size: 15px; margin-left: 5px; }
#mo-app[data-theme='theme6'] .bases { position: relative; width: 30px; height: 30px; margin-right: 20px; }
#mo-app[data-theme='theme6'] .base {
  width: 12px;
  height: 12px;
  border: 1.5px solid #888;
  transform: rotate(45deg);
  position: absolute;
  background-color: transparent;
  box-shadow: none;
}
#mo-app[data-theme='theme6'] .base-2 { top: 2px; left: 9px; }
#mo-app[data-theme='theme6'] .base-3 { top: 14px; left: -3px; }
#mo-app[data-theme='theme6'] .base-1 { top: 14px; left: 21px; }
#mo-app[data-theme='theme6'] .base.active { background-color: #ffcc00; border-color: #ffcc00; box-shadow: none; }
#mo-app[data-theme='theme6'] .counts { display: flex; align-items: center; font-weight: 700; font-size: 20px; }
#mo-app[data-theme='theme6'] .count-item { display: flex; align-items: center; margin-right: 10px; }
#mo-app[data-theme='theme6'] .count-label { margin-right: 10px; color: #ddd; }
#mo-app[data-theme='theme6'] .dot { width: 15px; height: 15px; border-radius: 50%; background-color: #555; margin-right: 3px; box-shadow: none; }
#mo-app[data-theme='theme6'] .dot.active { background-color: #00d26a; }
#mo-app[data-theme='theme6'] .dot.yellow.active { background-color: #f1c40f; }
#mo-app[data-theme='theme6'] .dot[id^='sb6-o-'].active { background-color: #ff3366; }

/* ----------------------------- 플로팅 패널 (L/F-Box) ---------------------- */
#mo-app .floating-panel {
  position: absolute;
  z-index: 90;
  width: 420px;
  background: rgba(12, 16, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: top left;
  color: #fff;
}
#mo-app .floating-panel .panel-header {
  padding: 10px 15px;
  background: linear-gradient(90deg, var(--panel-accent-color), #000);
  color: #fff;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#mo-app .floating-panel .panel-title { font-size: 14px; letter-spacing: 1px; margin: 0; }
#mo-app .floating-panel .panel-content { flex: 1; overflow: hidden; padding: 8px; }
#mo-app .floating-panel .player-row {
  display: flex;
  align-items: center;
  padding: 0;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}
#mo-app .floating-panel .player-row.active {
  background: rgba(195, 0, 47, 0.25);
  border: 1px solid var(--panel-accent-color);
}
#mo-app .floating-panel .batting-order {
  width: 32px;
  height: 32px;
  background-color: var(--panel-accent-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  font-weight: bold;
  margin: 0 10px;
  color: #fff;
  flex-shrink: 0;
}
#mo-app .floating-panel .player-img {
  width: 65px;
  height: 65px;
  border-radius: 4px;
  object-fit: cover;
  margin-right: 10px;
  background-color: #333;
  border: 1px solid #555;
  flex-shrink: 0;
}
#mo-app .floating-panel .player-info { display: flex; flex-direction: column; min-width: 0; }
#mo-app .floating-panel .player-name { font-size: 18px; font-weight: 600; color: #fff; }
#mo-app .floating-panel .player-detail { font-size: 14px; color: #aaa; }
#mo-app .floating-panel .position-badge {
  margin-left: auto;
  font-size: 14px;
  color: #fff;
  border: 1px solid #fff;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 10px;
}

/* F-Box (수비 위치) */
#mo-app .field-panel { width: 460px; }
#mo-app .field-container { position: relative; width: 100%; aspect-ratio: 1 / 1; }
#mo-app .field-container svg { width: 100%; height: 100%; display: block; }
#mo-app .field-player {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 125px;
  z-index: 5;
}
#mo-app .fp-marker {
  width: 52px;
  height: 52px;
  background: #fff;
  border: 2px solid var(--panel-accent-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 900;
  color: #333;
  font-size: 17px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
#mo-app .fp-info { margin-top: 2px; background: rgba(0, 0, 0, 0.7); padding: 2px 6px; border-radius: 4px; text-align: center; }
#mo-app .fp-name { font-size: 13px; font-weight: bold; display: block; }
#mo-app .fp-pos { font-size: 13px; color: #ccc; }
#mo-app .pos-c { top: 88%; left: 50%; }
#mo-app .pos-dh { top: 88%; left: 73%; }
#mo-app .pos-1b { top: 74%; left: 64%; }
#mo-app .pos-2b { top: 60%; left: 58%; }
#mo-app .pos-3b { top: 74%; left: 36%; }
#mo-app .pos-ss { top: 60%; left: 42%; }
#mo-app .pos-lf { top: 50%; left: 32%; }
#mo-app .pos-cf { top: 41%; left: 50%; }
#mo-app .pos-rf { top: 50%; left: 67%; }
#mo-app .pos-p { top: 71%; left: 50%; }

/* ------------------------------ 라이트박스 -------------------------------- */
#mo-app .lightbox-overlay {
  position: absolute;
  z-index: 120;
  transform-origin: top left;
}
#mo-app .lightbox-content {
  background: rgba(10, 12, 18, 0.92);
  border: 2px solid var(--accent-color);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  width: 320px;
}
#mo-app #lightboxImage { width: 100%; height: 360px; object-fit: cover; border-radius: 8px; background: #222; display: block; }
#mo-app .lightbox-info { color: #fff; text-align: center; margin-top: 10px; }
#mo-app .lightbox-info .lb-name { font-size: 26px; font-weight: 900; display: block; }
#mo-app .lightbox-info .lb-sub { font-size: 15px; color: var(--accent-color); }

/* ------------------------------ 액션 이펙트 ------------------------------- */
#mo-app .action-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#mo-app .action-overlay.show { display: flex; }
#mo-app .action-text {
  font-family: var(--score-font);
  font-size: 140px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-shadow: 0 0 40px rgba(0, 0, 0, 0.9), 0 8px 0 rgba(0, 0, 0, 0.35);
  padding: 20px 60px;
  border-radius: 20px;
  animation: actionPop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
  white-space: nowrap;
}
#mo-app .action-text.small { font-size: 76px; letter-spacing: 2px; }
#mo-app .action-text[data-type='HOMERUN'] { color: #ffcc00; }
#mo-app .action-text[data-type='STRIKE'],
#mo-app .action-text[data-type='KKK'] { color: #f1c40f; }
#mo-app .action-text[data-type='OUT'],
#mo-app .action-text[data-type='DOUBLE_PLAY'] { color: #e74c3c; }
#mo-app .action-text[data-type='WALK'] { color: #2ecc71; }
@keyframes actionPop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
#mo-app .action-image-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 190;
}
#mo-app .action-image-overlay img { max-width: 80vw; max-height: 80vh; transform-origin: center; }

/* -------------------------------- 상태 배지 -------------------------------- */
#mo-app .net-badge {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font: 12px/1 var(--font-main);
  padding: 6px 10px;
  border-radius: 20px;
}
#mo-app .net-badge span:first-child {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #888;
}
#mo-app .net-badge[data-status='connected'] span:first-child { background: #2ecc71; box-shadow: 0 0 6px #2ecc71; }
#mo-app .net-badge[data-status='polling'] span:first-child { background: #f1c40f; }
#mo-app .net-badge[data-status='offline'] span:first-child,
#mo-app .net-badge[data-status='error'] span:first-child { background: #e74c3c; }

/* 레퍼런스 빌드가 인라인 스타일을 뽑아 만든 유틸 클래스. bar 테마 HOME 쪽
   좌우 반전(로고-점수-이름 순서, 라벨이 오른쪽)에 쓰인다 — 원본 DOM 을 그대로
   옮겼으므로 이름도 그대로 둔다. */
#mo-app .mo-s31 { order: 1 !important; }
#mo-app .mo-s32 { order: 3 !important; }
#mo-app .mo-s33 { margin-right: 0; margin-left: 4px; }
#mo-app .mo-s34 { text-align: right; width: 65px; }
#mo-app .mo-s35 { flex-direction: row-reverse; }
#mo-app .mo-s36 { text-align: left; width: 110px; }
#mo-app .mo-s37 { align-items: flex-end !important; padding-left: 0; padding-right: 10px; }
#mo-app .mo-s38 { flex-direction: row-reverse; padding-left: 10px; padding-right: 5px; }
