/* Complete backgammon — Figma board + in-game UI */

.game-section {
	padding: 3.5rem 0 4.5rem;
}

.game-shell {
	width: min(100%, 1191px);
	margin-inline: auto;
}

.game-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 1191 / 855;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
	background: #0f1a1f;
}

.game-stage__board {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
	user-select: none;
}

.game-stage__ui {
	position: absolute;
	inset: 0;
	z-index: 2;
}

/* Point hit areas — mapped to board image trays & triangles */
.bg-points {
	position: absolute;
	/* playing field between side trays */
	top: 7.5%;
	bottom: 7.5%;
	left: 9.5%;
	right: 9.5%;
	display: grid;
	grid-template-columns: repeat(6, 1fr) 0.55fr repeat(6, 1fr);
	grid-template-rows: 1fr 1fr;
	gap: 0;
	pointer-events: none;
}

.bg-point {
	position: relative;
	pointer-events: auto;
	border: none;
	background: transparent;
	padding: 0;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 0;
}

.bg-point--top {
	justify-content: flex-start;
	flex-direction: column;
}

.bg-point--bottom {
	justify-content: flex-end;
	flex-direction: column-reverse;
}

.bg-point.is-source {
	background: rgba(69, 249, 198, 0.18);
	box-shadow: inset 0 0 0 2px rgba(69, 249, 198, 0.65);
}

.bg-point.is-movable {
	background: rgba(0, 191, 255, 0.16);
	box-shadow: inset 0 0 0 2px rgba(0, 255, 136, 0.55);
	animation: pulse-move 1.4s ease-in-out infinite;
}

.bg-point.is-target {
	background: rgba(255, 238, 178, 0.2);
	box-shadow: inset 0 0 0 2px rgba(204, 189, 104, 0.8);
	animation: pulse-target 1.1s ease-in-out infinite;
}

@keyframes pulse-move {
	0%, 100% { filter: brightness(1); }
	50% { filter: brightness(1.25); }
}

@keyframes pulse-target {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.75; }
}

.bg-point.is-blocked {
	cursor: not-allowed;
}

/* Center bar column (empty grid cell) */
.bg-mid {
	pointer-events: none;
}

.bg-checkers {
	display: flex;
	flex-direction: inherit;
	align-items: center;
	gap: 0;
	width: 100%;
	padding: 2% 8%;
	z-index: 1;
}

.bg-checker {
	width: min(78%, 36px);
	aspect-ratio: 1;
	border-radius: 50%;
	flex-shrink: 0;
	margin-block: -6%;
	border: 2px solid rgba(255, 255, 255, 0.2);
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
	position: relative;
}

.bg-checker--white {
	background:
		radial-gradient(circle at 32% 28%, #fff8e8, #e8d4a0 50%, #b89a5a);
}

.bg-checker--black {
	background:
		radial-gradient(circle at 32% 28%, #4a5a62, #1a242a 55%, #0a1014);
	border-color: rgba(69, 249, 198, 0.3);
}

.bg-checker__count {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-size: 0.7rem;
	font-weight: 700;
	color: #0f1a1f;
}

.bg-checker--black .bg-checker__count {
	color: var(--beige);
}

/* Bar (hit checkers) */
.bg-bar {
	position: absolute;
	left: 48.5%;
	top: 18%;
	bottom: 18%;
	width: 3%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-between;
	z-index: 3;
	pointer-events: auto;
}

.bg-bar__stack {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	min-height: 40px;
	width: 100%;
	cursor: pointer;
	border-radius: 6px;
}

.bg-bar__stack.is-source {
	background: rgba(69, 249, 198, 0.25);
	box-shadow: 0 0 0 2px var(--accent);
}

.bg-bar__stack .bg-checker {
	width: 100%;
	max-width: 28px;
	margin: -2px 0;
}

/* Bear-off trays (side teal areas) */
.bg-off {
	position: absolute;
	top: 12%;
	bottom: 12%;
	width: 6.5%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	gap: 3px;
	padding: 4px 2px;
	z-index: 3;
	border-radius: 6px;
	pointer-events: auto;
	cursor: pointer;
}

.bg-off--white {
	right: 1.8%;
}

.bg-off--black {
	left: 1.8%;
	justify-content: flex-start;
}

.bg-off.is-target {
	background: rgba(255, 238, 178, 0.25);
	box-shadow: inset 0 0 0 2px var(--border-gold);
}

.bg-off__label {
	position: absolute;
	bottom: -1.6rem;
	left: 50%;
	transform: translateX(-50%);
	font-size: 0.7rem;
	color: var(--gold);
	white-space: nowrap;
	font-weight: 600;
}

.bg-off--black .bg-off__label {
	bottom: auto;
	top: -1.6rem;
}

.bg-off .bg-checker {
	width: 70%;
	max-width: 26px;
	margin: -4px 0;
}

/* HUD overlays — Figma in-game style */
.game-hud {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 5;
}

.game-hud > * {
	pointer-events: auto;
}

.game-exit {
	position: absolute;
	top: 2.5%;
	right: 3%;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	color: var(--gold);
	font-weight: 600;
	font-size: 1.05rem;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0.35rem 0.6rem;
}

.game-exit:hover {
	color: var(--beige);
}

.game-exit__icon {
	width: 22px;
	height: 22px;
	border: 1.5px solid var(--gold);
	border-radius: 4px;
	display: grid;
	place-items: center;
	font-size: 0.85rem;
	line-height: 1;
}

.player-badge {
	position: absolute;
	top: 4%;
	width: 15%;
	min-width: 110px;
	max-width: 160px;
	aspect-ratio: 0.72;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	padding: 0.75rem 0.5rem;
	text-align: center;
	background:
		linear-gradient(180deg, rgba(29, 43, 43, 0.92), rgba(15, 26, 31, 0.95));
	border: 1.5px solid var(--border-gold);
	border-radius: 18px 18px 28px 28px;
	box-shadow: inset 0 0 20px rgba(0, 92, 115, 0.35);
}

.player-badge--you {
	left: 1.5%;
	box-shadow:
		0 0 28px rgba(255, 90, 40, 0.45),
		inset 0 0 20px rgba(0, 92, 115, 0.35);
}

.player-badge--cpu {
	right: 1.5%;
	box-shadow:
		0 0 28px rgba(40, 140, 255, 0.45),
		inset 0 0 20px rgba(0, 92, 115, 0.35);
}

.player-badge__avatar {
	width: 52%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(circle at 40% 35%, #3a4a52, #0f1a1f);
	border: 2px solid var(--border-gold);
	display: grid;
	place-items: center;
	font-size: 1.6rem;
}

.player-badge__name {
	font-size: clamp(0.7rem, 1.4vw, 0.95rem);
	font-weight: 600;
	color: var(--beige);
	margin: 0;
	line-height: 1.3;
}

.player-badge__score {
	display: inline-grid;
	place-items: center;
	min-width: 2.4rem;
	padding: 0.15rem 0.5rem;
	border-radius: 6px;
	background: var(--gold-gradient);
	color: #1a1208;
	font-weight: 700;
	font-size: 0.85rem;
}

.game-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-top: 1rem;
	padding: 0.85rem 1rem;
	border-radius: 16px;
	border: 1.5px solid rgba(204, 189, 104, 0.35);
	background: rgba(15, 26, 31, 0.9);
	box-shadow: inset 4px 4px 14px rgba(0, 92, 115, 0.35);
}

.game-status-bar {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 8px;
	display: flex;
	z-index: 4;
}

.game-status-bar__you {
	flex: 1;
	background: linear-gradient(90deg, #c23a1a, #ff6a3d);
}

.game-status-bar__cpu {
	flex: 1;
	background: linear-gradient(90deg, #2a7dff, #1a4a9a);
}

.game-pip {
	position: absolute;
	bottom: 1.2%;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--gold);
	z-index: 5;
}

.game-pip--you { left: 2%; }
.game-pip--cpu { right: 2%; }

.game-meta {
	position: absolute;
	top: 3%;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	z-index: 6;
	text-align: center;
	background: rgba(15, 26, 31, 0.75);
	border: 1px solid rgba(204, 189, 104, 0.35);
	border-radius: 12px;
	padding: 0.5rem 1.1rem;
	backdrop-filter: blur(8px);
}

.game-meta__status {
	color: var(--beige);
	font-weight: 600;
	font-size: 0.95rem;
}

.game-meta__rounds {
	color: var(--accent);
	font-size: 0.8rem;
	font-weight: 600;
}

.dice-pair {
	display: flex;
	gap: 0.5rem;
}

.die {
	width: 48px;
	height: 48px;
	border-radius: 10px;
	background: var(--gold-gradient);
	color: #1a1208;
	display: grid;
	place-items: center;
	font-size: 1.35rem;
	font-weight: 700;
	box-shadow: 0 4px 14px rgba(164, 124, 74, 0.45);
	border: 1.5px solid #fbe59b;
}

.die.is-used {
	opacity: 0.35;
}

.die.is-rolling {
	animation: dice-shake 0.4s ease;
}

@keyframes dice-shake {
	0%, 100% { transform: rotate(0); }
	25% { transform: rotate(-12deg) scale(1.05); }
	75% { transform: rotate(12deg) scale(1.05); }
}

.game-overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 18, 22, 0.9);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 20;
	padding: 2rem;
	text-align: center;
}

.game-overlay.is-visible {
	display: flex;
	animation: fade-up 0.35s ease;
}

.game-overlay__box {
	max-width: 420px;
	padding: 2rem;
	border-radius: 18px;
	border: 1.5px solid var(--border-gold);
	background: #162429;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.game-overlay__box h3 {
	font-size: 1.5rem;
	margin-bottom: 0.75rem;
}

.game-overlay__box p {
	color: var(--text-muted);
	margin-bottom: 1.5rem;
	font-weight: 300;
}

.game-overlay__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: center;
}

.game-hint {
	text-align: center;
	color: var(--text-dim);
	font-size: 0.88rem;
	margin-top: 1rem;
	font-weight: 300;
}

/* Tutorial — only over the playable board (.game-stage) */
.game-tutorial {
	position: absolute;
	inset: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(8, 14, 18, 0.72);
	backdrop-filter: blur(4px);
	border-radius: inherit;
}

.game-tutorial[hidden] {
	display: none !important;
}

.game-tutorial__card {
	width: min(100%, 360px);
	padding: 1.35rem 1.2rem;
	border-radius: 16px;
	border: 1.5px solid #fbe59b;
	background: #1a242a;
	box-shadow:
		inset 5px 5px 16px rgba(0, 92, 115, 0.45),
		0 16px 40px rgba(0, 0, 0, 0.45);
	text-align: center;
}

.game-tutorial__step {
	display: inline-block;
	margin-bottom: 0.65rem;
	padding: 0.25rem 0.7rem;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--accent);
	background: rgba(69, 249, 198, 0.1);
	border: 1px solid rgba(69, 249, 198, 0.3);
}

.game-tutorial__card h3 {
	font-size: 1.2rem;
	margin-bottom: 0.55rem;
}

.game-tutorial__card p {
	color: var(--text-muted);
	font-weight: 300;
	margin-bottom: 1.15rem;
	line-height: 1.8;
	font-size: 0.92rem;
}

.game-tutorial__actions {
	display: flex;
	gap: 0.65rem;
	justify-content: center;
	flex-wrap: wrap;
}

@media (max-width: 900px) {
	.player-badge {
		display: none;
	}

	.bg-checker {
		max-width: 22px;
	}
}

/* Mobile: full-width board, controls under board */
@media (max-width: 768px) {
	.game-section .container {
		padding-inline: 0.75rem;
	}

	.game-shell {
		width: 100%;
	}

	.game-stage {
		width: 100%;
		aspect-ratio: 1191 / 855;
		max-height: none;
		border-radius: 14px;
	}

	.game-stage__board {
		object-fit: contain;
		object-position: center center;
		background: #0a1216;
	}

	.game-stage__ui {
		/* Keep hit areas aligned to contained board (letterboxed) */
		inset: 0;
	}

	.bg-points {
		top: 8%;
		bottom: 8%;
		left: 10%;
		right: 10%;
	}

	.bg-off--white {
		right: 2%;
	}

	.bg-off--black {
		left: 2%;
	}

	.game-meta {
		top: 2%;
		max-width: calc(100% - 5.5rem);
	}

	.game-controls {
		margin-top: 0.85rem;
		flex-direction: column;
		gap: 0.65rem;
		width: 100%;
	}

	.game-controls .btn {
		width: 100%;
		max-width: 320px;
	}

	.dice-pair {
		justify-content: center;
	}

	.game-exit {
		top: 1.5%;
		right: 2%;
		font-size: 0.9rem;
		z-index: 8;
	}

	.game-pip {
		display: none;
	}

	.game-status-bar {
		height: 6px;
	}

	.bg-checker {
		max-width: 18px;
	}
}

@media (max-width: 640px) {
	.game-meta {
		top: 1.5%;
		padding: 0.35rem 0.7rem;
	}

	.game-meta__status {
		font-size: 0.8rem;
	}

	.die {
		width: 40px;
		height: 40px;
		font-size: 1.1rem;
	}

	.bg-checker {
		max-width: 14px;
		border-width: 1px;
	}

	.bg-points {
		top: 7%;
		bottom: 7%;
		left: 9%;
		right: 9%;
	}
}