/* Crnilo kup – javna rang-lista. Preuzima font teme; boje su prigušene i rade na svijetlim i tamnim temama. */

.crnilo-r {
	--ck-ink: #14222e;
	--ck-line: rgba(20, 34, 46, 0.14);
	--ck-soft: rgba(20, 34, 46, 0.05);
	--ck-amber: #b7791f;
	--ck-gold: #d9b23a;
	--ck-silver: #b8c2cc;
	--ck-bronze: #c98a55;
	--ck-focus: #2f6f73;
	box-sizing: border-box;
	max-width: 100%;
	margin: 1.5em 0;
	line-height: 1.5;
}

.crnilo-r *,
.crnilo-r *::before,
.crnilo-r *::after {
	box-sizing: inherit;
}

.crnilo-r [hidden] {
	display: none !important;
}

/* Status rezultata */
.crnilo-r__status {
	margin: 0 0 1em;
	padding: 0.6em 0.9em;
	border-left: 4px solid var(--ck-amber);
	background: rgba(183, 121, 31, 0.08);
	font-weight: 600;
}

.crnilo-r__status::before {
	content: "";
	display: inline-block;
	width: 0.55em;
	height: 0.55em;
	margin-right: 0.55em;
	border-radius: 50%;
	background: var(--ck-amber);
	vertical-align: 0.08em;
}

.crnilo-r--official .crnilo-r__status {
	border-left-color: var(--ck-ink);
	background: var(--ck-ink);
	color: #fff;
}

.crnilo-r--official .crnilo-r__status::before {
	background: var(--ck-gold);
	border-radius: 1px;
	transform: rotate(45deg);
}

/* Pretraga */
.crnilo-r__search {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4em 0.8em;
	margin: 0 0 0.6em;
}

.crnilo-r__search label {
	font-weight: 600;
}

.crnilo-r__search input[type="search"] {
	width: 14em;
	max-width: 100%;
	padding: 0.35em 0.6em;
	font: inherit;
	font-size: 1.1em;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	border: 2px solid var(--ck-line);
	border-radius: 4px;
	background: transparent;
	color: inherit;
}

.crnilo-r__search input[type="search"]:focus {
	outline: 2px solid var(--ck-focus);
	outline-offset: 1px;
	border-color: var(--ck-focus);
}

.crnilo-r__live {
	margin: 0 0 0.8em;
	font-size: 0.85em;
	opacity: 0.75;
}

.crnilo-r__live--offline {
	opacity: 1;
	color: var(--ck-amber);
	font-weight: 600;
}

/* Tablica */
.crnilo-r__table-wrap {
	overflow-x: auto;
}

.crnilo-r__table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	border: 0;
	font-variant-numeric: tabular-nums;
}

.crnilo-r__table th,
.crnilo-r__table td {
	padding: 0.65em 0.75em;
	border: 0;
	border-bottom: 1px solid var(--ck-line);
	text-align: left;
	vertical-align: middle;
	background: transparent;
}

.crnilo-r__table thead th {
	font-size: 0.8em;
	font-weight: 600;
	letter-spacing: 0.01em;
	border-bottom: 2px solid currentColor;
	white-space: nowrap;
}

.crnilo-r__table .crnilo-r__num {
	text-align: right;
	white-space: nowrap;
}

.crnilo-r__table .crnilo-r__points {
	font-weight: 700;
}

.crnilo-r__rank,
.crnilo-r__start {
	width: 1%;
	white-space: nowrap;
}

.crnilo-r__start {
	font-weight: 600;
}

.crnilo-r__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.3em;
	height: 2.3em;
	padding: 0 0.35em;
	border-radius: 999px;
	font-weight: 700;
}

.crnilo-r__row--podium {
	background: var(--ck-soft);
}

.crnilo-r__row--p1 .crnilo-r__badge {
	background: var(--ck-gold);
	color: var(--ck-ink);
}

.crnilo-r__row--p2 .crnilo-r__badge {
	background: var(--ck-silver);
	color: var(--ck-ink);
}

.crnilo-r__row--p3 .crnilo-r__badge {
	background: var(--ck-bronze);
	color: var(--ck-ink);
}

.crnilo-r__empty {
	margin: 1em 0;
	padding: 0.8em 1em;
	border: 1px dashed var(--ck-line);
	text-align: center;
}

.crnilo-r--message p {
	margin: 0;
	padding: 0.8em 1em;
	border-left: 4px solid var(--ck-amber);
	background: rgba(183, 121, 31, 0.08);
}

.crnilo-r__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Mobilni prikaz: svaki redak postaje kartica */
@media (max-width: 640px) {
	.crnilo-r__table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
	}

	.crnilo-r__table,
	.crnilo-r__table tbody {
		display: block;
	}

	.crnilo-r__table tr {
		display: grid;
		grid-template-columns: auto 1fr;
		gap: 0.15em 0.9em;
		padding: 0.8em 0.4em;
		border-bottom: 1px solid var(--ck-line);
	}

	.crnilo-r__table td {
		display: flex;
		justify-content: space-between;
		gap: 1em;
		padding: 0.1em 0;
		border: 0;
		width: auto;
		text-align: right;
	}

	.crnilo-r__table td::before {
		content: attr(data-label);
		font-weight: 400;
		opacity: 0.7;
		text-align: left;
		white-space: nowrap;
	}

	.crnilo-r__table td.crnilo-r__rank {
		grid-row: 1 / span 6;
		align-items: flex-start;
	}

	.crnilo-r__table td.crnilo-r__rank::before {
		content: none;
	}

	.crnilo-r__table td.crnilo-r__crew {
		text-align: right;
	}
}

/* ---------- Statistika (natjecanja i vaganja) ---------- */

.crnilo-s {
	--ck-male: #14222e;
	--ck-female: #2f8a8f;
}

.crnilo-s__grid {
	display: flex;
	flex-wrap: wrap;
	margin: 0 0 1em;
	padding: 0;
	border-top: 2px solid currentColor;
}

.crnilo-s__item {
	flex: 1 1 8.5em;
	min-width: 0;
	margin: 0;
	padding: 0.75em 0.9em 0.85em 0;
	border-bottom: 1px solid var(--ck-line);
}

.crnilo-s__item dt {
	margin: 0;
	font-size: 0.85em;
	font-weight: 400;
	opacity: 0.75;
}

.crnilo-s__item dd {
	margin: 0.15em 0 0;
}

/* Kad se naziv prelomi u dva retka, vrijednosti u istom retku ostaju poravnate. */
.crnilo-s__item {
	display: flex;
	flex-direction: column;
}

.crnilo-s__item > dd {
	margin-top: auto;
	padding-top: 0.15em;
}

.crnilo-s__value {
	display: block;
	font-size: 1.6em;
	line-height: 1.2;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.crnilo-s__note {
	display: block;
	font-size: 0.85em;
	opacity: 0.8;
}

.crnilo-s__note:empty {
	display: none;
}

/* Rekordi (najveća i najmanja lignja) su istaknuti */
.crnilo-s__group--records .crnilo-s__value {
	font-size: 2em;
}

.crnilo-s__group--records .crnilo-s__item--largest .crnilo-s__value {
	color: var(--ck-ink);
}

.crnilo-r--official .crnilo-s__grid,
.crnilo-s--competition .crnilo-s__grid {
	border-top-color: var(--ck-ink);
}

/* Udio muškaraca i žena */
.crnilo-s__item--gender {
	flex-basis: 100%;
}

.crnilo-s__group--records .crnilo-s__item,
.crnilo-s__group--totals .crnilo-s__item {
	flex-basis: 12em;
}

.crnilo-s__split {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5em 2em;
}

.crnilo-s__split-part {
	margin: 0;
}

.crnilo-s__split-part--female {
	text-align: right;
}

.crnilo-s__label {
	display: block;
	font-size: 0.85em;
	opacity: 0.75;
}

.crnilo-s__label::before {
	content: "";
	display: inline-block;
	width: 0.7em;
	height: 0.7em;
	margin-right: 0.4em;
	border-radius: 2px;
	background: var(--ck-male);
	vertical-align: -0.02em;
}

.crnilo-s__split-part--female .crnilo-s__label::before {
	background: var(--ck-female);
}

.crnilo-s__bar {
	display: flex;
	height: 0.6em;
	margin-top: 0.6em;
	border-radius: 999px;
	overflow: hidden;
	background: var(--ck-female);
}

.crnilo-s__bar span {
	display: block;
	height: 100%;
	background: var(--ck-male);
}

.crnilo-s__footnote {
	margin: 0;
	font-size: 0.8em;
	opacity: 0.7;
}

.crnilo-s__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* Dolazak natjecatelja */
.crnilo-s__arrivals {
	margin-top: 2em;
}

.crnilo-r .crnilo-s__heading {
	margin: 0 0 0.6em;
	font-size: 1.15em;
	line-height: 1.3;
	font-weight: 700;
}

.crnilo-s__tables {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 26em), 1fr));
	align-items: start;
	gap: 1.5em 2.5em;
	margin-bottom: 0.8em;
}

.crnilo-s__table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	border: 0;
	font-variant-numeric: tabular-nums;
}

.crnilo-s__table caption {
	caption-side: top;
	padding: 0 0 0.4em;
	text-align: left;
	font-weight: 700;
}

.crnilo-s__table th,
.crnilo-s__table td {
	padding: 0.45em 0.5em 0.45em 0;
	border: 0;
	border-bottom: 1px solid var(--ck-line);
	text-align: left;
	vertical-align: middle;
	background: transparent;
}

.crnilo-s__table thead th {
	font-size: 0.8em;
	font-weight: 600;
	border-bottom: 2px solid currentColor;
	white-space: nowrap;
}

.crnilo-s__table tbody th {
	font-weight: 600;
}

.crnilo-s__table .crnilo-s__num {
	text-align: right;
	width: 1%;
	white-space: nowrap;
	padding-right: 1em;
}

.crnilo-s__share-col {
	width: 38%;
}

.crnilo-s__sharebox {
	display: flex;
	align-items: center;
	gap: 0.6em;
}

.crnilo-s__meter {
	flex: 1 1 auto;
	min-width: 2.5em;
	height: 0.5em;
	border-radius: 999px;
	background: var(--ck-soft);
	overflow: hidden;
}

.crnilo-s__meter span {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--ck-female);
}

.crnilo-s__share {
	flex: 0 0 auto;
	min-width: 3.6em;
	text-align: right;
	font-size: 0.9em;
	white-space: nowrap;
}

.crnilo-s__row--muted th,
.crnilo-s__row--muted td {
	opacity: 0.65;
	font-weight: 400;
}

@media (max-width: 640px) {
	.crnilo-s__table {
		font-size: 0.92em;
	}

	.crnilo-s__table .crnilo-s__num {
		padding-right: 0.6em;
	}

	.crnilo-s__share-col {
		width: auto;
		text-align: right;
	}

	.crnilo-s__meter {
		display: none;
	}

	.crnilo-s__sharebox {
		justify-content: flex-end;
	}

	.crnilo-s__item {
		flex-basis: 40%;
	}

	/* Logičan slijed na mobitelu: ekipe | natjecatelji → omjer M/Ž (cijeli redak)
	   → prosječna dob (cijeli redak) → najstariji | najmlađi. */
	.crnilo-s__grid .crnilo-s__item--gender,
	.crnilo-s__grid .crnilo-s__item--average_age {
		flex-basis: 100%;
	}

	.crnilo-s__split {
		flex-wrap: nowrap;
		gap: 1em;
	}

	.crnilo-s__split-part {
		min-width: 0;
	}

	.crnilo-s__value {
		font-size: 1.35em;
	}
}

/* ---------- Lucky loser (ulaznica) ----------
   Uvijek u „mobilnom” obliku: odrezak sa startnim brojem na vrhu, ispod naziv i posada,
   uska kartica centrirana u sadržaju – jednako na mobitelu i na računalu. */

/* Dvostruka klasa: tema (npr. blok-raspored „constrained”) ne smije proširiti karticu na širinu sadržaja. */
.crnilo-r.crnilo-ll {
	--ck-ticket: #14222e;
	--ck-ticket-ink: #f6efe0;
	--ck-gold-2: #f0d77a;
	width: 100%;
	max-width: 400px;
	margin-left: auto !important;
	margin-right: auto !important;
	filter: drop-shadow(0 8px 18px rgba(20, 34, 46, 0.22));
}

.crnilo-ll__ticket {
	display: grid;
	grid-template-columns: 1fr;
	color: var(--ck-ticket-ink);
	background: var(--ck-ticket);
	border-radius: 14px;
	overflow: hidden;
}

.crnilo-ll__stub {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	padding: 0.9em 1.3em;
	background: linear-gradient(160deg, var(--ck-gold-2), var(--ck-gold) 55%, #b8901f);
	color: var(--ck-ticket);
	border-bottom: 2px dashed rgba(20, 34, 46, 0.45);
}

.crnilo-ll__stub-label {
	font-size: 0.72em;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.8;
}

.crnilo-ll__number {
	font-size: 2.6em;
	font-weight: 800;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}

.crnilo-ll__main {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 1.1em 1.3em 1.2em;
	min-width: 0;
}

.crnilo-ll__main p {
	margin: 0;
}

.crnilo-ll__eyebrow {
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	opacity: 0.7;
}

.crnilo-ll__title {
	font-size: 1.6em;
	font-weight: 800;
	line-height: 1.15;
	color: var(--ck-gold-2);
}

.crnilo-ll__crew {
	margin-top: 0.35em !important;
	font-size: 1.1em;
	font-weight: 600;
	overflow-wrap: anywhere;
}

/* Prije izvlačenja */
.crnilo-ll.is-waiting .crnilo-ll__stub {
	background: transparent;
	color: var(--ck-gold-2);
	border-bottom-color: rgba(246, 239, 224, 0.35);
}

.crnilo-ll.is-waiting .crnilo-ll__number {
	opacity: 0.55;
}

.crnilo-ll.is-waiting .crnilo-ll__crew {
	font-weight: 400;
	opacity: 0.75;
}

.crnilo-ll__live {
	margin-top: 0.6em;
}

/* Otkrivanje dobitnika uživo */
.crnilo-ll.is-revealed .crnilo-ll__ticket {
	animation: crnilo-ll-reveal 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.crnilo-ll.is-revealed .crnilo-ll__number {
	animation: crnilo-ll-number 1.2s ease-out;
}

@keyframes crnilo-ll-reveal {
	0% {
		transform: scale(0.94);
		opacity: 0.4;
	}
	60% {
		transform: scale(1.025);
		opacity: 1;
	}
	100% {
		transform: scale(1);
	}
}

@keyframes crnilo-ll-number {
	0% {
		opacity: 0;
		transform: translateY(0.3em);
	}
	100% {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.crnilo-ll.is-revealed .crnilo-ll__ticket,
	.crnilo-ll.is-revealed .crnilo-ll__number {
		animation: none;
	}
}
