/* 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-row-name[contenteditable="true"] {
	border-bottom: 2px dashed rgba(0, 0, 0, 0.45);
	cursor: text;
}

/* Editable lists: labels are interactive (rename / options / reorder) */
.tlm-can-edit .tlm-row-label {
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	transition: filter 0.12s ease;
}

.tlm-can-edit .tlm-row-label:hover {
	filter: brightness(1.08);
}

.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);
}

/* Tier options popover */
.tlm-pop {
	position: fixed;
	z-index: 100003;
	width: 240px;
	background: #1f1f28;
	border: 1px solid #34343f;
	border-radius: 12px;
	padding: 14px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
	color: #f4f4f8;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	animation: tlm-pop 0.14s ease;
}

.tlm-pop-title {
	font-weight: 700;
	font-size: 0.92em;
	margin-bottom: 10px;
}

.tlm-pop-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

.tlm-pop-lab {
	flex: 0 0 44px;
	font-size: 0.8em;
	color: #9b9ba8;
}

.tlm-pop-input {
	flex: 1;
	min-width: 0;
	background: #15151b;
	border: 1px solid #34343f;
	border-radius: 8px;
	color: #f4f4f8;
	padding: 6px 10px;
	font: inherit;
	font-size: 0.88em;
	outline: none;
}

.tlm-pop-input:focus {
	border-color: var(--tlm-accent, #8b7cf6);
}

.tlm-pop-color {
	flex: 1;
	height: 34px;
	padding: 2px;
	background: #15151b;
	border: 1px solid #34343f;
	border-radius: 8px;
	cursor: pointer;
}

.tlm-pop-actions {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin-top: 4px;
}

.tlm-pop-del {
	color: #ff8a8a !important;
	border-color: #5c2c2c !important;
}

.tlm-pop-del:hover {
	background: #5c2c2c !important;
}

/* ------------------------------------------------------------------ */
/* 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-can-edit .tlm-item:hover .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;
}

/* Segmented S / M / L size control */
.tlm-seg {
	display: inline-flex;
	align-items: center;
	gap: 0;
	background: var(--tlm-panel-2);
	border: 1px solid var(--tlm-line);
	border-radius: 10px;
	overflow: hidden;
	flex: 1 1 auto;
	justify-content: center;
}

.tlm-seg-label {
	font-size: 0.74em;
	font-weight: 700;
	color: var(--tlm-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 0 8px 0 10px;
}

.tlm-seg-b {
	background: transparent;
	border: 0;
	border-left: 1px solid var(--tlm-line);
	color: var(--tlm-muted);
	font: inherit;
	font-size: 0.8em;
	font-weight: 700;
	padding: 7px 12px;
	cursor: pointer;
	transition: background-color 0.12s ease, color 0.12s ease;
	flex: 1;
}

.tlm-seg-b:hover {
	color: var(--tlm-text);
	background: rgba(255, 255, 255, 0.06);
}

.tlm-seg-b.tlm-seg-on {
	background: var(--tlm-accent);
	color: #fff;
}

/* Pool image size: small / medium / large (pool only; tiers unaffected) */
.tlm-app.tlm-size-s .tlm-pool .tlm-item {
	height: 50px;
	max-width: 110px;
}

.tlm-app.tlm-size-s .tlm-pool .tlm-item img {
	max-width: 110px;
}

.tlm-app.tlm-size-l .tlm-pool .tlm-item {
	height: 112px;
	max-width: 240px;
}

.tlm-app.tlm-size-l .tlm-pool .tlm-item img {
	max-width: 240px;
}

/* ------------------------------------------------------------------ */
/* Lightbox                                                            */
/* ------------------------------------------------------------------ */
.tlm-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100002;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(10, 10, 16, 0.55);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	cursor: zoom-out;
}

.tlm-lightbox-fig {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: 100%;
}

.tlm-lightbox img {
	max-width: 92vw;
	max-height: 84vh;
	width: auto;
	height: auto;
	border-radius: 12px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
	animation: tlm-pop 0.18s ease;
}

.tlm-lightbox-cap {
	color: #f4f4f8;
	font-size: 0.9em;
	opacity: 0.85;
	text-align: center;
	max-width: 80vw;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.tlm-lightbox-x {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 40px;
	height: 40px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.12s ease;
}

.tlm-lightbox-x:hover {
	background: rgba(0, 0, 0, 0.75);
}

@keyframes tlm-pop {
	from {
		transform: scale(0.92);
		opacity: 0;
	}
}

/* ------------------------------------------------------------------ */
/* Guided onboarding: spotlight + anchored tooltips                    */
/* ------------------------------------------------------------------ */
.tlm-tourx {
	position: fixed;
	inset: 0;
	z-index: 100004;
	pointer-events: none;
}

.tlm-spotlight {
	position: fixed;
	border-radius: 12px;
	box-shadow: 0 0 0 9999px rgba(8, 8, 14, 0.62), 0 0 0 2px var(--tlm-accent, #8b7cf6);
	transition: left 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease;
	pointer-events: none;
}

.tlm-tip {
	position: fixed;
	width: 290px;
	max-width: calc(100vw - 16px);
	background: #1f1f28;
	border: 1px solid #34343f;
	border-radius: 14px;
	padding: 16px 16px 12px;
	color: #f4f4f8;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
	pointer-events: auto;
	transition: left 0.25s ease, top 0.25s ease;
	--tlm-arrow-x: 50%;
}

.tlm-tip::before {
	content: "";
	position: absolute;
	left: var(--tlm-arrow-x);
	margin-left: -8px;
	border: 8px solid transparent;
}

.tlm-tip.tlm-tip-below::before {
	top: -16px;
	border-bottom-color: #1f1f28;
}

.tlm-tip.tlm-tip-above::before {
	bottom: -16px;
	border-top-color: #1f1f28;
}

.tlm-tip-count {
	font-size: 0.7em;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--tlm-accent, #8b7cf6);
	margin-bottom: 6px;
}

.tlm-tip-h {
	font-weight: 800;
	font-size: 1.02em;
	margin-bottom: 6px;
	letter-spacing: -0.01em;
}

.tlm-tip-p {
	font-size: 0.86em;
	line-height: 1.55;
	color: #b9b9c6;
	margin: 0 0 12px;
}

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

.tlm-tip-nav .tlm-btn {
	padding: 5px 12px;
	font-size: 0.82em;
}

.tlm-tip-skip {
	margin-right: auto;
	background: none;
	border: 0;
	color: #9b9ba8;
	font: inherit;
	font-size: 0.8em;
	cursor: pointer;
	padding: 4px 4px;
}

.tlm-tip-skip:hover {
	color: #f4f4f8;
}

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

	/* On phones the pool always sits below the tiers. */
	.tlm-app.tlm-side .tlm-main {
		flex-direction: column;
		/* Desktop side layout uses flex-start; in a column that would
		   shrink children to content width. Stretch them full-width. */
		align-items: stretch;
		gap: 12px;
	}

	.tlm-app.tlm-side .tlm-board,
	.tlm-app.tlm-side .tlm-pool-wrap {
		width: 100%;
	}

	.tlm-app.tlm-side .tlm-pool-wrap {
		flex: none;
		height: auto !important;
		min-height: 0;
	}

	.tlm-app.tlm-side .tlm-pool {
		max-height: 42vh;
		overflow-y: auto;
	}

	/* The side/below toggle is meaningless on phones. */
	.tlm-sidebtn {
		display: none;
	}

	.tlm-row-label {
		flex-basis: 60px;
		font-size: 0.85em;
	}

	.tlm-item {
		height: 60px;
		max-width: 130px;
	}

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

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

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

	.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;
	}
}