.tbtmg-game {
	--tbtmg-blue: #0856c9;
	--tbtmg-blue-dark: #063f94;
	--tbtmg-blue-pale: #edf4ff;
	--tbtmg-ink: #1f2937;
	--tbtmg-muted: #64748b;
	--tbtmg-line: #dbe4f0;
	--tbtmg-success: #16803c;
	--tbtmg-success-bg: #ecfdf3;
	--tbtmg-danger: #c62828;
	--tbtmg-danger-bg: #fff1f1;
	--tbtmg-surface: #ffffff;
	--tbtmg-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
	box-sizing: border-box;
	width: min(1180px, 100%);
	margin: 1.5rem auto;
	color: var(--tbtmg-ink);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tbtmg-game *,
.tbtmg-game *::before,
.tbtmg-game *::after {
	box-sizing: border-box;
}

.tbtmg-hero {
	margin-bottom: 18px;
	padding: 26px 28px;
	border-radius: 22px;
	background: linear-gradient(135deg, var(--tbtmg-blue), var(--tbtmg-blue-dark));
	box-shadow: var(--tbtmg-shadow);
	color: #fff;
}

.tbtmg-eyebrow {
	margin: 0 0 6px;
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	opacity: 0.82;
}

.tbtmg-title {
	margin: 0;
	color: inherit;
	font-size: clamp(1.75rem, 4vw, 2.75rem);
	line-height: 1.08;
}

.tbtmg-subtitle {
	max-width: 780px;
	margin: 10px 0 0;
	font-size: 1rem;
	line-height: 1.55;
	opacity: 0.94;
}

.tbtmg-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
	padding: 13px 15px;
	border: 1px solid var(--tbtmg-line);
	border-radius: 16px;
	background: var(--tbtmg-surface);
	box-shadow: var(--tbtmg-shadow);
}

.tbtmg-status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	color: var(--tbtmg-muted);
	font-weight: 700;
}

.tbtmg-pill {
	display: inline-flex;
	align-items: center;
	min-height: 38px;
	padding: 0 13px;
	border-radius: 999px;
	background: var(--tbtmg-blue-pale);
	color: var(--tbtmg-blue-dark);
}

.tbtmg-button {
	min-height: 44px;
	padding: 10px 15px;
	border: 0;
	border-radius: 11px;
	font: inherit;
	font-weight: 800;
	cursor: pointer;
	transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.tbtmg-button:hover {
	transform: translateY(-1px);
}

.tbtmg-button:focus-visible {
	outline: 3px solid rgba(8, 86, 201, 0.35);
	outline-offset: 3px;
}

.tbtmg-button--primary {
	background: var(--tbtmg-blue);
	box-shadow: 0 7px 18px rgba(8, 86, 201, 0.22);
	color: #fff;
}

.tbtmg-board {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	align-items: start;
	gap: 18px;
}

.tbtmg-column {
	min-width: 0;
	padding: 14px;
	border: 1px solid var(--tbtmg-line);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.86);
}

.tbtmg-column-heading {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin: 2px 3px 12px;
}

.tbtmg-column-heading h3 {
	margin: 0;
	color: var(--tbtmg-blue-dark);
	font-size: 1.05rem;
}

.tbtmg-column-heading span {
	color: var(--tbtmg-muted);
	font-size: 0.82rem;
}

.tbtmg-card-list {
	display: grid;
	gap: 10px;
}

.tbtmg-card {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	min-height: 82px;
	padding: 14px 45px 14px 15px;
	border: 2px solid transparent;
	border-radius: 14px;
	background: var(--tbtmg-surface);
	box-shadow: 0 5px 16px rgba(15, 23, 42, 0.07);
	color: var(--tbtmg-ink);
	font: inherit;
	line-height: 1.43;
	text-align: left;
	cursor: grab;
	touch-action: none;
	user-select: none;
	transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.tbtmg-card::after {
	position: absolute;
	top: 50%;
	right: 15px;
	content: "⋮⋮";
	transform: translateY(-50%);
	color: #7f92a8;
	font-weight: 900;
	letter-spacing: -2px;
}

.tbtmg-card:hover,
.tbtmg-card:focus-visible {
	border-color: rgba(8, 86, 201, 0.55);
	outline: none;
	box-shadow: 0 8px 20px rgba(8, 86, 201, 0.12);
}

.tbtmg-card.is-selected {
	border-color: var(--tbtmg-blue);
	background: var(--tbtmg-blue-pale);
	box-shadow: 0 8px 22px rgba(8, 86, 201, 0.18);
}

.tbtmg-card.is-drop-target {
	border-color: var(--tbtmg-blue);
	background: var(--tbtmg-blue-pale);
	transform: scale(1.018);
}

.tbtmg-card.is-matched {
	border-color: rgba(22, 128, 60, 0.65);
	background: var(--tbtmg-success-bg);
	box-shadow: none;
	color: #14532d;
	cursor: default;
}

.tbtmg-card.is-matched::after {
	content: "✓";
	color: var(--tbtmg-success);
	font-size: 1.1rem;
	letter-spacing: 0;
}

.tbtmg-card.is-drag-source {
	opacity: 0.3;
}

.tbtmg-drag-ghost {
	position: fixed;
	z-index: 999999;
	width: min(460px, calc(100vw - 30px));
	padding: 13px 15px;
	border: 2px solid #0856c9;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
	color: #1f2937;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	line-height: 1.4;
	pointer-events: none;
	transform: rotate(1deg);
}

.tbtmg-card.is-jittering {
	border-color: var(--tbtmg-danger) !important;
	background: var(--tbtmg-danger-bg) !important;
	animation: tbtmg-jitter 0.38s ease;
}

.tbtmg-card.is-match-pop {
	animation: tbtmg-match-pop 0.42s ease;
}

.tbtmg-completion {
	margin-top: 18px;
	padding: 22px;
	border: 1px solid rgba(22, 128, 60, 0.28);
	border-radius: 18px;
	background: var(--tbtmg-success-bg);
	box-shadow: var(--tbtmg-shadow);
	text-align: center;
}

.tbtmg-completion[hidden] {
	display: none;
}

.tbtmg-completion.is-visible {
	animation: tbtmg-fade-in 0.4s ease;
}

.tbtmg-completion h3 {
	margin: 0 0 5px;
	color: #166534;
}

.tbtmg-completion p {
	margin: 0;
	color: #3f6250;
}

.tbtmg-completion-attempts {
	margin-top: 7px !important;
	font-weight: 700;
}

.tbtmg-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.tbtmg-admin-error {
	padding: 1rem;
	border-left: 4px solid #d63638;
	background: #fff;
}

.tbtmg-standalone {
	width: 100%;
	padding: 1rem;
}

.tbtmg-standalone__inner {
	width: min(1180px, 100%);
	margin: 0 auto;
}

.tbtmg-game--compact .tbtmg-hero {
	padding: 20px;
}

.tbtmg-game--compact .tbtmg-card {
	min-height: 68px;
}

@keyframes tbtmg-jitter {
	0%, 100% { transform: translateX(0); }
	18% { transform: translateX(-9px); }
	36% { transform: translateX(8px); }
	54% { transform: translateX(-6px); }
	72% { transform: translateX(5px); }
	90% { transform: translateX(-2px); }
}

@keyframes tbtmg-match-pop {
	0% { transform: scale(0.98); }
	55% { transform: scale(1.035); }
	100% { transform: scale(1); }
}

@keyframes tbtmg-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
	.tbtmg-hero {
		padding: 21px 19px;
		border-radius: 17px;
	}

	.tbtmg-toolbar {
		align-items: stretch;
	}

	.tbtmg-button {
		width: 100%;
	}

	.tbtmg-board {
		grid-template-columns: 1fr;
	}

	.tbtmg-card {
		min-height: 74px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tbtmg-game *,
	.tbtmg-game *::before,
	.tbtmg-game *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}
