/*
 * TPM Tour Guides — layout layer (s485).
 * Loaded after player.css (injected by player.js). Compact offer anchored above the launcher,
 * bubble that never leaves the viewport, bottom sheet below 768px.
 * s487: glow ring, smooth hand-over between steps (no blink), structured article fragments.
 */

.tpm-tg-player [hidden] {
	display: none !important;
}

/* ---------- Launcher dock: offer on top, launch + settings row under it ---------- */

.tpm-tg-player .tpm-tg-player__launch-dock {
	left: max(16px, env(safe-area-inset-left, 0px));
	bottom: max(16px, env(safe-area-inset-bottom, 0px));
	align-items: flex-start;
	gap: 8px;
	max-width: min(280px, calc(100vw - 32px));
}

.tpm-tg-player .tpm-tg-player__launch-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.tpm-tg-player .tpm-tg-player__launch-row .tpm-tg-player__launch-menu {
	width: 32px;
	height: 32px;
	margin: 0 0 2px;
	padding: 0;
	border-radius: 9999px;
	background: rgba(29, 35, 39, 0.78);
	color: #fff;
	font-size: 14px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	transition: background-color 150ms ease;
}

.tpm-tg-player .tpm-tg-player__launch-row .tpm-tg-player__launch-menu:hover,
.tpm-tg-player .tpm-tg-player__launch-row .tpm-tg-player__launch-menu[aria-expanded="true"] {
	background: rgba(29, 35, 39, 0.95);
}

.tpm-tg-player .tpm-tg-player__launch-menu-panel {
	left: 0;
	bottom: calc(100% + 8px);
	max-width: calc(100vw - 32px);
	z-index: 2;
}

/* Compact offer: one line (title · N steps) + close, then Start / Dismiss. */
.tpm-tg-player .tpm-tg-player-offer.tpm-tg-player-offer--compact {
	display: block;
	box-sizing: border-box;
	width: max-content;
	max-width: min(280px, calc(100vw - 32px));
	margin: 0;
	padding: 10px 10px 10px 12px;
	border-radius: 10px;
	font-size: 13px;
	line-height: 1.35;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.tpm-tg-player .tpm-tg-player-offer__head {
	display: flex;
	align-items: flex-start;
	gap: 6px;
}

.tpm-tg-player .tpm-tg-player-offer__text {
	display: flex;
	align-items: baseline;
	gap: 4px;
	flex: 1 1 auto;
	min-width: 0;
	margin: 2px 0 0;
	padding: 0;
	font-size: 13px;
	font-weight: 600;
	color: inherit;
}

.tpm-tg-player .tpm-tg-player-offer__title {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tpm-tg-player .tpm-tg-player-offer__meta {
	flex: none;
	font-size: 12px;
	font-weight: 400;
	white-space: nowrap;
	opacity: 0.75;
}

.tpm-tg-player .tpm-tg-player-offer__meta::before {
	content: "\00B7\00A0";
}

.tpm-tg-player .tpm-tg-player-offer__close.tpm-tg-sidebar__close {
	width: 24px;
	height: 24px;
	margin: -2px -2px 0 0;
	font-size: 13px;
}

.tpm-tg-player .tpm-tg-player-offer__actions {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 8px;
}

.tpm-tg-player .tpm-tg-player-offer__start.tpm-tg-player-btn {
	padding: 5px 12px;
	border: none;
	border-radius: 6px;
	background: var(--tpm-tg-bubble-btn-primary-bg, #2271b1);
	color: var(--tpm-tg-bubble-btn-primary-text, #fff);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
}

.tpm-tg-player .tpm-tg-player-offer__start.tpm-tg-player-btn:hover {
	background: var(--tpm-tg-bubble-btn-primary-bg-hover, #135e96);
	color: var(--tpm-tg-bubble-btn-primary-text-hover, #fff);
}

.tpm-tg-player .tpm-tg-player-btn--link,
.tpm-tg-player .tpm-tg-player-offer__dismiss.tpm-tg-player-btn {
	padding: 5px 8px;
	border: none;
	background: transparent;
	color: inherit;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
	text-decoration: underline;
	text-underline-offset: 2px;
	opacity: 0.75;
	cursor: pointer;
}

.tpm-tg-player .tpm-tg-player-btn--link:hover,
.tpm-tg-player .tpm-tg-player-offer__dismiss.tpm-tg-player-btn:hover {
	opacity: 1;
}

.tpm-tg-player .tpm-tg-player-offer button:focus-visible,
.tpm-tg-player .tpm-tg-player__launch-menu:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.85);
	outline-offset: 2px;
}

/* ---------- Bubble: always inside the viewport ---------- */

.tpm-tg-player .tpm-tg-player-bubble {
	box-sizing: border-box;
	max-width: calc(100vw - 24px);
	max-height: min(70vh, calc(100vh - 24px));
	overscroll-behavior: contain;
}

.tpm-tg-player .tpm-tg-player-bubble.tpm-tg-player-bubble--pinned {
	box-shadow:
		1px 1px 2px 0 rgba(0, 0, 0, 0.45) inset,
		0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- Small screens: bottom sheet (class set by player.js below 768px) ---------- */

.tpm-tg-player .tpm-tg-player-bubble.tpm-tg-player-bubble--sheet {
	top: auto !important;
	left: 8px !important;
	right: 8px;
	bottom: calc(8px + env(safe-area-inset-bottom, 0px));
	width: auto;
	max-width: none;
	max-height: 45vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 12px 14px 0;
	border-radius: 12px;
	transform: none !important;
	box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
}

.tpm-tg-player .tpm-tg-player-bubble--sheet .tpm-tg-player-bubble__title {
	font-size: 16px;
}

.tpm-tg-player .tpm-tg-player-bubble--sheet .tpm-tg-player-bubble__actions {
	position: sticky;
	bottom: 0;
	margin: 0 -14px;
	padding: 10px 14px 12px;
	background: var(--tpm-tg-bubble-bg, #1d2327);
}

.tpm-tg-player .tpm-tg-player-bubble--sheet .tpm-tg-player-bubble__media--video {
	max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
	.tpm-tg-player .tpm-tg-player__launch-row .tpm-tg-player__launch-menu {
		transition: none !important;
	}
}

/* ---------- s487: ring that always shows, glides between steps ---------- */

.tpm-tg-player .tpm-tg-player-highlight {
	border: 3px solid rgba(244, 114, 182, 0.98);
	border-radius: 8px;
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.92),
		0 0 0 5px rgba(236, 72, 153, 0.28),
		0 0 22px 6px rgba(236, 72, 153, 0.55);
	transition:
		top 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
		left 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
		width 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
		height 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
	animation: tpm-tg-glow 2.4s ease-in-out infinite;
}

@keyframes tpm-tg-glow {
	0%,
	100% {
		box-shadow:
			0 0 0 1px rgba(255, 255, 255, 0.92),
			0 0 0 5px rgba(236, 72, 153, 0.28),
			0 0 22px 6px rgba(236, 72, 153, 0.55);
	}
	50% {
		box-shadow:
			0 0 0 1px rgba(255, 255, 255, 0.92),
			0 0 0 7px rgba(236, 72, 153, 0.36),
			0 0 34px 10px rgba(236, 72, 153, 0.7);
	}
}

.tpm-tg-player .tpm-tg-player-dim {
	transition:
		top 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
		left 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
		width 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
		height 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* The block continues beyond the screen edge (big map on a laptop): dashed edge + arrow. */
.tpm-tg-player .tpm-tg-player-highlight--cut-bottom {
	border-bottom-style: dashed;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.tpm-tg-player .tpm-tg-player-highlight--cut-top {
	border-top-style: dashed;
	border-top-left-radius: 0;
	border-top-right-radius: 0;
}

.tpm-tg-player .tpm-tg-player-highlight--cut-bottom::after,
.tpm-tg-player .tpm-tg-player-highlight--cut-top::before {
	content: "";
	position: absolute;
	left: 50%;
	width: 0;
	height: 0;
	border: 9px solid transparent;
	transform: translateX(-50%);
}

.tpm-tg-player .tpm-tg-player-highlight--cut-bottom::after {
	bottom: 4px;
	border-top-color: rgba(244, 114, 182, 0.98);
}

.tpm-tg-player .tpm-tg-player-highlight--cut-top::before {
	top: 4px;
	border-bottom-color: rgba(244, 114, 182, 0.98);
}

.tpm-tg-player .tpm-tg-player-bubble:not(.tpm-tg-player-bubble--sheet) {
	transition:
		top 320ms cubic-bezier(0.2, 0.7, 0.2, 1),
		left 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tpm-tg-player .tpm-tg-player-bubble > * {
	transition: opacity 180ms ease;
}

.tpm-tg-player .tpm-tg-player-bubble--swapping > :not(.tpm-tg-player-bubble__header):not(.tpm-tg-player-bubble__actions) {
	opacity: 0.35;
}

/* While the page scrolls the ring follows the target frame by frame — no lag, no transition. */
.tpm-tg-player .tpm-tg-player-spotlight--tracking .tpm-tg-player-highlight,
.tpm-tg-player .tpm-tg-player-spotlight--tracking .tpm-tg-player-dim,
.tpm-tg-player .tpm-tg-player-spotlight--tracking .tpm-tg-player-bubble {
	transition: none !important;
}

/* ---------- s487: article fragment with paragraphs and a list ---------- */

.tpm-tg-player .tpm-tg-player-bubble__fragment p {
	margin: 0 0 6px;
}

.tpm-tg-player .tpm-tg-player-bubble__fragment ol,
.tpm-tg-player .tpm-tg-player-bubble__fragment ul {
	margin: 4px 0 6px;
	padding-left: 1.3em;
}

.tpm-tg-player .tpm-tg-player-bubble__fragment li {
	margin: 0 0 4px;
}

.tpm-tg-player .tpm-tg-player-bubble__fragment > :last-child {
	margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
	.tpm-tg-player .tpm-tg-player-highlight,
	.tpm-tg-player .tpm-tg-player-dim,
	.tpm-tg-player .tpm-tg-player-bubble,
	.tpm-tg-player .tpm-tg-player-bubble > * {
		transition: none !important;
		animation: none !important;
	}
}
