/* LHVB – Trải bài Trọng Suốt */
.lhvb-tb {
	--tb-red: #8a1a13;
	--tb-red-deep: #3a0b09;
	--tb-gold: #ffd64f;
	--tb-gold-ink: #2b1a05;
	--tb-ink: #fdf6f6;
	--tb-ink-soft: #f1d9d3;
	--tb-surface: rgba(253, 246, 246, .08);
	--tb-surface-2: rgba(253, 246, 246, .14);
	--tb-ease: cubic-bezier(.16, 1, .3, 1);
	--tb-cw: 104px;
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 1180px;
	margin-inline: auto;
	padding-inline: 16px;
	color: var(--tb-ink);
	font-family: "Noto Sans", system-ui, sans-serif;
	font-size: 16px;
	line-height: 1.55;
	-webkit-tap-highlight-color: transparent;
}
.lhvb-tb ::selection { background: var(--tb-gold); color: var(--tb-gold-ink); }
.lhvb-tb *, .lhvb-tb *::before, .lhvb-tb *::after { box-sizing: border-box; }

/* Head */
.lhvb-tb__head { text-align: center; margin-bottom: 28px; }
.lhvb-tb__title {
	margin: 0 0 10px;
	font-family: Phudu, "Noto Sans", sans-serif;
	font-weight: 800;
	font-size: clamp(34px, 6vw, 72px);
	line-height: .98;
	letter-spacing: -.02em;
	text-transform: uppercase;
	color: var(--tb-gold);
	text-wrap: balance;
}
.lhvb-tb__lede { margin: 0 auto; max-width: 46ch; font-size: clamp(16px, 1.6vw, 19px); color: var(--tb-ink-soft); text-wrap: pretty; }

/* Spread chooser */
.lhvb-tb__spreads {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	max-width: 860px;
	margin: 0 auto 8px;
	padding: 0;
	border: 0;
}
.lhvb-tb__spread {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-height: 64px;
	padding: 10px 14px;
	border-radius: 3px;
	background: var(--tb-surface);
	color: var(--tb-ink);
	text-transform: none;
	cursor: pointer;
	transition: background-color .25s var(--tb-ease), color .25s var(--tb-ease), transform .25s var(--tb-ease);
}
.lhvb-tb__spread:hover { background: var(--tb-surface-2); }
.lhvb-tb__spread:active { transform: scale(.98); }
.lhvb-tb__spread input { position: absolute; opacity: 0; pointer-events: none; }
.lhvb-tb__spread-name { font-family: Phudu, "Noto Sans", sans-serif; font-weight: 600; font-size: 18px; line-height: 1.2; color: inherit; }
.lhvb-tb__spread-count { font-size: 14px; color: var(--tb-ink-soft); }
.lhvb-tb__spread:has(input:checked) { background: var(--tb-gold); color: var(--tb-gold-ink); }
.lhvb-tb__spread:has(input:checked) .lhvb-tb__spread-count { color: var(--tb-gold-ink); }
.lhvb-tb__spread:has(input:focus-visible) { outline: 2px solid var(--tb-gold); outline-offset: 3px; }
.lhvb-tb__spread:has(input:disabled) { opacity: .5; cursor: default; }
.lhvb-tb__note { max-width: 860px; margin: 0 auto; text-align: center; font-size: 15px; color: var(--tb-ink-soft); min-height: 1.55em; }

/* Table */
.lhvb-tb__table {
	position: relative;
	margin-top: 28px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 28px;
}
.lhvb-tb[data-state="choose"] .lhvb-tb__table { min-height: calc(var(--tb-cw) * 1.5 * 12 / 7 + 80px); justify-content: center; }

/* Card back and face art */
.lhvb-tb__back, .lhvb-tb__card, .lhvb-tb__face {
	border-radius: calc(var(--tb-cw) * .06);
	background-color: var(--tb-red);
	background-image: var(--tb-back);
	background-size: cover;
	background-position: center;
}

/* Deck */
.lhvb-tb__deck {
	position: relative;
	width: calc(var(--tb-cw) * 1.5);
	aspect-ratio: 7 / 12;
	transition: opacity .4s var(--tb-ease), transform .5s var(--tb-ease);
}
.lhvb-tb__deck .lhvb-tb__back {
	position: absolute;
	inset: 0;
	transform: translate(calc(var(--i) * -1px), calc(var(--i) * -2px));
	box-shadow: 0 2px 6px rgba(20, 2, 0, .35); /* taste-skill-ignore: playing cards are physical objects lifted off the table */
}
.lhvb-tb__deck .lhvb-tb__back:last-child { box-shadow: 0 18px 40px rgba(20, 2, 0, .55); } /* taste-skill-ignore: deck thickness */
.lhvb-tb__deck.is-riffle .lhvb-tb__back:nth-child(odd) { animation: lhvb-tb-cut-l .42s var(--tb-ease); }
.lhvb-tb__deck.is-riffle .lhvb-tb__back:nth-child(even) { animation: lhvb-tb-cut-r .42s var(--tb-ease); }
@keyframes lhvb-tb-cut-l { 45% { transform: translate(-58%, -6%) rotate(-9deg); } }
@keyframes lhvb-tb-cut-r { 45% { transform: translate(58%, -2%) rotate(9deg); } }
.lhvb-tb:not([data-state="choose"]) .lhvb-tb__deck { display: none; }

/* Fan */
.lhvb-tb__fan { position: relative; width: 100%; display: none; }
.lhvb-tb[data-state="fanned"] .lhvb-tb__fan { display: block; }
.lhvb-tb__card {
	position: absolute;
	left: 50%;
	top: var(--top, 0px);
	width: var(--tb-cw);
	aspect-ratio: 7 / 12;
	margin-left: calc(var(--tb-cw) / -2);
	padding: 0;
	border: 0;
	cursor: pointer;
	transform-origin: 50% var(--origin, 900%);
	transform: rotate(var(--r, 0deg)) translate(var(--x, 0px), var(--y, 0px));
	box-shadow: 0 6px 16px rgba(20, 2, 0, .45); /* taste-skill-ignore: playing cards are physical objects lifted off the table */
	opacity: 0;
	transition: transform .55s var(--tb-ease), opacity .35s var(--tb-ease), box-shadow .25s var(--tb-ease);
	transition-delay: var(--d, 0ms);
}
.lhvb-tb__fan.is-open .lhvb-tb__card { opacity: 1; }
.lhvb-tb__card:hover, .lhvb-tb__card:focus-visible {
	transform: rotate(var(--r, 0deg)) translate(var(--x, 0px), calc(var(--y, 0px) - var(--tb-cw) * .22));
	box-shadow: 0 16px 30px rgba(20, 2, 0, .55); /* taste-skill-ignore: playing cards are physical objects lifted off the table */
	transition-delay: 0ms;
	z-index: 60;
}
.lhvb-tb__card:focus-visible { outline: 2px solid var(--tb-gold); outline-offset: 3px; }
.lhvb-tb__card.is-taken { opacity: 0 !important; pointer-events: none; transition-delay: 0ms; }
.lhvb-tb__fan.is-done .lhvb-tb__card { opacity: 0; transform: rotate(0deg) translate(0, 40px); transition-delay: calc(var(--d, 0ms) / 3); pointer-events: none; }

/* Slots */
.lhvb-tb__slots {
	display: none;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: clamp(14px, 3vw, 40px);
	justify-content: center;
	width: 100%;
}
.lhvb-tb[data-state="fanned"] .lhvb-tb__slots,
.lhvb-tb[data-state="revealed"] .lhvb-tb__slots { display: flex; }
.lhvb-tb[data-state="fanned"] .lhvb-tb__slots { --slot-w: 96px; }
.lhvb-tb[data-state="revealed"] .lhvb-tb__slots { --slot-w: min(300px, calc((100% - 80px) / 3)); }
.lhvb-tb[data-state="revealed"] .lhvb-tb__slots:has(> :only-child) { --slot-w: min(360px, 82vw); }
.lhvb-tb__slot { display: flex; flex-direction: column; align-items: center; gap: 12px; width: var(--slot-w, 260px); max-width: 100%; transition: width .6s var(--tb-ease); }
.lhvb-tb[data-state="fanned"] .lhvb-tb__slot-label strong { font-size: 15px; }
.lhvb-tb[data-state="fanned"] .lhvb-tb__slot-label span { display: none; }
.lhvb-tb__slot-label { text-align: center; line-height: 1.25; }
.lhvb-tb__slot-label strong { display: block; font-family: Phudu, "Noto Sans", sans-serif; font-weight: 700; font-size: clamp(20px, 2.2vw, 26px); color: var(--tb-gold); text-transform: uppercase; letter-spacing: -.01em; }
.lhvb-tb__slot-label span { font-size: 15px; color: var(--tb-ink-soft); }
.lhvb-tb__place {
	position: relative;
	width: 100%;
	aspect-ratio: 7 / 12;
	border-radius: calc(var(--tb-cw) * .06);
	background: var(--tb-surface);
	perspective: 1400px;
}
.lhvb-tb__flip {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
	transition: transform .9s var(--tb-ease);
}
.lhvb-tb__flip.is-flying { transition: none; }
.lhvb-tb__flip.is-landing { transition: transform .6s var(--tb-ease); }
.lhvb-tb__flip.is-open { transform: rotateY(180deg); }
.lhvb-tb__flip > * {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	box-shadow: 0 14px 34px rgba(20, 2, 0, .5); /* taste-skill-ignore: playing cards are physical objects lifted off the table */
}
.lhvb-tb__face { transform: rotateY(180deg); background-image: none; padding: 0; border: 0; cursor: zoom-in; overflow: hidden; }
.lhvb-tb__face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lhvb-tb__face:focus-visible { outline: 2px solid var(--tb-gold); outline-offset: 3px; }

/* Bar */
.lhvb-tb__bar { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 36px; text-align: center; }
.lhvb-tb__status { margin: 0; max-width: 52ch; font-size: 17px; color: var(--tb-ink); min-height: 1.55em; text-wrap: pretty; }
.lhvb-tb__status b { color: var(--tb-gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.lhvb-tb__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.lhvb-tb__btn {
	min-height: 48px;
	padding: 0 22px;
	border: 0;
	border-radius: 3px;
	background: var(--tb-surface-2);
	color: var(--tb-ink);
	font: 600 16px/1 "Noto Sans", system-ui, sans-serif;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	transition: background-color .2s var(--tb-ease), transform .2s var(--tb-ease);
}
.lhvb-tb__btn:hover { background: rgba(253, 246, 246, .22); }
.lhvb-tb__btn:active { transform: scale(.97); }
.lhvb-tb__btn:focus-visible { outline: 2px solid var(--tb-gold); outline-offset: 3px; }
.lhvb-tb__btn--main { background: var(--tb-gold); color: var(--tb-gold-ink); }
.lhvb-tb__btn--main:hover { background: #ffe07a; }
.lhvb-tb__btn.is-holding { transform: scale(.96); background: #ffe07a; }
.lhvb-tb__btn[hidden] { display: none; }

/* Zoom */
.lhvb-tb__zoom {
	border: 0;
	padding: 0;
	background: transparent;
	max-width: min(92vw, 520px);
	max-height: 94vh;
	overflow: visible;
}
.lhvb-tb__zoom::backdrop { background: rgba(26, 4, 3, .82); }
.lhvb-tb__zoom[open] { display: flex; flex-direction: column; align-items: center; gap: 14px; animation: lhvb-tb-zoom .35s var(--tb-ease); }
.lhvb-tb__zoom img { display: block; max-width: 100%; max-height: calc(94vh - 76px); width: auto; border-radius: 10px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6); } /* taste-skill-ignore: zoomed card sits in a dialog overlay */
@keyframes lhvb-tb-zoom { from { opacity: 0; transform: scale(.94); } }

.lhvb-tb .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Phone */
@media (max-width: 640px) {
	.lhvb-tb__spreads { grid-template-columns: 1fr; }
	.lhvb-tb__spread { flex-direction: row; justify-content: space-between; align-items: center; min-height: 52px; }
	.lhvb-tb__table { margin-top: 20px; }
	.lhvb-tb__card { margin-left: 0; left: var(--gx, 0px); top: var(--gy, 0px); transform: none; transform-origin: center; transition-property: left, top, opacity, transform, box-shadow; border-radius: 3px; }
	.lhvb-tb[data-state="fanned"] .lhvb-tb__slots { --slot-w: 76px; }
	.lhvb-tb[data-state="revealed"] .lhvb-tb__slots,
	.lhvb-tb[data-state="revealed"] .lhvb-tb__slots:has(> :only-child) { flex-direction: column; align-items: center; gap: 36px; --slot-w: min(300px, 78vw); }
	.lhvb-tb__card:hover, .lhvb-tb__card:focus-visible { transform: translateY(-6px); }
	.lhvb-tb__fan.is-done .lhvb-tb__card { transform: translateY(20px); }
	.lhvb-tb__slot-label span { font-size: 14px; }
	.lhvb-tb__bar { margin-top: 28px; }
	.lhvb-tb__btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
	.lhvb-tb__deck.is-riffle .lhvb-tb__back { animation: none !important; }
	.lhvb-tb__card, .lhvb-tb__flip, .lhvb-tb__flip.is-landing { transition-duration: .01ms !important; transition-delay: 0ms !important; }
	.lhvb-tb__flip.is-open > .lhvb-tb__face { transition: opacity .3s; }
	.lhvb-tb__zoom[open] { animation: none; }
}

/* Ambient sky canvas (tb-sky.js) – sits over the section photo, under the widget */
.lhvb-sky {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity 1.4s var(--tb-ease, ease);
}
.lhvb-sky.is-on { opacity: 1; }
