* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: transparent;  /* biar bisa transparan di OBS kalau perlu */
}

/* Container full size */
.overlay {
  position: relative;
  width: 100vw;   /* penuh layar */
  height: calc(100vw / 32.5); /* biar proporsi tetap sama */
}

/* Biar gampang dipakai sebagai Browser Source di OBS:
   - Atur Width=1280 Height=200 (atau sesuai kamu set)
   - Alternatively kamu bisa pakai `width: 100vw; height: 100vh;` kalau mau full layar */
.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* atau 'contain' tergantung gambar */
  pointer-events: none;
}



/* Teks */

@font-face {
  font-family: 'MyFont';
  src: url('/assets/fonts/AcehSoft-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'BebasNeue';
  src: url('/assets/fonts/BEBASNEUE-REGULAR.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

.name, .score, .race {
  position: absolute;
  color: #fff;
  font-family: 'MyFont', Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
  user-select: none;
  pointer-events: none;
}

/* Contoh posisi — SILAKAN DISESUAIKAN DENGAN BACKGROUND-KU */
.p1.name {
  position: absolute;
  top: 25%;
  left: 15%;
  width: 20%;           /* kasih lebar tetap */
  text-align: right;    /* teksnya rata kanan */
  font-size: 28px;
  white-space: nowrap;  /* biar gak turun ke baris baru */
  overflow: hidden;     /* potong kalau kepanjangan */
}

.p2.name {
  position: absolute;
  top: 25%;
  right: 15%;
  width: 20%;           /* kasih lebar tetap */
  text-align: left;    /* teksnya rata kiri */
  font-size: 28px;
  white-space: nowrap;  /* biar gak turun ke baris baru */
  overflow: hidden;     /* potong kalau kepanjangan */
}


.p1.score { top: 20%; left: 21%; font-size: 35px; font-weight: 800; width: 20%; text-align: right; white-space: nowrap; overflow: hidden; transform-origin: right center; }
.p2.score { top: 20%; right: 21%; font-size: 35px; font-weight: 800; width: 20%; text-align: left; white-space: nowrap; overflow: hidden; transform-origin: left center; }


.race { bottom: 14px; left: 50%; transform: translateX(-50%); font-size: 26px; opacity: .9; }

/* Efek bump saat angka berubah */
.bump { animation: bump .25s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}


.bola.hidden {
  opacity: 0;
  visibility: hidden;
}

/* dari sini update */
  
.ball-overlay-container {
  position: absolute;       /* ambil posisi bebas di layar */
  top: 93px;                 /* tengah vertikal */
  left: 50%;                /* tengah horizontal */
  transform: translate(-50%, -50%); /* center tepat */
  display: inline-flex;     /* lebar menyesuaikan jumlah bola */
  justify-content: center;
  align-items: center;
  z-index: 10;              /* pastikan di atas overlay utama */

  /* animasi muncul/hilang */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.ball-overlay-container.enabled {
  opacity: 1;
  pointer-events: auto;
}

.ball-bg {
  position: absolute;
  top: 0;
  left: -15px; /* geser background supaya menutupi bola pertama */
  right: 0;
  bottom: 0;
  background: white;
  border-radius: 38px;
  z-index: 0;
}

.ball-overlay {
  display: flex;
  gap: 0px;
  position: relative;
  z-index: 1; /* bola di atas background */
}

.bola {
  width: 63px;
  height: 53px;
  transition: opacity 0.3s ease;
}

.ball-overlay img.bola {
  width: 63px;
  height: 53px;
  margin-left: -15px; /* geser sedikit ke kiri */
}

/* BADMINTON INDIVIDUAL POSITIONING */
.p1-name {
	position: absolute;
	left: 17.2%; /* 220px / 1280 */
	top: 25%;    /* 100px / 400 */
	font-size: clamp(18px, 4.3vw, 55px);
	font-weight: 700;
	color: #000;
	font-family: 'MyFont', Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
	letter-spacing: 0.5px;
	text-align: left;
	max-width: 60vw;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	z-index: 2;
}
.p2-name {
	position: absolute;
	left: 17.2%; /* 220px / 1280 */
	bottom: 21.25%; /* 85px / 400 */
	font-size: clamp(18px, 4.3vw, 55px);
	font-weight: 700;
	color: #000;
	font-family: 'MyFont', Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
	letter-spacing: 0.5px;
	text-align: left;
	max-width: 60vw;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	z-index: 2;
}

.p1-score {
	position: absolute;
	right: 4.7%; /* 60px / 1280 */
	top: 16.25%; /* 65px / 400 */
	font-size: clamp(24px, 5vw, 64px);
	font-weight: 900;
	color: #fff;
	font-family: 'BebasNeue', 'MyFont', Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
	display: flex;
	align-items: center;
	z-index: 2;
}
.p2-score {
	position: absolute;
	right: 4.7%; /* 60px / 1280 */
	bottom: 13.75%; /* 55px / 400 */
	font-size: clamp(24px, 5vw, 64px);
	font-weight: 900;
	color: #fff;
	font-family: 'BebasNeue', 'MyFont', Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
	display: flex;
	align-items: center;
	z-index: 2;
}
@media (max-width: 600px) {
	.p1-name, .p2-name { max-width: 70vw; }
}
/* END BADMINTON INDIVIDUAL POSITIONING */

/* Posisi default saat TIDAK ada history (kembalikan ke nilai awal) */
.p1-score.no-history { top: 22.25%; }
.p2-score.no-history { bottom: 19.75%; }

.p1-serve-indicator img, .p2-serve-indicator img {
	width: clamp(24px, 3.9vw, 50px);
	height: clamp(24px, 3.9vw, 50px);
	vertical-align: middle;
	transition: opacity 0.2s;
	display: inline-block;
}


.set-history-overlay {
	display: inline-block;
	width: clamp(36px, 7vw, 90px);
	height: clamp(28px, 9.8vw, 125px);
	line-height: clamp(28px, 9.8vw, 125px);
	font-size: clamp(20px, 4.8vw, 64px);
	font-weight: 500;
	color: #000;
	text-align: center; /* biar angkanya rapi di tengah */
	margin-right: 0.6vw;
	font-family: 'BebasNeue', 'MyFont', Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
	background: #DEDEDE;
	border-radius: 8px;
	padding: 2px 0; /* vert padding saja agar width tetap */
	box-sizing: border-box;
}

.main-score {
	font-size: clamp(24px, 5vw, 64px);
	font-weight: 900;
	color: #fff;
	margin-left: 8px;
	font-family: 'BebasNeue', 'MyFont', Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
	display: inline-block; /* stabilkan lebar */
	width: clamp(52px, 9vw, 120px);          /* fixed width agar history tidak terdorong saat 2 digit */
	text-align: right;     /* angka rata kanan */
	white-space: nowrap;
	font-variant-numeric: tabular-nums; /* angka proporsional stabil */
}

.set-history-overlay-empty {
  display: none; /* jangan tampil dan jangan memakan ruang */
}
@media (max-width: 900px) {
  .set-history-overlay-empty { display: none; }
}

.serve-inline {
  width: 50px;
  height: 50px;
  display: inline-block;
  vertical-align: middle;
  margin: 0 6px;
}
@media (max-width: 900px) {
  .serve-inline { width: 28px; height: 28px; margin: 0 4px; }
}

/* Saat tidak ada set history, beri jarak kecil antara ikon serve dan skor utama */
.p1-score.no-history .serve-inline,
.p2-score.no-history .serve-inline {
	margin-right: 8px;
}

.history {
	display: inline-flex;
	flex-direction: row-reverse;
	align-items: center;
	margin-right: 0;
}
.history .set-history-overlay,
.history .set-history-overlay-empty {
  margin-left: 5px; /* jarak antar kotak ke arah kiri default : 8px */
  margin-right: 0;
}

.history-spacer {
	display: inline-block;
	/* reserve width for up to 3 history boxes + 2 gaps */
	width: calc(3 * clamp(36px, 7vw, 90px) + 2 * 0.6vw);
	height: clamp(28px, 7.2vw, 72px);
}

.history.history-empty {
	margin-right: 0;
	display: none; /* sembunyikan kontainer history saat kosong agar ikon serve menempel skor */
}

/* Pastikan spacer benar-benar hilang saat kosong */
.history.history-empty .history-spacer { width: 0; height: 0; }





