.chvc-counter-wrap {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.chvc-align-left {
	align-items: flex-start;
	text-align: left;
}

.chvc-align-center {
	align-items: center;
	text-align: center;
}

.chvc-align-right {
	align-items: flex-end;
	text-align: right;
}

.chvc-layout-horizontal .chvc-counter {
	padding: 8px 12px;
}

.chvc-layout-horizontal .chvc-counter > .chvc-counter-inner {
	gap: 0;
	width: auto;
	align-items: center;
}

/* Column stack: metrics row + date. Avoids flex-basis:100% stretching to the panel width. */
.chvc-layout-horizontal .chvc-counter > .chvc-counter-inner .chvc-counter-body {
	flex-direction: column;
	flex-wrap: nowrap;
	justify-content: flex-start;
	align-items: center;
	align-content: flex-start;
	gap: 6px;
	width: max-content;
	max-width: 100%;
}

.chvc-layout-horizontal .chvc-counter > .chvc-counter-inner .chvc-counter-body .chvc-counter-metrics {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: center;
	align-items: flex-start;
	gap: 6px 12px;
	width: max-content;
	max-width: 100%;
}

.chvc-layout-horizontal .chvc-counter > .chvc-counter-inner .chvc-counter-body .chvc-counter-line {
	width: auto;
	align-items: center;
	text-align: center;
}

.chvc-layout-horizontal .chvc-counter > .chvc-counter-inner .chvc-counter-body .chvc-counter-datetime {
	flex: 0 0 auto;
	width: max-content;
	max-width: 100%;
	margin: 0;
	padding: 0;
	align-self: center;
	text-align: center;
}

.chvc-counter-metrics {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: max-content;
	max-width: 100%;
}

.chvc-layout-vertical .chvc-counter-body .chvc-counter-metrics {
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.chvc-layout-compact .chvc-counter-inner {
	gap: 2px;
}

.chvc-layout-compact .chvc-counter-label {
	font-size: 0.65em;
}

.chvc-layout-compact .chvc-counter-value {
	font-size: 1em;
}

.chvc-counter {
	display: inline-block;
	color: var(--chvc-text, #fff);
	background-color: var(--chvc-bg, #1e3a5f);
	font-size: var(--chvc-size, 16px);
	font-family: var(--chvc-font, inherit);
	border-radius: 8px;
	border-width: var(--chvc-border-width, 0);
	border-style: var(--chvc-border-style, solid);
	border-color: var(--chvc-border-color, transparent);
	box-sizing: border-box;
	padding: 12px 16px;
	width: fit-content;
	max-width: 100%;
}

.chvc-counter-inner {
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-items: stretch;
	text-align: center;
	width: 100%;
}

.chvc-counter-inner--logo-side {
	flex-direction: row;
	align-items: center;
	width: auto;
}

.chvc-counter-body {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	flex: 0 1 auto;
	min-width: 0;
	width: fit-content;
	max-width: 100%;
}

.chvc-counter-line {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 100%;
}

.chvc-counter-body .chvc-counter-line {
	width: auto;
	align-items: center;
	text-align: center;
}

.chvc-counter-label {
	font-size: 0.75em;
	opacity: 0.85;
}

.chvc-counter-value {
	font-size: 1.15em;
	font-weight: 700;
	line-height: 1.2;
	word-break: break-word;
}

.chvc-counter-logo img {
	max-height: 42px;
	width: auto;
	display: block;
}

.chvc-counter-logo-top,
.chvc-counter-logo-bottom {
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	align-self: stretch;
}

.chvc-counter-logo-left,
.chvc-counter-logo-right {
	flex: 0 0 auto;
	align-self: center;
}

.chvc-counter-clock {
	font-size: 0.85em;
	font-weight: 400;
}

.chvc-layout-vertical .chvc-counter-body .chvc-counter-datetime {
	margin-top: 4px;
}

/* Large themed scene frames (radio, speedo, custom club artwork). */
.chvc-scene {
	position: relative;
	display: inline-block;
	width: auto;
	max-width: min(100%, var(--chvc-scene-max-width, 640px));
	line-height: 0;
}

.chvc-scene-art {
	display: block;
	width: 100%;
	height: auto;
}

.chvc-scene-slot {
	position: absolute;
	top: var(--chvc-slot-top, 40%);
	left: var(--chvc-slot-left, 25%);
	width: var(--chvc-slot-box-w, auto);
	height: var(--chvc-slot-box-h, auto);
	min-width: 0;
	min-height: 0;
	display: block;
	overflow: visible;
	color: var(--chvc-slot-text, var(--chvc-text, #fff));
	font-size: var(--chvc-slot-size, var(--chvc-size, 16px));
	font-family: var(--chvc-slot-font, var(--chvc-font, inherit));
	text-align: center;
	box-sizing: border-box;
	padding: 4px 6px;
	line-height: 1.15;
}

.chvc-scene-has-labels .chvc-scene-slot .chvc-counter-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	width: auto;
	height: auto;
}

.chvc-scene-has-labels .chvc-scene-slot .chvc-counter-label {
	font-size: 0.55em;
	line-height: 1.1;
	white-space: nowrap;
}

.chvc-scene-has-labels .chvc-scene-slot .chvc-counter-value {
	font-size: 0.95em;
	line-height: 1.1;
	white-space: nowrap;
}

.chvc-scene-slot .chvc-counter-inner {
	width: auto;
	height: auto;
	gap: 2px;
}

.chvc-scene-slot .chvc-counter-body {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: auto;
	height: auto;
	gap: 2px;
}

.chvc-scene-slot .chvc-counter-value {
	font-size: 1em;
}

.chvc-scene-slot-vertical .chvc-counter-inner {
	flex-direction: column;
	align-items: center;
}

/* Individual stat boxes on custom / saved counters. */
.chvc-scene-individual-stats .chvc-scene-stat {
	position: absolute;
	top: var(--chvc-stat-top, 30%);
	left: var(--chvc-stat-left, 30%);
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	display: block;
	overflow: visible;
	color: var(--chvc-stat-text, #39ff14);
	font-size: var(--chvc-stat-size, 16px);
	font-family: var(--chvc-stat-font, monospace);
	text-align: center;
	box-sizing: border-box;
	padding: 2px 4px;
	line-height: 1.15;
}

.chvc-scene-individual-stats .chvc-scene-stat .chvc-counter-line {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	width: auto;
}

.chvc-scene-individual-stats .chvc-scene-stat .chvc-counter-label {
	font-size: 0.55em;
	line-height: 1.1;
	white-space: nowrap;
}

.chvc-scene-individual-stats .chvc-scene-stat .chvc-counter-value {
	font-size: 0.95em;
	line-height: 1.1;
	white-space: nowrap;
}

.chvc-scene-individual-stats .chvc-scene-stat.is-editing {
	outline: 2px dashed #1e3a5f;
	outline-offset: 2px;
}

.chvc-scene-instrument .chvc-counter-label {
	display: none;
}

.chvc-scene-slot-horizontal .chvc-scene-slot .chvc-counter-body,
.chvc-scene-slot-horizontal .chvc-scene-slot .chvc-counter-inner,
.chvc-scene-slot-horizontal .chvc-counter-inner {
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 10px 14px;
}

.chvc-scene-slot-horizontal .chvc-scene-slot .chvc-counter-body .chvc-counter-line,
.chvc-scene-slot-horizontal .chvc-scene-slot .chvc-counter-line,
.chvc-scene-slot-horizontal .chvc-counter-line {
	width: auto;
	align-items: center;
	text-align: center;
}

.chvc-scene-slot-horizontal .chvc-scene-slot .chvc-counter-body .chvc-counter-datetime,
.chvc-scene-slot-horizontal .chvc-scene-slot .chvc-counter-datetime,
.chvc-scene-slot-horizontal .chvc-counter-datetime {
	flex: 0 0 100%;
	width: 100%;
	text-align: center;
}

.chvc-scene-slot-vertical .chvc-scene-slot .chvc-counter-body,
.chvc-scene-slot-vertical .chvc-scene-slot .chvc-counter-inner,
.chvc-scene-slot-vertical .chvc-counter-inner {
	flex-direction: column;
	align-items: center;
}

.chvc-scene-instrument .chvc-scene-slot .chvc-counter-body,
.chvc-scene-instrument .chvc-counter-inner {
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px 14px;
}

.chvc-scene-instrument .chvc-scene-slot .chvc-counter-body .chvc-counter-line,
.chvc-scene-instrument .chvc-counter-line {
	flex-direction: column;
	width: auto;
	align-items: center;
}

.chvc-scene-instrument .chvc-scene-slot .chvc-counter-body .chvc-counter-datetime,
.chvc-scene-instrument .chvc-counter-datetime {
	flex: 0 0 100%;
	width: 100%;
	text-align: center;
}

.chvc-scene-instrument.chvc-scene-slot-vertical .chvc-scene-slot .chvc-counter-body,
.chvc-scene-instrument.chvc-scene-slot-vertical .chvc-scene-slot .chvc-counter-inner {
	flex-direction: column;
	align-items: center;
}

.chvc-scene-logo {
	position: absolute;
	z-index: 2;
	max-width: 22%;
}

.chvc-scene-logo img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 56px;
}

.chvc-scene-logo-top {
	top: 4%;
	left: 50%;
	transform: translateX(-50%);
}

.chvc-scene-logo-left {
	top: 50%;
	left: 4%;
	transform: translateY(-50%);
}

.chvc-scene-logo-right {
	top: 50%;
	right: 4%;
	left: auto;
	transform: translateY(-50%);
}

.chvc-scene-logo-bottom {
	bottom: 4%;
	left: 50%;
	top: auto;
	transform: translateX(-50%);
}
