/* RTC Lottery Checker - scoped under .rtc-lc so it cannot leak into the theme. */

.rtc-lc {
	margin: 0 0 28px;
	padding: 20px;
	border: 1px solid rgba(128, 128, 128, .28);
	border-radius: 10px;
	background: rgba(127, 127, 127, .06);
}

.rtc-lc__title {
	margin: 0 0 14px;
	font-size: 1.2rem;
	line-height: 1.3;
}

/* ---- collapsible header ------------------------------------------------- */

.rtc-lc__heading {
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

.rtc-lc__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-align: left;
	background: none;
	border: 0;
	cursor: pointer;
}

.rtc-lc--collapsible .rtc-lc__title {
	margin: 0;
}

.rtc-lc--collapsible.is-open .rtc-lc__title {
	margin-bottom: 14px;
}

/* Chevron points right when closed, down when open. */
.rtc-lc__chev {
	flex: 0 0 auto;
	width: 10px;
	height: 10px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform .18s ease;
}

.rtc-lc.is-open .rtc-lc__chev {
	transform: rotate(45deg);
	margin-bottom: 14px;
}

.rtc-lc__body[hidden] {
	display: none;
}

/* ---- form --------------------------------------------------------------- */

.rtc-lc__form {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: flex-end;
}

.rtc-lc__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1 1 150px;
	min-width: 0;
}

.rtc-lc__label {
	font-size: .82rem;
	opacity: .75;
}

.rtc-lc__select,
.rtc-lc__input {
	width: 100%;
	box-sizing: border-box;
	min-height: 44px;            /* comfortable touch target */
	padding: 10px 12px;
	font-family: inherit;
	font-size: 16px;             /* below 16px iOS zooms the page on focus */
	line-height: 1.4;
	border: 1px solid rgba(128, 128, 128, .45);
	border-radius: 6px;
	background-color: #fff;
	color: #111;
	transition: border-color .15s ease, box-shadow .15s ease;
}

/* Native select chrome differs wildly between browsers - draw our own arrow
   so the control matches the inputs beside it. */
.rtc-lc__select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding-right: 34px;
	cursor: pointer;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23555' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 10px 6px;
	text-overflow: ellipsis;
}

.rtc-lc__select::-ms-expand {
	display: none;
}

.rtc-lc__select:hover,
.rtc-lc__input:hover {
	border-color: rgba(128, 128, 128, .75);
}

.rtc-lc__select:focus,
.rtc-lc__input:focus {
	outline: none;
	border-color: #d32f2f;
	box-shadow: 0 0 0 3px rgba(211, 47, 47, .18);
}

.rtc-lc__input {
	letter-spacing: .06em;
}

/* The input itself must stay at 16px or iOS zooms the page on focus, but the
   placeholder may be smaller - that is what lets the full Thai wording show. */
.rtc-lc__input::placeholder {
	font-size: var(--rtc-ph, .8em);
	letter-spacing: 0;
	opacity: .75;
}

.rtc-lc__input::-webkit-input-placeholder { font-size: var(--rtc-ph, .8em); letter-spacing: 0; opacity: .75; }
.rtc-lc__input::-moz-placeholder { font-size: var(--rtc-ph, .8em); letter-spacing: 0; opacity: .75; }

.rtc-lc__submit {
	flex: 0 0 auto;
	box-sizing: border-box;
	min-height: 44px;
	padding: 11px 22px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	background: #d32f2f;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color .15s ease, box-shadow .15s ease;
}

.rtc-lc__submit:hover { background: #b62626; }

.rtc-lc__submit:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(211, 47, 47, .35);
}

/* ---- results ------------------------------------------------------------ */

.rtc-lc__panel { margin-top: 18px; }

.rtc-lc__panel-title {
	margin: 0 0 12px;
	font-size: 1.05rem;
}

.rtc-lc__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 12px;
}

.rtc-lc__cell {
	padding: 14px;
	border-radius: 8px;
	text-align: center;
	border: 1px solid transparent;
}

.rtc-lc__cell.is-win {
	background: rgba(46, 125, 50, .10);
	border-color: rgba(46, 125, 50, .38);
}

.rtc-lc__cell.is-lose {
	background: rgba(211, 47, 47, .08);
	border-color: rgba(211, 47, 47, .30);
}

.rtc-lc__number {
	font-size: 1.7rem;
	font-weight: 700;
	letter-spacing: .07em;
	margin-bottom: 6px;
}

.is-win  .rtc-lc__number { color: #2e7d32; }
.is-lose .rtc-lc__number { color: #d32f2f; }

.rtc-lc__tier   { font-size: .9rem; line-height: 1.5; }
.rtc-lc__amount { margin-top: 4px; font-weight: 600; font-size: .92rem; }
.rtc-lc__total  { margin-top: 12px; font-weight: 700; text-align: right; }
.rtc-lc__hint   { margin: 14px 0 0; color: #d32f2f; }

/* ---- phone -------------------------------------------------------------- */

@media (max-width: 767px) {
	.rtc-lc {
		padding: 14px 12px;
		margin-bottom: 20px;
	}

	.rtc-lc__title {
		font-size: 1.05rem;
	}

	.rtc-lc--collapsible.is-open .rtc-lc__title,
	.rtc-lc.is-open .rtc-lc__chev {
		margin-bottom: 10px;
	}

	/* Date on its own row, the 6-digit boxes side by side, button full width.
	   auto-fit keeps it sane whatever number of ticket boxes is configured. */
	/* A fixed column count, not auto-fit: auto-fit would pack in a spare empty
	   column on wider phones and needlessly shrink every box. */
	.rtc-lc__form {
		display: grid;
		grid-template-columns: repeat(var(--rtc-cols, 3), minmax(0, 1fr));
		gap: 6px;
		align-items: end;
	}

	.rtc-lc__field--date,
	.rtc-lc__submit {
		grid-column: 1 / -1;
	}

	.rtc-lc__field--code {
		min-width: 0;
	}

	/* Stacked (default): every ticket box full width with a magnifier, so the
	   whole Thai placeholder is readable - the Sanook phone treatment, but
	   repeated for each box rather than only the first. */
	.rtc-lc--mstacked .rtc-lc__field--code {
		grid-column: 1 / -1;
	}

	.rtc-lc--mstacked .rtc-lc__field--code .rtc-lc__input {
		text-align: left;
		padding-left: 34px;
		background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cg fill='none' stroke='%23888' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.6'/%3E%3Cpath d='M10.6 10.6 14 14'/%3E%3C/g%3E%3C/svg%3E");
		background-repeat: no-repeat;
		background-position: left 10px center;
		background-size: 15px 15px;
	}



	.rtc-lc__field {
		gap: 2px;
	}

	.rtc-lc__label {
		font-size: .72rem;
		line-height: 1.2;
	}

	/* 38px rather than the 44px guideline: with several boxes stacked the extra
	   height costs more than it gains, and 38 is still a usable thumb target. */
	.rtc-lc__select,
	.rtc-lc__input,
	.rtc-lc__submit {
		min-height: 38px;
		padding: 6px 10px;
	}

	.rtc-lc__submit {
		min-height: 42px;      /* the one control worth keeping big */
		padding: 9px 16px;
	}

	.rtc-lc__select {
		padding-right: 30px;
		background-position: right 10px center;
	}

	.rtc-lc__input {
		text-align: center;
		letter-spacing: .04em;
	}

	/* Three across leaves little room, so trim the padding and let the script
	   size the placeholder to whatever actually fits. */
	.rtc-lc--mcompact .rtc-lc__input {
		padding-left: 5px;
		padding-right: 5px;
	}

	/* Results sit in the same columns as the ticket boxes above them. */
	.rtc-lc__panel {
		margin-top: 12px;
	}

	.rtc-lc__panel-title {
		font-size: .95rem;
		margin-bottom: 8px;
	}

	.rtc-lc__grid {
		grid-template-columns: repeat(var(--rtc-cols, 3), minmax(0, 1fr));
		gap: 6px;
	}

	.rtc-lc__cell {
		padding: 9px 6px;
		text-align: center;
	}

	.rtc-lc__number {
		font-size: 1.05rem;
		letter-spacing: .03em;
		margin-bottom: 3px;
		overflow-wrap: anywhere;
	}

	.rtc-lc__tier {
		font-size: .72rem;
		line-height: 1.3;
	}

	.rtc-lc__amount {
		margin-top: 3px;
		font-size: .72rem;
		line-height: 1.3;
	}

	.rtc-lc__total {
		margin-top: 8px;
		text-align: center;
		font-size: .88rem;
	}
}

/* ---- sticky recap -------------------------------------------------------- */

/* Stays in view while the visitor scrolls the prize tables, so the numbers they
   just checked are still on screen. `top` is set from JS, below the theme header. */
.rtc-lc__sticky {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;          /* the merimag header sits at 999 */
	padding: 7px 20px;
	background: rgba(22, 22, 22, .96);
	border-bottom: 1px solid rgba(255, 255, 255, .14);
	box-shadow: 0 3px 12px rgba(0, 0, 0, .34);
	cursor: pointer;
}

/* Row two: the chips, scrolled sideways if there are more than fit. */
.rtc-lc__chips {
	display: flex;
	flex-wrap: nowrap;
	gap: 6px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.rtc-lc__chips::-webkit-scrollbar { display: none; }

.rtc-lc__sticky::-webkit-scrollbar { display: none; }

.rtc-lc__sticky[hidden] { display: none; }

/* Row one: which draw these results belong to. */
.rtc-lc__recap {
	margin-bottom: 5px;
	font-size: .72rem;
	line-height: 1.3;
	color: rgba(255, 255, 255, .68);
	white-space: nowrap;
}

.rtc-lc__chip {
	display: flex;
	align-items: baseline;
	gap: 5px;
	flex: 0 0 auto;
	padding: 4px 9px;
	border-radius: 999px;
	font-size: .74rem;
	line-height: 1.3;
	white-space: nowrap;
	border: 1px solid transparent;
}

.rtc-lc__chip b {
	font-size: .92rem;
	letter-spacing: .04em;
}

.rtc-lc__chip.is-win {
	color: #a5e2aa;
	background: rgba(46, 125, 50, .22);
	border-color: rgba(46, 125, 50, .5);
}

.rtc-lc__chip.is-lose {
	color: #f0a9a9;
	background: rgba(211, 47, 47, .18);
	border-color: rgba(211, 47, 47, .42);
}

@media (min-width: 768px) {
	.rtc-lc__sticky {
		padding-top: 9px;
		padding-bottom: 9px;
	}
}
