/* BDC Tree Vote. Override the variables below to match the client's brand. */
.bdctv {
	--bdctv-ink: #14231b;
	--bdctv-muted: #5d6b63;
	--bdctv-accent: #b8913f;       /* gold */
	--bdctv-accent-ink: #ffffff;
	--bdctv-green: #1f4a35;        /* evergreen */
	--bdctv-surface: #ffffff;
	--bdctv-line: rgba(20, 35, 27, 0.12);
	--bdctv-radius: 16px;
	--bdctv-shadow: 0 1px 2px rgba(20, 35, 27, 0.06), 0 8px 24px rgba(20, 35, 27, 0.08);

	color: var(--bdctv-ink);
	max-width: 1100px;
	margin: 0 auto;
	padding: 8px 0 32px;
	font: inherit;
	-webkit-tap-highlight-color: transparent;
}
.bdctv *,
.bdctv *::before,
.bdctv *::after { box-sizing: border-box; }
.bdctv [hidden] { display: none !important; }

/* Header */
.bdctv-head { text-align: center; margin: 0 auto 28px; max-width: 640px; padding: 0 16px; }
.bdctv-title {
	margin: 0 0 10px;
	font-size: clamp(1.75rem, 5vw, 2.6rem);
	line-height: 1.1;
	letter-spacing: -0.01em;
	color: var(--bdctv-green);
}
.bdctv-intro { margin: 0; color: var(--bdctv-muted); font-size: 1.05rem; line-height: 1.5; }
.bdctv-empty { text-align: center; color: var(--bdctv-muted); }

/* Grid */
.bdctv-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
	padding: 0 14px;
}
@media (min-width: 720px) {
	.bdctv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
}

.bdctv-card {
	appearance: none;
	display: flex;
	flex-direction: column;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--bdctv-radius);
	background: var(--bdctv-surface);
	box-shadow: var(--bdctv-shadow);
	color: inherit;
	font: inherit;
	text-align: center;
	cursor: pointer;
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
	outline: 2px solid transparent;
	outline-offset: 3px;
}
.bdctv-card:hover:not(:disabled) { transform: translateY(-2px); }
.bdctv-card:focus-visible { outline-color: var(--bdctv-accent); }
.bdctv-card:disabled { cursor: default; }
.bdctv.is-loading .bdctv-card { opacity: 0.6; }
.bdctv.is-closed .bdctv-card { opacity: 0.55; filter: grayscale(0.4); }

.bdctv-photo {
	position: relative;
	display: block;
	aspect-ratio: 3 / 4;
	background: linear-gradient(160deg, #e9efe9, #d6e0d8);
	overflow: hidden;
}
.bdctv-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}
.bdctv-card:hover:not(:disabled) .bdctv-photo img { transform: scale(1.03); }
.bdctv-noimg { position: absolute; inset: 0; }

.bdctv-name {
	display: block;
	padding: 14px 12px 16px;
	font-weight: 600;
	font-size: 1.02rem;
	line-height: 1.3;
}

/* Selection */
.bdctv-grid.has-selection .bdctv-card:not(.is-selected) { opacity: 0.55; }
.bdctv-card.is-selected {
	box-shadow: 0 0 0 3px var(--bdctv-accent), 0 12px 32px rgba(20, 35, 27, 0.18);
	transform: translateY(-2px);
}
.bdctv-check {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--bdctv-accent);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	opacity: 0;
	transform: scale(0.6);
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.bdctv-check::after {
	content: "";
	position: absolute;
	left: 12px;
	top: 8px;
	width: 8px;
	height: 14px;
	border: solid var(--bdctv-accent-ink);
	border-width: 0 3px 3px 0;
	transform: rotate(45deg);
}
.bdctv-card.is-selected .bdctv-check { opacity: 1; transform: scale(1); }

/* Sticky confirm bar (thumb friendly on phones) */
.bdctv-confirm {
	position: sticky;
	bottom: 0;
	z-index: 20;
	display: flex;
	gap: 10px;
	align-items: center;
	margin: 22px 0 0;
	padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
	background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, rgba(255, 255, 255, 0));
}
.bdctv-submit,
.bdctv-cancel {
	appearance: none;
	border: 0;
	font: inherit;
	cursor: pointer;
	border-radius: 999px;
}
.bdctv-submit {
	flex: 1;
	min-height: 56px;
	padding: 14px 22px;
	background: var(--bdctv-green);
	color: #fff;
	font-weight: 700;
	font-size: 1.05rem;
	box-shadow: 0 8px 20px rgba(31, 74, 53, 0.3);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.bdctv-submit:disabled { opacity: 0.7; cursor: wait; }
.bdctv-cancel {
	flex: 0 0 56px;
	height: 56px;
	background: var(--bdctv-surface);
	color: var(--bdctv-muted);
	font-size: 1.6rem;
	line-height: 1;
	box-shadow: inset 0 0 0 1px var(--bdctv-line);
}
@media (min-width: 720px) {
	.bdctv-confirm { max-width: 560px; margin-left: auto; margin-right: auto; }
}

/* Messages */
.bdctv-msg { min-height: 1.4em; margin: 14px 16px 0; text-align: center; color: var(--bdctv-muted); }
.bdctv-msg:empty { display: none; }
.bdctv-msg.is-error { color: #a12a2a; font-weight: 600; }
.bdctv.is-closed .bdctv-msg { font-size: 1.1rem; color: var(--bdctv-ink); font-weight: 600; }

/* Results */
.bdctv-results {
	max-width: 640px;
	margin: 0 auto;
	padding: 0 16px;
	scroll-margin-top: 80px;
	animation: bdctv-in 0.4s ease both;
}
@keyframes bdctv-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.bdctv-results-title {
	margin: 0 0 6px;
	text-align: center;
	font-size: clamp(1.6rem, 5vw, 2.2rem);
	line-height: 1.15;
	color: var(--bdctv-green);
}
.bdctv-you, .bdctv-pending { margin: 0 0 24px; text-align: center; color: var(--bdctv-muted); font-size: 1.05rem; }

.bdctv-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bdctv-row {
	display: flex;
	gap: 14px;
	align-items: center;
	padding: 12px;
	border-radius: var(--bdctv-radius);
	background: var(--bdctv-surface);
	box-shadow: var(--bdctv-shadow);
}
.bdctv-row.is-mine { box-shadow: 0 0 0 2px var(--bdctv-accent), var(--bdctv-shadow); }

.bdctv-row-thumb {
	flex: 0 0 56px;
	width: 56px;
	height: 56px;
	border-radius: 12px;
	overflow: hidden;
	background: linear-gradient(160deg, #e9efe9, #d6e0d8);
}
.bdctv-row-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

.bdctv-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bdctv-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bdctv-row-name { font-weight: 600; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bdctv-row-pct { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--bdctv-green); }
.bdctv-row-count { font-size: 0.85rem; color: var(--bdctv-muted); font-variant-numeric: tabular-nums; }

.bdctv-tag {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	background: rgba(184, 145, 63, 0.15);
	color: #7a5d1e;
}
.bdctv-tag-leader { background: var(--bdctv-green); color: #fff; }

.bdctv-track { display: block; height: 10px; border-radius: 999px; background: rgba(20, 35, 27, 0.08); overflow: hidden; }
.bdctv-fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--bdctv-green), #2f6b4d);
	transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.bdctv-row.is-leader .bdctv-fill { background: linear-gradient(90deg, #a57e30, var(--bdctv-accent)); }

.bdctv-total { margin: 20px 0 0; text-align: center; color: var(--bdctv-muted); font-size: 0.95rem; }

@media (prefers-reduced-motion: reduce) {
	.bdctv *, .bdctv *::before, .bdctv *::after { transition: none !important; animation: none !important; }
}
