/* Cricket Scorecard Live — styles + animation
   Theme: stadium turf green with warm gold/sunset accents. */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,800&display=swap');

.csl-wrap {
	--turf:      #1f7a3d;
	--turf-deep: #14592c;
	--sky-1:     #bfe9ff;
	--sky-2:     #7cc6f0;
	--gold:      #ffc233;
	--gold-deep: #e8920c;
	--ink:       #10271a;
	--card:      #ffffff;
	--line:      #e3e8e3;
	--live:      #e23b3b;

	max-width: 640px;
	margin: 0 auto;
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	color: var(--ink);
	background: #f4f8f3;
	border: 1px solid #d8e4da;
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 18px 40px -20px rgba(16, 39, 26, .45);
}

/* ---------- ANIMATED SCENE ---------- */
.csl-scene {
	position: relative;
	height: 200px;
	overflow: hidden;
	background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%);
	isolation: isolate;
}
.csl-sky::before {
	/* sun */
	content: "";
	position: absolute;
	top: 18px; right: 40px;
	width: 46px; height: 46px;
	border-radius: 50%;
	background: radial-gradient(circle, #fff6d8 0%, var(--gold) 70%);
	box-shadow: 0 0 36px 10px rgba(255, 194, 51, .55);
}
.csl-ground {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 78px;
	background:
		repeating-linear-gradient(90deg, var(--turf) 0 34px, var(--turf-deep) 34px 68px);
	border-top: 4px solid #ffffff66;
}
.csl-ground::after {
	/* pitch strip */
	content: "";
	position: absolute;
	left: 8%; right: 8%; bottom: 14px;
	height: 30px;
	background: #cdab74;
	border-radius: 40px / 8px;
	box-shadow: inset 0 2px 6px #00000022;
}
.csl-crease {
	position: absolute;
	bottom: 18px; left: 72%;
	width: 2px; height: 22px;
	background: #ffffffcc;
}

/* Bowler (left) */
.csl-bowler {
	position: absolute;
	left: 13%; bottom: 30px;
	width: 14px; height: 56px;
	z-index: 2;
}
.csl-bowler-body {
	position: absolute;
	bottom: 0; left: 2px;
	width: 9px; height: 40px;
	background: #2b3a8c;
	border-radius: 6px 6px 3px 3px;
}
.csl-bowler-body::before { /* head */
	content: "";
	position: absolute;
	top: -13px; left: 0px;
	width: 11px; height: 11px;
	border-radius: 50%;
	background: #f0c69b;
}
.csl-bowler-arm {
	position: absolute;
	bottom: 30px; left: 8px;
	width: 4px; height: 18px;
	background: #2b3a8c;
	border-radius: 3px;
	transform-origin: bottom center;
	animation: csl-bowl-arm 4s ease-in-out infinite;
}

/* Batter (right) */
.csl-batter {
	position: absolute;
	right: 14%; bottom: 30px;
	width: 16px; height: 56px;
	z-index: 2;
}
.csl-batter-body {
	position: absolute;
	bottom: 0; right: 2px;
	width: 9px; height: 40px;
	background: #0a8a5a;
	border-radius: 6px 6px 3px 3px;
}
.csl-batter-body::before { /* head + helmet */
	content: "";
	position: absolute;
	top: -13px; right: 0;
	width: 11px; height: 11px;
	border-radius: 50%;
	background: #f0c69b;
	box-shadow: 0 -2px 0 1px #1d1d1d;
}
/* Rest states. Motion is driven by JS (Web Animations API) so each
   delivery can resolve differently: four, six, dot, or out. */
.csl-bat {
	position: absolute;
	bottom: 26px; right: 9px;
	width: 5px; height: 30px;
	background: linear-gradient(180deg, #c98a3c, #9c5f1d);
	border-radius: 3px;
	transform-origin: bottom center;
	transform: rotate(-28deg);
}
.csl-bat::after { /* handle grip */
	content: "";
	position: absolute;
	top: -8px; left: 1px;
	width: 3px; height: 10px;
	background: #1d1d1d;
	border-radius: 2px;
}
.csl-bowler-arm { transform: rotate(140deg); }

/* Ball */
.csl-ball {
	position: absolute;
	top: 112px; left: 15%;
	width: 15px; height: 15px;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #ff6b6b, #b4131a 70%);
	box-shadow: 0 2px 5px #00000040;
	z-index: 3;
}
.csl-seam {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border-top: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: rotate(35deg);
	animation: csl-spin .35s linear infinite;
}

/* Stumps + bails the batter defends */
.csl-stumps {
	position: absolute;
	right: 10%; bottom: 30px;
	width: 16px; height: 28px;
	z-index: 1;
}
.csl-stump {
	position: absolute;
	bottom: 0;
	width: 3px; height: 26px;
	background: #f3ead4;
	border-radius: 1px;
	transform-origin: bottom center;
}
.csl-bail {
	position: absolute;
	top: -2px;
	width: 7px; height: 3px;
	background: #d8c9a0;
	border-radius: 2px;
	transform-origin: center;
}
.csl-bail-l { left: 1px; }
.csl-bail-r { left: 8px; }

/* Outcome pop (text + colour set by JS via the variant class) */
.csl-label {
	position: absolute;
	top: 22px; left: 50%;
	transform: translateX(-50%) scale(.4);
	font-family: 'Anton', sans-serif;
	font-size: 42px;
	letter-spacing: 2px;
	opacity: 0;
	z-index: 4;
	white-space: nowrap;
}
.csl-label.six  { color: var(--gold); -webkit-text-stroke: 2px #b4131a; }
.csl-label.four { color: #fff; -webkit-text-stroke: 2px #185fa5; }
.csl-label.out  { color: #fff; -webkit-text-stroke: 3px var(--live); }
.csl-label.dot  { color: #e7ecdf; -webkit-text-stroke: 1px #7a8a80; font-size: 26px; }

@keyframes csl-spin { to { transform: rotate(395deg); } }

/* ---------- HEADER ---------- */
.csl-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 18px 10px;
}
.csl-title {
	margin: 0;
	font-family: 'Anton', sans-serif;
	font-weight: 400;
	font-size: 22px;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: var(--turf-deep);
}
.csl-refresh-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	cursor: pointer;
	border: none;
	border-radius: 999px;
	padding: 7px 14px;
	font: 600 13px 'Bricolage Grotesque', sans-serif;
	color: #fff;
	background: linear-gradient(180deg, var(--gold), var(--gold-deep));
	box-shadow: 0 4px 12px -4px var(--gold-deep);
	transition: transform .15s ease, filter .15s ease;
}
.csl-refresh-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.csl-refresh-btn:active { transform: translateY(0); }
.csl-refresh-ico {
	width: 13px; height: 13px;
	border: 2px solid #fff;
	border-right-color: transparent;
	border-radius: 50%;
}
.csl-wrap.is-loading .csl-refresh-ico { animation: csl-spin .7s linear infinite; }

/* ---------- STATUS / LIST ---------- */
.csl-status {
	padding: 6px 18px 12px;
	font-size: 13px;
	color: #5a6b5f;
}
.csl-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 0 18px 6px;
}

.csl-card {
	background: var(--card);
	border: 1px solid #e6ece7;
	border-radius: 14px;
	padding: 13px 15px;
	box-shadow: 0 6px 16px -12px rgba(16, 39, 26, .5);
	animation: csl-rise .4s ease both;
}
.csl-card-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 10px;
}
.csl-type {
	font: 800 10px 'Bricolage Grotesque', sans-serif;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--turf-deep);
	background: #e7f4ea;
	border-radius: 6px;
	padding: 3px 8px;
}
.csl-pill {
	font: 700 11px 'Bricolage Grotesque', sans-serif;
	letter-spacing: .5px;
	text-transform: uppercase;
	padding: 3px 9px;
	border-radius: 999px;
}
.csl-pill.live   { color: #fff; background: var(--live); }
.csl-pill.live::before {
	content: ""; display: inline-block;
	width: 7px; height: 7px; margin-right: 5px;
	border-radius: 50%; background: #fff;
	animation: csl-blink 1s steps(2) infinite; vertical-align: middle;
}
.csl-pill.result   { color: #38503f; background: #dde7e0; }
.csl-pill.upcoming { color: #7a5b00; background: #fff0c2; }

.csl-team {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 5px 0;
}
.csl-team + .csl-team { border-top: 1px dashed #edf1ee; }
.csl-flag {
	width: 26px; height: 26px;
	border-radius: 50%;
	object-fit: cover;
	background: #eef3ef;
	flex: 0 0 auto;
	font: 800 10px 'Bricolage Grotesque', sans-serif;
	display: inline-flex; align-items: center; justify-content: center;
	color: var(--turf-deep);
}
.csl-team-name { font-weight: 600; font-size: 14px; flex: 1 1 auto; }
.csl-team-score { font-weight: 800; font-size: 14px; color: var(--ink); white-space: nowrap; }
.csl-team-score:empty::after { content: "—"; color: #b6c0b9; }

.csl-result {
	margin-top: 9px;
	font-size: 12.5px;
	color: #475a4d;
	border-top: 1px solid #eef2ef;
	padding-top: 8px;
}
.csl-venue { display:block; margin-top:3px; font-size: 11.5px; color:#8a978d; }

.csl-foot {
	padding: 4px 18px 14px;
	font-size: 11px;
	color: #93a098;
	text-align: right;
}
.csl-demo-note {
	margin: 0 18px 12px;
	padding: 9px 12px;
	font-size: 12px;
	border-radius: 10px;
	background: #fff6db;
	color: #7a5b00;
	border: 1px solid #f3e0a0;
}
.csl-error {
	margin: 0 18px 14px;
	padding: 10px 12px;
	border-radius: 10px;
	background: #fde8e8;
	color: #9a2020;
	border: 1px solid #f3bcbc;
	font-size: 13px;
}

@keyframes csl-rise  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes csl-blink { 50% { opacity: .15; } }

@media (max-width: 480px) {
	.csl-label { font-size: 34px; }
	.csl-title { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
	.csl-seam { animation: none; }
	.csl-label { opacity: 0; }
}
