/* Tivity AR Studio — reproductor de escenarios */

/* ---------------------------------------------------------------- portada */

.tvs-launcher {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	min-height: 320px;
	padding: 32px 20px;
	overflow: hidden;
	border-radius: 14px;
	color: #fff;
	text-align: center;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.tvs-launcher--page {
	position: fixed;
	inset: 0;
	min-height: 0;
	border-radius: 0;
}

.tvs-launcher__media {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tvs-launcher__shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.12) 60%);
}

.tvs-launcher__title,
.tvs-launcher__text,
.tvs-launcher__button {
	position: relative;
}

.tvs-launcher__title {
	margin: 0;
	font-size: clamp(22px, 5vw, 38px);
	font-weight: 800;
	line-height: 1.15;
	color: inherit;
}

.tvs-launcher__text {
	margin: 0;
	max-width: 520px;
	font-size: 16px;
	line-height: 1.45;
	opacity: 0.92;
}

.tvs-launcher__button {
	margin-top: 6px;
	padding: 15px 38px;
	border: 0;
	border-radius: 999px;
	background: #ff5a5f;
	color: #fff;
	font-size: 18px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.tvs-launcher__button:active {
	transform: scale(0.97);
}

/* ---------------------------------------------------------------- overlay */

body.tvs-open {
	overflow: hidden;
}

.tvs-overlay {
	position: fixed;
	left: 0;
	top: 0;
	width: 100vw;
	height: 100vh;
	z-index: 2147483000;
	overflow: hidden;
	background: #000;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.tvs-cam {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	z-index: 0;
}

.tvs-stage {
	position: absolute;
	inset: 0;
	z-index: 1;
	overflow: hidden;
}

/* A-Frame trae sus propias reglas para a-scene; aquí manda el visor. */
.tvs-overlay .tvs-stage a-scene {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.tvs-holder {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

/* La capa de delante no intercepta los toques: sólo sus botones. */
.tvs-front {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
}

.tvs-front > * {
	position: absolute;
}

.tvs-hud,
.tvs-ui {
	inset: 0;
}

.tvs-ui > *,
.tvs-hud > * {
	pointer-events: auto;
}

.tvs-ui > * {
	position: absolute;
}

.is-hidden {
	display: none !important;
}

/* ------------------------------------------------- elementos en pantalla */

.tvs-hud__el {
	position: absolute;
	transform: translate(-50%, -50%);
	max-width: 92%;
	margin: 0;
	border: 0;
	line-height: 1.25;
	pointer-events: none;
	transition: opacity 0.3s ease;
	white-space: pre-wrap;
	font-family: inherit;
}

.tvs-hud__el.is-hidden {
	display: block !important;
	opacity: 0;
	pointer-events: none !important;
}

.tvs-hud__el.is-tappable,
.tvs-hud__el--button {
	pointer-events: auto;
	cursor: pointer;
}

.tvs-hud__el--button {
	padding: 0.5em 1.1em;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.tvs-hud__el--text {
	padding: 0.25em 0.5em;
	border-radius: 0.3em;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.tvs-hud__el--image {
	height: auto;
}

/* --------------------------------------------------------------- botones */

.tvs-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 18px;
	font-weight: 600;
	cursor: pointer;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.tvs-btn--close {
	position: absolute;
	top: max(14px, env(safe-area-inset-top));
	right: 14px;
}

.tvs-btn--mute {
	top: max(14px, env(safe-area-inset-top));
	left: 14px;
}

.tvs-btn--mute.is-off {
	opacity: 0.55;
	text-decoration: line-through;
}

.tvs-btn--xr {
	top: max(14px, env(safe-area-inset-top));
	left: 50%;
	transform: translateX(-50%);
	padding: 0 18px;
	font-size: 15px;
	background: #2563eb;
}

/* ---------------------------------------------------------- avisos y ayuda */

.tvs-hint,
.tvs-tip {
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: min(88%, 460px);
	padding: 12px 18px;
	border-radius: 14px;
	background: rgba(0, 0, 0, 0.66);
	color: #fff;
	font-size: 15px;
	line-height: 1.35;
	text-align: left;
	pointer-events: none;
}

.tvs-hint {
	bottom: max(110px, calc(env(safe-area-inset-bottom) + 96px));
}

.tvs-hint.is-error {
	top: 50%;
	bottom: auto;
	transform: translate(-50%, -50%);
	background: rgba(127, 29, 29, 0.92);
}

.tvs-hint__img {
	width: 62px;
	height: 62px;
	object-fit: cover;
	border-radius: 8px;
	border: 2px solid rgba(255, 255, 255, 0.7);
}

.tvs-tip {
	top: max(70px, calc(env(safe-area-inset-top) + 60px));
}

.tvs-loading {
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 5;
	padding: 12px 22px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 15px;
}

.tvs-fade {
	inset: 0;
	z-index: 4;
	background: #000;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.tvs-fade.is-on {
	opacity: 1;
}

.tvs-overlay.is-flash .tvs-fade {
	background: #fff;
	opacity: 0.85;
	transition: none;
}

/* En AR real no hay nada detrás que tapar. */
.tvs-overlay.is-xr {
	background: transparent;
}

/* --------------------------------------------------------------- joystick */

.tvs-joy {
	left: 22px;
	bottom: max(26px, calc(env(safe-area-inset-bottom) + 18px));
	width: 124px;
	height: 124px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.55);
	background: rgba(0, 0, 0, 0.28);
	touch-action: none;
}

.tvs-joy__knob {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 54px;
	height: 54px;
	margin: -27px 0 0 -27px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

/* ------------------------------------------------------------ foto y vídeo */

.tvs-capbar {
	left: 50%;
	bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 22px;
}

.tvs-cap {
	width: 66px;
	height: 66px;
	padding: 0;
	border-radius: 50%;
	border: 4px solid #fff;
	background: rgba(255, 255, 255, 0.28);
	cursor: pointer;
	position: relative;
}

.tvs-cap--photo::after,
.tvs-cap--video::after {
	content: "";
	position: absolute;
	inset: 6px;
	border-radius: 50%;
	background: #fff;
}

.tvs-cap--video::after {
	background: #ef4444;
	transition: border-radius 0.2s ease, inset 0.2s ease;
}

.tvs-cap--video.is-recording::after {
	inset: 17px;
	border-radius: 6px;
}

.tvs-cap--video.is-recording {
	animation: tvs-pulse 1.2s ease-in-out infinite;
}

@keyframes tvs-pulse {
	50% { border-color: #ef4444; }
}

.tvs-capture,
.tvs-lightbox {
	inset: 0;
	z-index: 6;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 20px;
	background: rgba(0, 0, 0, 0.9);
	pointer-events: auto;
}

.tvs-capture__media,
.tvs-lightbox__media {
	max-width: 100%;
	max-height: calc(100% - 90px);
	border-radius: 10px;
	object-fit: contain;
}

.tvs-lightbox__media {
	max-height: 100%;
}

.tvs-capture__bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

.tvs-capture__btn {
	padding: 12px 24px;
	border: 0;
	border-radius: 999px;
	background: #ff5a5f;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

.tvs-capture__btn--ghost {
	background: rgba(255, 255, 255, 0.18);
}

/* A-Frame añade su botón de pantalla completa a las escenas incrustadas. */
.tvs-overlay .a-enter-vr,
.tvs-overlay .a-enter-ar,
.tvs-overlay .a-orientation-modal {
	display: none !important;
}

/* ------------------------------------------------- cámara frontal y marco */

.tvs-cam.is-mirror {
	transform: scaleX(-1);
}

.tvs-photoframe {
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none !important;
}

/* Debajo del botón de cerrar: el centro de arriba suele llevar botones del escenario. */
.tvs-btn--top {
	top: max(66px, calc(env(safe-area-inset-top) + 52px));
	right: 14px;
	padding: 0 14px;
	font-size: 13px;
}

.tvs-btn--top.is-on {
	background: #2563eb;
}

/* Registro de la AR real: para saber en qué paso se queda. */
.tvs-xrlog {
	left: 10px;
	right: 10px;
	bottom: max(100px, calc(env(safe-area-inset-bottom) + 90px));
	max-height: 40%;
	margin: 0;
	padding: 8px 10px;
	overflow: auto;
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.75);
	color: #d9f99d;
	font: 11px/1.4 ui-monospace, Consolas, monospace;
	white-space: pre-wrap;
	word-break: break-word;
	z-index: 7;
}

/* Escenarios anclados: anclar y ejecutar. */
.tvs-btn--anchor,
.tvs-btn--run {
	background: #2563eb;
	font-size: 16px;
	padding: 0 22px;
	height: 50px;
}

.tvs-btn--run {
	left: 50%;
	bottom: max(110px, calc(env(safe-area-inset-bottom) + 96px));
	transform: translateX(-50%);
	background: #16a34a;
}

.tvs-lightbox {
	overflow: hidden;
	touch-action: none;
}

.tvs-lightbox__media {
	transform-origin: center center;
	will-change: transform;
	user-select: none;
	-webkit-user-drag: none;
}

/* Anclado en AR real. */
.tvs-btn--here,
.tvs-btn--re {
	left: 50%;
	transform: translateX(-50%);
	padding: 0 22px;
	font-size: 16px;
}

.tvs-btn--here {
	bottom: max(170px, calc(env(safe-area-inset-bottom) + 156px));
	height: 50px;
	background: #2563eb;
}

.tvs-btn--re {
	top: max(66px, calc(env(safe-area-inset-top) + 52px));
	height: 38px;
	font-size: 13px;
}

/* Distintivo de la portada: pensado para gafas VR. */
.tvs-launcher__vr {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border-radius: 999px;
	background: rgba(124, 58, 237, 0.85);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	position: relative;
	z-index: 1;
}

.tvs-launcher__vr::before {
	content: '🥽';
}

/* Gafas VR. */
.tvs-btn--vr {
	top: max(14px, env(safe-area-inset-top));
	left: 50%;
	transform: translateX(-50%);
	padding: 0 18px;
	font-size: 15px;
	background: #7c3aed;
}

/* Transiciones entre escenas. */
.tvs-stage {
	clip-path: circle(100% at 50% 50%);
	transition: filter 0.55s ease-in, transform 0.55s ease-in, clip-path 0.6s ease-in;
}

.tvs-stage.tvs-tr-blur { filter: blur(18px); }
.tvs-stage.tvs-tr-slide { transform: translateX(-45%) scale(1.15); }
.tvs-stage.tvs-tr-iris { clip-path: circle(0% at 50% 50%); }

/* Agujero negro: la pantalla entera hace zoom hacia el elemento tocado (el
   origen lo pone el reproductor), sin girar. */
.tvs-stage.tvs-tr-vortex {
	transform: scale(3.4);
	filter: blur(2px) brightness(0.6);
	transition: transform 0.9s cubic-bezier(0.65, 0, 1, 0.4), filter 0.9s ease-in;
}

.tvs-fade.is-white { background: #fff; }

.tvs-bubbles {
	inset: 0;
	z-index: 5;
	overflow: hidden;
	pointer-events: none;
}

.tvs-bubbles span {
	position: absolute;
	bottom: -70px;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95), rgba(170, 220, 255, 0.35) 55%, rgba(120, 190, 255, 0.12));
	box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.7);
	animation: tvs-bubble-up linear forwards;
}

@keyframes tvs-bubble-up {
	to { transform: translateY(-125vh) translateX(20px); }
}
