/* Tier List Maker — frontend styles v1.3 */

.tlm-app {
	--tlm-bg: #15151b;
	--tlm-panel: #1f1f28;
	--tlm-panel-2: #262630;
	--tlm-line: #34343f;
	--tlm-text: #f4f4f8;
	--tlm-muted: #9b9ba8;
	--tlm-accent: #8b7cf6;
	--tlm-radius: 14px;
	margin: 1.6em 0;
	background: transparent;
	color: var(--tlm-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	box-sizing: border-box;
}

.tlm-app *,
.tlm-app *::before,
.tlm-app *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Share bar (top)                                                     */
/* ------------------------------------------------------------------ */
.tlm-share-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
	padding: 10px;
	background: var(--tlm-panel);
	border: 1px solid var(--tlm-line);
	border-radius: var(--tlm-radius);
}

.tlm-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: var(--tlm-panel-2);
	border: 1px solid var(--tlm-line);
	border-radius: 10px;
	color: var(--tlm-text);
	padding: 7px 14px;
	font: inherit;
	font-size: 0.86em;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
	transition: transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.tlm-btn:hover {
	background: #2d2d39;
	border-color: #45455333;
	transform: translateY(-1px);
}

.tlm-btn:active {
	transform: translateY(0);
}

.tlm-btn:disabled {
	opacity: 0.55;
	cursor: wait;
	transform: none;
}

.tlm-btn-primary {
	background: var(--tlm-accent);
	border-color: var(--tlm-accent);
	color: #fff;
}

.tlm-btn-primary:hover {
	background: #9c8ffa;
	border-color: #9c8ffa;
}

.tlm-btn svg {
	flex: none;
}

/* Network pills with brand colors */
.tlm-net {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font: inherit;
	font-size: 0.8em;
	font-weight: 600;
	color: var(--tlm-text);
	background: var(--tlm-panel-2);
	border: 1px solid var(--tlm-line);
	border-radius: 999px;
	padding: 6px 14px;
	cursor: pointer;
	line-height: 1.4;
	transition: transform 0.12s ease, filter 0.12s ease, background-color 0.12s ease;
}

.tlm-net:hover {
	transform: translateY(-1px);
	filter: brightness(1.12);
}

.tlm-net:disabled {
	opacity: 0.55;
	cursor: wait;
	transform: none;
}

.tlm-net-x {
	background: #000;
	border-color: #2a2a2a;
}

.tlm-net-fb {
	background: #1877f2;
	border-color: #1877f2;
	color: #fff;
}

.tlm-net-wa {
	background: #1faa53;
	border-color: #1faa53;
	color: #fff;
}

.tlm-net-rd {
	background: #ff4500;
	border-color: #ff4500;
	color: #fff;
}

.tlm-net-pi {
	background: #e60023;
	border-color: #e60023;
	color: #fff;
}

.tlm-help {
	margin-left: auto;
	width: 30px;
	height: 30px;
	justify-content: center;
	padding: 0;
	font-weight: 700;
	color: var(--tlm-muted);
}

.tlm-help:hover {
	color: var(--tlm-text);
}

/* Spinner shown while preparing a share */
.tlm-spin {
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	display: inline-block;
	animation: tlm-rot 0.7s linear infinite;
}

@keyframes tlm-rot {
	to {
		transform: rotate(360deg);
	}
}

/* ------------------------------------------------------------------ */
/* Main layout: pool docked on the side by default                     */
/* ------------------------------------------------------------------ */
.tlm-main {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.tlm-app.tlm-side .tlm-main {
	flex-direction: row;
	align-items: flex-start;
}

.tlm-app.tlm-side .tlm-board {
	flex: 1;
	min-width: 0;
}

.tlm-app.tlm-side .tlm-pool-wrap {
	flex: 0 0 224px;
	display: flex;
	flex-direction: column;
	min-height: 220px;
	/* height is set by JS to match the board exactly */
}

.tlm-app.tlm-side .tlm-pool {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	align-content: flex-start;
}

/* ------------------------------------------------------------------ */
/* Board                                                               */
/* ------------------------------------------------------------------ */
.tlm-board {
	border-radius: var(--tlm-radius);
	overflow: hidden;
	background: var(--tlm-line);
	display: flex;
	flex-direction: column;
	gap: 1px;
	border: 1px solid var(--tlm-line);
}

.tlm-row {
	display: flex;
	align-items: stretch;
	min-height: 92px;
	background: var(--tlm-panel);
}

.tlm-row.tlm-row-dragging {
	opacity: 0.55;
	outline: 2px dashed rgba(255, 255, 255, 0.4);
	outline-offset: -2px;
}

.tlm-row-label {
	flex: 0 0 96px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	font-weight: 800;
	font-size: 1.02em;
	color: #15151b;
	padding: 8px 6px;
	word-break: break-word;
}

.tlm-row-name {
	outline: none;
	min-width: 1em;
	min-height: 1em;
	display: inline-block;
}

.tlm-editing .tlm-row-name {
	border-bottom: 2px dashed rgba(0, 0, 0, 0.45);
	cursor: text;
}

.tlm-zone {
	flex: 1;
	display: flex;
	flex-wrap: wrap;
	align-content: flex-start;
	gap: 5px;
	padding: 7px;
	min-height: 92px;
	transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.tlm-zone.tlm-over {
	background: rgba(139, 124, 246, 0.12);
	box-shadow: inset 0 0 0 2px var(--tlm-accent);
}

/* Row edit tools */
.tlm-row-tools {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	padding: 7px;
	background: rgba(0, 0, 0, 0.28);
}

.tlm-editing .tlm-row-tools {
	display: flex;
}

.tlm-tool {
	width: 30px;
	height: 28px;
	border: 1px solid var(--tlm-line);
	border-radius: 7px;
	background: var(--tlm-panel-2);
	color: var(--tlm-text);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	transition: background-color 0.12s ease;
}

.tlm-tool:hover {
	background: #34344080;
}

.tlm-row-handle {
	cursor: grab;
	touch-action: none;
}

input.tlm-row-color {
	padding: 2px;
	cursor: pointer;
}

.tlm-row-del:hover {
	background: #8c2b2b;
	border-color: #8c2b2b;
}

/* ------------------------------------------------------------------ */
/* Items                                                               */
/* ------------------------------------------------------------------ */
.tlm-item {
	position: relative;
	width: auto;
	height: 78px;
	max-width: 170px;
	border-radius: 8px;
	overflow: hidden;
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	background: transparent;
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tlm-item:hover {
	transform: scale(1.05);
	box-shadow: 0 0 0 2px var(--tlm-accent), 0 6px 16px rgba(0, 0, 0, 0.4);
	z-index: 1;
}

.tlm-item img {
	width: auto;
	height: 100%;
	max-width: 170px;
	object-fit: contain;
	display: block;
	pointer-events: none;
	margin: 0 !important;
	border-radius: 0 !important;
}

.tlm-item.tlm-lifting {
	opacity: 0.3;
	transform: none;
	box-shadow: none;
}

.tlm-item-x {
	display: none;
	position: absolute;
	top: 3px;
	right: 3px;
	width: 20px;
	height: 20px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.72);
	color: #fff;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	z-index: 2;
}

.tlm-editing .tlm-item-x {
	display: block;
}

.tlm-item-x:hover {
	background: #d63638;
}

.tlm-ghost {
	position: fixed;
	z-index: 100001;
	pointer-events: none;
	box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55), 0 0 0 2px var(--tlm-accent, #8b7cf6);
	transform: scale(1.08) rotate(2deg);
	cursor: grabbing;
	border-radius: 8px;
	overflow: hidden;
}

.tlm-ghost .tlm-item-x {
	display: none;
}

/* ------------------------------------------------------------------ */
/* Pool                                                                */
/* ------------------------------------------------------------------ */
.tlm-pool-wrap {
	border: 1px solid var(--tlm-line);
	border-radius: var(--tlm-radius);
	background: var(--tlm-panel);
	overflow: hidden;
}

.tlm-pool-head {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px 10px 0;
	font-size: 0.8em;
}

.tlm-pool-hint {
	color: var(--tlm-muted);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-size: 0.86em;
}

.tlm-head-btns {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.tlm-head-btns .tlm-btn {
	flex: 1 1 auto;
	justify-content: center;
	padding: 6px 10px;
	font-size: 0.98em;
}

.tlm-pool {
	min-height: 100px;
	scrollbar-width: thin;
	scrollbar-color: var(--tlm-line) transparent;
}

.tlm-pool::-webkit-scrollbar {
	width: 8px;
}

.tlm-pool::-webkit-scrollbar-thumb {
	background: var(--tlm-line);
	border-radius: 99px;
}

.tlm-pool::-webkit-scrollbar-track {
	background: transparent;
}

.tlm-file {
	display: none;
}

.tlm-btn.tlm-edit-only {
	display: none;
}

.tlm-editing .tlm-btn.tlm-edit-only {
	display: inline-flex;
}

/* ------------------------------------------------------------------ */
/* Onboarding tour                                                     */
/* ------------------------------------------------------------------ */
.tlm-tour {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(8, 8, 12, 0.7);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.tlm-tour-card {
	background: var(--tlm-panel, #1f1f28);
	color: var(--tlm-text, #f4f4f8);
	border: 1px solid var(--tlm-line, #34343f);
	border-radius: 18px;
	max-width: 430px;
	width: 100%;
	padding: 30px 28px 20px;
	text-align: center;
	box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tlm-tour-icon {
	font-size: 42px;
	line-height: 1;
	margin-bottom: 14px;
}

.tlm-tour-h {
	font-weight: 800;
	font-size: 1.25em;
	margin-bottom: 8px;
	letter-spacing: -0.01em;
}

.tlm-tour-p {
	font-size: 0.92em;
	line-height: 1.6;
	color: var(--tlm-muted, #9b9ba8);
	margin: 0 0 18px;
	min-height: 6em;
}

.tlm-tour-dots {
	display: flex;
	justify-content: center;
	gap: 7px;
	margin-bottom: 18px;
}

.tlm-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--tlm-line, #34343f);
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.tlm-dot-on {
	background: var(--tlm-accent, #8b7cf6);
	transform: scale(1.25);
}

.tlm-tour-nav {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}

.tlm-tour-skip {
	margin-right: auto;
	background: none;
	border: 0;
	color: var(--tlm-muted, #9b9ba8);
	font: inherit;
	font-size: 0.85em;
	cursor: pointer;
	padding: 4px 6px;
}

.tlm-tour-skip:hover {
	color: var(--tlm-text, #f4f4f8);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 760px) {

	/* Same side-by-side layout as desktop, just more compact. */
	.tlm-app.tlm-side .tlm-pool-wrap {
		flex: 0 0 142px;
		min-height: 160px;
	}

	.tlm-app.tlm-side .tlm-main {
		gap: 10px;
	}

	.tlm-row-label {
		flex-basis: 56px;
		font-size: 0.8em;
	}

	.tlm-item {
		height: 58px;
		max-width: 116px;
	}

	.tlm-item img {
		max-width: 116px;
	}

	.tlm-row,
	.tlm-zone {
		min-height: 70px;
	}

	.tlm-head-btns .tlm-btn {
		padding: 6px 8px;
		font-size: 0.88em;
	}

	.tlm-help {
		margin-left: 0;
	}
}

@media (prefers-reduced-motion: reduce) {

	.tlm-app *,
	.tlm-app *::before,
	.tlm-app *::after {
		transition: none !important;
		animation-duration: 0.01s !important;
	}

	.tlm-ghost {
		transform: none;
	}
}